mirror of
https://github.com/eoli3n/dotfiles
synced 2024-11-26 06:08:35 +01:00
changed blur type i3lock
This commit is contained in:
parent
c50b4f9d70
commit
1c1155abab
22
i3/i3lock-fancy-multimonitor/LICENSE
Normal file
22
i3/i3lock-fancy-multimonitor/LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Gui Meira
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
31
i3/i3lock-fancy-multimonitor/README.md
Normal file
31
i3/i3lock-fancy-multimonitor/README.md
Normal file
@ -0,0 +1,31 @@
|
||||
# i3lock-fancy-multimonitor
|
||||
The idea for this project was shamelessly copied from [meskarune](https://github.com/meskarune)'s [i3lock-fancy](https://github.com/meskarune/i3lock-fancy).
|
||||
|
||||
It uses [scrot](http://freecode.com/projects/scrot) to take a screenshot of the desktop, then [ImageMagick](http://www.imagemagick.org/) blurs the image and adds a lock icon and text.
|
||||
|
||||
By using information from [xrandr](http://www.x.org/wiki/Projects/XRandR/) and basic math, this script supports multiple monitor setups, displaying the icon and text centered on all screens.
|
||||
|
||||
The lock icon is different from the original project, with a transparent black circle around it. The text is also an image, making it easier to customize (and to put it at the correct position). Finally, it uses vanilla [i3lock](https://github.com/i3/i3lock) instead of [i3lock-color](https://github.com/eBrnd/i3lock-color). The author of i3lock-color [is not maintaining it anymore](https://github.com/eBrnd/i3lock-color/issues/6). If you want to customize the colors of i3lock, the recommended version of i3lock-color is [this one](https://github.com/Arcaena/i3lock-color), maintained by [Chris Guillott](https://github.com/Arcaena).
|
||||
|
||||
## Installation
|
||||
Make sure you have all the dependencies:
|
||||
|
||||
```
|
||||
sudo apt-get install scrot imagemagick i3lock
|
||||
```
|
||||
|
||||
Copy the `lock` script along with the images to some place on your system (e.g.: the i3 folder) and give it execution permission:
|
||||
|
||||
```
|
||||
git clone https://github.com/guimeira/i3lock-fancy-multimonitor.git
|
||||
cp -r i3lock-fancy-multimonitor ~/.i3
|
||||
chmod +x ~/.i3/i3lock-fancy-multimonitor/lock
|
||||
```
|
||||
|
||||
Create a key binding on your i3 config file (in this example I'm using $mod+p):
|
||||
|
||||
```
|
||||
echo "bindsym \$mod+p exec /home/<your username>/.i3/i3lock-fancy-multimonitor/lock" >> ~/.i3/config
|
||||
```
|
||||
|
||||
Now reload the i3 configuration file. By default, the key binding is `$mod+Shift+c`.
|
59
i3/i3lock-fancy-multimonitor/lock
Executable file
59
i3/i3lock-fancy-multimonitor/lock
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
|
||||
#BLURTYPE="0x5"
|
||||
#BLURTYPE="0x2"
|
||||
BLURTYPE="5x3"
|
||||
#BLURTYPE="2x8"
|
||||
#BLURTYPE="2x3"
|
||||
|
||||
DISPLAY_RE="([0-9]+)x([0-9]+)\\+([0-9]+)\\+([0-9]+)"
|
||||
IMAGE_RE="([0-9]+)x([0-9]+)"
|
||||
FOLDER=`dirname "$BASH_SOURCE"`
|
||||
LOCK="$FOLDER/lock.png"
|
||||
TEXT="$FOLDER/text.png"
|
||||
PARAMS=""
|
||||
OUTPUT_IMAGE="/tmp/i3lock.png"
|
||||
|
||||
#Take screenshot:
|
||||
scrot $OUTPUT_IMAGE
|
||||
|
||||
#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]}
|
||||
|
||||
#Get dimensions of the text image:
|
||||
TEXT_IMAGE_INFO=`identify $TEXT`
|
||||
[[ $TEXT_IMAGE_INFO =~ $IMAGE_RE ]]
|
||||
TEXT_WIDTH=${BASH_REMATCH[1]}
|
||||
TEXT_HEIGHT=${BASH_REMATCH[2]}
|
||||
|
||||
#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' '-composite' '$TEXT' '-geometry' '+$TEXT_X+$TEXT_Y' '-composite'"
|
||||
fi
|
||||
done <<<"`xrandr`"
|
||||
|
||||
#Execute ImageMagick:
|
||||
PARAMS="'$OUTPUT_IMAGE' '-level' '0%,100%,0.6' '-blur' '$BLURTYPE' $PARAMS '$OUTPUT_IMAGE'"
|
||||
eval convert $PARAMS
|
||||
|
||||
#Lock the screen:
|
||||
i3lock -i $OUTPUT_IMAGE -t
|
||||
|
||||
#Remove the generated image:
|
||||
rm $OUTPUT_IMAGE
|
BIN
i3/i3lock-fancy-multimonitor/lock.png
Normal file
BIN
i3/i3lock-fancy-multimonitor/lock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
i3/i3lock-fancy-multimonitor/text.png
Normal file
BIN
i3/i3lock-fancy-multimonitor/text.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue
Block a user