123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/bin/bash
- # This script invokes the screensaver when the lid is closed,
- # then puts the pc to sleep.
- # 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 /etc/acpi/actions/. Do not forget to give
- # sudo chmod +x lid.sh
- # to make it executable.
- # ALL THE COMMANDS IN THE SCRIPT HAVE TO BE GIVEN VIA su -c BECAUSE OF QUBESOS WEIRDNESS.
- # IN OTHER SYSTEMS EVERYTHING IS MAYBE EASIER.
- # Modify the username to suit yours!
- user=Nigredo
- screensaver=i3-blur
- # Grepping the lid status
- state=`grep open /proc/acpi/button/lid/*/state`
- # Checks if the scring is empty. If it is, executes the if
- if [ -z $state ]; then
- sudo -u $user -H sh -c "DISPLAY=:0 $screensaver"
- systemctl suspend
- fi
|