summaryrefslogtreecommitdiff
path: root/scripts/glitchlock
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/glitchlock')
-rwxr-xr-xscripts/glitchlock55
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/glitchlock b/scripts/glitchlock
new file mode 100755
index 0000000..16016a9
--- /dev/null
+++ b/scripts/glitchlock
@@ -0,0 +1,55 @@
+#!/bin/bash
+# ┏━┓┳ o┏┓┓┏━┓┳ ┳┳ ┏━┓┏━┓┳┏
+# ┃ ┳┃ ┃ ┃ ┃ ┃━┫┃ ┃ ┃┃ ┣┻┓
+# ┇━┛┇━┛┇ ┇ ┗━┛┇ ┻┇━┛┛━┛┗━┛┇ ┛
+#
+# author: xero <x@xero.nu> http://xero.nu
+# requires: i3lock-color, imagemagick, scrot
+
+maim /tmp/lock.png
+convert /tmp/lock.png /tmp/lock.jpg
+file=/tmp/lock.jpg
+
+function datamosh() {
+ fileSize=$(wc -c < "$file")
+ headerSize=1000
+ skip=$(shuf -i "$headerSize"-"$fileSize" -n 1)
+ count=$(shuf -i 1-10 -n 1)
+ for i in $(seq 1 $count);do byteStr=$byteStr'\x'$(shuf -i 0-255 -n 1); done;
+ printf $byteStr | dd of="$file" bs=1 seek=$skip count=$count conv=notrunc >/dev/null 2>&1
+}
+
+steps=$(shuf -i 40-70 -n 1)
+for i in $(seq 1 $steps);do datamosh "$file"; done
+
+GLITCHICON=${GLITCHICON:=""}
+PARAM=(--bar-indicator --bar-orientation horizontal --bar-direction 1 --redraw-thread -t "" \
+ --bar-step 50 --bar-total-width 250 --bar-base-width 50 --bar-max-height 100 --bar-periodic-step 50 \
+ --bar-color 00000077 --keyhl-color 00666666 --ringver-color cc87875f --wrong-color ffff0000 \
+ --verif-text="" --wrong-text="" --noinput-text="" )
+
+LOCK=()
+while read LINE
+do
+ if [[ "$LINE" =~ ([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+) ]]; then
+ W=${BASH_REMATCH[1]}
+ H=${BASH_REMATCH[2]}
+ Xoff=${BASH_REMATCH[3]}
+ Yoff=${BASH_REMATCH[4]}
+ if [ ! -z "$GLITCHICON" ]; then
+ IW=`identify -ping -format '%w' $GLITCHICON`
+ IH=`identify -ping -format '%h' $GLITCHICON`
+ MIDXi=$(($W / 2 + $Xoff - $IW / 2))
+ MIDYi=$(($H / 2 + $Yoff - $IH / 2))
+ LOCK+=($GLITCHICON -geometry +$MIDXi+$MIDYi -composite)
+ fi
+ fi
+done <<<"$(xrandr)"
+
+convert /tmp/lock.jpg /tmp/lock.png >/dev/null 2>&1
+rm /tmp/lock.jpg
+file=/tmp/lock.png
+
+convert "$file" "${LOCK[@]}" "$file"
+
+i3lock -f --indicator -k --time-color="458588ff" --date-color="458588ff" --verif-text="Vérification\n..." --wrong-text="Bonjour non." --noinput-text="Pas de putes internes" -i "$file" > /dev/null 2>&1