# HG changeset patch # User Xander Ziiryanoff # Date 1445723813 -7200 # Node ID 11bd286c39d2d5d4b70d2931258ed48ef7330c63 # Parent a05bf0bcba3b26a56cad1fafa754713b30f13384 xorg-xset: add gui for screensaver configuration diff -r a05bf0bcba3b -r 11bd286c39d2 xorg-xset/receipt --- a/xorg-xset/receipt Sun Oct 25 00:41:02 2015 +0300 +++ b/xorg-xset/receipt Sat Oct 24 23:56:53 2015 +0200 @@ -13,6 +13,7 @@ DEPENDS="xorg-libXmu" BUILD_DEPENDS="xorg-libXmu-dev" +SUGGESTED="yad" # Rules to configure and make the package. compile_rules() @@ -28,4 +29,6 @@ { mkdir -p $fs/usr cp -a $install/usr/bin $fs/usr + cp -a $stuff/xset-screensaver.sh $fs/usr/bin + chmod 755 $fs/usr/bin/xset-screensaver.sh } diff -r a05bf0bcba3b -r 11bd286c39d2 xorg-xset/stuff/xorg-xset.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xorg-xset/stuff/xorg-xset.desktop Sat Oct 24 23:56:53 2015 +0200 @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=Set screensaver timeout +Comment=0(always on) +Name[ru]=Время отключения монитора +Comment[ru]=0(не выключать) +Icon=preferences-desktop-screensaver +Exec=xset-screensaver.sh +Categories=GTK;Settings;HardwareSettings; diff -r a05bf0bcba3b -r 11bd286c39d2 xorg-xset/stuff/xset-screensaver.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xorg-xset/stuff/xset-screensaver.sh Sat Oct 24 23:56:53 2015 +0200 @@ -0,0 +1,42 @@ +#!/bin/sh +# +case $(id -u) in + 0) path=/etc/xdg ;; + *) path=${XDG_CONFIG_HOME:-$HOME/.config} ;; +esac + +AutostartFile="$path/autostart/xset-screensaver.desktop" +launcher='/usr/share/applications/xorg-xset.desktop' # Must be same as package name + +exec_d() +{ + cmd=$(cat $AutostartFile | grep Exec | sed 's/Exec=//') ; $cmd +} + +[ -f $AutostartFile ] && exec_d + +case $LC_ALL in + C|POSIX|en*) lang='=' ;; + *) lang='\['${LC_ALL%_*} ;; +esac + +val=$(yad --title="$(cat $launcher | grep Name$lang | cut -d= -f2)" \ + --scale --max-value=18000 --mark=1h.:3600 \ + --mark="$(cat $launcher | grep Comment$lang | cut -d= -f2)":0 \ + --mark="120min.(2h.)":7200 --mark="180min.(3h.)":10800 \ + --mark="240min.(4h.)":14400 --mark="300min.(5h.)":18000 \ + --page=1800 --step=60 --geometry=630x42+10+100 \ + --value=$(xset q | grep timeout | cut -d' ' -f5) \ + --window-icon="preferences-desktop-screensaver" ) + +[ -z $val ] || cat > $AutostartFile <