You are not logged in.
Pages: 1
Hi,
I'm using Xubuntu 20.04. When I press power off button on computer and hit enter then I've got logout. I would like to have power off machine instead logout.
1. Is possible to rearrange icons in logout menu to swap places "logout" with "turn off" icons?
2. Or maybe is possible to automaticly focus on "turn off" button? (power off button, hit enter to shutdown)
Offline
Hello and welcome.
1. Is possible to rearrange icons in logout menu to swap places "logout" with "turn off" icons?
Unfortunately, no - not that I am aware of. It's hard-coded to display that way.
2. Or maybe is possible to automaticly focus on "turn off" button? (power off button, hit enter to shutdown)
There was a discussion about that here with some options.
.
Here is an idea around another option that might work (I haven't tested this yet) assuming systemd:
Have xfce4-power-manager pass on processing of the power key to systemd:
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-power-key -n -t bool -s true
Have systemd ignore the power key (/etc/systemd/logind.conf):
HandlePowerKey=ignore
Create your own script/dialog to run when the power key is pressed (maybe something as simple as "systemctl poweroff") and create a shortcut for it in Settings Manager > Keyboard > Application shortcuts. When asked to press a key to associate to the shortcut, press the power button.
I'll see if I can find time to test this.
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
Hello and welcome to our forum!
A resounding yes. You need to include the following two lines in your gtk.css file, which is located in $HOME/.config/gtk-3.0/gtk.css. If it doesn't exist yet, simply create it.
Here is the default layout of the logout dialog on Xubuntu 20.04:
This code:
.xfsm-logout-buttons > box:first-child button:nth-child(1) { margin-left: 168px; margin-right: -168px; }
.xfsm-logout-buttons > box:first-child button:nth-child(3) { margin-left: -168px; margin-right: 168px; }
swapped the position of Log Out and Shut Down buttons like so:
You'll most likely going to need to adjust the numbers to fit your theme and layout. They are opposite numbers; just remember that for the first button, the right margin is negative (you're pushing it from left to right) and for the third button, the left margin is negative (you're pulling it from right to left).
Try what ToZ suggested but I'd imagine this will be difficult to achieve as it seems to be hard-coded
Last edited by KBar (2022-01-10 12:41:00)
Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please!
Offline
.xfsm-logout-buttons > box:first-child button:nth-child(1) { margin-left: 168px; margin-right: -168px; } .xfsm-logout-buttons > box:first-child button:nth-child(3) { margin-left: -168px; margin-right: 168px; }
Thanks. This is just visual swap because focus is always on "logout" button even if is on "turn off" position
Offline
Thanks. This is just visual swap because focus is always on "logout" button even if is on "turn off" position
Both the subject and your first question only ask about rearranging icons, which is a cosmetic action. Sorry if I misunderstood you.
As to your second question, see my second point above and ToZ's answer. I don't believe it's possible to do what you want without resorting to scripts or downright modifying the source code, which currently has this block:
button = xfsm_logout_dialog_button (_("_Log Out"), "xfsm-logout",
"system-log-out", NULL,
XFSM_SHUTDOWN_LOGOUT, dialog);
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
gtk_widget_grab_focus (button);
As you can see, it's set to grab focus.
If you have mnemonics enabled, just press Alt+D to Shut Down. Alt+R is for Restart and Alt+L is for Log Out.
Last edited by KBar (2022-01-10 13:09:34)
Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please!
Offline
Both the subject and your first question only ask about rearranging icons, which is a cosmetic action. Sorry if I misunderstood you
It's ok, you understood well. This is my fault. I thought it would be enough to swap buttons.
Offline
I think ToZ' workaround that imitates Tab presses a couple of times is the most optimal. I'd probably do the same, except in a more convoluted and superfluous way.
Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please!
Offline
This code:
.xfsm-logout-buttons > box:first-child button:nth-child(1) { margin-left: 168px; margin-right: -168px; } .xfsm-logout-buttons > box:first-child button:nth-child(3) { margin-left: -168px; margin-right: 168px; }
Cool. I had no idea. Even an old dog learns new tricks every once in a while.
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
I made a program that allows to have preferred (Shutdown/Reboot) buttons focused:
https://codeberg.org/chang-zhao/shutdown-gtk
Then it calls XFCE session manager to actually perform the corresponding logout action.
The only problem is to start it instead of the regular XFCE session manager (perhaps with udev rule for Power button or something?). I just set a hotkey to use for shutdown (Super-Escape), and for my purposes it's OK.
Options:
Options:
-h, --help show this help message and exit
-r, --reboot Reboot button will be focused initially
-s, --shutdown Shutdown button will be focused initially
-q, --quiet Don't print the info message
-p, --preserve Save the current session on shutdown
Offline
Pages: 1
[ Generated in 0.012 seconds, 8 queries executed - Memory usage: 575.28 KiB (Peak: 592.13 KiB) ]