Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: applet or launcher to turn off/on screensaver

  1. #1
    Join Date
    Apr 2008
    Location
    Fairbanks, AK USA
    Beans
    133
    Distro
    Ubuntu 10.04 Lucid Lynx

    applet or launcher to turn off/on screensaver

    Hi All,

    I am looking for an applet or a launcher or a script to turn the gnome screensaver off and on with a click. The feature I would like, though, would be that the icon changes depending on whether the screensaver is on or off. I was going to try and build it, but I couldn't figure out how to change the icon picture for a toolbar launcher with a *sh script and I don't really have enough experience programming in gnome with any language...

    Thanks in advance for any suggestions

  2. #2
    Join Date
    Mar 2008
    Location
    Las Vegas
    Beans
    1,148

    Re: applet or launcher to turn off/on screensaver

    You can control the screensaver with gnome-screensaver-command --option, where option can be one of:
    Code:
           --exit Causes the screensaver to exit gracefully
    
           -q, --query
                  Query the state of the screensaver
    
           -t, --time
                  Query the length of time the screensaver has been active
    
           -l, --lock
                  Tells the running screensaver process to lock the screen immedi-
                  ately
    
           -c, --cycle
                  If  the  screensaver  is  active then switch to another graphics
                  demo
    
           -a, --activate
                  Turn the screensaver on (blank the screen)
    
           -d, --deactivate
                  If the screensaver is active then deactivate  it  (un-blank  the
                  screen)
    
           -p, --poke
                  Poke the running screensaver to simulate user activity
    
           -i, --inhibit
                  Inhibit  the  screensaver  from activating. Command blocks while
                  inhibit is active.
    
           -n, --application-name
                  The calling application that is inhibiting the screensaver
    
           -r, --reason
                  The reason for inhibiting the screensaver
    
           -V, --version
                  Version of this application
    Can't help you with changing the icon regarding the status though.

    Barrie
    Last edited by Barriehie; February 6th, 2010 at 06:20 AM.
    Debian Stable
    FluxBox
    Mark Your Thread Solved

  3. #3
    Join Date
    Oct 2008
    Beans
    3,509

    Re: applet or launcher to turn off/on screensaver

    Quote Originally Posted by juanoleso View Post
    Hi All,

    I am looking for an applet or a launcher or a script to turn the gnome screensaver off and on with a click. The feature I would like, though, would be that the icon changes depending on whether the screensaver is on or off. I was going to try and build it, but I couldn't figure out how to change the icon picture for a toolbar launcher with a *sh script and I don't really have enough experience programming in gnome with any language...

    Thanks in advance for any suggestions
    This script script will toggle gnome-screensaver on/off and display a message to the notification bubble.
    Changing the icon is beyond my knowledge.
    Code:
    #!/bin/sh
    
    # click to start, click to stop
    
    if pidof gnome-screensaver | grep [0-9] > /dev/null
    then
     exec killall gnome-screensaver &
     notify-send "Screen Saver" "Disabled"
    else
     exec gnome-screensaver &
     notify-send "Screen Saver" "Enabled"
    fi
    Save as whatever you like and make executable.
    Link to the script in your panel custom application launcher.

  4. #4
    Join Date
    Apr 2008
    Location
    Fairbanks, AK USA
    Beans
    133
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: applet or launcher to turn off/on screensaver

    Thanks both, I think that will work perfectly!

    For someone who sees this:

    I had to install libnotify1 and libnotify-bin on my debian Lenny box:

    Code:
    sudo aptitude install libnotify1 libnotify-bin
    Last edited by juanoleso; February 9th, 2010 at 08:26 PM. Reason: posterity

  5. #5
    Join Date
    May 2008
    Location
    Thrissur, Kerala
    Beans
    461
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Thumbs down Re: applet or launcher to turn off/on screensaver

    I could not understand why you need the script to STOP the screensaver. I think moving your mouse will instantly stop the screensaver and if you use a password, you cannot disable screensaver without entering it in the first place. In my opinion a custom launcher with command
    Code:
    gnome-screensaver-command -a
    is enough.
    Last edited by hariks0; February 9th, 2010 at 08:27 PM.
    How can I use a signature in forums?

  6. #6
    Join Date
    Apr 2008
    Location
    Fairbanks, AK USA
    Beans
    133
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: applet or launcher to turn off/on screensaver

    sometimes we watch movies on hulu and firefox doesn't disable the screensaver. It isn't much work to go into prefs and change the screensaver, but I thought this little script would be fun to put together.

  7. #7
    Join Date
    May 2006
    Location
    Rochester, NY,
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: applet or launcher to turn off/on screensaver

    Actually there is one already in the gnome panel applets (at least on my system)..

    The screensaver inhibit applet .. works fine for me.

  8. #8
    Join Date
    Feb 2010
    Location
    Colorado
    Beans
    26
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: applet or launcher to turn off/on screensaver

    There is also this thing: "Caffeine". Works!

    http://www.liberiangeek.net/2010/07/...04-lucid-lynx/

  9. #9
    Join Date
    Apr 2005
    Location
    Sintra, Portugal
    Beans
    835

    Re: applet or launcher to turn off/on screensaver

    Quote Originally Posted by jruberto View Post
    There is also this thing: "Caffeine". Works!

    http://www.liberiangeek.net/2010/07/...04-lucid-lynx/
    Thanks so much for this. I just looking for something that did this and you pointed me into the right direction.

  10. #10
    Join Date
    Nov 2005
    Beans
    4

    Re: applet or launcher to turn off/on screensaver

    Does not work for me in Natty Narwhal. Instead:
    Code:
    #!/bin/sh
    
    # click to start, click to stop
    
    if gconftool-2 -g /apps/gnome-screensaver/idle_activation_enabled | grep true
    then
     gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type=bool false
     notify-send --expire-time=50 "Screen Saver" "Disabled"
    else
     gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type=bool true
     notify-send  --expire-time=50 "Screen Saver" "Enabled"
    fi

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •