Skip to content

Instantly share code, notes, and snippets.

@hansyulian
Last active January 25, 2025 13:24
Show Gist options
  • Save hansyulian/14106ef2b56d8b21d6912f5b43ec724a to your computer and use it in GitHub Desktop.
Save hansyulian/14106ef2b56d8b21d6912f5b43ec724a to your computer and use it in GitHub Desktop.
Sleep Script for XFCE desktop
#!/bin/bash
# Script: hans-set-screen-timeout
# Purpose: Set the XFCE Power Manager's "Blank After" display timeout.
# Check if a parameter is provided
if [ -z "$1" ]; then
echo "Usage: hans-set-screen-timeout <true|false>"
exit 1
fi
# Define the XFCE Power Manager settings property for "Blank After"
PROPERTY="/xfce4-power-manager/blank-on-ac"
if [ "$1" == "true" ]; then
# Set "Blank After" to 1 minute
xfconf-query -c xfce4-power-manager -p $PROPERTY -s 1
echo "Display 'Blank After' timeout set to 1 minute."
elif [ "$1" == "false" ]; then
# Disable "Blank After"
xfconf-query -c xfce4-power-manager -p $PROPERTY -s 0
echo "Display 'Blank After' timeout disabled."
else
echo "Invalid parameter. Use 'true' to set to 1 minute or 'false' to disable."
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment