wok rev 18515

xorg-xset: add gui for screensaver configuration
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Sat Oct 24 23:56:53 2015 +0200 (2015-10-24)
parents a05bf0bcba3b
children d2dc20032ed1
files xorg-xset/receipt xorg-xset/stuff/xorg-xset.desktop xorg-xset/stuff/xset-screensaver.sh
line diff
     1.1 --- a/xorg-xset/receipt	Sun Oct 25 00:41:02 2015 +0300
     1.2 +++ b/xorg-xset/receipt	Sat Oct 24 23:56:53 2015 +0200
     1.3 @@ -13,6 +13,7 @@
     1.4  
     1.5  DEPENDS="xorg-libXmu"
     1.6  BUILD_DEPENDS="xorg-libXmu-dev"
     1.7 +SUGGESTED="yad"
     1.8  
     1.9  # Rules to configure and make the package.
    1.10  compile_rules()
    1.11 @@ -28,4 +29,6 @@
    1.12  {
    1.13  	mkdir -p $fs/usr
    1.14  	cp -a $install/usr/bin $fs/usr
    1.15 +	cp -a $stuff/xset-screensaver.sh $fs/usr/bin
    1.16 +	chmod 755 $fs/usr/bin/xset-screensaver.sh
    1.17  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/xorg-xset/stuff/xorg-xset.desktop	Sat Oct 24 23:56:53 2015 +0200
     2.3 @@ -0,0 +1,9 @@
     2.4 +[Desktop Entry]
     2.5 +Type=Application
     2.6 +Name=Set screensaver timeout
     2.7 +Comment=0(always on)
     2.8 +Name[ru]=Время отключения монитора
     2.9 +Comment[ru]=0(не выключать)
    2.10 +Icon=preferences-desktop-screensaver
    2.11 +Exec=xset-screensaver.sh
    2.12 +Categories=GTK;Settings;HardwareSettings;
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xorg-xset/stuff/xset-screensaver.sh	Sat Oct 24 23:56:53 2015 +0200
     3.3 @@ -0,0 +1,42 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +case $(id -u) in
     3.7 +	0) path=/etc/xdg ;;
     3.8 +	*) path=${XDG_CONFIG_HOME:-$HOME/.config} ;;
     3.9 +esac
    3.10 +
    3.11 +AutostartFile="$path/autostart/xset-screensaver.desktop"
    3.12 +launcher='/usr/share/applications/xorg-xset.desktop' # Must be same as package name
    3.13 +
    3.14 +exec_d()
    3.15 +{
    3.16 +	cmd=$(cat $AutostartFile | grep Exec | sed 's/Exec=//') ; $cmd
    3.17 +}
    3.18 +
    3.19 +[ -f $AutostartFile ] && exec_d
    3.20 +
    3.21 +case $LC_ALL in
    3.22 +	C|POSIX|en*) lang='=' ;;
    3.23 +	*) lang='\['${LC_ALL%_*} ;;
    3.24 +esac
    3.25 +
    3.26 +val=$(yad --title="$(cat $launcher | grep Name$lang | cut -d= -f2)" \
    3.27 +	--scale --max-value=18000 --mark=1h.:3600 \
    3.28 +	--mark="$(cat $launcher | grep Comment$lang | cut -d= -f2)":0 \
    3.29 +	--mark="120min.(2h.)":7200 --mark="180min.(3h.)":10800 \
    3.30 +	--mark="240min.(4h.)":14400 --mark="300min.(5h.)":18000 \
    3.31 +	--page=1800 --step=60 --geometry=630x42+10+100 \
    3.32 +	--value=$(xset q | grep timeout | cut -d' ' -f5) \
    3.33 +	--window-icon="preferences-desktop-screensaver" )
    3.34 +
    3.35 +[ -z $val ] || cat > $AutostartFile <<EOT
    3.36 +[Desktop Entry]
    3.37 +Type=Application
    3.38 +Name=xset screensaver timeout
    3.39 +Exec=xset dpms $val $val $val s $val $val
    3.40 +EOT
    3.41 +
    3.42 +exec_d
    3.43 +
    3.44 +# Notes: 'xset s' max val is 32767, 'xset dpms' limit is unknown
    3.45 +exit 0
    3.46 \ No newline at end of file