diff --git a/.i3/config b/.i3/config index 09cb7be..ee19976 100644 --- a/.i3/config +++ b/.i3/config @@ -136,7 +136,8 @@ bindsym $mod+Shift+p restart bindsym $mod+Shift+period exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" ## Lock the screen -bindsym Control+Mod1+l exec i3lock --fuzzy +#bindsym Control+Mod1+l exec i3lock --fuzzy +bindsym Control+Mod1+l exec /home/ahosking/.i3/i3lock-fancy-multimonitor/lock # resize window (you can also use the mouse for that) mode "resize" { diff --git a/.i3/i3 b/.i3/i3 deleted file mode 120000 index 87ca232..0000000 --- a/.i3/i3 +++ /dev/null @@ -1 +0,0 @@ -/home/ahosking/dotfiles/i3 \ No newline at end of file diff --git a/.i3/i3lock-fancy-multimonitor/LICENSE b/.i3/i3lock-fancy-multimonitor/LICENSE new file mode 100644 index 0000000..ff87a9e --- /dev/null +++ b/.i3/i3lock-fancy-multimonitor/LICENSE @@ -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. + diff --git a/.i3/i3lock-fancy-multimonitor/README.md b/.i3/i3lock-fancy-multimonitor/README.md new file mode 100644 index 0000000..c8ad2a3 --- /dev/null +++ b/.i3/i3lock-fancy-multimonitor/README.md @@ -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//.i3/i3lock-fancy-multimonitor/lock" >> ~/.i3/config +``` + +Now reload the i3 configuration file. By default, the key binding is `$mod+Shift+c`. diff --git a/.i3/i3lock-fancy-multimonitor/lock b/.i3/i3lock-fancy-multimonitor/lock new file mode 100755 index 0000000..4a6bb27 --- /dev/null +++ b/.i3/i3lock-fancy-multimonitor/lock @@ -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 -z $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 diff --git a/.i3/i3lock-fancy-multimonitor/lock.png b/.i3/i3lock-fancy-multimonitor/lock.png new file mode 100644 index 0000000..620aa5b Binary files /dev/null and b/.i3/i3lock-fancy-multimonitor/lock.png differ diff --git a/.i3/i3lock-fancy-multimonitor/text.png b/.i3/i3lock-fancy-multimonitor/text.png new file mode 100644 index 0000000..b1a4369 Binary files /dev/null and b/.i3/i3lock-fancy-multimonitor/text.png differ