all repos — dotfiles @ 724147201fc9781c878727aa689c478eb90acb46

linux dotfiles

update i3 config, add lock.sh

added a lock.sh script that uses i3lock and added a keybinding
corrected a silly mistake
Prithu Goswami prithugoswami524@gmail.com
Mon, 16 Apr 2018 11:14:16 +0530
commit

724147201fc9781c878727aa689c478eb90acb46

parent

bfa3958243d3baafca65d8df0fdd95b5c4a7645b

2 files changed, 41 insertions(+), 1 deletions(-)

jump to
M .config/i3/config.config/i3/config

@@ -125,6 +125,8 @@ bindsym $mod+Shift+8 move container to workspace 8

bindsym $mod+Shift+9 move container to workspace 9 bindsym $mod+Shift+0 move container to workspace 10 +#Lock screen +bindsym $mod+v exec ~/.config/i3/lock.sh # Dual Monitor # the keybindings mod+Shift+t/y change the monitor position and then write to file the same command # it used to set the the respective position of the monitor. That command is then executed at startup

@@ -143,7 +145,8 @@

# sets monitor to the right bindsym $mod+Shift+y exec $monitor_right ; exec ~/.fehbg ; exec echo $monitor_right > ~/.screenlayout/last_layout -# when there is no external monitor connected bindsym $mod+Shift+g exec $monitor_none ; exec ~/.fehbg ; exec echo $monitor_right > ~/.screenlayout/last_layout +# when there is no external monitor connected +bindsym $mod+Shift+g exec $monitor_none ; exec ~/.fehbg ; exec echo $monitor_right > ~/.screenlayout/last_layout exec ~/.screenlayout/last_layout
A .config/i3/lock.sh

@@ -0,0 +1,37 @@

+#!/bin/bash +# This script is a lockscnreen script that utilizes i3lock +# it produces a pixelated screenshot along with a icon you can choose that is placed in the middle +# this isn't my work and I picked it up and modified it a little from the good folks over at /r/unixporn +# https://www.reddit.com/r/unixporn/comments/3358vu/i3lock_unixpornworthy_lock_screen/ + +scrot /tmp/screen.png +convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png +icon=$HOME/.config/i3/icon.png + +if [[ -f $icon ]] +then + # placement x/y + PX=0 + PY=0 + # lockscreen image info + R=$(file $icon | grep -o '[0-9]* x [0-9]*') + RX=$(echo $R | cut -d' ' -f 1) + RY=$(echo $R | cut -d' ' -f 3) + + SR=$(xrandr --query | grep ' connected'| sed 's/primary //' | cut -f3 -d' ') + for RES in $SR + do + # monitor position/offset + SRX=$(echo $RES | cut -d'x' -f 1) # x pos + SRY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 1) # y pos + SROX=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 2) # x offset + SROY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 3) # y offset + PX=$(($SROX + $SRX/2 - $RX/2)) + PY=$(($SROY + $SRY/2 - $RY/2)) + + convert /tmp/screen.png $icon -geometry +$PX+$PY -composite -matte /tmp/screen.png + done +fi +# dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop +# i3lock -I 10 -d -e -u -n -i /tmp/screen.png +i3lock -e -u -n -i /tmp/screen.png