add multi-monitor support to i3lock, revert previous change

This commit is contained in:
Frieder Schlesier 2017-05-08 09:17:42 +02:00
parent 5251470fb7
commit 2df2739ab0
3 changed files with 46 additions and 6 deletions

View File

@ -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
}

View File

@ -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

BIN
lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB