From: ds6 Date: Tue, 16 Jan 2018 05:59:07 +0000 (-0600) Subject: add screen lock `l', `share' dir, install.sh edit X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/commitdiff_plain/a58ad2f0f50aeb3e5525cc7324503969d687f70b?ds=sidebyside;hp=-c add screen lock `l', `share' dir, install.sh edit --- a58ad2f0f50aeb3e5525cc7324503969d687f70b diff --git a/bin/dmenu_runsmart b/bin/dmenu_runsmart index 71cb8ad..c239db1 100755 --- a/bin/dmenu_runsmart +++ b/bin/dmenu_runsmart @@ -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 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 diff --git a/install.sh b/install.sh index 713e702..eb1366a 100755 --- a/install.sh +++ b/install.sh @@ -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 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 index 0000000..cae18d5 Binary files /dev/null and b/src/share/l/overlay.xcf differ