Shutting down with keybindings

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
henpeckary

Shutting down with keybindings

Post by henpeckary »

Hi, I was wondering if anyone could help, I'm trying to shutdown/poweroff with keybindings. I've edited the /etc/sudoers file and put the shortcut in my keys file but all to no avail. What am I doing wrong ? I got the rest of the keys working working no problem. Heres my keys file if anyone finds it useful - the only shortcut that doesn't work is the "halt" one.

OnDesktop Mouse2 :WorkspaceMenu
OnDesktop Mouse3 :RootMenu
KP_Add :NextWorkspace
KP_Subtract :PrevWorkspace

Control m :RootMenu
Alt m :HideMenus

KP_Insert :Maximize
KP_Delete :Minimize
KP_Enter :Fullscreen
Control k :KillWindow
Control c :Close
Control q :Exit
Control z :Exec sudo halt


Control e :ExecCommand eject
Control h :Exec thunar # Ctrl+h will bring up file manager
Control r :ExecCommand rhythmbox # Ctrl+r will bring up music player
Control b :ExecCommand deluge # Ctrl+b will bring up deluge
Control a :ExecCommand abiword # Ctrl+a will bring up abiword
Control f :ExecCommand firefox # Ctrl+f will bring up firefox
Control o :ExecCommand opera # Ctrl+o will bring up opera
Control t :ExecCommand lxterminal # Ctrl+t will bring up an lxterminal
Control l :ExecCommand leafpad # Ctrl+l will bring up leafpad
Control x :ExecCommand xfburn # Ctrl+x will bring up xfburn
Control p :ExecCommand picasa # Ctrl+p will bring up picasa

None Control Right :MoveRight 30
None Control Left :MoveLeft 30
None Control Up :MoveUp 30
None Control Down :MoveDown 30
None Alt Right :ResizeHorizontal 25
None Alt Left :ResizeHorizontal -25
None Alt Up :ResizeVertical -25
None Alt Down :ResizeVertical 25

KP_Prior :MoveTo 0 0 UpperRight -> snap to upper right workspace corner
KP_Home :MoveTo 0 0 UpperLeft -> snap to upper left workspace corner
KP_End :MoveTo 0 0 BottomLeft -> snap to bottom left workspace corner
KP_Next :MoveTo 0 0 BottomRight -> snap to bottom right workspace corner
KP_Begin :MoveTo 0 0 Center -> snap to center of workspace
KP_Right :MoveTo 0 0 RightCenter -> snap to right center of workspace
KP_Left :MoveTo 0 0 LeftCenter -> snap to left center of workspace
KP_8 :MoveTo 0 0 TopCenter -> snap to top center of workspace
KP_Down :MoveTo 0 0 BottomCenter -> snap to bottom center of workspace

#Volume. Will lower or raise volume by 5%. The third key binding will toggle mute.
None XF86AudioRaiseVolume :Exec amixer sset Master,0 5%+
None XF86AudioLowerVolume :Exec amixer sset Master,0 5%-
None XF86AudioMute :Exec amixer sset Master,0 toggle











Thanks
Tony
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Alaric

Re: Shutting down with keybindings

Post by Alaric »

I suppose it's because it requires 'sudo'? I tried ciao, instead of halt, and that brought up the shutdown pop-up, which isn't really what you're going for. Heck, I tried a few different things; interesting question and quite an extensive list of keys you've got there. Must be a keyboard warrior in the making. :)
richyrich

Re: Shutting down with keybindings

Post by richyrich »

couple of suggestions . .

Code: Select all

sudo /sbin/halt

Code: Select all

gksudo /sbin/halt
henpeckary

Re: Shutting down with keybindings

Post by henpeckary »

Hi, I tried those and still no luck, ah well - I'll keep trying and if i manage it I'll post back with the solution. Thanks anyway for the suggestions, it was worth a shot.

PS. I've noticed that whenever anyone else posts code it's always in that neat little code box. How do you get that ? - so I'm not copying and pasting code into the message area.

Tony.
richyrich

Re: Shutting down with keybindings

Post by richyrich »

One other to try :

Code: Select all

gksudo shutdown -P now
When you are in the edit window, they are the small buttons along the top of the text box. Just click quote or code, paste between the two squares [ code ] here [ / code ]

ps: when you changed commands, did you change the command in your visudo too ?
henpeckary

Re: Shutting down with keybindings

Post by henpeckary »

No I didn't, I just opened /etc as root and opened the sudoers file in leafpad. Whats visudo ? Sorry if it's a dumb question but I've never come accross it. just tried "visudo leafpad /etc/sudoers" and "visudo /etc/sudoers" and got "usage: visudo [-c] [-q] [-s] [-V] [-f sudoers]".
How do I use it to open the sudoers file ?

Thanks for your patience.
Tony
henpeckary

Re: Shutting down with keybindings

Post by henpeckary »

I'm kinda getting there. i've found that if I use ":ExecCommand gksudo poweroff" in my keys file then that works. It requires my password to shutdown but I can live with that for now till I suss it out, it's not perfect but it's still quicker than fiddling about with a track pad.

Tony.
Locked

Return to “Software & Applications”