Posts: 69
Ninho
Joined: 28 Oct 2016
#1
Using the applet from Control center, I can't for the salvation of me change the blank screen delay from preconfigured 60 mn __{{emoticon}}__ Is there a known bug in script, or else what am I missing ? - Alternatively to the graphical applet, I guess the delay could be modified by editing a configuration file... Please help !
Last edited by Ninho on 17 Nov 2016, 17:08, edited 1 time in total.
Posts: 4,164
rokytnji
Joined: 20 Feb 2009
#2
I set mine in xscreensaver.


========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://www.google.com/search?q=screenblanking+site%3Aantix.freeforums.org&ie=utf-8&oe=utf-8"
linktext was:"Linky"
====================================



========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://www.google.com/search?num=50&q=screen+blanking+site%3Aantix.freeforums.org&oq=screen+blanking+site%3Aantix.freeforums.org&gs_l=serp.12...166813.166813.0.173707.1.1.0.0.0.0.68.68.1.1.0....0...1.1.64.serp..0.0.0.zY7WkLFrwnM"
linktext was:"Linky2"
====================================
Posts: 1,445
skidoo
Joined: 09 Feb 2012
#3
Ninho, it works for me & I can't recall other reports of it not working.

To investigate"stuffs" launched via controlCentre, you can
leafpad /usr/local/bin/antixcc.sh
and find in file ("blanking" in this case) which executable is called when you click a given button.

Here, the command is"set-screen-blank". Most of the commands exposed via controlCentre are shell scripts, so let's check:
sudo locate set-screen-blank
leafpad /usr/local/bin/set-screen-blank

Notice that the set-screen-blank script writes to this configuration file:
~/.desktop-session/desktop-session.conf

To test just now, I opened ~/.desktop-session/desktop-session.conf in text editor, scroll to bottom and note the (my) line stating
SCREEN_BLANK_TIME="3600"
then opened controlCentre, clicked the button, changed to"59" minutes, click"Apply", then click"Close".

Upon revisiting ~/.desktop-session/desktop-session.conf in text editor, I confirmed the setting is successfully changed:
SCREEN_BLANK_TIME="3540"

I also tested: if you neglect to click the"Apply" button... nope, your change will not be written to the .conf file


ps:
xscreensaver isn't installed here & the blanking does still work. It's handled by kernel DPMS.
Posts: 69
Ninho
Joined: 28 Oct 2016
#4
Thanks for the walkthrough, @Skidoo ! I've manually edited the SCREEN_BLANK_TIME now.

I'm glad for you that the Control Centre graphical applet works for you, but - as stated in question - it did't for me. At least I could not make sense of how it was supposed to work.
... opened controlCentre, clicked the button, changed to"59" minutes, click"Apply", then click"Close".
When I click"apply", it will always repeat"screen blanking is off" and offer to turn it on, which opens another instance of the settings dialog, ad nauseam. Oh, well...
Posts: 64
reverseDog
Joined: 13 Jul 2016
#5
Ninho wrote: When I click"apply", it will always repeat"screen blanking is off" and offer to turn it on, which opens another instance of the settings dialog, ad nauseam. Oh, well...
Yeah, I was having exactly the same issue – all these dialogs popping up to no effect. Finally I began to wonder if this was related to my systems locale being German. So in the file /usr/local/bin/set-screen-blank I inserted the new line"export LANG=en_US" (after the line"TEXTDOMAIN=set-screen-blank") -- and bingo: now customizing the blanking delay via control center is working just fine.
Posts: 69
Ninho
Joined: 28 Oct 2016
#6
@ReverseDog : Wow! This is pure genius __{{emoticon}}__ Works a treat (French locale here).

It also explains why the developers/testers missed the problem (not enough serious testers on non-English locales, I bet)...

This should be added to the tricks & tips section if you don't mind - and since it with high probability will work unmodified whatever the locale, including standard US-en, the mod should be considered by maintainers for permanent inclusion in further versions of AntiX, imho.

Thanks : Marking the case -> closed...
Posts: 1,445
skidoo
Joined: 09 Feb 2012
#7
When I click"apply", it will always repeat"screen blanking is off" and offer to turn it on, which opens another instance of the settings dialog, ad nauseam.
In my testing, I had not toggled the on/off state.
Doing so now, I notice that yes a reproducable bug exists. If not an outright bug, it's confusing.

A squarish-proportioned dialogbox opens when you click icon in controlCentre.
Not obvious until you hover mouse over it, the [___OFF___] label is a button.
Clicking this"button" raises a second, smaller dialogbox in which you perform the actual"toggle state" operation.
After toggling the state on--}off (or vice versa), second dialogbox closes...
...leaving the original dialogbox, which now (unchanged) incorrectly displays the state.
Yep, loopy

Well anyhow at least the topic is solved to the extent that you achieved your goal, Ninho.
Posts: 64
reverseDog
Joined: 13 Jul 2016
#8
Taking a deeper look into the script /usr/local/bin/set-screen-blank, I think I finally understand why it fails for certain non-English locales.

YAD is the culprit. As a matter of fact, with some locales YAD returns a comma for decimal mark instead of a dot. If a French or German antiX user tries to set the screen blank time to, let's say, 45, the value of the variable TimeScale (as defined by script lines 82-93) will come out as"|||45,000|". Hence it doesn't get properly cut by the command

Code: Select all

minutes=$(echo"$TimeScale" |cut -d"|" -f4|cut -d"." -f1);
(line 43) which assumes a"." for separator and not a",".

So it's no wonder that running set-screen-blank from terminal (with German locale) and trying to change blanking delay returns the error message

Code: Select all

$ set-screen-blank
/usr/local/bin/set-screen-blank: Zeile 47: [: 45,000: Ganzzahliger Ausdruck erwartet.
(="integer expression expected").

To avoid this problem I suggest the use of YAD option --float-precision=0 in forthcoming updates of set-screen-blank-antix (lines 82-93):

Code: Select all

 TimeScale=$(yad --title=$"Screen Blanking" \
    --image="info" \
    --float-precision=0 \ # the added option
    --form \
    --field=$"$DIFFERING_VALUES\nScreen blanking is currently ON.:LBL" \
    --field=$"Turn OFF:BTN""""bash -c 'xset dpms 0 0 0 s 0 0; kill $(pgrep -P $MY_PID); exec $0 & kill $MY_PID'"\
    --field=$"Set the screen blank time.\nValue in minutes:LBL" \
    --field=":NUM""""$SAVED_TIME_M" \
    --width=300 \
    --height=200 \
    --button="gtk-apply:0"  \
    --button="gtk-close:1"  \
    );
This way decimal places in YAD output are omitted from the beginning. Setting the screen blank time to 45 will return the value"|||45|" for the variable TimeScale.

The definition of the variable minutes in line 43 can consequently be simplified to

Code: Select all

minutes=$(echo"$TimeScale" |cut -d"|" -f4);
I prefer this solution over the insertion of"export LANG=en_US" I suggested above, because it will preserve the language of YAD's GTK buttons as specified by the user's locale.
anticapitalista
Posts: 5,955
Site Admin
Joined: 11 Sep 2007
#9
Bug fix version should hit the repos soon.

Thanks for the fix reverseDog
Posts: 69
Ninho
Joined: 28 Oct 2016
#10
Update: unfortunately the revised, more complicated, version of the script works but only once for me :=( I guess there remain one or more subtle language dependencies in the revised script, the debugging of which is evidently much over my head...
Fortunately, rDog's original fix ("export LANG=en_US") works perfectly here. :=)
Posts: 64
reverseDog
Joined: 13 Jul 2016
#11
Sorry, Ninho, that the revised script won't work for you. To test it with a French locale I just ran"export LANG="fr_FR.utf8"; set-screen-blank" from the terminal and found I was able to change the blanking delay succesfully – not just once, but repeatedly. (Learned the French words"appliquer" and"fermer" on this occasion, my French being very bad, even though the French border is only a few kilometers away from where I live. __{{emoticon}}__ )

Could it be that you edited the script manually, and some typo slipped in? Or part of the code got lost in the process of copying? The fix is in the repos by now, so there is no need to edit the script manually in order to test the"more complicated" version.
Posts: 69
Ninho
Joined: 28 Oct 2016
#12
I have upgraded from the Repository - all correkt, now, yeah ! __{{emoticon}}__
reverseDog wrote:Could it be that you edited the script manually, and some typo slipped in? Or part of the code got lost in the process of copying?
That... quite probably ! Sorry : next time, I'll be sure to save a copy before manually editing system scripts...