12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #!/bin/bash
- # This is a simple program that blurs the current screen and uses it as
- # a screensaver. scrot and i3lock have to be installed in order to make it
- # work.
- # i3-blur - A simple i3lock addon for a blurred screensaver
- # Copyright (C) 2017 Fabrizio Romano Genovese <egonigredo@gmail.com>
- # This copyrighted material is made available to anyone wishing to use,
- # modify, copy, or redistribute it subject to the terms and conditions of
- # the GNU General Public License v.2, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful, but WITHOUT
- # ANY WARRANTY expressed or implied, including the implied warranties of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- # Public License for more details.
- # You should have received a copy of the
- # GNU General Public License along with this program; if not,
- # see <http://www.gnu.org/licenses/>
- # Put this file in /bin/ or in /usr/bin. Do not forget to give
- # sudo chmod +x i3-blur
- # to make it executable.
- version=1.0
- if [[ "$#" -ge 2 ]]; then
- echo "Usage: $0 {-v, --version | -h --help}"
- exit 0
- elif [[ "$#" -eq 1 ]]; then
- case $1 in
- -v | --version)
- echo "$0 - Version $version"
- exit 0;;
- -h | --help)
- echo "This is a simple program that blurs the current screen and uses it as a screensaver. scrot and i3lock have to be installed in order to make it work."
- echo "- v, --version Display current version"
- echo "-h, --help Display this message"
- exit 0;;
- *)
- echo "Usage: $0 {-v, --version | -h, --help}"
- exit 2;;
- esac
- fi
- # Check if scrot and i3lock are installed
- if [ -f /bin/scrot -a -f /bin/i3lock ]; then
- # Take a screenshot
- scrot /tmp/screenshot.png
- # Blur it
- convert /tmp/screenshot.png -blur 0x5 /tmp/screenshotblur.png
- # Invoke the i3lock screensaver using it as a background
- i3lock -f -i /tmp/screenshotblur.png
- else
- # Abort if they are not
- echo "i3lock and/or scrot are not installed. Please install them."
- exit 2
- fi
|