Results 1 to 9 of 9

Thread: how to shutdown computer with a keyboard button

  1. #1
    Join Date
    Nov 2008
    Beans
    17

    how to shutdown computer with a keyboard button

    Is there a way that I can shutdown the system by only pressing a keyboard button?

  2. #2
    Join Date
    Jun 2007
    Beans
    676

    Re: how to shutdown computer with a keyboard button

    If your computer has a power button, all you need to do is to go to the power management settings and assign "shutdown" to this button.

    If you want to shutdown with an arbitray key, this might help:

    http://www.howtogeek.com/howto/ubunt...-ubuntu-linux/

    PS: it might take an entire day to check your reply to this, but I will
    Last edited by Keyper7; November 27th, 2008 at 01:43 PM.

  3. #3
    Join Date
    Nov 2008
    Beans
    17

    Re: how to shutdown computer with a keyboard button

    Thanks alot. It seems that it will work. but when i press the buttons I assigned it says:

    There was an error running "/home/mybox/shutdown.csh":
    Failed to execute child process "/home/mybox/shutdown.csh" (No such file or directory).

    The shutdown.csh is in my folder and I execute:

    chmod 777 shutdown.csh at the correct place and all its permissions are enabled.

  4. #4
    Join Date
    Jun 2007
    Beans
    676

    Re: how to shutdown computer with a keyboard button

    That's strange... does putting a common command like, say, "firefox" work?

  5. #5
    Join Date
    Nov 2008
    Beans
    17

    Re: how to shutdown computer with a keyboard button

    It was a fault of mine with script. But now I have 2 different problems. First I cannot assign any keybinding command to numpad but in my project I don't have any buttons accept numpad that is I have to use numpad. Do you have any suggestions about this?

    Secondly I tried some commands like firefox chmod in my script they work fine but when I tried:
    sudo -p mypassword -u root shutdown -h 0
    it doesn't shutdown.

  6. #6
    Join Date
    Dec 2004
    Location
    hacking on my Debian box
    Beans
    1,305

    Re: how to shutdown computer with a keyboard button

    There are some suggestions. Some of them might be silly or outright dangerous though.
    http://www.google.com/search?q=non-root+shutdown

  7. #7
    Join Date
    Nov 2008
    Beans
    17

    Re: how to shutdown computer with a keyboard button

    Thanks. I tried one of them and now shutting down works fine without numpad. The last question is how can I assign this script to numpad ?

  8. #8
    Join Date
    Dec 2004
    Location
    hacking on my Debian box
    Beans
    1,305

    Re: how to shutdown computer with a keyboard button

    What key would you like to use?

    The drill is here. Open a terminal and type in xev. A white little box should pop up. Move your mouse cursor into it. Now hit a key. You will then see in the terminal a log for the key down and key up events. There you'll see the name of they key, it's right there after the keysum, e.g. the plus on the keypad would be KP_Add. (Capitalization matters, like always.) Find out the name of they key you'd like to use. Then close the event tester, the white box and type into the terminal gconf-editor.

    There navigate to /apps/metacity/global_keybindings/ and add the key combo to a run command. (You can add modifiers like Ctrl and Alt to the key.) Finally edit /apps/metacity/keybinding_commands/ to point to the shutdown command.
    Last edited by glotz; December 1st, 2008 at 05:01 PM.

  9. #9
    Join Date
    Nov 2008
    Beans
    17

    Re: how to shutdown computer with a keyboard button

    thanks for all the replies.
    I wanted to use "-" key. KP_Subtract solved my problem, and for numbers only KP_#(KP_8 ) works.
    Last edited by ekansdiuqil; December 2nd, 2008 at 09:04 AM.

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
  •