shfmt
shfmt
This commit is contained in:
parent
1f2fda79e8
commit
774f14f273
59 changed files with 797 additions and 721 deletions
.config
X11
nvim/lua/plugins/config
.local/bin
|
@ -66,14 +66,14 @@ serverargs=${serverargs}" -auth "${xserverauthfile}
|
|||
# if '$displayname' already exists do not overwrite it as another
|
||||
# server may need it. Add them to the '$xserverauthfile' instead.
|
||||
for displayname in $authdisplay $hostname$authdisplay; do
|
||||
authcookie=$(xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p") 2>/dev/null;
|
||||
authcookie=$(xauth list "$displayname" | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p") 2>/dev/null
|
||||
if [ -n "${authcookie+x}" ]; then
|
||||
xauth -q <<EOF
|
||||
add $displayname . $mcookie
|
||||
EOF
|
||||
removelist="$displayname $removelist"
|
||||
else
|
||||
dummy=$((dummy+1));
|
||||
dummy=$((dummy + 1))
|
||||
xauth -q -f "$xserverauthfile" <<EOF
|
||||
add :$dummy . $authcookie
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ message_nonl () {
|
|||
# pretty-print messages of arbitrary length (no trailing newline); use
|
||||
# xmessage if it is available and $DISPLAY is set
|
||||
MESSAGE="$PROGNAME: $*"
|
||||
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
|
||||
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
|
||||
# if [ -n "$DISPLAY" ] && command -v xmessage > /dev/null 2>&1; then
|
||||
# echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
|
||||
# fi
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] && \
|
||||
[ "$XDG_RUNTIME_DIR" = "/run/user/`id -u`" ] && \
|
||||
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] &&
|
||||
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] &&
|
||||
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
|
||||
# We are under systemd-logind or something remarkably similar, and
|
||||
# a user-session socket has already been set up.
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
add_module()
|
||||
{
|
||||
add_module() {
|
||||
case :$GTK_MODULES: in
|
||||
*:$1:*)
|
||||
;;
|
||||
*:$1:*) ;;
|
||||
|
||||
*)
|
||||
if [ -z "$GTK_MODULES" ]
|
||||
then
|
||||
if [ -z "$GTK_MODULES" ]; then
|
||||
GTK_MODULES=$1
|
||||
else
|
||||
GTK_MODULES=$GTK_MODULES:$1
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# vim:set ft=sh
|
||||
|
||||
start()
|
||||
{
|
||||
start() {
|
||||
pidof -s $1 || $@ >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ null_ls.setup {
|
|||
debug = false,
|
||||
sources = {
|
||||
formatting.black.with { extra_args = { "--fast" } },
|
||||
formatting.shfmt,
|
||||
-- formatting.stylua,
|
||||
-- diagnostics.flake8,
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@ ext="${file##*.}"
|
|||
|
||||
cd "$dir" || exit 1
|
||||
|
||||
textype() { \
|
||||
textype() {
|
||||
command="pdflatex"
|
||||
texroot=$(readlink -f "$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]")")
|
||||
[ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot"
|
||||
|
@ -36,7 +36,10 @@ case "$ext" in
|
|||
go) go run "$file" ;;
|
||||
h) sudo make install ;;
|
||||
# findup is a script available here: https://unix.stackexchange.com/a/35265
|
||||
java) loc=$(findup . -name gradlew); [ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)" ;;
|
||||
java)
|
||||
loc=$(findup . -name gradlew)
|
||||
[ "$loc":w != "" ] && exec "$loc" run -q -p "$(dirname $loc)"
|
||||
;;
|
||||
m) octave "$file" ;;
|
||||
md) if [ -x "$(command -v lowdown)" ]; then
|
||||
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf >"$base".pdf
|
||||
|
@ -44,7 +47,7 @@ case "$ext" in
|
|||
groffdown -i "$file" | groff -T pdf >"$base.pdf"
|
||||
else
|
||||
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
|
||||
fi ; ;;
|
||||
fi ;;
|
||||
mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf >"$base".pdf ;;
|
||||
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;;
|
||||
org) emacs "$file" --batch -u "$USER" -f org-latex-export-to-pdf ;;
|
||||
|
|
|
@ -4,8 +4,11 @@ These cronjobs have components that require information about your current displ
|
|||
|
||||
When you add them as cronjobs, I recommend you precede the command with commands as those below:
|
||||
|
||||
```
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus; export DISPLAY=:0; . $HOME/.zprofile; then_command_goes_here
|
||||
```
|
||||
$()$(
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $USER)/bus
|
||||
export DISPLAY=:0
|
||||
. $HOME/.zprofile
|
||||
then_command_goes_here
|
||||
)$()
|
||||
|
||||
This ensures that notifications will display, xdotool commands will function and environmental variables will work as well.
|
||||
|
|
|
@ -9,8 +9,7 @@ sudo pacman -Syyuw --noconfirm || notify-send "Error downloading updates.
|
|||
Check your internet connection, if pacman is already running, or run update manually to see errors."
|
||||
pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
if pacman -Qu | grep -v "\[ignored\]"
|
||||
then
|
||||
if pacman -Qu | grep -v "\[ignored\]"; then
|
||||
notify-send " Repository Sync" "Updates available. Click statusbar icon () for update."
|
||||
else
|
||||
notify-send " Repository Sync" "Sync complete. No new packages for update."
|
||||
|
|
|
@ -12,9 +12,15 @@
|
|||
# Xorg and MacOS as well.
|
||||
|
||||
# Run only if user logged in (prevent cron errors)
|
||||
pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
|
||||
pgrep -u "${USER:=$LOGNAME}" >/dev/null || {
|
||||
echo "$USER not logged in; sync will not run."
|
||||
exit
|
||||
}
|
||||
# Run only if not already running in other instance
|
||||
pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;}
|
||||
pgrep mbsync >/dev/null && {
|
||||
echo "mbsync is already running."
|
||||
exit
|
||||
}
|
||||
|
||||
# First, we have to get the right variables for the mbsync file, the pass
|
||||
# archive, notmuch and the GPG home. This is done by searching common profile
|
||||
|
@ -56,8 +62,7 @@ esac
|
|||
syncandnotify() {
|
||||
acc="$(echo "$account" | sed "s/.*\///")"
|
||||
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
||||
new=$(find\
|
||||
"$HOME/.local/share/mail/$acc/INBOX/new/"\
|
||||
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" \
|
||||
"$HOME/.local/share/mail/$acc/Inbox/new/" \
|
||||
"$HOME/.local/share/mail/$acc/inbox/new/" \
|
||||
"$HOME/.local/share/mail/$acc/INBOX/cur/" \
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)
|
||||
playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done)
|
||||
|
|
|
@ -13,9 +13,9 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
|
|||
external=$(echo "$screens" | dmenu -i -p "Optimize resolution for:")
|
||||
internal=$(echo "$screens" | grep -v "$external")
|
||||
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \
|
||||
res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
|
||||
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" |
|
||||
tail -n 1 | awk '{print $1}')
|
||||
|
||||
res_ext_x=$(echo "$res_external" | sed 's/x.*//')
|
||||
|
@ -50,7 +50,8 @@ multimon() { # Multi-monitor handler.
|
|||
case "$(echo "$screens" | wc -l)" in
|
||||
2) twoscreen ;;
|
||||
*) morescreen ;;
|
||||
esac ;}
|
||||
esac
|
||||
}
|
||||
|
||||
onescreen() { # If only one output available or chosen.
|
||||
xrandr --output "$1" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "\b$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ' -)""
|
||||
|
@ -59,7 +60,10 @@ onescreen() { # If only one output available or chosen.
|
|||
postrun() { # Stuff to run to clean up.
|
||||
setbg # Fix background if screen size/arangement has changed.
|
||||
remaps -n # Re-remap keys if keyboard added (for laptop bases)
|
||||
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||
{
|
||||
killall dunst
|
||||
setsid -f dunst
|
||||
} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||
}
|
||||
|
||||
# Get all possible displays
|
||||
|
@ -70,12 +74,20 @@ screens=$(echo "$allposs" | awk '/ connected/ {print $1}')
|
|||
|
||||
# If there's only one screen
|
||||
[ "$(echo "$screens" | wc -l)" -lt 2 ] &&
|
||||
{ onescreen "$screens"; postrun; notify-send "💻 Only one screen detected." "Using it in its optimal settings..."; exit ;}
|
||||
{
|
||||
onescreen "$screens"
|
||||
postrun
|
||||
notify-send "💻 Only one screen detected." "Using it in its optimal settings..."
|
||||
exit
|
||||
}
|
||||
|
||||
# Get user choice including multi-monitor and manual selection:
|
||||
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") &&
|
||||
case "$chosen" in
|
||||
"manual selection") arandr ; exit ;;
|
||||
"manual selection")
|
||||
arandr
|
||||
exit
|
||||
;;
|
||||
"multi-monitor") multimon ;;
|
||||
*) onescreen "$chosen" ;;
|
||||
esac
|
||||
|
|
|
@ -15,7 +15,10 @@ case "$(printf "copy url\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv
|
|||
PDF) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
sxiv) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
vim) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;;
|
||||
setbg)
|
||||
curl -L "$feed" >$XDG_CACHE_HOME/pic
|
||||
xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1
|
||||
;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;;
|
||||
lynx) lynx "$feed" >/dev/null 2>&1 ;;
|
||||
esac
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# be prompted to give a mountpoint from already existsing directories. If you
|
||||
# input a novel directory, it will prompt you to create that directory.
|
||||
|
||||
getmount() { \
|
||||
getmount() {
|
||||
[ -z "$chosen" ] && exit 1
|
||||
# shellcheck disable=SC2086
|
||||
mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1
|
||||
|
@ -16,7 +16,7 @@ getmount() { \
|
|||
fi
|
||||
}
|
||||
|
||||
mountusb() { \
|
||||
mountusb() {
|
||||
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1
|
||||
chosen="$(echo "$chosen" | awk '{print $1}')"
|
||||
sudo -A mount "$chosen" 2>/dev/null && notify-send "禍 USB mounting" "$chosen mounted." && exit 0
|
||||
|
@ -26,12 +26,17 @@ mountusb() { \
|
|||
case "$partitiontype" in
|
||||
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000 ;;
|
||||
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)" ;;
|
||||
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
|
||||
*)
|
||||
sudo -A mount "$chosen" "$mp"
|
||||
user="$(whoami)"
|
||||
ug="$(groups | awk '{print $1}')"
|
||||
sudo -A chown "$user":"$ug" "$mp"
|
||||
;;
|
||||
esac && notify-send "禍 USB mounting" "$chosen mounted to $mp." ||
|
||||
notify-send "禍 Drive failed to mount." "Probably a permissions issue or a drive is already mounted."
|
||||
}
|
||||
|
||||
mountandroid() { \
|
||||
mountandroid() {
|
||||
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
|
||||
chosen="$(echo "$chosen" | cut -d : -f 1)"
|
||||
getmount "$HOME -maxdepth 3 -type d"
|
||||
|
@ -41,7 +46,7 @@ mountandroid() { \
|
|||
notify-send " Android Failed mounting." "Probably a permissions issue or phone is already mounted"
|
||||
}
|
||||
|
||||
asktype() { \
|
||||
asktype() {
|
||||
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1
|
||||
case $choice in
|
||||
USB) mountusb ;;
|
||||
|
|
|
@ -13,7 +13,8 @@ share2mnt=//"$srvname".local/"$share"
|
|||
sharemount() {
|
||||
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share")
|
||||
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
|
||||
notify-send "Netshare $share already mounted"; exit 1
|
||||
notify-send "Netshare $share already mounted"
|
||||
exit 1
|
||||
}
|
||||
|
||||
sharemount
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
# If there is already a running instance, user will be prompted to end it.
|
||||
|
||||
updateicon() { \
|
||||
updateicon() {
|
||||
echo "$1" >/tmp/recordingicon
|
||||
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ killrecording() {
|
|||
exit
|
||||
}
|
||||
|
||||
screencast() { \
|
||||
screencast() {
|
||||
ffmpeg -y \
|
||||
-f x11grab \
|
||||
-framerate 60 \
|
||||
|
@ -41,7 +41,8 @@ screencast() { \
|
|||
updateicon "ﲠ"
|
||||
}
|
||||
|
||||
video() { ffmpeg \
|
||||
video() {
|
||||
ffmpeg \
|
||||
-f x11grab \
|
||||
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
|
||||
-i "$DISPLAY" \
|
||||
|
@ -51,7 +52,8 @@ video() { ffmpeg \
|
|||
updateicon "ﲣ"
|
||||
}
|
||||
|
||||
webcamhidef() { ffmpeg \
|
||||
webcamhidef() {
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 1920x1080 \
|
||||
|
@ -60,7 +62,8 @@ webcamhidef() { ffmpeg \
|
|||
updateicon ""
|
||||
}
|
||||
|
||||
webcam() { ffmpeg \
|
||||
webcam() {
|
||||
ffmpeg \
|
||||
-f v4l2 \
|
||||
-i /dev/video0 \
|
||||
-video_size 640x480 \
|
||||
|
@ -69,8 +72,7 @@ webcam() { ffmpeg \
|
|||
updateicon ""
|
||||
}
|
||||
|
||||
|
||||
audio() { \
|
||||
audio() {
|
||||
ffmpeg \
|
||||
-f alsa -i default \
|
||||
-c:a flac \
|
||||
|
@ -79,7 +81,7 @@ audio() { \
|
|||
updateicon ""
|
||||
}
|
||||
|
||||
askrecording() { \
|
||||
askrecording() {
|
||||
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
|
||||
case "$choice" in
|
||||
screencast) screencast ;;
|
||||
|
@ -91,13 +93,12 @@ askrecording() { \
|
|||
esac
|
||||
}
|
||||
|
||||
asktoend() { \
|
||||
asktoend() {
|
||||
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
||||
[ "$response" = "Yes" ] && killrecording
|
||||
}
|
||||
|
||||
videoselected()
|
||||
{
|
||||
videoselected() {
|
||||
slop -f "%x %y %w %h" >/tmp/slop
|
||||
read -r X Y W H </tmp/slop
|
||||
rm /tmp/slop
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
# Provides you with mounted partitions, select one to unmount.
|
||||
# Drives mounted at /, /boot and /home will not be options to unmount.
|
||||
|
||||
drives="$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'; awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab)"
|
||||
drives="$(
|
||||
lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'
|
||||
awk '/simple-mtpfs/ { print "", $2; }' /etc/mtab
|
||||
)"
|
||||
|
||||
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
|
||||
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
set -e
|
||||
path="$1"
|
||||
shift 1
|
||||
while [[ $path != / ]];
|
||||
do
|
||||
while [[ $path != / ]]; do
|
||||
find "$path" -maxdepth 1 -mindepth 1 "$@"
|
||||
# Note: if you want to ignore symlinks, use "$(realpath -s "$path"/..)"
|
||||
path="$(readlink -f "$path"/..)"
|
||||
done
|
||||
|
||||
|
|
|
@ -14,14 +14,18 @@ fi
|
|||
|
||||
case "$url" in
|
||||
*mkv | *webm | *mp4 | *youtube.com/watch* | *youtube.com/playlist* | *youtube.com/shorts* | *youtu.be* | *hooktube.com* | *bitchute.com* | *videos.lukesmith.xyz* | *odysee.com*)
|
||||
setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
|
||||
setsid -f mpv -quiet "$url" >/dev/null 2>&1
|
||||
;;
|
||||
*png | *jpg | *jpe | *jpeg | *gif)
|
||||
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||
;;
|
||||
*pdf | *cbz | *cbr)
|
||||
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;
|
||||
curl -sL "$url" >"/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 &
|
||||
;;
|
||||
*mp3 | *flac | *opus | *mp3?source*)
|
||||
qndl "$url" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
qndl "$url" 'curl -LO' >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
[ -f "$url" ] && setsid -f "$TERMINAL" -e "$EDITOR" "$url" >/dev/null 2>&1 || setsid -f "$BROWSER" "$url" >/dev/null 2>&1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -16,4 +16,3 @@ case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area
|
|||
"current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;;
|
||||
"full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
# (with other things) by default and is used in some other places.
|
||||
|
||||
for i in $(ls /tmp/mpvSockets/*); do
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
|
||||
echo '{ "command": ["set_property", "pause", true] }' | socat - "$i"
|
||||
done
|
||||
|
|
|
@ -6,8 +6,7 @@ index() {
|
|||
|
||||
if [ "$1" = "-n" ]; then
|
||||
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
elif [ "$1" = "" ];
|
||||
then
|
||||
elif [ "$1" = "" ]; then
|
||||
groups="us:dvorak de:nodeadkeys"
|
||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||
i=1
|
||||
|
@ -29,7 +28,8 @@ fi
|
|||
|
||||
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp 1>/dev/null 2>&1 || echo "Unkown keyboard layout"
|
||||
xset r rate 300 50
|
||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
||||
killall xcape 2>/dev/null
|
||||
xcape -e 'Super_L=Escape'
|
||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||
sleep 0.03
|
||||
pkill -RTMIN+15 dwmblocks
|
||||
|
|
|
@ -4,7 +4,8 @@ current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s
|
|||
|
||||
setxkbmap -layout "$(echo "$current" | cut -d ':' -f1)" -variant "$(echo "$current" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
|
||||
xset r rate 300 50
|
||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
||||
killall xcape 2>/dev/null
|
||||
xcape -e 'Super_L=Escape'
|
||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||
sleep 0.03
|
||||
pkill -RTMIN+15 dwmblocks
|
||||
|
|
|
@ -11,7 +11,10 @@ trueloc="$(readlink -f "$1")" &&
|
|||
case "$(file --mime-type -b "$trueloc")" in
|
||||
image/*) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
|
||||
inode/directory) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
|
||||
*) notify-send "Error" "Not a valid image." ; exit 1;;
|
||||
*)
|
||||
notify-send "Error" "Not a valid image."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
xwallpaper --zoom "$bgloc"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
vals=$(aptitude full-upgrade --simulate --assume-yes |\
|
||||
grep -m1 '^[0-9]\+ packages upgraded,' |\
|
||||
tr -cd '0-9 ' |\
|
||||
tr ' ' '\n' |\
|
||||
grep '[0-9]\+' |\
|
||||
vals=$(aptitude full-upgrade --simulate --assume-yes |
|
||||
grep -m1 '^[0-9]\+ packages upgraded,' |
|
||||
tr -cd '0-9 ' |
|
||||
tr ' ' '\n' |
|
||||
grep '[0-9]\+' |
|
||||
xargs echo)
|
||||
|
||||
print=" "
|
||||
|
|
|
@ -10,37 +10,60 @@ for battery in /sys/class/power_supply/BAT?*; do
|
|||
[ -n "${capacity+x}" ] && printf " "
|
||||
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||
case "$(cat "$battery/status" 2>&1)" in
|
||||
"Full") icon=""; color="$green" ;;
|
||||
"Charging") icon=""; color="$cyan" ;;
|
||||
"Not charging") icon=""; color="$white" ;;
|
||||
"Unknown") icon=""; color="$orange" ;;
|
||||
"Full")
|
||||
icon=""
|
||||
color="$green"
|
||||
;;
|
||||
"Charging")
|
||||
icon=""
|
||||
color="$cyan"
|
||||
;;
|
||||
"Not charging")
|
||||
icon=""
|
||||
color="$white"
|
||||
;;
|
||||
"Unknown")
|
||||
icon=""
|
||||
color="$orange"
|
||||
;;
|
||||
"Discharging")
|
||||
if [ "$capacity" -le 10 ]; then
|
||||
icon=""; color="$red"
|
||||
icon=""
|
||||
color="$red"
|
||||
elif [ "$capacity" -le 20 ]; then
|
||||
icon=""; color="$red"
|
||||
icon=""
|
||||
color="$red"
|
||||
elif [ "$capacity" -le 30 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 40 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 50 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 60 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 70 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 80 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 90 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
elif [ "$capacity" -le 95 ]; then
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
else
|
||||
icon=""; color="$white"
|
||||
icon=""
|
||||
color="$white"
|
||||
fi
|
||||
|
||||
;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
printf "$color%s$reset %d" "$icon" "$capacity";
|
||||
printf "$color%s$reset %d" "$icon" "$capacity"
|
||||
done && printf "\\n"
|
||||
|
|
|
@ -21,5 +21,6 @@ echo "$stats" | while read -r row; do
|
|||
"6" | "7" | "8") printf "\033[31m▇" ;;
|
||||
|
||||
esac
|
||||
done; printf "\033[0m\n"
|
||||
done
|
||||
printf "\033[0m\n"
|
||||
echo "$stats" >"$cache"
|
||||
|
|
|
@ -30,7 +30,7 @@ getforecast() { curl -sf "$url$opt" > "$weatherfile" && curl -sf "$url$emojiopt"
|
|||
showweather() {
|
||||
emoji="$(printf "\033[12m%s\033[10m" "$(cut -d ' ' -f 1 "$emojifile")")"
|
||||
sed '16q;d' "$weatherfile" | grep -wo "[0-9]*%" | sort -rn | sed "s/^/$emoji /g;1q" | tr -d '\n'
|
||||
sed '13q;d' "$weatherfile" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " \033[34m\033[0m " $1 "°","\033[31m\033[0m " $2 "°"}';
|
||||
sed '13q;d' "$weatherfile" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " \033[34m\033[0m " $1 "°","\033[31m\033[0m " $2 "°"}'
|
||||
}
|
||||
getforecast && convertemoji
|
||||
showweather
|
||||
|
|
|
@ -6,7 +6,10 @@ case "$(readlink -f /sbin/init)" in
|
|||
esac
|
||||
|
||||
case "$(printf " lock\nﴚ leave dwm\n累 renew dwm\nﭦ hibernate\n sleep\nﰇ reboot\n襤 shutdown\n display off" | dmenu -i -p 'Action: ')" in
|
||||
' lock') xset s activate & gpg-connect-agent --no-autostart reloadagent /bye;;
|
||||
' lock')
|
||||
xset s activate &
|
||||
gpg-connect-agent --no-autostart reloadagent /bye
|
||||
;;
|
||||
'ﴚ leave dwm') kill -TERM "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
'累 renew dwm') kill -HUP "$(pgrep -u "$USER" "\bdwm$")" ;;
|
||||
# 'ﭦ hibernate') slock $ctl hibernate -i ;;
|
||||
|
|
|
@ -8,9 +8,9 @@ getfsroot() {
|
|||
filepath="$(realpath "$1")"
|
||||
filename="$(basename "$1")"
|
||||
fsroot="$(getfsroot "$1")"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
||||
|| basedir="${fsroot}/.Trash"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||
basedir="${fsroot}/.Trash"
|
||||
infodir="$basedir/info"
|
||||
filedir="$basedir/files"
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ list() {
|
|||
# 2nd arg is directory to match trash files for
|
||||
[ ! "$(ls -A "$1")" ] && exit 1
|
||||
for file in "$1"/*; do
|
||||
[ "$(head -1 "$file")" = "[Trash Info]" ] && \
|
||||
fpath=$(grep Path "$file" | cut -d '=' -f2) && \
|
||||
echo "$fpath" | grep -qP "^$2/[^/]+$" && \
|
||||
[ "$(head -1 "$file")" = "[Trash Info]" ] &&
|
||||
fpath=$(grep Path "$file" | cut -d '=' -f2) &&
|
||||
echo "$fpath" | grep -qP "^$2/[^/]+$" &&
|
||||
printf "%s %s %s\n" \
|
||||
"$(basename "$file")" \
|
||||
"$fpath" \
|
||||
|
@ -20,9 +20,9 @@ list() {
|
|||
|
||||
[ -n "$1" ] && dir="$(realpath "$1")" || dir="$(getfsroot "$PWD")"
|
||||
fsroot="$(getfsroot "$dir")"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] \
|
||||
&& basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" \
|
||||
|| basedir="${fsroot}/.Trash"
|
||||
[ "$fsroot" = "$(getfsroot "${XDG_DATA_HOME:-$HOME/.local/share}")" ] &&
|
||||
basedir="${XDG_DATA_HOME:-$HOME/.local/share}/Trash" ||
|
||||
basedir="${fsroot}/.Trash"
|
||||
|
||||
sel="$(list "$basedir/info" "$dir" | fzf)"
|
||||
file="$basedir/files/$(echo "$sel" | cut -d ' ' -f1)"
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
|
||||
[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit
|
||||
|
||||
echo "Enter the album/book title:"; read -r booktitle
|
||||
echo "Enter the album/book title:"
|
||||
read -r booktitle
|
||||
|
||||
echo "Enter the artist/author:"; read -r author
|
||||
echo "Enter the artist/author:"
|
||||
read -r author
|
||||
|
||||
echo "Enter the publication year:"; read -r year
|
||||
echo "Enter the publication year:"
|
||||
read -r year
|
||||
|
||||
inputaudio="$1"
|
||||
|
||||
|
@ -24,8 +27,7 @@ ext="opus"
|
|||
# Get the total number of tracks from the number of lines.
|
||||
total="$(wc -l <"$2")"
|
||||
|
||||
while read -r x;
|
||||
do
|
||||
while read -r x; do
|
||||
end="$(echo "$x" | cut -d' ' -f1)"
|
||||
|
||||
[ -n "$start" ] &&
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
if [ -f "$1" ]; then
|
||||
# Try to get DOI from pdfinfo or pdftotext output.
|
||||
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
|
||||
doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
|
||||
doi=$(pdftotext "$1" - 2>/dev/null | grep -io "doi:.*" -m 1) ||
|
||||
exit 1
|
||||
else
|
||||
doi="$1"
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
usage ()
|
||||
{
|
||||
usage() {
|
||||
printf "Usage : noisereduce <input video file> <output video file>\n"
|
||||
exit
|
||||
}
|
||||
|
||||
# Tests for requirements
|
||||
ifinstalled ffmpeg || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
||||
ifinstalled sox || { echo >&2 "We require 'ffmpeg' but it's not installed."; exit 1; }
|
||||
ifinstalled ffmpeg || {
|
||||
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||
exit 1
|
||||
}
|
||||
ifinstalled sox || {
|
||||
echo >&2 "We require 'ffmpeg' but it's not installed."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$#" -ne 2 ]
|
||||
then
|
||||
if [ "$#" -ne 2 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ ! -e "$1" ]
|
||||
then
|
||||
if [ ! -e "$1" ]; then
|
||||
printf "File not found: %s\n" "$1"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -e "$2" ]
|
||||
then
|
||||
if [ -e "$2" ]; then
|
||||
printf "File %s already exists, overwrite? [y/N]\n: " "$2"
|
||||
read -r yn
|
||||
case $yn in
|
||||
|
@ -35,8 +37,7 @@ inBasename=$(basename "$1")
|
|||
inExt="${inBasename##*.}"
|
||||
|
||||
isVideoStr=$(ffprobe -v warning -show_streams "$1" | grep codec_type=video)
|
||||
if [ -n "$isVideoStr" ]
|
||||
then
|
||||
if [ -n "$isVideoStr" ]; then
|
||||
isVideo=1
|
||||
printf "Detected %s as a video file\n" "$inBasename"
|
||||
else
|
||||
|
@ -54,7 +55,6 @@ printf "Noise reduction amount [0.21]: "
|
|||
read -r sensitivity
|
||||
if [ -z "$sensitivity" ]; then sensitivity="0.21"; fi
|
||||
|
||||
|
||||
tmpVidFile="/tmp/noiseclean_tmpvid.$inExt"
|
||||
tmpAudFile="/tmp/noiseclean_tmpaud.wav"
|
||||
noiseAudFile="/tmp/noiseclean_noiseaud.wav"
|
||||
|
|
|
@ -13,7 +13,11 @@ ifinstalled pass pass-otp
|
|||
|
||||
dir="${PASSWORD_STORE_DIR}"
|
||||
|
||||
choice="$({ echo "🆕add" ; echo "🕙sync-time" ; ls ${dir}/*-otp.gpg ;} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
||||
choice="$({
|
||||
echo "🆕add"
|
||||
echo "🕙sync-time"
|
||||
ls ${dir}/*-otp.gpg
|
||||
} | sed "s/.*\///;s/-otp.gpg//" | dmenu -p "Pick a 2FA:")"
|
||||
|
||||
case $choice in
|
||||
🆕add)
|
||||
|
|
|
@ -20,14 +20,18 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
|||
r) redo="$OPTARG" ;;
|
||||
s) ppt="$OPTARG" ;;
|
||||
e) endtime="$OPTARG" ;;
|
||||
x) res="$OPTARG"
|
||||
x)
|
||||
res="$OPTARG"
|
||||
echo "$res" | grep -qv "^[0-9]\+x[0-9]\+$" &&
|
||||
echo "Resolution must be dimensions separated by a 'x': 1280x720, etc." &&
|
||||
exit 1 ;;
|
||||
p) echo "Purge old build files in $cache? [y/N]"
|
||||
exit 1
|
||||
;;
|
||||
p)
|
||||
echo "Purge old build files in $cache? [y/N]"
|
||||
read -r confirm
|
||||
echo "$confirm" | grep -iq "^y$" && rm -rf "$cache" && echo "Done."
|
||||
exit ;;
|
||||
exit
|
||||
;;
|
||||
v) verbose=True ;;
|
||||
*) echo "$(basename "$0") usage:
|
||||
-i input timecode list (required)
|
||||
|
@ -42,7 +46,7 @@ while getopts "hvrpi:c:a:o:d:f:t:e:x:" o; do case "${o}" in
|
|||
-d tmp directory
|
||||
-r rerun imagemagick commands even if done previously (in case files or background has changed)
|
||||
-p purge old build files instead of running
|
||||
-v be verbose" && exit 1
|
||||
-v be verbose" && exit 1 ;;
|
||||
|
||||
esac done
|
||||
|
||||
|
@ -64,7 +68,10 @@ if [ -n "${audio+x}" ]; then
|
|||
# Check that the audio file looks like an actual audio file.
|
||||
case "$(file --dereference --brief --mime-type -- "$audio")" in
|
||||
audio/*) ;;
|
||||
*) echo "That doesn't look like an audio file."; exit 1 ;;
|
||||
*)
|
||||
echo "That doesn't look like an audio file."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
totseconds="$(date '+%s' -d $(ffmpeg -i "$audio" 2>&1 | awk '/Duration/ {print $2}' | sed s/,//))"
|
||||
endtime="$((totseconds - seconds))"
|
||||
|
@ -78,8 +85,7 @@ prepfile="$prepdir/$file.prep"
|
|||
mkdir -p "$prepdir"
|
||||
|
||||
{
|
||||
while read -r x;
|
||||
do
|
||||
while read -r x; do
|
||||
# Get the time from the first column.
|
||||
time="${x%% *}"
|
||||
seconds="$(date '+%s' -d "$time")"
|
||||
|
|
|
@ -35,4 +35,3 @@ json="$(jq -r --arg "$movie" "$thumbnail" ". + {\"$movie\": \"$thumbnail\"}" <"$
|
|||
echo "$json" >"$index"
|
||||
|
||||
echo "$cache/$thumbnail"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue