You are not logged in.
Pages: 1
Hi,
i'm using 3 os on my machine (xubuntu, kubuntu and windows 7). normally i use xubuntu. i want to add 2 extra buttons to the xfce4-session-logout window to directly reboot into kubuntu or windows using 'grub-reboot'. that means when i press one of the extra buttons xubuntu sets the changes settings to 'grubenv' and reboots
sudo grub-reboot "Kubuntu" && sudo reboot
can i edit this window in this way?
how can i use this command without having to enter the password? when i shutdown or restart the computer i don't need it.
friedrich
Offline
can i edit this window in this way?
Unfortunately, no. These options are hard coded. However, you can create your own logout launcher. Using zenity:
zenity --title "Save With Exit" --height 300 --width 200 --list --text "Log Out: $USER" --radiolist --column " " --column "Method" TRUE Logout FALSE Shutdown FALSE Reboot FALSE Suspend FALSE Hibernate FALSE "Lock Screen" FALSE "Reboot Kubuntu"
...or yad:
yad --window-icon=system-devices-panel-information --on-top --sticky --fixed --center --width 200 --entry --title "Xfce Exit" --text "\nSelect an action:\n" --image=xfce4_xicon3 --image-on-top --button="gtk-ok:0" --button="gtk-cancel:1" --text-align center --entry-text "Logout" "Reboot" "Suspend" "Hibernate" "Power Off" "Lock Screen" "Reboot Kubuntu"
The full code snippet would look like this:
#!/bin/bash
### Uncomment either the zenity or yad command
#ans=$(zenity --title "Save With Exit" --height 300 --width 200 --list --text "Log Out: $USER" --radiolist --column " " --column "Method" TRUE Logout FALSE Shutdown FALSE Reboot FALSE Suspend FALSE Hibernate FALSE "Lock Screen" FALSE "Reboot Kubuntu")
#ans=$(yad --window-icon=system-devices-panel-information --on-top --sticky --fixed --center --width 200 --entry --title "Xfce Exit" --text "\nSelect an action:\n" --image=xfce4_xicon3 --image-on-top --button="gtk-ok:0" --button="gtk-cancel:1" --text-align center --entry-text "Logout" "Reboot" "Suspend" "Hibernate" "Power Off" "Lock Screen" "Reboot Kubuntu")
[[ $ret -eq 1 ]] && exit 0
case $ans in
Logout*)
xfce4-session-logout -l
;;
Power*)
xfce4-session-logout -h
;;
Reboot)
xfce4-session-logout -r
;;
Suspend*)
xfce4-session-logout -s
;;
Hibernate*)
xfce4-session-logout --hibernate
;;
Lock*)
xflock4
;;
Reboot\ Kubuntu)
sudo grub-reboot "Kubuntu"
xfce4-session-logout -r
;;
*)
;;
esac
exit 0
...just uncomment the code line to use either zenity or yad. For the sudo command to work, see below.
how can i use this command without having to enter the password? when i shutdown or restart the computer i don't need it.
You can configure sudo to allow non-password authentication to certain commands. To do so, add something like this to your sudo configs:
%wheel ALL=(ALL) NOPASSWD: /usr/bin/grub-reboot
...for all members of the wheel group to have non-password access to the command, or for only one user:
YOUR_USER_NAME ALL=(ALL) NOPASSWD: /usr/bin/grub-reboot
...and change YOUR_USER_NAME to your actual user name. Where to place this command may be dependent on your distro. For Arch linux, I would create the file /etc/sudoers.d/grub-reboot and put the contents there.
When you've done all that, create a new launcher on your panel and point it to this executable.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
this is now
YOUR_USER_NAME ALL=(ALL) NOPASSWD: /usr/sbin/grub-reboot
note sbin change. Full code for a shell script would be (e.g.)
#!/bin/sh
sudo grub-reboot "$(grep -i 'windows' /boot/grub/grub.cfg|cut -d"'" -f2)" && reboot
Save as .sh, make executable, and add that script (full path) to /etc/sudoers as above. You do NOT need to add reboot as well.
Offline
Pages: 1
[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 534.37 KiB (Peak: 535.21 KiB) ]