Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-01-10 11:32:18

friday
Member
Registered: 2022-01-10
Posts: 3

How to rearrange icons in logout menu?

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

#2 2022-01-10 12:03:28

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 8,832

Re: How to rearrange icons in logout menu?

Hello and welcome.

friday wrote:

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:

  1. 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
  2. Have systemd ignore the power key (/etc/systemd/logind.conf):

    HandlePowerKey=ignore
  3. 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.

Offline

#3 2022-01-10 12:28:55

KBar
Member
Registered: 2021-11-05
Posts: 377

Re: How to rearrange icons in logout menu?

Hello and welcome to our forum!

  1. 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:
    tXMTFRB.png

    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:
    LyCX0cJ.png
    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).

  2. 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)


Xubuntu 20.04

Offline

#4 2022-01-10 12:57:51

friday
Member
Registered: 2022-01-10
Posts: 3

Re: How to rearrange icons in logout menu?

KBar wrote:
.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 smile

Offline

#5 2022-01-10 13:04:40

KBar
Member
Registered: 2021-11-05
Posts: 377

Re: How to rearrange icons in logout menu?

friday wrote:

Thanks. This is just visual swap because focus is always on "logout" button even if is on "turn off" position smile

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)


Xubuntu 20.04

Offline

#6 2022-01-10 16:29:11

friday
Member
Registered: 2022-01-10
Posts: 3

Re: How to rearrange icons in logout menu?

KBar wrote:

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

#7 2022-01-10 16:38:50

KBar
Member
Registered: 2021-11-05
Posts: 377

Re: How to rearrange icons in logout menu?

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. tongue


Xubuntu 20.04

Offline

#8 2022-01-10 16:52:03

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 8,832

Re: How to rearrange icons in logout menu?

KBar wrote:

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.

Offline

Board footer

Powered by FluxBB