1
0
Fork 0

retabbing

This commit is contained in:
Luca Bilke 2024-02-03 18:34:14 +01:00
parent bbb1c368a0
commit ee3ac5fbcb
11 changed files with 200 additions and 199 deletions

View File

@ -8,22 +8,22 @@ start() {
# Set up xsecurelock
xset s 300
env \
XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b" \
XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5" \
XSECURELOCK_AUTH_WARNING_COLOR="#f7768e" \
XSECURELOCK_BACKGROUND_COLOR="#15161E" \
XSECURELOCK_DATETIME_FORMAT="%d.%m.%Y %H:%M" \
XSECURELOCK_PASSWORD_PROMPT="time_hex" \
XSECURELOCK_AUTH_TIMEOUT=5 \
XSECURELOCK_BLANK_TIMEOUT=30 \
XSECURELOCK_BLANK_DPMS_STATE="off" \
XSECURELOCK_BURNIN_MITIGATION=0 \
XSECURELOCK_DIM_FPS=60 \
XSECURELOCK_SHOW_DATETIME=1 \
XSECURELOCK_SAVER="/usr/libexec/xscreensaver/cubicgrid" \
XSECURELOCK_SHOW_USERNAME=1 \
XSECURELOCK_SHOW_HOSTNAME=1 \
xss-lock -n /usr/libexec/xsecurelock/dimmer -l -- sh -c "xsecurelock -- playerctl pause || kill -9 -1" &
XSECURELOCK_AUTH_BACKGROUND_COLOR="#24283b" \
XSECURELOCK_AUTH_FOREGROUND_COLOR="#c0caf5" \
XSECURELOCK_AUTH_WARNING_COLOR="#f7768e" \
XSECURELOCK_BACKGROUND_COLOR="#15161E" \
XSECURELOCK_DATETIME_FORMAT="%d.%m.%Y %H:%M" \
XSECURELOCK_PASSWORD_PROMPT="time_hex" \
XSECURELOCK_AUTH_TIMEOUT=5 \
XSECURELOCK_BLANK_TIMEOUT=30 \
XSECURELOCK_BLANK_DPMS_STATE="off" \
XSECURELOCK_BURNIN_MITIGATION=0 \
XSECURELOCK_DIM_FPS=60 \
XSECURELOCK_SHOW_DATETIME=1 \
XSECURELOCK_SAVER="/usr/libexec/xscreensaver/cubicgrid" \
XSECURELOCK_SHOW_USERNAME=1 \
XSECURELOCK_SHOW_HOSTNAME=1 \
xss-lock -n /usr/libexec/xsecurelock/dimmer -l -- sh -c "xsecurelock -- playerctl pause || kill -9 -1" &
[ -r "$XDG_CONFIG_HOME/dwm/host.sh" ] && "$XDG_CONFIG_HOME/dwm/host.sh" &
@ -32,8 +32,9 @@ remaps -qd
start unclutter -noevents &
start gpgconf --launch gpg-agent
start dwmblocks
start env PATH="$HOME/.local/libexec/statusbar:$PATH" dwmblocks
start picom
start pipewire
start dunst
start checkup
start syncthingtray

View File

@ -3,7 +3,7 @@ msgTag="brightness" # Arbitrary but unique message tag
highlight="#7aa2f7"
round() {
awk "BEGIN {printf \"%.0f\", $*}"
awk "BEGIN {printf \"%.0f\", $*}"
}
oldbrightness="$(cat /sys/class/backlight/*/brightness)"
@ -12,23 +12,23 @@ newpercent="$(round "$oldpercent + $1")"
newbrightness="$(round "$newpercent * (255/100)")"
if [ "$newpercent" -gt "100" ]; then
icon="gpm-brightness-lcd"
newpercent=100
newbrightness=255
icon="gpm-brightness-lcd"
newpercent=100
newbrightness=255
elif [ "$newpercent" -gt "50" ]; then
icon="gpm-brightness-lcd"
icon="gpm-brightness-lcd"
elif [ "$newpercent" -gt "0" ]; then
icon="gpm-brightness-lcd-disabled"
icon="gpm-brightness-lcd-disabled"
else
icon="gpm-brightness-lcd-disabled"
newpercent=0
newbrightness=0
icon="gpm-brightness-lcd-disabled"
newpercent=0
newbrightness=0
fi
# shellcheck disable=2086
round $newbrightness | sudo tee /sys/class/backlight/*/brightness
notify-send -a "changeBrightness" -i "$icon" -u low "Brightness: ${newpercent}%" \
-h "string:x-dunst-stack-tag:$msgTag" \
-h "int:value:$newpercent" \
-h "string:hlcolor:$highlight"
-h "string:x-dunst-stack-tag:$msgTag" \
-h "int:value:$newpercent" \
-h "string:hlcolor:$highlight"

View File

@ -16,9 +16,9 @@ PDF) curl -sL "$feed" >"/tmp/$(echo "$feed" | sed "s|.*/||;s/%20/ /g")" && zathu
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
;;
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

View File

@ -9,17 +9,17 @@ xclip_cmd="xclip -sel clip -t image/png"
case $1 in
"full")
maim -q "$dir/pic-full-${output}"
exit
;;
maim -q "$dir/pic-full-${output}"
exit
;;
"current")
maim -q -i "$(xdotool getactivewindow)" "$dir/pic-window-${output}"
exit
;;
maim -q -i "$(xdotool getactivewindow)" "$dir/pic-window-${output}"
exit
;;
"selected")
maim -usq "$dir/pic-selected-${output}"
exit
;;
maim -usq "$dir/pic-selected-${output}"
exit
;;
esac
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in

View File

@ -16,11 +16,11 @@ phones="$(simple-mtpfs -l 2>/dev/null | sed "s/^/ /")"
mountedphones="$(grep "simple-mtpfs" /etc/mtab)"
# If there are already mounted phones, remove them from the list of mountables.
[ -n "$mountedphones" ] && phones="$(for phone in $phones; do
for mounted in $mountedphones; do
escphone="$(escape "$phone")"
[[ "$mounted" =~ $escphone ]] && break 1
done && continue 1
echo "$phone"
for mounted in $mountedphones; do
escphone="$(escape "$phone")"
[[ "$mounted" =~ $escphone ]] && break 1
done && continue 1
echo "$phone"
done)"
# Check for drives.
@ -34,12 +34,12 @@ filter() { sed "s/ /:/g" | awk -F':' '$7==""{printf "%s%s (%s) %s\n",$1,$3,$5,$6
# Get only LUKS drives that are not decrypted.
unopenedluks="$(for drive in $allluks; do
uuid="${drive%% *}"
uuid="${uuid//-/}" # This is a bashism.
[ -n "$decrypted" ] && for open in $decrypted; do
[ "$uuid" = "$open" ] && break 1
done && continue 1
echo " $drive"
uuid="${drive%% *}"
uuid="${uuid//-/}" # This is a bashism.
[ -n "$decrypted" ] && for open in $decrypted; do
[ "$uuid" = "$open" ] && break 1
done && continue 1
echo " $drive"
done | filter)"
# Get all normal, non-encrypted or decrypted partitions that are not mounted.
@ -60,55 +60,55 @@ chosen="$(echo "$alldrives" | dmenu -p "Mount which drive?" -i)"
# Function for prompting user for a mountpoint.
getmount() {
mp="$(find /mnt /media /mount /home -maxdepth 1 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")"
test -n "$mp"
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
mp="$(find /mnt /media /mount /home -maxdepth 1 -type d 2>/dev/null | dmenu -i -p "Mount this drive where?")"
test -n "$mp"
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
attemptmount() {
# Attempt to mount without a mountpoint, to see if drive is in fstab.
sudo -A mount "$chosen" || return 1
notify-send " Drive Mounted." "$chosen mounted."
exit
# Attempt to mount without a mountpoint, to see if drive is in fstab.
sudo -A mount "$chosen" || return 1
notify-send " Drive Mounted." "$chosen mounted."
exit
}
case "$chosen" in
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Drive Mounted." "$chosen mounted to $mp."
;;
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
attemptmount || getmount
sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Drive Mounted." "$chosen mounted to $mp."
;;
*)
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num + 1))")"
done
chosen="${chosen%% *}"
chosen="${chosen:1}" # This is a bashism.
# Number the drive.
while true; do
[ -f "/dev/mapper/usb$num" ] || break
num="$(printf "%02d" "$((num + 1))")"
done
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
# Decrypt in a terminal window
${TERMINAL:-st} -n floatterm -g 60x1 -e sudo cryptsetup open "$chosen" "usb$num"
# Check if now decrypted.
test -b "/dev/mapper/usb$num"
attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;
attemptmount || getmount
sudo -A mount "/dev/mapper/usb$num" "$mp" -o uid="$(id -u)",gid="$(id -g)"
notify-send " Decrypted drive Mounted." "$chosen decrypted and mounted to $mp."
;;
*)
notify-send "❗Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send " Android Mounted." "Android device mounted to $mp."
;;
notify-send "❗Note" "Remember to allow file access on your phone now."
getmount
number="${chosen%%:*}"
number="${chosen:1}" # This is a bashism.
sudo -A simple-mtpfs -o allow_other -o fsname="simple-mtpfs-$(escape "$chosen")" --device "$number" "$mp"
notify-send " Android Mounted." "Android device mounted to $mp."
;;
esac

View File

@ -11,10 +11,10 @@ share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p
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
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
}
sharemount

View File

@ -10,108 +10,108 @@
# If there is already a running instance, user will be prompted to end it.
updateicon() {
echo "$1" >/tmp/recordingicon
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
echo "$1" >/tmp/recordingicon
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
}
killrecording() {
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
recpid="$(cat /tmp/recordingpid)"
# kill with SIGTERM, allowing finishing touches.
kill -15 "$recpid"
rm -f /tmp/recordingpid
updateicon ""
pkill -RTMIN+9 "${STATUSBAR:-dwmblocks}"
# even after SIGTERM, ffmpeg may still run, so SIGKILL it.
sleep 3
kill -9 "$recpid"
exit
}
screencast() {
ffmpeg -y \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-f alsa -i default \
-r 30 \
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! >/tmp/recordingpid
updateicon "ﲠ"
ffmpeg -y \
-f x11grab \
-framerate 60 \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-f alsa -i default \
-r 30 \
-c:v h264 -crf 0 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4" &
echo $! >/tmp/recordingpid
updateicon "ﲠ"
}
video() {
ffmpeg \
-f x11grab \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
ffmpeg \
-f x11grab \
-s "$(xdpyinfo | awk '/dimensions/ {print $2;}')" \
-i "$DISPLAY" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/video-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
}
webcamhidef() {
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 1920x1080 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
}
webcam() {
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
ffmpeg \
-f v4l2 \
-i /dev/video0 \
-video_size 640x480 \
"$HOME/webcam-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon ""
}
audio() {
ffmpeg \
-f alsa -i default \
-c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! >/tmp/recordingpid
updateicon ""
ffmpeg \
-f alsa -i default \
-c:a flac \
"$HOME/audio-$(date '+%y%m%d-%H%M-%S').flac" &
echo $! >/tmp/recordingpid
updateicon ""
}
askrecording() {
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast ;;
audio) audio ;;
video) video ;;
*selected) videoselected ;;
webcam) webcam ;;
"webcam (hi-def)") webcamhidef ;;
esac
choice=$(printf "screencast\\nvideo\\nvideo selected\\naudio\\nwebcam\\nwebcam (hi-def)" | dmenu -i -p "Select recording style:")
case "$choice" in
screencast) screencast ;;
audio) audio ;;
video) video ;;
*selected) videoselected ;;
webcam) webcam ;;
"webcam (hi-def)") webcamhidef ;;
esac
}
asktoend() {
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
response=$(printf "No\\nYes" | dmenu -i -p "Recording still active. End recording?") &&
[ "$response" = "Yes" ] && killrecording
}
videoselected() {
slop -f "%x %y %w %h" >/tmp/slop
read -r X Y W H </tmp/slop
rm /tmp/slop
slop -f "%x %y %w %h" >/tmp/slop
read -r X Y W H </tmp/slop
rm /tmp/slop
ffmpeg \
-f x11grab \
-framerate 60 \
-video_size "$W"x"$H" \
-i :0.0+"$X,$Y" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
ffmpeg \
-f x11grab \
-framerate 60 \
-video_size "$W"x"$H" \
-i :0.0+"$X,$Y" \
-c:v libx264 -qp 0 -r 30 \
"$HOME/box-$(date '+%y%m%d-%H%M-%S').mkv" &
echo $! >/tmp/recordingpid
updateicon "ﲣ"
}
case "$1" in

View File

@ -5,25 +5,25 @@
# 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
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
if case "$chosen" in
*)
chosen="${chosen#📱 }"
sudo -A umount -l "$chosen"
;;
*)
chosen="${chosen% (*}"
sudo -A umount -l "$chosen"
;;
esac then
notify-send "禍 Drive unmounted." "$chosen successfully unmounted."
*)
chosen="${chosen#📱 }"
sudo -A umount -l "$chosen"
;;
*)
chosen="${chosen% (*}"
sudo -A umount -l "$chosen"
;;
esac then
notify-send "禍 Drive unmounted." "$chosen successfully unmounted."
else
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
notify-send "禍 Drive failed to unmount." "Possibly a permissions or I/O issue."
fi
sudo -A umount "$chosen" && notify-send "禍 USB unmounting" "$chosen unmounted."

View File

@ -11,8 +11,8 @@ chosen=$(cut -d ';' -f1 ~/.local/share/chars/* | dmenu -i -l 30 | sed "s/ .*//")
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
xdotool type "$chosen"
xdotool type "$chosen"
else
printf "%s" "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
printf "%s" "$chosen" | xclip -selection clipboard
notify-send "'$chosen' copied to clipboard." &
fi

View File

@ -7,20 +7,20 @@ volume="$(pamixer --get-volume)"
mute="$(pamixer --get-mute)"
[ "$volume" -gt "100" ] &&
highlight="#ff768e" ||
highlight="#7aa2f7"
highlight="#ff768e" ||
highlight="#7aa2f7"
if [ "$mute" = "true" ]; then
icon="audio-volume-muted"
icon="audio-volume-muted"
elif [ "$volume" -gt "70" ]; then
icon="audio-volume-high"
icon="audio-volume-high"
elif [ "$volume" -gt "30" ]; then
icon="audio-volume-medium"
icon="audio-volume-medium"
elif [ "$volume" -ge "0" ]; then
icon="audio-volume-low"
icon="audio-volume-low"
fi
notify-send -a "changeVolume" -i "$icon" -u low "Volume: ${volume}%" \
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:$volume \
-h string:hlcolor:$highlight
-h string:x-dunst-stack-tag:$msgTag \
-h int:value:$volume \
-h string:hlcolor:$highlight

View File

@ -1,11 +1,11 @@
#!/bin/sh
if pidof picom; then
killall picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor Off"
killall picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor Off"
else
setsid -f picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor On"
setsid -f picom
notify-send -h string:x-dunst-stack-tag:"togcom" \
"Compositor On"
fi