ninjastille

Code snippets and hacks

Aug 10th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. dowhatever.sh | awk '!x[$0]++'
  2.  
  3. #!/bin/bash
  4.  
  5. scrot /tmp/screen.png
  6. convert /tmp/screen.png -scale 10% -scale 1000% /tmp/screen.png
  7.  
  8. if [[ -f $HOME/.xlock/screen-lock.png ]]
  9. then
  10. # placement x/y
  11. PX=0
  12. PY=0
  13. # lockscreen image info
  14. R=$(file ~/.xlock/screen-lock.png | grep -o '[0-9]* x [0-9]*')
  15. RX=$(echo $R | cut -d' ' -f 1)
  16. RY=$(echo $R | cut -d' ' -f 3)
  17.  
  18. SR=$(xrandr --query | grep ' connected' | cut -f3 -d' ')
  19. for RES in $SR
  20. do
  21. # monitor position/offset
  22. SRX=$(echo $RES | cut -d'x' -f 1) # x pos
  23. SRY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 1) # y pos
  24. SROX=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 2) # x offset
  25. SROY=$(echo $RES | cut -d'x' -f 2 | cut -d'+' -f 3) # y offset
  26. PX=$(($SROX + $SRX/2 - $RX/2))
  27. PY=$(($SROY + $SRY/2 - $RY/2))
  28.  
  29. convert /tmp/screen.png $HOME/.xlock/screen-lock.png -geometry +$PX+$PY -composite -matte /tmp/screen.png
  30. echo "done"
  31. done
  32. fi
  33. i3lock -e -u -n -i /tmp/screen.png
  34.  
  35. #end
Add Comment
Please, Sign In to add comment