summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorivan-boikov <ik.boikov.public@protonmail.com>2022-05-22 22:32:07 +0200
committerivan-boikov <ik.boikov.public@protonmail.com>2022-05-22 22:32:07 +0200
commit128ae72e6b0ff6ab70b4c54938a5354218c58abc (patch)
tree31f579c9e67112151acca65ca835b50d181a56a7 /scripts
parentf7498cf11733a375e2a70e5139659d10036faf0c (diff)
xprofile and others
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/.local/bin/dmnt2
-rwxr-xr-xscripts/.local/bin/ilock70
2 files changed, 42 insertions, 30 deletions
diff --git a/scripts/.local/bin/dmnt b/scripts/.local/bin/dmnt
index fb615fc..4d4b70c 100755
--- a/scripts/.local/bin/dmnt
+++ b/scripts/.local/bin/dmnt
@@ -73,7 +73,7 @@ unmountdev() { \
pids="$(echo "$processes" | awk '{print $2}')"
#notify-send -u critical "Unmount device" "$result\nPreparing list of processes blocking $1..."
notify-send -u critical "Unmount $1" "$result\nBlocking processes:\n$processes"
- action=$(echo "nothing\nterminate\nkill" | $dmenu -p "What to do to processes blocking $1" -l 3)
+ action=$(echo -e "nothing\nterminate\nkill" | $dmenu -p "What to do to processes blocking $1" -l 3)
case $action in
terminate) echo "$pids" | while IFS='\n' read -r pid ; do kill $pid; done ;;
kill) echo "$pids" | while IFS='\n' read -r pid ; do kill -9 $pid; done ;;
diff --git a/scripts/.local/bin/ilock b/scripts/.local/bin/ilock
index 6450407..40f1f9d 100755
--- a/scripts/.local/bin/ilock
+++ b/scripts/.local/bin/ilock
@@ -1,40 +1,52 @@
#!/usr/bin/env bash
-icon="$HOME/.local/share/icons/lock.png"
-pngfile='/tmp/screen.png'
-bmpfile='/tmp/screen.bmp'
-glitchedfile="/tmp/sclock_g.bmp"
+icon_file="$HOME/.local/share/icons/lock.png"
+icon_scaled_file='/tmp/lock-icon.png'
+scr_png='/tmp/screen.png'
+scr_bmp='/tmp/screen.bmp'
+scr_gl_bmp="/tmp/sclock_g.bmp"
(( $# )) && { icon=$1; }
-# flush keyring passwords
-gnome-keyring-daemon -r -d
+# flush passwords
+if [ -n $(which gnome-keyring-daemon) ]; then
+ gnome-keyring-daemon -r -d
+fi
+ssh-agent -k
+gpgconf --kill gpg-agent
-# generate fancy lock screen
-rm "$pngfile"
-maim > "$pngfile"
-
-# old method
-#convert "$pngfile" -scale 5% -scale 2000% "$pngfile"
-
-# new method with heavy distortion
-convert -rotate -90 $pngfile $bmpfile
-for a in {1,2,4,5,2}
-do
- # Glitch it with sox FROM: https://maryknize.com/blog/glitch_art_with_sox_imagemagick_and_vim/
- sox -t ul -c 1 -r 48k $bmpfile -t ul $glitchedfile trim 0 90s : echo 0.2 0.3 $((a*3)) 0.7
- # Rotate it by 90 degrees
- convert -scale $((100/(a)))% -scale $((100*(a)))% -rotate 90 $glitchedfile $bmpfile
-done
-convert -gamma 0.1 -gravity center -font "Liberation-Mono" \
- -pointsize 200 -channel RGBA -fill '#bf616a' \
- $bmpfile $pngfile
-
-convert "$pngfile" "$icon" -gravity center -composite -matte "$pngfile"
+# generate fancy lock screen
+rm "$scr_png"
+maim > "$scr_png"
+
+# just pixelate
+convert "$scr_png" -scale 10% -scale 1000% "$scr_png"
+
+# add heavy distortion
+#convert "$scr_png" -resize 500x "$scr_png"
+#convert -rotate -90 $scr_png $scr_bmp
+#for a in {1,2,4,5,2}
+#do
+# # Glitch it with sox FROM: https://maryknize.com/blog/glitch_art_with_sox_imagemagick_and_vim/
+# sox -t ul -c 1 -r 48k $scr_bmp -t ul $scr_gl_bmp trim 0 90s : echo 0.2 0.3 $((a*3)) 0.7
+# # Rotate it by 90 degrees
+# convert -scale $((100/(a)))% -scale $((100*(a)))% -rotate 90 $scr_gl_bmp $scr_bmp
+#done
+#convert -gamma 0.1 -gravity center -font "Liberation-Mono" \
+# -pointsize 200 -channel RGBA -fill '#bf616a' \
+# $scr_bmp $scr_png
+
+# add lock icon
+# first, rescale to match half screen height
+resolutiony=$(xrandr | fgrep '*' | cut -d'x' -f2 | awk '{print $1}')
+locksizey=$(echo "$resolutiony / 2" | bc -l)
+convert "$icon_file" -resize x"$locksizey" "$icon_scaled_file"
+# and add icon on top of screenshot
+convert "$scr_png" "$icon_scaled_file" -gravity center -composite -matte "$scr_png"
playerctl pause
-#sxiv $pngfile
+#sxiv $scr_png
-i3lock -u -i "$pngfile"
+i3lock -u -i "$scr_png"