Results 1 to 6 of 6

Thread: lock screen before hibernate

  1. #1

    Default lock screen before hibernate

    First off I'm using gnome 3 and opensuse 12.2 on my laptop (not my desktop signature). I have Ubuntu, opensuse, windows 8 beta, and Kubuntu on it.
    I wanted multi-hibernate my laptop so I switched my swap from my swap partition (/dev/sda5) to a file on /dev/sda6. I changed my /etc/fstab, I then changed my grub2 statement
    to
    resume=/dev/sda6 resume_offset=whatever running swap-offset myfile was
    Then I noticed hibernate button doesn't work
    so I switched to the kernel method and wrote a script
    Code:
    #!/bin/bash
    echo shutdown > /sys/power/disk
    echo disk > /sys/power/state
    Then I made a keyboard shortcut to F11
    gnomesu my_hibernate_script

    Works very nicely
    but my screen won't lock b4 it shutsdown
    I've tried editing my script to include:
    Code:
    su <myname> -c gnome-screensaver-command --lock &
    all combinations of such
    to no avail

    so my question is if its possible to lock it b4, whether there is some other place to signify this

    and what do you think about my hibernate setup anyway. AFAIK the kernel method is the only way to hibernate to a swap file, if not can you point me in the right direction
    (pm-utils etc). Would be nice if I could use the already made button under the menu for powering down/logout.

    Thanks for any help
    DESKTOP: Home built OS: opensuse 13.2 64 bit
    Asus p8h61-M LE/CSM | Intel i5-2500k 3.3Ghz Sandy Bridge | 4gb DDR3 | Intel integrated Video
    LAPTOP: Acer Aspire 4730z OS: opensuse 13.2 32 bit
    Intel Pentium dual-core 2.16Ghz T3400 | 3gb DDR2 | Intel Video

  2. #2
    dd@home.dk NNTP User

    Default Re: lock screen before hibernate

    On 10/09/2012 12:36 AM, cw9000 wrote:
    > su <myname> -c gnome-screensaver-command --lock &


    hopefully you are not running GNOME as root, right?

    so, when you are running GNOME as yourself and want to manually lock the
    screen, do you have to do that as root, or can't you do it as yourself?
    (i ask because i've never seen GNOME3 running, so i have no idea if
    'they' made it so that a simple users can't lock their own screen--but i
    doubt it)..

    well, if _you_ can lock your GNOME screen, then i see no need to provoke
    "su" in a script to do the same thing (wouldn't doing so tell the system
    to lock *root's* screen--when he shouldn't even have a screen to lock!!)...

    so, also think about maybe you should lock your screen in a script owned
    and located in your /home and executed by you, which then (somehow)
    launches the next phase of your hibernate sequence...which probably does
    need root powers.

    and, if you do it that way for all your various linux distros: each user
    could invoke the correct way to lock their screen and _then_ hand off
    the hibernating task to each distro's unique way of doing that (do NOT
    assume that all linux distributions will react the same way to the same
    script:

    If you have seen one Linux, you have seen one Linux.

    and, for next time: in my opinion your post, and especially this
    question "and what do you think about my hibernate setup" should be in
    our programming & scripting forum, here: http://tinyurl.com/5v695w4

    [that is where the scripting gurus seek such questions...they might not
    ever look into your thread in the *applications* forum--hmmmm, is
    'hibernate' an application?]

    --
    dd
    http://tinyurl.com/DD-Caveat

  3. #3
    dd@home.dk NNTP User

    Default Re: lock screen before hibernate

    On 10/09/2012 08:32 AM, dd@home.dk wrote:
    > su <myname>


    anyway, if sudoers were so set, wouldn't it be "sudo <myname> ..."


    --
    dd

  4. #4
    dd@home.dk NNTP User

    Default Re: lock screen before hibernate

    stupid me! JUST dawned on me, nevermind...now i understand what and why!


    --
    dd

  5. #5

    Default Re: lock screen before hibernate

    well thanks for pointing me in the direction of scripting and programming forum. I thought maybe the gnome interface and such would constitute an application, but I've been wrong before. What I really want is to use pm-utils , so I can use the hibernate button, but I don't believe it works with a swap FILE.
    DESKTOP: Home built OS: opensuse 13.2 64 bit
    Asus p8h61-M LE/CSM | Intel i5-2500k 3.3Ghz Sandy Bridge | 4gb DDR3 | Intel integrated Video
    LAPTOP: Acer Aspire 4730z OS: opensuse 13.2 32 bit
    Intel Pentium dual-core 2.16Ghz T3400 | 3gb DDR2 | Intel Video

  6. #6
    dd@home.dk NNTP User

    Default Re: lock screen before hibernate

    > What I really
    > want is to use pm-utils , so I can use the hibernate button, but I don't
    > believe it works with a swap FILE.


    wellllll...perhaps i missed the main thrust of your thread when i
    decided you 'just' needed help to perfect the script which would lock
    the screen prior to hibernate (as in the subject line) i now see that
    was probably not what you really needed...that is, perhaps the script is
    not the thing here to be 'fixed'...maybe it is your entire approach to
    the problem, and yes maybe you need a gnome guru to point the best route
    (and not a script guru)...

    having last run gnome (on Red Hat) last century, and i'm not a script
    guru either...so, i'm sorry i made any posts in this thread at all.

    i guess Malcolm Lewis might have a trick to make you smile...

    --
    dd

Posting Permissions

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