How to suspend with a keyboard shortcut?












10















I would like to suspend my xubuntu (14.04) system from a keyboard shortcut without entering my superuser password (sudo). I'm looking a command line which I can convert to a shortcut.



So far, I tried two solutions:



Xfce command:



xfce4-session-logout --suspend


Problem: The system doesn't lock the session. I don't need to enter my password for the wake-up and I want to do it.



Dbus:



dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


Problem: After wake-up, the Internet connection is down and I have to reboot the system to get it back.



Is there a third solution which 1. ask the password during the wake-up process, and 2. doesn't mess up with Internet connection?



In fact, the graphical default shortcut (from the menu) works fine. I just don't know which command line is called.










share|improve this question





























    10















    I would like to suspend my xubuntu (14.04) system from a keyboard shortcut without entering my superuser password (sudo). I'm looking a command line which I can convert to a shortcut.



    So far, I tried two solutions:



    Xfce command:



    xfce4-session-logout --suspend


    Problem: The system doesn't lock the session. I don't need to enter my password for the wake-up and I want to do it.



    Dbus:



    dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


    Problem: After wake-up, the Internet connection is down and I have to reboot the system to get it back.



    Is there a third solution which 1. ask the password during the wake-up process, and 2. doesn't mess up with Internet connection?



    In fact, the graphical default shortcut (from the menu) works fine. I just don't know which command line is called.










    share|improve this question



























      10












      10








      10


      3






      I would like to suspend my xubuntu (14.04) system from a keyboard shortcut without entering my superuser password (sudo). I'm looking a command line which I can convert to a shortcut.



      So far, I tried two solutions:



      Xfce command:



      xfce4-session-logout --suspend


      Problem: The system doesn't lock the session. I don't need to enter my password for the wake-up and I want to do it.



      Dbus:



      dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


      Problem: After wake-up, the Internet connection is down and I have to reboot the system to get it back.



      Is there a third solution which 1. ask the password during the wake-up process, and 2. doesn't mess up with Internet connection?



      In fact, the graphical default shortcut (from the menu) works fine. I just don't know which command line is called.










      share|improve this question
















      I would like to suspend my xubuntu (14.04) system from a keyboard shortcut without entering my superuser password (sudo). I'm looking a command line which I can convert to a shortcut.



      So far, I tried two solutions:



      Xfce command:



      xfce4-session-logout --suspend


      Problem: The system doesn't lock the session. I don't need to enter my password for the wake-up and I want to do it.



      Dbus:



      dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


      Problem: After wake-up, the Internet connection is down and I have to reboot the system to get it back.



      Is there a third solution which 1. ask the password during the wake-up process, and 2. doesn't mess up with Internet connection?



      In fact, the graphical default shortcut (from the menu) works fine. I just don't know which command line is called.







      xfce suspend xubuntu






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 12 '15 at 23:51







      ppr

















      asked Jul 30 '14 at 16:03









      pprppr

      71061434




      71061434






















          5 Answers
          5






          active

          oldest

          votes


















          7














          I wrote a script. It seems to do what you ask for:



          #!/usr/bin/env zsh
          # Custom suspend
          #
          # (That 'zsh' up there can be switched to 'bash', or
          # pretty much any shell - this doesn't do anything too fancy.)
          #
          # Dependencies are mostly xfce stuff:
          #
          # xbacklight
          # xflock4
          # xfce4-session-logout

          # Set how dim we want the screen to go (percentage, out of 100)
          dim=5

          # Pack up your toys
          previous_dimness=$(xbacklight -get)

          # Turn down the lights
          xbacklight -set $dim

          # Lock the door (this requires a password to get back in)
          xflock4

          # And go to sleep
          xfce4-session-logout --suspend

          # When we wake up, turn the lights back on
          xbacklight -set $previous_dimness





          share|improve this answer



















          • 1





            +1 for the wonderful comments. I think I will use this script when I install Ubuntu.

            – Wildcard
            Dec 12 '15 at 3:21











          • Im sorry but where should I place this script? how should I connect it with a keyboard shortcut (for example ctrl+alt+s)? I am using Lubuntu

            – hipoglucido
            Aug 12 '17 at 15:29











          • You can technically put the script anywhere. I have a bin/ directory under my home directory just for personal scripts like this that I want to use. In this case, the path to the script is: /home/<username>/bin/custom-suspend You'll want to make sure the script is executable. One way to do that is to run the following command: $ chmod +x /home/<username>/bin/custom-suspend To give it a shortcut under LXDE (which Lubuntu) uses, you should be able to search for something like 'keyboard' from the start menu, which should show you the keyboard config app.

            – Jon Carter
            Aug 14 '17 at 3:53





















          4














          You can very simply send the command for it to lock screen first, and then have it suspend:



          xscreensaver-command -lock ; xfce4-session-logout --suspend


          For usage of xscreensaver-command, run xscreensaver-command --help






          share|improve this answer
























          • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04). By the way, the Xfce app for locking the screen is xflock4 (no args), which by default is bound to control-alt-delete.

            – BobDoolittle
            Oct 22 '15 at 18:21













          • xscreensaver-command seems to be gone in 15.10.

            – Jesse Glick
            Jan 14 '16 at 23:54











          • @JesseGlick - just install the xscreensaver package

            – Wilf
            Jan 15 '16 at 17:28



















          2














          Oddly enough xfce4-session-logout --suspend works just fine, and my system is xubuntu 14.04.
          It also does lock the session, although I have switched on the option "lock screen before sleep", go to Settings->Session and Startup-> Advanced, and check if it switched on there.






          share|improve this answer
























          • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04).

            – BobDoolittle
            Oct 22 '15 at 18:21











          • well, it is supposed to work in xubuntu, not ubuntu. I am not sure why do you even have the xfce4-session-logout command.

            – Ufos
            Oct 23 '15 at 14:41











          • We are talking Xfce, which can be added to any ubuntu distribution. Xubuntu is simply a convenience distro that happens to have added Xfce packages and configured them as a desktop. You can start with ubuntu and add/configure it yourself. The xubuntu/ubuntu distinction is a red herring here.

            – BobDoolittle
            Oct 23 '15 at 18:21











          • Working fine for me, with screen lock, in Xubuntu 15.10.

            – Jesse Glick
            Jan 15 '16 at 0:25



















          0














          This command works for me:
          I just make a launcher for desktop and set the Shutdown Icon for that. put this command in command filed:



          dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


          fist time ask me to make Executable and after that working very well.



          I'm using wicd for Internet connection and It's working well too after waking up!






          share|improve this answer
























          • Xubuntu 15.10: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

            – Jesse Glick
            Jan 14 '16 at 23:53



















          0














          If you're on a laptop and just want a key to press. You can use the power button.
          The behavior can be set from the Power settings:





          1. Open Settings Manager (or by command : xfce4-settings-manager )

          2. Open Power Manager settings

          3. In General : set When power button is pressed to Ask

          4. Close Power Manager settings


          If you have ACPI scripts installed, deactivate or update the
          power-button script from



          /etc/acpi/events/, and change the action field to /bin/true:
          # EXAMPLE
          event=button/power.*
          #action=/usr/lib/acpid/power_button
          action=/bin/true



          Ref: https://wiki.xfce.org/tips#solution_2






          share|improve this answer
























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f147465%2fhow-to-suspend-with-a-keyboard-shortcut%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            7














            I wrote a script. It seems to do what you ask for:



            #!/usr/bin/env zsh
            # Custom suspend
            #
            # (That 'zsh' up there can be switched to 'bash', or
            # pretty much any shell - this doesn't do anything too fancy.)
            #
            # Dependencies are mostly xfce stuff:
            #
            # xbacklight
            # xflock4
            # xfce4-session-logout

            # Set how dim we want the screen to go (percentage, out of 100)
            dim=5

            # Pack up your toys
            previous_dimness=$(xbacklight -get)

            # Turn down the lights
            xbacklight -set $dim

            # Lock the door (this requires a password to get back in)
            xflock4

            # And go to sleep
            xfce4-session-logout --suspend

            # When we wake up, turn the lights back on
            xbacklight -set $previous_dimness





            share|improve this answer



















            • 1





              +1 for the wonderful comments. I think I will use this script when I install Ubuntu.

              – Wildcard
              Dec 12 '15 at 3:21











            • Im sorry but where should I place this script? how should I connect it with a keyboard shortcut (for example ctrl+alt+s)? I am using Lubuntu

              – hipoglucido
              Aug 12 '17 at 15:29











            • You can technically put the script anywhere. I have a bin/ directory under my home directory just for personal scripts like this that I want to use. In this case, the path to the script is: /home/<username>/bin/custom-suspend You'll want to make sure the script is executable. One way to do that is to run the following command: $ chmod +x /home/<username>/bin/custom-suspend To give it a shortcut under LXDE (which Lubuntu) uses, you should be able to search for something like 'keyboard' from the start menu, which should show you the keyboard config app.

              – Jon Carter
              Aug 14 '17 at 3:53


















            7














            I wrote a script. It seems to do what you ask for:



            #!/usr/bin/env zsh
            # Custom suspend
            #
            # (That 'zsh' up there can be switched to 'bash', or
            # pretty much any shell - this doesn't do anything too fancy.)
            #
            # Dependencies are mostly xfce stuff:
            #
            # xbacklight
            # xflock4
            # xfce4-session-logout

            # Set how dim we want the screen to go (percentage, out of 100)
            dim=5

            # Pack up your toys
            previous_dimness=$(xbacklight -get)

            # Turn down the lights
            xbacklight -set $dim

            # Lock the door (this requires a password to get back in)
            xflock4

            # And go to sleep
            xfce4-session-logout --suspend

            # When we wake up, turn the lights back on
            xbacklight -set $previous_dimness





            share|improve this answer



















            • 1





              +1 for the wonderful comments. I think I will use this script when I install Ubuntu.

              – Wildcard
              Dec 12 '15 at 3:21











            • Im sorry but where should I place this script? how should I connect it with a keyboard shortcut (for example ctrl+alt+s)? I am using Lubuntu

              – hipoglucido
              Aug 12 '17 at 15:29











            • You can technically put the script anywhere. I have a bin/ directory under my home directory just for personal scripts like this that I want to use. In this case, the path to the script is: /home/<username>/bin/custom-suspend You'll want to make sure the script is executable. One way to do that is to run the following command: $ chmod +x /home/<username>/bin/custom-suspend To give it a shortcut under LXDE (which Lubuntu) uses, you should be able to search for something like 'keyboard' from the start menu, which should show you the keyboard config app.

              – Jon Carter
              Aug 14 '17 at 3:53
















            7












            7








            7







            I wrote a script. It seems to do what you ask for:



            #!/usr/bin/env zsh
            # Custom suspend
            #
            # (That 'zsh' up there can be switched to 'bash', or
            # pretty much any shell - this doesn't do anything too fancy.)
            #
            # Dependencies are mostly xfce stuff:
            #
            # xbacklight
            # xflock4
            # xfce4-session-logout

            # Set how dim we want the screen to go (percentage, out of 100)
            dim=5

            # Pack up your toys
            previous_dimness=$(xbacklight -get)

            # Turn down the lights
            xbacklight -set $dim

            # Lock the door (this requires a password to get back in)
            xflock4

            # And go to sleep
            xfce4-session-logout --suspend

            # When we wake up, turn the lights back on
            xbacklight -set $previous_dimness





            share|improve this answer













            I wrote a script. It seems to do what you ask for:



            #!/usr/bin/env zsh
            # Custom suspend
            #
            # (That 'zsh' up there can be switched to 'bash', or
            # pretty much any shell - this doesn't do anything too fancy.)
            #
            # Dependencies are mostly xfce stuff:
            #
            # xbacklight
            # xflock4
            # xfce4-session-logout

            # Set how dim we want the screen to go (percentage, out of 100)
            dim=5

            # Pack up your toys
            previous_dimness=$(xbacklight -get)

            # Turn down the lights
            xbacklight -set $dim

            # Lock the door (this requires a password to get back in)
            xflock4

            # And go to sleep
            xfce4-session-logout --suspend

            # When we wake up, turn the lights back on
            xbacklight -set $previous_dimness






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 12 '15 at 2:01









            Jon CarterJon Carter

            20826




            20826








            • 1





              +1 for the wonderful comments. I think I will use this script when I install Ubuntu.

              – Wildcard
              Dec 12 '15 at 3:21











            • Im sorry but where should I place this script? how should I connect it with a keyboard shortcut (for example ctrl+alt+s)? I am using Lubuntu

              – hipoglucido
              Aug 12 '17 at 15:29











            • You can technically put the script anywhere. I have a bin/ directory under my home directory just for personal scripts like this that I want to use. In this case, the path to the script is: /home/<username>/bin/custom-suspend You'll want to make sure the script is executable. One way to do that is to run the following command: $ chmod +x /home/<username>/bin/custom-suspend To give it a shortcut under LXDE (which Lubuntu) uses, you should be able to search for something like 'keyboard' from the start menu, which should show you the keyboard config app.

              – Jon Carter
              Aug 14 '17 at 3:53
















            • 1





              +1 for the wonderful comments. I think I will use this script when I install Ubuntu.

              – Wildcard
              Dec 12 '15 at 3:21











            • Im sorry but where should I place this script? how should I connect it with a keyboard shortcut (for example ctrl+alt+s)? I am using Lubuntu

              – hipoglucido
              Aug 12 '17 at 15:29











            • You can technically put the script anywhere. I have a bin/ directory under my home directory just for personal scripts like this that I want to use. In this case, the path to the script is: /home/<username>/bin/custom-suspend You'll want to make sure the script is executable. One way to do that is to run the following command: $ chmod +x /home/<username>/bin/custom-suspend To give it a shortcut under LXDE (which Lubuntu) uses, you should be able to search for something like 'keyboard' from the start menu, which should show you the keyboard config app.

              – Jon Carter
              Aug 14 '17 at 3:53










            1




            1





            +1 for the wonderful comments. I think I will use this script when I install Ubuntu.

            – Wildcard
            Dec 12 '15 at 3:21





            +1 for the wonderful comments. I think I will use this script when I install Ubuntu.

            – Wildcard
            Dec 12 '15 at 3:21













            Im sorry but where should I place this script? how should I connect it with a keyboard shortcut (for example ctrl+alt+s)? I am using Lubuntu

            – hipoglucido
            Aug 12 '17 at 15:29





            Im sorry but where should I place this script? how should I connect it with a keyboard shortcut (for example ctrl+alt+s)? I am using Lubuntu

            – hipoglucido
            Aug 12 '17 at 15:29













            You can technically put the script anywhere. I have a bin/ directory under my home directory just for personal scripts like this that I want to use. In this case, the path to the script is: /home/<username>/bin/custom-suspend You'll want to make sure the script is executable. One way to do that is to run the following command: $ chmod +x /home/<username>/bin/custom-suspend To give it a shortcut under LXDE (which Lubuntu) uses, you should be able to search for something like 'keyboard' from the start menu, which should show you the keyboard config app.

            – Jon Carter
            Aug 14 '17 at 3:53







            You can technically put the script anywhere. I have a bin/ directory under my home directory just for personal scripts like this that I want to use. In this case, the path to the script is: /home/<username>/bin/custom-suspend You'll want to make sure the script is executable. One way to do that is to run the following command: $ chmod +x /home/<username>/bin/custom-suspend To give it a shortcut under LXDE (which Lubuntu) uses, you should be able to search for something like 'keyboard' from the start menu, which should show you the keyboard config app.

            – Jon Carter
            Aug 14 '17 at 3:53















            4














            You can very simply send the command for it to lock screen first, and then have it suspend:



            xscreensaver-command -lock ; xfce4-session-logout --suspend


            For usage of xscreensaver-command, run xscreensaver-command --help






            share|improve this answer
























            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04). By the way, the Xfce app for locking the screen is xflock4 (no args), which by default is bound to control-alt-delete.

              – BobDoolittle
              Oct 22 '15 at 18:21













            • xscreensaver-command seems to be gone in 15.10.

              – Jesse Glick
              Jan 14 '16 at 23:54











            • @JesseGlick - just install the xscreensaver package

              – Wilf
              Jan 15 '16 at 17:28
















            4














            You can very simply send the command for it to lock screen first, and then have it suspend:



            xscreensaver-command -lock ; xfce4-session-logout --suspend


            For usage of xscreensaver-command, run xscreensaver-command --help






            share|improve this answer
























            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04). By the way, the Xfce app for locking the screen is xflock4 (no args), which by default is bound to control-alt-delete.

              – BobDoolittle
              Oct 22 '15 at 18:21













            • xscreensaver-command seems to be gone in 15.10.

              – Jesse Glick
              Jan 14 '16 at 23:54











            • @JesseGlick - just install the xscreensaver package

              – Wilf
              Jan 15 '16 at 17:28














            4












            4








            4







            You can very simply send the command for it to lock screen first, and then have it suspend:



            xscreensaver-command -lock ; xfce4-session-logout --suspend


            For usage of xscreensaver-command, run xscreensaver-command --help






            share|improve this answer













            You can very simply send the command for it to lock screen first, and then have it suspend:



            xscreensaver-command -lock ; xfce4-session-logout --suspend


            For usage of xscreensaver-command, run xscreensaver-command --help







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 30 '14 at 16:25









            WilfWilf

            1,77421535




            1,77421535













            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04). By the way, the Xfce app for locking the screen is xflock4 (no args), which by default is bound to control-alt-delete.

              – BobDoolittle
              Oct 22 '15 at 18:21













            • xscreensaver-command seems to be gone in 15.10.

              – Jesse Glick
              Jan 14 '16 at 23:54











            • @JesseGlick - just install the xscreensaver package

              – Wilf
              Jan 15 '16 at 17:28



















            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04). By the way, the Xfce app for locking the screen is xflock4 (no args), which by default is bound to control-alt-delete.

              – BobDoolittle
              Oct 22 '15 at 18:21













            • xscreensaver-command seems to be gone in 15.10.

              – Jesse Glick
              Jan 14 '16 at 23:54











            • @JesseGlick - just install the xscreensaver package

              – Wilf
              Jan 15 '16 at 17:28

















            That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04). By the way, the Xfce app for locking the screen is xflock4 (no args), which by default is bound to control-alt-delete.

            – BobDoolittle
            Oct 22 '15 at 18:21







            That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04). By the way, the Xfce app for locking the screen is xflock4 (no args), which by default is bound to control-alt-delete.

            – BobDoolittle
            Oct 22 '15 at 18:21















            xscreensaver-command seems to be gone in 15.10.

            – Jesse Glick
            Jan 14 '16 at 23:54





            xscreensaver-command seems to be gone in 15.10.

            – Jesse Glick
            Jan 14 '16 at 23:54













            @JesseGlick - just install the xscreensaver package

            – Wilf
            Jan 15 '16 at 17:28





            @JesseGlick - just install the xscreensaver package

            – Wilf
            Jan 15 '16 at 17:28











            2














            Oddly enough xfce4-session-logout --suspend works just fine, and my system is xubuntu 14.04.
            It also does lock the session, although I have switched on the option "lock screen before sleep", go to Settings->Session and Startup-> Advanced, and check if it switched on there.






            share|improve this answer
























            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04).

              – BobDoolittle
              Oct 22 '15 at 18:21











            • well, it is supposed to work in xubuntu, not ubuntu. I am not sure why do you even have the xfce4-session-logout command.

              – Ufos
              Oct 23 '15 at 14:41











            • We are talking Xfce, which can be added to any ubuntu distribution. Xubuntu is simply a convenience distro that happens to have added Xfce packages and configured them as a desktop. You can start with ubuntu and add/configure it yourself. The xubuntu/ubuntu distinction is a red herring here.

              – BobDoolittle
              Oct 23 '15 at 18:21











            • Working fine for me, with screen lock, in Xubuntu 15.10.

              – Jesse Glick
              Jan 15 '16 at 0:25
















            2














            Oddly enough xfce4-session-logout --suspend works just fine, and my system is xubuntu 14.04.
            It also does lock the session, although I have switched on the option "lock screen before sleep", go to Settings->Session and Startup-> Advanced, and check if it switched on there.






            share|improve this answer
























            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04).

              – BobDoolittle
              Oct 22 '15 at 18:21











            • well, it is supposed to work in xubuntu, not ubuntu. I am not sure why do you even have the xfce4-session-logout command.

              – Ufos
              Oct 23 '15 at 14:41











            • We are talking Xfce, which can be added to any ubuntu distribution. Xubuntu is simply a convenience distro that happens to have added Xfce packages and configured them as a desktop. You can start with ubuntu and add/configure it yourself. The xubuntu/ubuntu distinction is a red herring here.

              – BobDoolittle
              Oct 23 '15 at 18:21











            • Working fine for me, with screen lock, in Xubuntu 15.10.

              – Jesse Glick
              Jan 15 '16 at 0:25














            2












            2








            2







            Oddly enough xfce4-session-logout --suspend works just fine, and my system is xubuntu 14.04.
            It also does lock the session, although I have switched on the option "lock screen before sleep", go to Settings->Session and Startup-> Advanced, and check if it switched on there.






            share|improve this answer













            Oddly enough xfce4-session-logout --suspend works just fine, and my system is xubuntu 14.04.
            It also does lock the session, although I have switched on the option "lock screen before sleep", go to Settings->Session and Startup-> Advanced, and check if it switched on there.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 3 '15 at 20:01









            UfosUfos

            1587




            1587













            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04).

              – BobDoolittle
              Oct 22 '15 at 18:21











            • well, it is supposed to work in xubuntu, not ubuntu. I am not sure why do you even have the xfce4-session-logout command.

              – Ufos
              Oct 23 '15 at 14:41











            • We are talking Xfce, which can be added to any ubuntu distribution. Xubuntu is simply a convenience distro that happens to have added Xfce packages and configured them as a desktop. You can start with ubuntu and add/configure it yourself. The xubuntu/ubuntu distinction is a red herring here.

              – BobDoolittle
              Oct 23 '15 at 18:21











            • Working fine for me, with screen lock, in Xubuntu 15.10.

              – Jesse Glick
              Jan 15 '16 at 0:25



















            • That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04).

              – BobDoolittle
              Oct 22 '15 at 18:21











            • well, it is supposed to work in xubuntu, not ubuntu. I am not sure why do you even have the xfce4-session-logout command.

              – Ufos
              Oct 23 '15 at 14:41











            • We are talking Xfce, which can be added to any ubuntu distribution. Xubuntu is simply a convenience distro that happens to have added Xfce packages and configured them as a desktop. You can start with ubuntu and add/configure it yourself. The xubuntu/ubuntu distinction is a red herring here.

              – BobDoolittle
              Oct 23 '15 at 18:21











            • Working fine for me, with screen lock, in Xubuntu 15.10.

              – Jesse Glick
              Jan 15 '16 at 0:25

















            That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04).

            – BobDoolittle
            Oct 22 '15 at 18:21





            That works from command line (although the lock screen is unnecessary since that's automatic with suspend), but not as a keyboard application shortcut (at least with Ubuntu 12.04).

            – BobDoolittle
            Oct 22 '15 at 18:21













            well, it is supposed to work in xubuntu, not ubuntu. I am not sure why do you even have the xfce4-session-logout command.

            – Ufos
            Oct 23 '15 at 14:41





            well, it is supposed to work in xubuntu, not ubuntu. I am not sure why do you even have the xfce4-session-logout command.

            – Ufos
            Oct 23 '15 at 14:41













            We are talking Xfce, which can be added to any ubuntu distribution. Xubuntu is simply a convenience distro that happens to have added Xfce packages and configured them as a desktop. You can start with ubuntu and add/configure it yourself. The xubuntu/ubuntu distinction is a red herring here.

            – BobDoolittle
            Oct 23 '15 at 18:21





            We are talking Xfce, which can be added to any ubuntu distribution. Xubuntu is simply a convenience distro that happens to have added Xfce packages and configured them as a desktop. You can start with ubuntu and add/configure it yourself. The xubuntu/ubuntu distinction is a red herring here.

            – BobDoolittle
            Oct 23 '15 at 18:21













            Working fine for me, with screen lock, in Xubuntu 15.10.

            – Jesse Glick
            Jan 15 '16 at 0:25





            Working fine for me, with screen lock, in Xubuntu 15.10.

            – Jesse Glick
            Jan 15 '16 at 0:25











            0














            This command works for me:
            I just make a launcher for desktop and set the Shutdown Icon for that. put this command in command filed:



            dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


            fist time ask me to make Executable and after that working very well.



            I'm using wicd for Internet connection and It's working well too after waking up!






            share|improve this answer
























            • Xubuntu 15.10: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

              – Jesse Glick
              Jan 14 '16 at 23:53
















            0














            This command works for me:
            I just make a launcher for desktop and set the Shutdown Icon for that. put this command in command filed:



            dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


            fist time ask me to make Executable and after that working very well.



            I'm using wicd for Internet connection and It's working well too after waking up!






            share|improve this answer
























            • Xubuntu 15.10: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

              – Jesse Glick
              Jan 14 '16 at 23:53














            0












            0








            0







            This command works for me:
            I just make a launcher for desktop and set the Shutdown Icon for that. put this command in command filed:



            dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


            fist time ask me to make Executable and after that working very well.



            I'm using wicd for Internet connection and It's working well too after waking up!






            share|improve this answer













            This command works for me:
            I just make a launcher for desktop and set the Shutdown Icon for that. put this command in command filed:



            dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend


            fist time ask me to make Executable and after that working very well.



            I'm using wicd for Internet connection and It's working well too after waking up!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 2 '15 at 9:50









            VahidVahid

            1011




            1011













            • Xubuntu 15.10: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

              – Jesse Glick
              Jan 14 '16 at 23:53



















            • Xubuntu 15.10: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

              – Jesse Glick
              Jan 14 '16 at 23:53

















            Xubuntu 15.10: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

            – Jesse Glick
            Jan 14 '16 at 23:53





            Xubuntu 15.10: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Suspend" with signature "" on interface "org.freedesktop.UPower" doesn't exist

            – Jesse Glick
            Jan 14 '16 at 23:53











            0














            If you're on a laptop and just want a key to press. You can use the power button.
            The behavior can be set from the Power settings:





            1. Open Settings Manager (or by command : xfce4-settings-manager )

            2. Open Power Manager settings

            3. In General : set When power button is pressed to Ask

            4. Close Power Manager settings


            If you have ACPI scripts installed, deactivate or update the
            power-button script from



            /etc/acpi/events/, and change the action field to /bin/true:
            # EXAMPLE
            event=button/power.*
            #action=/usr/lib/acpid/power_button
            action=/bin/true



            Ref: https://wiki.xfce.org/tips#solution_2






            share|improve this answer




























              0














              If you're on a laptop and just want a key to press. You can use the power button.
              The behavior can be set from the Power settings:





              1. Open Settings Manager (or by command : xfce4-settings-manager )

              2. Open Power Manager settings

              3. In General : set When power button is pressed to Ask

              4. Close Power Manager settings


              If you have ACPI scripts installed, deactivate or update the
              power-button script from



              /etc/acpi/events/, and change the action field to /bin/true:
              # EXAMPLE
              event=button/power.*
              #action=/usr/lib/acpid/power_button
              action=/bin/true



              Ref: https://wiki.xfce.org/tips#solution_2






              share|improve this answer


























                0












                0








                0







                If you're on a laptop and just want a key to press. You can use the power button.
                The behavior can be set from the Power settings:





                1. Open Settings Manager (or by command : xfce4-settings-manager )

                2. Open Power Manager settings

                3. In General : set When power button is pressed to Ask

                4. Close Power Manager settings


                If you have ACPI scripts installed, deactivate or update the
                power-button script from



                /etc/acpi/events/, and change the action field to /bin/true:
                # EXAMPLE
                event=button/power.*
                #action=/usr/lib/acpid/power_button
                action=/bin/true



                Ref: https://wiki.xfce.org/tips#solution_2






                share|improve this answer













                If you're on a laptop and just want a key to press. You can use the power button.
                The behavior can be set from the Power settings:





                1. Open Settings Manager (or by command : xfce4-settings-manager )

                2. Open Power Manager settings

                3. In General : set When power button is pressed to Ask

                4. Close Power Manager settings


                If you have ACPI scripts installed, deactivate or update the
                power-button script from



                /etc/acpi/events/, and change the action field to /bin/true:
                # EXAMPLE
                event=button/power.*
                #action=/usr/lib/acpid/power_button
                action=/bin/true



                Ref: https://wiki.xfce.org/tips#solution_2







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 7 at 9:17









                Mads HansenMads Hansen

                13




                13






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f147465%2fhow-to-suspend-with-a-keyboard-shortcut%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to make a Squid Proxy server?

                    Is this a new Fibonacci Identity?

                    Touch on Surface Book