From 2df2739ab0f96fcdf75929ddd0752b2e87b9e5cf Mon Sep 17 00:00:00 2001 From: Frieder Schlesier Date: Mon, 8 May 2017 09:17:42 +0200 Subject: [PATCH] add multi-monitor support to i3lock, revert previous change --- .i3/config | 3 +-- bin/fancy-i3lock | 49 +++++++++++++++++++++++++++++++++++++++++++---- lock.png | Bin 0 -> 1387 bytes 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 lock.png diff --git a/.i3/config b/.i3/config index 0a18e34..dc3e170 100755 --- a/.i3/config +++ b/.i3/config @@ -212,8 +212,7 @@ bar { output VGA-1 output DP-1 output HDMI-1 - status_command i3status --config ~/.i3/status.conf -# status_command i3status --config ~/.i3/status_small.conf + status_command i3status --config ~/.i3/status_small.conf tray_output LVDS1 } diff --git a/bin/fancy-i3lock b/bin/fancy-i3lock index e051806..b5b358f 100755 --- a/bin/fancy-i3lock +++ b/bin/fancy-i3lock @@ -12,6 +12,10 @@ # :date: 8 June 2015 # :version: 0.0.1 ############################################################################## +# fschl copy multi monitor features from +# https://github.com/guimeira/i3lock-fancy-multimonitor/blob/master/lock +# + set -e # subshell this shiz @@ -25,13 +29,50 @@ set -e # BLURTYPE="2x8" # 2.90s # BLURTYPE="2x3" # 2.92s + DISPLAY_RE="([0-9]+)x([0-9]+)\\+([0-9]+)\\+([0-9]+)" + IMAGE_RE="([0-9]+)x([0-9]+)" + LOCK="$HOME/dotfiles/lock.png" + LOCK_INSIDE="/root/lock.png" + TEXT="i3session locked by @fschl" + PARAMS="" + + # Get dimensions of the lock image: + LOCK_IMAGE_INFO=`identify $LOCK` + [[ $LOCK_IMAGE_INFO =~ $IMAGE_RE ]] + IMAGE_WIDTH=${BASH_REMATCH[1]} + IMAGE_HEIGHT=${BASH_REMATCH[2]} + scrot $IMAGE + # Execute xrandr to get information about the monitors: + while read LINE + do + #If we are reading the line that contains the position information: + if [[ $LINE =~ $DISPLAY_RE ]]; then + #Extract information and append some parameters to the ones that will be given to ImageMagick: + WIDTH=${BASH_REMATCH[1]} + HEIGHT=${BASH_REMATCH[2]} + X=${BASH_REMATCH[3]} + Y=${BASH_REMATCH[4]} + POS_X=$(($X+$WIDTH/2-$IMAGE_WIDTH/2)) + POS_Y=$(($Y+$HEIGHT/2-$IMAGE_HEIGHT/2)) + # TEXT_X=$(($X+$WIDTH/2-$TEXT_WIDTH/2)) + # TEXT_Y=$(($Y+$HEIGHT/2-$TEXT_HEIGHT/2+200)) + + # PARAMS="$PARAMS '$LOCK' '-geometry' '+$POS_X+$POS_Y' '-geometry' '+$TEXT_X+$TEXT_Y' '-composite'" + PARAMS="$PARAMS '$LOCK_INSIDE' '-geometry' '+$POS_X+$POS_Y' '-composite'" + fi + done <<<"`xrandr`" + + #Execute ImageMagick: + PARAMS="'$IMAGE' '-level' '0%,100%,0.6' '-blur' '$BLURTYPE' $PARAMS '$IMAGE'" + + docker run --rm \ - -v $IMAGE:$IMAGE \ - -v $HOME/Pictures/lock.png:/root/lock.png \ - fschl/imagemagick \ - sh -c "convert $IMAGE -brightness-contrast -30x10 -level 0%,100%,0.6 -blur $BLURTYPE -gravity center - | composite -gravity center /root/lock.png - $IMAGE" + -v $IMAGE:$IMAGE \ + -v $HOME/dotfiles/lock.png:/root/lock.png \ + fschl/imagemagick \ + sh -c "convert $PARAMS" i3lock -i $IMAGE diff --git a/lock.png b/lock.png new file mode 100644 index 0000000000000000000000000000000000000000..e268624ffb83252bd0838b2861ae9dd30da8f6d6 GIT binary patch literal 1387 zcmV-x1(f=UP)!1A2fvfvbTl{O3P`-+*CY0Qkmh<03LcNwipDF{o;b zh*bUioxnZ74ZvlYf?@u}nH~W8MdWzsA}*GO8BQvvs+)n=fnK1)6k7<>z)9d~5qU*b z0UBn!VuidU6#`mRbvtkfxRzpO0a}3#z+P2-4QTTh(iAJkq75_KOP&PYpfTT>@Br|E zs;*fQE$q8-RaKt_o&hefWg5V3z~|t`2ouXq;V($tvwgtZK)WrI;uLTK_z@Vyjm{f@ z>w#^+rMS_2uKK($BHOK)m$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