wok-next rev 18517

xset-screensaver.sh: some fixes
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Sun Oct 25 03:23:44 2015 +0100 (2015-10-25)
parents d2dc20032ed1
children 66723aff655f
files xorg-xset/stuff/xorg-xset.desktop xorg-xset/stuff/xset-screensaver.sh
line diff
     1.1 --- a/xorg-xset/stuff/xorg-xset.desktop	Sun Oct 25 02:48:19 2015 +0200
     1.2 +++ b/xorg-xset/stuff/xorg-xset.desktop	Sun Oct 25 03:23:44 2015 +0100
     1.3 @@ -1,9 +1,9 @@
     1.4  [Desktop Entry]
     1.5  Type=Application
     1.6  Name=Set screensaver timeout
     1.7 -Comment=0(always on)
     1.8 +Comment=0(always on), Default settings: 10 min (600 sec)
     1.9  Name[ru]=Время отключения монитора
    1.10 -Comment[ru]=0(не выключать)
    1.11 +Comment[ru]=0(не выключать), По умолчанию: 10 мин.(600 ceк.)
    1.12  Icon=preferences-desktop-screensaver
    1.13  Exec=xset-screensaver.sh
    1.14  Categories=GTK;Settings;HardwareSettings;
     2.1 --- a/xorg-xset/stuff/xset-screensaver.sh	Sun Oct 25 02:48:19 2015 +0200
     2.2 +++ b/xorg-xset/stuff/xset-screensaver.sh	Sun Oct 25 03:23:44 2015 +0100
     2.3 @@ -1,8 +1,12 @@
     2.4  #!/bin/sh
     2.5  #
     2.6 +[ -z $(which yad) ] && exec yad && exit 0
     2.7 +
     2.8  case $(id -u) in
     2.9  	0) path=/etc/xdg ;;
    2.10 -	*) path=${XDG_CONFIG_HOME:-$HOME/.config} ;;
    2.11 +	*) path=${XDG_CONFIG_HOME:-$HOME/.config}
    2.12 +		[ -f "$path/autostart" ] && mv $path/autostart $path/autostart.bak
    2.13 +		[ -d "$path/autostart" ] || mkdir -p $path/autostart ;;
    2.14  esac
    2.15  
    2.16  AutostartFile="$path/autostart/xset-screensaver.desktop"
    2.17 @@ -17,12 +21,15 @@
    2.18  
    2.19  case $LC_ALL in
    2.20  	C|POSIX|en*) lang='=' ;;
    2.21 -	*) lang='\['${LC_ALL%_*} ;;
    2.22 +	*) lang='\['${LC_ALL%_*}
    2.23 +	grep -q '\['${LC_ALL%_*} $launcher || lang='=' ;;
    2.24  esac
    2.25  
    2.26 -val=$(yad --title="$(cat $launcher | grep Name$lang | cut -d= -f2)" \
    2.27 -	--scale --max-value=18000 --mark=1h.:3600 \
    2.28 -	--mark="$(cat $launcher | grep Comment$lang | cut -d= -f2)":0 \
    2.29 +
    2.30 +
    2.31 +val=$(yad --title="$(cat $launcher | grep Name$lang | cut -d'=' -f2)" \
    2.32 +	--scale --max-value=18000 --mark="1h.":3600 --buttons-layout=spread \
    2.33 +	--mark="$(cat $launcher | grep Comment$lang | cut -d'=' -f2 | cut -d',' -f1)":0 \
    2.34  	--mark="120min.(2h.)":7200 --mark="180min.(3h.)":10800 \
    2.35  	--mark="240min.(4h.)":14400 --mark="300min.(5h.)":18000 \
    2.36  	--page=1800 --step=60 --geometry=630x42+10+100 \
    2.37 @@ -39,4 +46,4 @@
    2.38  exec_d
    2.39  
    2.40  # Notes: 'xset s' max val is 32767, 'xset dpms' limit is unknown
    2.41 -exit 0
    2.42 \ No newline at end of file
    2.43 +exit 0