-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xero
committed
Aug 21, 2018
0 parents
commit 5febc60
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
``` | ||
┏━┓┳ o┏┓┓┏━┓┳ ┳┳ ┏━┓┏━┓┳┏ | ||
┃ ┳┃ ┃ ┃ ┃ ┃━┫┃ ┃ ┃┃ ┣┻┓ | ||
┇━┛┇━┛┇ ┇ ┗━┛┇ ┻┇━┛┛━┛┗━┛┇ ┛ | ||
``` | ||
|
||
glitchlock: a glitch art themed randomized lockscreen. powered by i3lock-color. | ||
|
||
 | ||
|
||
(note, the lock screen is **NOT** animated. this gif is just a few examples of it's random output) | ||
|
||
## table of contents | ||
* [about](#about) | ||
* [how it works](#how-it-works) | ||
* [security](#security) | ||
* [requirements](#requirements) | ||
* [customize](#customize) | ||
* [more](#more) | ||
|
||
### about | ||
|
||
i do [glitch art](https://x-ero.tumblr.com) for fun. i was messing around w/ one of my shell scripts and though: this would make a cool lockscreen! after a bit of research and refactoring here we are. | ||
|
||
### how it works | ||
|
||
the application takes a screenshot. then datamoshes it. optionally overlays an image (one for each display) then uses that image as the background for the lockscreen. | ||
|
||
### security | ||
|
||
this lockscreen has the potential for information leakage, since it uses a screenshot of your active screen. it made this for fun and personal use, please take care and weigh your opsec and threat models before deciding to use this. | ||
|
||
a workaround i like is setting up your screen very nicely w/o any secret info in it and taking a screenshot. then replace line #9 in the script (`scrot /tmp/lock.png`) with a command to move your pre-setup screenshot into place (e.g. `mv ~/lib/img/lock.png /tmp/lock.png`) then let the script randomly glitch that image out everytime. | ||
|
||
### requirements | ||
|
||
* i3lock-color | ||
* the "ricing" fork of the lockscreen application | ||
* https://github.com/PandorasFox/i3lock-color | ||
* scrot | ||
* the premiere nix screen shot tool | ||
* https://github.com/dreamer/scrot | ||
* imagemagick | ||
* image manipulation toolkit | ||
* https://github.com/ImageMagick/ImageMagick | ||
|
||
if you're using arch they can all be installed from the community and aur repos: | ||
|
||
`yaourt -S i3lock-color-git scrot imagemagick` | ||
|
||
### customize | ||
|
||
if called alone, the script will take a screenshot and glitch it. but you can optionally pass an environment variable named `GLITCHICON` to the app and it will center that image on each display and overlay it on the glitched image. | ||
|
||
an example of calling the script on `MOD4+ESC` using [sxhkd](https://github.com/baskerville/sxhkd) | ||
|
||
``` | ||
# lockscreen | ||
mod4 + Escape | ||
GLITCHICON=/home/x0/src/glitchlock/stop.png /home/x0/bin/glitchlock | ||
``` | ||
|
||
### more | ||
|
||
* https://0w.nz | ||
* https://xero.nu | ||
* https://nixers.net | ||
* https://git.io/.files | ||
* https://reddit.com/r/unixporn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
# ┏━┓┳ o┏┓┓┏━┓┳ ┳┳ ┏━┓┏━┓┳┏ | ||
# ┃ ┳┃ ┃ ┃ ┃ ┃━┫┃ ┃ ┃┃ ┣┻┓ | ||
# ┇━┛┇━┛┇ ┇ ┗━┛┇ ┻┇━┛┛━┛┗━┛┇ ┛ | ||
# | ||
# author: xero <x@xero.nu> http://xero.nu | ||
# requires: i3lock-color, imagemagick, scrot | ||
|
||
scrot /tmp/lock.png | ||
convert /tmp/lock.png /tmp/lock.jpg | ||
file=/tmp/lock.jpg | ||
|
||
function datamosh() { | ||
fileSize=$(wc -c < "$file") | ||
headerSize=1000 | ||
skip=$(shuf -i "$headerSize"-"$fileSize" -n 1) | ||
count=$(shuf -i 1-10 -n 1) | ||
for i in $(seq 1 $count);do byteStr=$byteStr'\x'$(shuf -i 0-255 -n 1); done; | ||
printf $byteStr | dd of="$file" bs=1 seek=$skip count=$count conv=notrunc >/dev/null 2>&1 | ||
} | ||
|
||
steps=$(shuf -i 40-70 -n 1) | ||
for i in $(seq 1 $steps);do datamosh "$file"; done | ||
|
||
GLITCHICON=${GLITCHICON:=""} | ||
PARAM=(--bar-indicator --bar-position h --bar-direction 1 --redraw-thread -t "" \ | ||
--bar-step 50 --bar-width 250 --bar-base-width 50 --bar-max-height 100 --bar-periodic-step 50 \ | ||
--bar-color 00000077 --keyhlcolor 00666666 --ringvercolor cc87875f --wrongcolor ffff0000 \ | ||
--veriftext="" --wrongtext="" --noinputtext="" ) | ||
|
||
LOCK=() | ||
while read LINE | ||
do | ||
if [[ "$LINE" =~ ([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+) ]]; then | ||
W=${BASH_REMATCH[1]} | ||
H=${BASH_REMATCH[2]} | ||
Xoff=${BASH_REMATCH[3]} | ||
Yoff=${BASH_REMATCH[4]} | ||
if [ ! -z "$GLITCHICON" ]; then | ||
IW=`identify -ping -format '%w' $GLITCHICON` | ||
IH=`identify -ping -format '%h' $GLITCHICON` | ||
MIDXi=$(($W / 2 + $Xoff - $IW / 2)) | ||
MIDYi=$(($H / 2 + $Yoff - $IH / 2)) | ||
LOCK+=($GLITCHICON -geometry +$MIDXi+$MIDYi -composite) | ||
fi | ||
fi | ||
done <<<"$(xrandr)" | ||
|
||
convert /tmp/lock.jpg /tmp/lock.png >/dev/null 2>&1 | ||
rm /tmp/lock.jpg | ||
file=/tmp/lock.png | ||
|
||
convert "$file" "${LOCK[@]}" "$file" | ||
|
||
i3lock -n "${PARAM[@]}" -i "$file" > /dev/null 2>&1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.