]> git.sev.monster Git - dotfiles.git/commitdiff
add screen lock `l', `share' dir, install.sh edit
authords6 <git@ds6.pw>
Tue, 16 Jan 2018 05:59:07 +0000 (23:59 -0600)
committerds6 <git@ds6.pw>
Tue, 16 Jan 2018 05:59:07 +0000 (23:59 -0600)
bin/dmenu_runsmart
bin/l [new file with mode: 0755]
install.sh
share/l/overlay.png [new file with mode: 0644]
src/share/l/overlay.xcf [new file with mode: 0644]

index 71cb8adc4a0e72dba6b6493029f63223885f7fe9..c239db1f29c2864b7b0acebea95b10eee7660972 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/sh
 cmd=$(dmenu_path | ~/bin/dmenu "$@")
 if [ -n "$cmd" ]; then
-       # zsh SH_WORD_SPLIT is unset by default, `=' flag is required to expand
+       # NOTE: only tested with zsh and sh, and has issues with expansion; zsh
+       # SH_WORD_SPLIT is unset by default, `=' flag is required to expand it
        echo "alias sudo='sudo -Ak'
 cmd='$(echo "$cmd" | sed "s/'/'\\\\''/g")'" '
 if [ -n "$ZSH_VERSION" ]; then
diff --git a/bin/l b/bin/l
new file mode 100755 (executable)
index 0000000..f7e2d3d
--- /dev/null
+++ b/bin/l
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# term lock
+if [ -z "$DISPLAY" ]; then
+       lock -npv
+       exit
+fi
+
+# xorg lock
+img=~/tmp/lock.png
+if [ -f "$img" ]; then
+       # rudimentary attempt to prevent multiple locks
+       # XXX: could block lock and replace with malicious locker
+       echo "Lock file exists at '$img', exiting"
+       exit 1
+fi
+res="$(xdpyinfo | grep dimensions | awk '{print $2}')"
+scale=0.07
+ffmpeg -y -loglevel 0 \
+  -s "$res" -f x11grab -i $DISPLAY -i ~/share/l/overlay.png \
+  -filter_complex "
+    [0]
+      scale=iw * $scale:ih * $scale,
+      noise=alls=2,
+      scale=`echo $res | tr x :`:flags=neighbor,
+      noise=alls=5,
+      gblur=8
+      [composite];
+    [composite]
+      [1] overlay=x=(main_w - overlay_w) / 2 + 0.5:
+                  y=(main_h - overlay_h) / 2
+      [out]" \
+  -map "[out]" -vframes 1 "$img"
+# pause dunst
+killall -USR1 dunst
+i3lock -nefi "$img"
+rm "$img"
+killall -USR2 dunst
index 713e7026a0f5d83106393c57bf85531dc2a8d853..eb1366aadcdfd63be2d44e00524bd802e3c5b2a1 100755 (executable)
@@ -13,20 +13,20 @@ fi
 
 l() {
        # TODO: use install?
-       [ -L "$1" -o \! -e "$1" ] && ln -sFhvw "$x" "$1"
+       [ -L "$1" -o \! -e "$1" ] && ln -sFhvw "${2:-$x}" "$1"
 }
 
 find "$PWD/base" -depth 1 | while read -r x; do
        l "$HOME/`basename "$x"`"
 done
-mkdir "$HOME/bin"
-find "$PWD/bin" -depth 1 | while read -r x; do
-       l "$HOME/bin/`basename "$x"`"
+mkdir "$HOME/bin" "$HOME/share" > /dev/null 2>&1
+find bin share -depth 1 | while read -r x; do
+       l "$HOME/$x" "$PWD/$x"
 done
 find "$PWD/xdg" -depth 1 | while read -r x; do
        l "${XDG_CONFIG_HOME:-$HOME/.config}/`basename "$x"`"
 done
-mkdir -p "$HOME/.urxvt/ext"
+mkdir -p "$HOME/.urxvt/ext" > /dev/null 2>&1
 find "$PWD/urxvt-ext" -type f -perm -ugo=x -mindepth 1 -maxdepth 2 | while read -r x; do
        l "$HOME/.urxvt/ext/`basename $x`"
 done
diff --git a/share/l/overlay.png b/share/l/overlay.png
new file mode 100644 (file)
index 0000000..99afd9b
Binary files /dev/null and b/share/l/overlay.png differ
diff --git a/src/share/l/overlay.xcf b/src/share/l/overlay.xcf
new file mode 100644 (file)
index 0000000..cae18d5
Binary files /dev/null and b/src/share/l/overlay.xcf differ
This page took 0.044829 seconds and 4 git commands to generate.