My pseudo Presentation Mode
Nio Wiklund
nio.wiklund at gmail.com
Fri Dec 19 19:27:09 UTC 2014
Den 2014-12-19 19:22, John Hupp skrev:
> My most-hated-bugs list includes
> https://bugs.launchpad.net/ubuntu/+source/xfce4-power-manager/+bug/1193716.
> If you are streaming video in your browser, after 10 minutes it will
> blank and then lock the screen (unless you keep moving the mouse). The
> bug has been fixed for 14.10, but policy has prevented the fix from
> being back-ported to the LTS. Worry about a regression I suppose, but a
> usability black eye for the LTS.
>
> I wrote a script that toggles to a pseudo Presentation Mode (and back to
> Normal Mode if you run it again) and notifies the user of the present
> mode. I also made up a desktop entry file named Power Mode Toggler that
> will run the script from the Preferences menu.
>
> Note that the Presentation Mode settings are not permanent, but expire
> with the session.
>
> To use these, install the very small libnotify-bin package, which is
> required for the user notifications. Then as root, create both files in
> /usr/local/share/applications (or an equivalent location). Remember to
> make the script executable.
>
> ------------------------------------------------------------------------
>
> #!/bin/bash
> # /usr/local/share/applications/xset-mode.sh
> # A script to toggle between Presentation and Normal mode and notify the
> user of the mode
>
> STATUS_MONITOR=$(xset q | grep "DPMS is" | awk '{print $3}')
>
> if [ "$STATUS_MONITOR" == "Enabled" ]; then
>
> xset s off
> xset -dpms
> notify-send -t 5000 “The computer is now in Presentation Mode”
>
> else
>
> xset s on
> xset +dpms
> notify-send -t 5000 “The computer is now in Normal Mode”
>
> fi
>
> ------------------------------------------------------------------------
>
> A desktop entry file to run the script and appear in the Preferences
> menu as Power Mode Toggler:
> /usr/local/share/applications/power-mode-toggler.desktop
>
> [Desktop Entry]
> Version=1.0
>
> Type=Application
>
> Name=Power Mode Toggle
> Icon=xfpm-ac-adapter
>
> Exec=bash /usr/local/share/applications/xset-mode.sh
> Terminal=false
>
> Categories=Settings
> Name[en_US]=Power Mode Toggler
> Comment[en_US]=Toggle between Presentation and Normal Mode
>
> ------------------------------------------------------------------------
>
> *Arcane Background Reading*
>
> A summary of my research into this problem:
>
> /*Command Line Behavior*/
>
> Command line utility xset sets the X user preferences
>
> Some commands:
> xset q - queries the current settings for the X user preferences
> xset s on/off - turn the screen saver functions on or off
> xset -dpms/+dpms - disables/enables the DPMS functions
>
> xset q output includes these two sections which determine the screen
> behavior:
>
> Screen Saver:
> prefer blanking: yes allow exposures: yes
> timeout: 600 cycle: 600
>
> DPMS (Energy Star):
> Standby: 600 Suspend: 0 Off: 900
> DPMS is Enabled
> Monitor is On
>
> This xset output is the reliable indicator of behavior, not the GUI
> interfaces.
>
> An ad hoc Presentation Mode:
> $ xset s off # sets Screen Saver timeout: 0
> $ xset -dpms # disables DPMS, though leaving the Standby, Suspend,
> Off values unaffected
> This works!
>
> An ad hoc Normal Mode:
> $ xset s on # sets Screen Saver timeout to the X default: 600
> $ xset +dpms # enables DPMS with whatever Standby, Suspend, Off
> values are current
>
> ------------------------------------------------------------------------
>
> /*GUI Interface Behavior (A Mess)*/
>
> Menu: Preferences: Power Manager, Light Locker
> (xfce4-power-manager-settings, light-locker-settings)
>
> Changing settings in LL/XPM will also change the output of xset q, but
> changing settings via xset does not result in changes to the LL/XPM
> interfaces. Perhaps a reboot would effect that.
>
> If you set XPM systray icon to always appear and right-click it, you can
> choose Mode: Normal/Presentation. But Presentation Mode merely disables
> DPMS and does not turn off the screen saver.
>
> Note that light-locker-settings and xfce4-power-manager-settings both
> offer sliders to set monitor blank/sleep and monitor switched off. But
> these operate in lock-step: changing a slider setting in LL will also
> change it in XPM. However, the effects in xset depend on which
> interface you made the change from!!!
>
> XPM: By default the monitor-sleep slider affects DPMS Standby, but the
> Extended tab can set it to affect DPMS Suspend instead. The
> monitor-offs slider affects DPMS Off. XPM has no effect on the Screen
> Saver section.
>
> LL: The monitor-blank slider affects Screen Saver timeout. The
> monitor-off slider affects DPMS Standby and sets DPMS Off: 0. Setting
> Enable Light Locker On/Off has varying effects depending on the initial
> state. Enabling LL after it had been disabled set the Screen Saver
> timeout: 600 and DPMS Off: 0. I thought I found a case that set Screen
> Saver timeout: 0, but couldn’t duplicate that result.
>
> An Ad Hoc Presentation Mode: Set XPM systray icon to always appear;
> right-click it and choose Mode: Presentation. Set LL monitor-blank
> slider to Never and Apply.
>
> An Ad Hoc Normal Mode: Right-click XPM systray icon and choose Mode:
> Normal. Set LL monitor-blank slider to 10 minutes and Apply.
>
>
>
Hi John,
Thank you for sharing :-)
Best regards
Nio
More information about the Lubuntu-users
mailing list