Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6731645a2d | ||
|
|
55f5c30071 | ||
|
|
0feb479c2e | ||
|
|
4cfcd47264 | ||
|
|
a62725e4ed | ||
|
|
2829bb580c | ||
|
|
9073a2a054 | ||
|
|
d35078ced3 | ||
|
|
3c65cbdee4 | ||
|
|
39f3f9f61d | ||
|
|
dae922c79b | ||
|
|
2753fab640 | ||
|
|
c1b0eb6af0 | ||
|
|
ea830e8dab | ||
|
|
997e6a40ae | ||
|
|
5e3d036797 | ||
|
|
aee4f57cab | ||
|
|
c054844276 | ||
|
|
81e5d27725 | ||
|
|
1734f7752f | ||
|
|
8d327b0ea8 | ||
|
|
dd356ece43 | ||
|
|
b92d5a99ef | ||
|
|
cb791253ab | ||
|
|
c1da4ca540 | ||
|
|
7accfb2aa2 | ||
|
|
97303997fa | ||
|
|
f2e9bdd1d2 | ||
|
|
421ffc0c33 | ||
|
|
6a6e0e73bf | ||
|
|
9997e66217 | ||
|
|
98f5d8c620 | ||
|
|
35e6ff3ca3 | ||
|
|
ec7a2f16a2 | ||
|
|
7217cb5089 | ||
|
|
b77540eb2b | ||
|
|
2c018760d0 | ||
|
|
e128f9d97a | ||
|
|
883fac2ce5 | ||
|
|
7d6517700d | ||
|
|
e5e7d32759 | ||
|
|
78c03700a9 | ||
|
|
0eedfa4149 | ||
|
|
0892e09fc1 | ||
|
|
8a3567f253 | ||
|
|
de7e6fb319 | ||
|
|
7ec676d31d | ||
|
|
ec522cdd8c | ||
|
|
95eed4b76f | ||
|
|
a12ce234a8 | ||
|
|
3873b0e56f | ||
|
|
3734fba160 | ||
|
|
9250f6a17f | ||
|
|
e96fc59ae4 | ||
|
|
2ed5732153 | ||
|
|
471f73d5fb | ||
|
|
fa70629d05 | ||
|
|
819d3ef698 | ||
|
|
20ab403e44 | ||
|
|
b81db647fa | ||
|
|
de145dffe7 | ||
|
|
4d3931ace2 | ||
|
|
695276663b | ||
|
|
894076dd43 | ||
|
|
90d5ceb270 | ||
|
|
4c909fd8d3 | ||
|
|
7df8c24d84 | ||
|
|
7763b2c31f | ||
|
|
a974a4c7b4 | ||
|
|
765a37f87b | ||
|
|
e7eb9e7de4 |
16
Makefile
Normal file
16
Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
PRGM = i3lock-fancy
|
||||
PREFIX ?= /usr
|
||||
SHRDIR ?= $(PREFIX)/share
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
|
||||
install:
|
||||
@install -Dm755 i3lock-fancy -t $(DESTDIR)$(BINDIR)
|
||||
@install -Dm644 icons/* -t $(DESTDIR)$(SHRDIR)/$(PRGM)/icons
|
||||
@install -Dm644 doc/i3lock-fancy.1 -t $(DESTDIR)$(SHRDIR)/man/man1
|
||||
@install -Dm644 LICENSE -t $(DESTDIR)$(SHRDIR)/licenses/$(PRGM)
|
||||
|
||||
uninstall:
|
||||
@unlink $(DESTDIR)$(BINDIR)/$(PRGM) # Remove binary
|
||||
@rm -Rf $(DESTDIR)$(SHRDIR)/$(PRGM) # Remove icons
|
||||
@unlink $(DESTDIR)$(SHRDIR)/man/man1/i3lock-fancy.1 # Remove man
|
||||
@rm -Rf $(DESTDIR)$(SHRDIR)/licenses/$(PRGM) # Remove license
|
||||
65
README.md
65
README.md
@@ -10,11 +10,11 @@ website: [github pages website](http://meskarune.github.io/i3lock-fancy/)
|
||||
Dependencies
|
||||
------------
|
||||
* <s>[i3lock-color-git](https://github.com/eBrnd/i3lock-color)</s>
|
||||
* [i3lock-color-git](https://github.com/chrjguill/i3lock-color) - this is a fork of i3lock-color that is kept up to date with i3lock
|
||||
* [i3lock-color-git](https://github.com/Raymo111/i3lock-color) - this is a fork of i3lock-color that is kept up to date with i3lock
|
||||
* imagemagick
|
||||
* bash
|
||||
* awk
|
||||
* utils-linux
|
||||
* util-linux
|
||||
|
||||
Optional Dependencies
|
||||
---------------------
|
||||
@@ -23,14 +23,30 @@ Optional Dependencies
|
||||
|
||||
Installation
|
||||
------------
|
||||
Arch Linux Package: https://aur.archlinux.org/packages/i3lock-fancy-git/
|
||||
|
||||
git clone the repository and copy lock and /icons to "/usr/local/bin"
|
||||
To install i3lock-fancy manually, git clone the repository:
|
||||
|
||||
git clone https://github.com/meskarune/i3lock-fancy.git
|
||||
|
||||
Then change to the directory and run make.
|
||||
|
||||
cd i3lock-fancy
|
||||
sudo make install
|
||||
|
||||
**IMPORTANT NOTE: the way to install i3lock-fancy has changed! If you are a
|
||||
package maintainer or previously installed manually you may have to review
|
||||
and update your configurations. The new change simplifies a lot of
|
||||
things so updates will be easier in the future.**
|
||||
|
||||
### The following distro's have packages you can use to install:
|
||||
* Arch Linux: https://aur.archlinux.org/packages/i3lock-fancy-git/
|
||||
* GNU Guix: Run `guix package --install i3lock-fancy`
|
||||
* Debian: https://packages.debian.org/sid/i3lock-fancy
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
lock [options]
|
||||
i3lock-fancy [options]
|
||||
|
||||
Options:
|
||||
-h, --help This help menu.
|
||||
@@ -44,17 +60,19 @@ Usage
|
||||
-f <fontname>, --font <fontname> Set a custom font.
|
||||
|
||||
-t <text>, --text <text> Set a custom text prompt.
|
||||
|
||||
|
||||
-l, --listfonts Display a list of possible fonts for use with -f/--font.
|
||||
Note: this option will not lock the screen, it displays
|
||||
the list and exits immediately.
|
||||
|
||||
-n, --nofork Do not fork i3lock after starting.
|
||||
|
||||
-- Must be last option. Set command to use for taking a
|
||||
screenshot. Default is 'import -window root'. Using 'scrot'
|
||||
or 'maim' will increase script speed and allow setting
|
||||
custom flags like haing a delay.
|
||||
custom flags like having a delay.
|
||||
|
||||
example: ```lock -gpf Comic-Sans-MS -- scrot -z```
|
||||
example: ```i3lock-fancy -gpf Comic-Sans-MS -- scrot -z```
|
||||
|
||||
Extras
|
||||
------
|
||||
@@ -78,15 +96,34 @@ Systemd Unit file example (edit for your own use):
|
||||
Type=simple
|
||||
User=meskarune
|
||||
Environment=DISPLAY=:0
|
||||
ExecStart=/usr/bin/xautolock -time 5 -locker /usr/local/bin/lock/lock -detectsleep
|
||||
ExecStart=/usr/bin/xautolock -time 5 -locker /usr/bin/i3lock-fancy -detectsleep
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical.target
|
||||
|
||||
Multiple Monitors
|
||||
-----------------
|
||||
There is a branch called dual monitor with support for multiple monitors. This
|
||||
branch uses a grey icon and text with outlines to make it visible on light and
|
||||
dark backgrounds (though it looks better on dark backgrounds). I am still
|
||||
working to get it looking just right right. The script is usable now, but it's
|
||||
under developement and things may change.
|
||||
There is a branch called dual monitor with support for multiple monitors.
|
||||
(it is currently out of date compared to the main locker, I need to update
|
||||
it with all the new features) This branch uses a grey icon and text with
|
||||
outlines to make it visible on light and dark backgrounds (though it looks
|
||||
better on dark backgrounds). I am still working to get it looking just right
|
||||
right. The script is usable now, but it's under developement and things may change.
|
||||
|
||||
Static image
|
||||
------------
|
||||
If you would like to run `i3lock-color` with a static image in the style of
|
||||
i3lock-fancy, run `convert` from image magick directly on the background image
|
||||
you want to use. Then specify the result `newimage.png` to `i3lock -i`:
|
||||
```
|
||||
#!/bin/sh
|
||||
# Add a lock icon and text to the center of an image
|
||||
convert /path/to/background.png -font Liberation-Sans \
|
||||
-pointsize 26 -fill white -gravity center \
|
||||
-annotate +0+160 "Type Password to Unlock" lock.png \
|
||||
-gravity center -composite newimage.png
|
||||
```
|
||||
|
||||
```
|
||||
i3lock -i newimage.png
|
||||
```
|
||||
|
||||
67
doc/i3lock-fancy.1
Normal file
67
doc/i3lock-fancy.1
Normal file
@@ -0,0 +1,67 @@
|
||||
.TH I3LOCK-FANCY 1 2017-06-26
|
||||
|
||||
.SH NAME
|
||||
.B i3lock-fancy
|
||||
- Bash script around i3lock for fancy effect
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
Takes a screenshot of the desktop, blurs the background and adds a lock icon and
|
||||
text. This blurred image is then given to \fBi3lock\fR as the lockscreen
|
||||
background.
|
||||
|
||||
.SH SYNOPSIS
|
||||
|
||||
.B i3lock-fancy [options]
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
\fB-h, --help\fP
|
||||
Display a help screen and exit.
|
||||
|
||||
.TP
|
||||
\fB-d, --desktop\fP
|
||||
Attempt to minimize all windows before locking.
|
||||
|
||||
.TP
|
||||
\fB-g, --greyscale\fP
|
||||
Set background to greyscale instead of color.
|
||||
|
||||
.TP
|
||||
\fB-p, --pixelate\fP
|
||||
Pixelate the background instead of blur, runs faster.
|
||||
|
||||
.TP
|
||||
\fB-f <fontname>, --font <fontname>\fP
|
||||
Set a custom font.
|
||||
|
||||
.TP
|
||||
\fB-t <text>, --text <text>\fP
|
||||
Set a custom text prompt.
|
||||
|
||||
.TP
|
||||
\fB-l, --listfonts\fP
|
||||
Display a list of possible fonts for use with -f/--font.
|
||||
|
||||
.IP
|
||||
Note: this option will not lock the screen, it displays the list and exits
|
||||
immediately.
|
||||
|
||||
.TP
|
||||
\fB-n, --nofork\fP
|
||||
Do not fork i3lock after starting.
|
||||
|
||||
.TP
|
||||
\fB--\fP
|
||||
Must be last option. Set command to use for taking a screenshot. Default is
|
||||
\'import -window root\'. Using \'scrot\' or \'maim\' will increase script speed and
|
||||
allow setting custom flags like having a delay.
|
||||
|
||||
.SH SEE ALSO
|
||||
\fBi3lock\fR(1)
|
||||
|
||||
.SH AUTHORS
|
||||
|
||||
Dolores Portalatin <hello@doloresportalatin.info>
|
||||
|
||||
@@ -3,18 +3,14 @@
|
||||
# Dependencies: imagemagick, i3lock-color-git, scrot, wmctrl (optional)
|
||||
set -o errexit -o noclobber -o nounset
|
||||
|
||||
# get path where the script is located to find the lock icon
|
||||
scriptpath=$(readlink -f -- "$0")
|
||||
scriptpath=${scriptpath%/*}
|
||||
|
||||
hue=(-level "0%,100%,0.6")
|
||||
effect=(-filter Gaussian -resize 20% -define "filter:sigma=1.5" -resize 500.5%)
|
||||
# default system sans-serif font
|
||||
font="$(convert -list font | awk "{ a[NR] = \$2 } /family: $(fc-match sans -f "%{family}\n")/ { print a[NR-1]; exit }")"
|
||||
image="$(mktemp).png"
|
||||
shot=(import -window root)
|
||||
font=$(convert -list font | awk "{ a[NR] = \$2 } /family: $(fc-match sans -f "%{family}\n")/ { print a[NR-1]; exit }")
|
||||
image=$(mktemp --suffix=.png)
|
||||
shot=(import -silent -window root)
|
||||
desktop=""
|
||||
param_add=("")
|
||||
i3lock_cmd=(i3lock -i "$image")
|
||||
shot_custom=false
|
||||
|
||||
options="Options:
|
||||
@@ -48,18 +44,27 @@ temp="$(getopt -o :hdnpglt:f: -l desktop,help,listfonts,nofork,pixelate,greyscal
|
||||
eval set -- "$temp"
|
||||
|
||||
# l10n support
|
||||
text="Type password to unlock"
|
||||
case "${LANG:-}" in
|
||||
af_* ) text="Tik wagwoord om te ontsluit" ;; # Afrikaans
|
||||
cs_* ) text="Pro odemčení zadajte heslo" ;; # Czech
|
||||
de_* ) text="Bitte Passwort eingeben" ;; # Deutsch
|
||||
da_* ) text="Indtast adgangskode" ;; # Danish
|
||||
en_* ) text="Type password to unlock" ;; # English
|
||||
es_* ) text="Ingrese su contraseña" ;; # Española
|
||||
fr_* ) text="Entrez votre mot de passe" ;; # Français
|
||||
he_* ) text="הקלד סיסמה לביטול הנעילה" ;; # Hebrew עברית
|
||||
hi_* ) text="अनलॉक करने के लिए पासवर्ड टाईप करें" ;; #Hindi
|
||||
id_* ) text="Masukkan kata sandi Anda" ;; # Bahasa Indonesia
|
||||
it_* ) text="Inserisci la password" ;; # Italian
|
||||
ja_* ) text="パスワードを入力してください" ;; # Japanese
|
||||
lv_* ) text="Ievadi paroli" ;; # Latvian
|
||||
nb_* ) text="Skriv inn passord" ;; # Norwegian
|
||||
pl_* ) text="Podaj hasło" ;; # Polish
|
||||
pt_* ) text="Digite a senha para desbloquear" ;; # Português
|
||||
sk_* ) text="Pre odomknutie zadajte heslo" ;; # Slovak
|
||||
tr_* ) text="Giriş yapmak için şifrenizi girin" ;; # Turkish
|
||||
ru_* ) text="Введите пароль" ;; # Russian
|
||||
zh_* ) text="请输入密码以解锁" ;; # Chinese
|
||||
* ) text="Type password to unlock" ;; # Default to English
|
||||
esac
|
||||
|
||||
@@ -68,7 +73,7 @@ while true ; do
|
||||
-h|--help)
|
||||
printf "Usage: %s [options]\n\n%s\n\n" "${0##*/}" "$options"; exit 1 ;;
|
||||
-d|--desktop) desktop=$(command -V wmctrl) ; shift ;;
|
||||
-g|--greyscale) hue=(-level "0%,100%,0.6" -set colorspace Gray -separate -average) ; shift ;;
|
||||
-g|--greyscale) hue=(-level "0%,100%,0.6" -set colorspace Gray -average) ; shift ;;
|
||||
-p|--pixelate) effect=(-scale 10% -scale 1000%) ; shift ;;
|
||||
-f|--font)
|
||||
case "$2" in
|
||||
@@ -79,7 +84,7 @@ while true ; do
|
||||
-l|--listfonts)
|
||||
convert -list font | awk -F: '/Font: / { print $2 }' | sort -du | command -- ${PAGER:-less}
|
||||
exit 0 ;;
|
||||
-n|--nofork) param_add=(--nofork) ; shift ;;
|
||||
-n|--nofork) i3lock_cmd+=(--nofork) ; shift ;;
|
||||
--) shift; shot_custom=true; break ;;
|
||||
*) echo "error" ; exit 1 ;;
|
||||
esac
|
||||
@@ -98,31 +103,56 @@ color=$(convert "$image" -gravity center -crop 100x100+0+0 +repage -colorspace h
|
||||
|
||||
if [[ $color -gt $value ]]; then #white background image and black text
|
||||
bw="black"
|
||||
icon="$scriptpath/icons/lockdark.png"
|
||||
param=("--textcolor=00000000" "--insidecolor=0000001c" "--ringcolor=0000003e" \
|
||||
"--linecolor=00000000" "--keyhlcolor=ffffff80" "--ringvercolor=ffffff00" \
|
||||
"--separatorcolor=22222260" "--insidevercolor=ffffff1c" \
|
||||
"--ringwrongcolor=ffffff55" "--insidewrongcolor=ffffff1c")
|
||||
icon="/usr/share/i3lock-fancy/icons/lockdark.png"
|
||||
param=("--inside-color=0000001c" "--ring-color=0000003e" \
|
||||
"--line-color=00000000" "--keyhl-color=ffffff80" "--ringver-color=ffffff00" \
|
||||
"--separator-color=22222260" "--insidever-color=ffffff1c" \
|
||||
"--ringwrong-color=ffffff55" "--insidewrong-color=ffffff1c" \
|
||||
"--verif-color=ffffff00" "--wrong-color=ff000000" "--time-color=ffffff00" \
|
||||
"--date-color=ffffff00" "--layout-color=ffffff00")
|
||||
else #black
|
||||
bw="white"
|
||||
icon="$scriptpath/icons/lock.png"
|
||||
param=("--textcolor=ffffff00" "--insidecolor=ffffff1c" "--ringcolor=ffffff3e" \
|
||||
"--linecolor=ffffff00" "--keyhlcolor=00000080" "--ringvercolor=00000000" \
|
||||
"--separatorcolor=22222260" "--insidevercolor=0000001c" \
|
||||
"--ringwrongcolor=00000055" "--insidewrongcolor=0000001c")
|
||||
icon="/usr/share/i3lock-fancy/icons/lock.png"
|
||||
param=("--inside-color=ffffff1c" "--ring-color=ffffff3e" \
|
||||
"--line-color=ffffff00" "--keyhl-color=00000080" "--ringver-color=00000000" \
|
||||
"--separator-color=22222260" "--insidever-color=0000001c" \
|
||||
"--ringwrong-color=00000055" "--insidewrong-color=0000001c" \
|
||||
"--verif-color=00000000" "--wrong-color=ff000000" "--time-color=00000000" \
|
||||
"--date-color=00000000" "--layout-color=00000000")
|
||||
fi
|
||||
|
||||
convert "$image" "${hue[@]}" "${effect[@]}" -font "$font" -pointsize 26 -fill "$bw" -gravity center \
|
||||
-annotate +0+160 "$text" "$icon" -gravity center -composite "$image"
|
||||
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]}
|
||||
MIDXi=$(($W / 2 + $Xoff - 60 / 2))
|
||||
MIDYi=$(($H / 2 + $Yoff - 60 / 2))
|
||||
MIDXt=$(($W / 2 + $Xoff - 285 / 2))
|
||||
MIDYt=$(($H / 2 + $Yoff + 320 / 2))
|
||||
LOCK+=(-font $font -pointsize 26 -fill "$bw" -stroke grey10 \
|
||||
-strokewidth 2 -annotate +$MIDXt+$MIDYt "$text" \
|
||||
-fill "$bw" -stroke "$bw" -strokewidth 1 -annotate +$MIDXt+$MIDYt "$text" \
|
||||
$icon -geometry +$MIDXi+$MIDYi -composite)
|
||||
fi
|
||||
done <<<"$(xrandr)"
|
||||
|
||||
convert "$image" "${hue[@]}" "${effect[@]}" "${LOCK[@]}" "$image"
|
||||
|
||||
#convert "$image" "${hue[@]}" "${effect[@]}" -font "$font" -pointsize 26 -fill "$bw" -gravity center \
|
||||
# -annotate +0+160 "$text" "$icon" -gravity center -composite "$image"
|
||||
|
||||
# If invoked with -d/--desktop, we'll attempt to minimize all windows (ie. show
|
||||
# the desktop) before locking.
|
||||
${desktop} ${desktop:+-k on}
|
||||
|
||||
# try to use a forked version of i3lock with prepared parameters
|
||||
if ! i3lock "${param_add[@]}" "${param[@]}" -i "$image" > /dev/null 2>&1; then
|
||||
# try to use i3lock with prepared parameters
|
||||
if ! "${i3lock_cmd[@]}" "${param[@]}" >/dev/null 2>&1; then
|
||||
# We have failed, lets get back to stock one
|
||||
i3lock "${param_add[@]}" -i "$image"
|
||||
"${i3lock_cmd[@]}"
|
||||
fi
|
||||
|
||||
# As above, if we were passed -d/--desktop, we'll attempt to restore all windows
|
||||
Reference in New Issue
Block a user