sleep.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # This script invokes the screensaver and puts the pc to sleep.
  3. # Copyright (C) 2017 Fabrizio Romano Genovese <egonigredo@gmail.com>
  4. # This copyrighted material is made available to anyone wishing to use,
  5. # modify, copy, or redistribute it subject to the terms and conditions of
  6. # the GNU General Public License v.2, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY expressed or implied, including the implied warranties of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  11. # Public License for more details.
  12. # You should have received a copy of the
  13. # GNU General Public License along with this program; if not,
  14. # see <http://www.gnu.org/licenses/>
  15. # Put this file in /etc/acpi/actions/. Do not forget to give
  16. # sudo chmod +x sleep.sh
  17. # to make it executable.
  18. # ALL THE COMMANDS IN THE SCRIPT HAVE TO BE GIVEN VIA su -c BECAUSE OF QUBESOS WEIRDNESS.
  19. # IN OTHER SYSTEMS EVERYTHING IS MAYBE EASIER.
  20. # Modify the username to suit yours!
  21. user=Nigredo
  22. screensaver=i3-blur
  23. sudo -u $user -H sh -c "DISPLAY=:0 $screensaver"
  24. systemctl suspend