! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Add commands for shutdown and restart
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfce4-whiskermenu-plugin
Component:
General

Comments

Description Peter Feichtinger 2018-08-29 22:28:59 CEST
I would like to add commands for shutdown and restart.

I already have an implementation that adds the necessary commands and UI elements, let me know if I should attach a patch.
I still need guidance for updating the translations though, is there an automated way to copy translations from another project (xfce-panel already has some of the new words)?
Comment 1 Graeme Gott editbugs 2018-08-30 11:27:39 CEST
(In reply to Peter Feichtinger from comment #0)
> I would like to add commands for shutdown and restart.
> 
> I already have an implementation that adds the necessary commands and UI
> elements, let me know if I should attach a patch.
> I still need guidance for updating the translations though, is there an
> automated way to copy translations from another project (xfce-panel already
> has some of the new words)?

Interesting idea. An attached patch would be fine.

Don't worry about the translations. I will update the .pot file, and then upload it to Transifex.
Comment 2 Peter Feichtinger 2018-08-30 12:59:00 CEST
So I shouldn't touch the .po and .pot files at all? Because I can also do the German translation.
Comment 3 Graeme Gott editbugs 2018-08-30 13:43:08 CEST
(In reply to Peter Feichtinger from comment #2)
> So I shouldn't touch the .po and .pot files at all? Because I can also do
> the German translation.

Correct. If you want to update the German translation, I would prefer it be done through Transifex. It makes things much simpler if all translations are done there and then imported into git.
Comment 4 Peter Feichtinger 2018-08-30 15:56:28 CEST
Created attachment 7917 
Patch that adds shutdown and restart commands

I've attached the patch.
Comment 5 Graeme Gott editbugs 2018-08-30 21:13:43 CEST
(In reply to Peter Feichtinger from comment #4)
> Created attachment 7917 
> Patch that adds shutdown and restart commands
> 
> I've attached the patch.

After having tested this, I have some thoughts. I like quality of the code, so my issues are with how it works in practice.

My biggest issue is that the commands happen immediately. Which means that if you accidentally click the shutdown button, off goes your computer. There is no prompt like you get from the actions panel plugin. This is a big concern for me because it happened while testing! I was intending to click on something below my menu and hit the shutdown button by accident instead.

This feature also makes the space taken up by command buttons quite large. I wouldn't be opposed to rearranging some of the commands into a drop-down menu. That would take care of the accidental click issue as well, but at the expense of more clicks to turn off the computer: Whisker Menu, commands menu, shut down.

A minor thing is that the reboot icon should probably be "system-reboot", not "system-restart", to match the actions panel plugin. More icon themes have "system-reboot" than "system-restart".
Comment 6 Peter Feichtinger 2018-08-31 11:51:22 CEST
I intended the addition of those two buttons as a replacement for the Action Buttons panel plugin, which I have set up so it doesn't ask for confirmation. I see your concern, however, the current logout and change user buttons don't ask for confirmation also...

About the space, I noticed that all of the commands are enabled by default. Maybe we should disable some of them (the new ones perhaps), so it looks cleaner and there's less of a chance that new users will hit unfortunate buttons without having enabled them and knowing what they do. I'd rather not move the commands into a drop-down menu, for one because I don't know how, and also because I'd like to have them immediately accessible as with the Action Buttons plugin.

Agreed on the icon, it looks strange beside the other two but I like to be consistent with other parts of the UI as well.
Comment 7 Graeme Gott editbugs 2018-09-01 12:21:40 CEST
(In reply to Peter Feichtinger from comment #6)
> I intended the addition of those two buttons as a replacement for the Action
> Buttons panel plugin, which I have set up so it doesn't ask for
> confirmation. I see your concern, however, the current logout and change
> user buttons don't ask for confirmation also...

True, but there is a difference. The log out button shows a dialog that allows you to choose what happens or to cancel it. Switching users can be undone by just going back to your current login. You can't stop restart and shut down. I have added confirmation dialogs to my own local copy, so you don't need to worry about adding those. But I will not merge this without them.

> About the space, I noticed that all of the commands are enabled by default.
> Maybe we should disable some of them (the new ones perhaps), so it looks
> cleaner and there's less of a chance that new users will hit unfortunate
> buttons without having enabled them and knowing what they do. I'd rather not
> move the commands into a drop-down menu, for one because I don't know how,
> and also because I'd like to have them immediately accessible as with the
> Action Buttons plugin.

I wrote up a local version with a menu to test before you made this comment. I still found it disconcerting to have my computer just shut down without asking, but at least it wasn't accidental. And there really is no point in having a menu instead of popping up the logout dialog, because it is the same number of clicks. I agree that a menu doesn't really help after all.

I have changed the code to hide the new buttons by default, so that does clean things up. I also added buttons for all of the rest of the logout dialog actions like suspend or hibernate. Might as well if they are hidden by default.

However, I discovered another issue while testing. Unless --fast is passed to xfce-session-logout, it saves the session. I personally hate saved sessions and have them disabled in my Xfce settings. But apparently xfce-session-logout doesn't check the settings if you pass it an action to run. I know that some users like saved sessions, and some users hate them, so the command buttons should really respect whatever value the user has already set in the Xfce settings and not require them to either add or remove --fast as that is non-obvious.

One solution would be to create a special type of command button that doesn't let the user set a value for the action so that it can compile the command itself. I'm happy to work on that.

I had considered just adding a confirmation checkbox to the prompt, and defaulting to whatever value is set in the Xfce settings. The problem is that if the users changes what the value of the command is, the new command might not accept --fast as a parameter...
Comment 8 Peter Feichtinger 2018-09-02 12:49:28 CEST
I'd really like one click buttons, but if you won't merge them then I'll have to live with that or stay with the action buttons, I'll have to try.

Regarding a submenu vs. confirmation dialog, it does make a subtle difference because the dialog is likely far away from the button whereas the submenu would be right there. With a confirmation dialog, on the other hand, it would be possible to have a setting whether it should be shown or not, which is enabled by default, then people like me could still disable them for immediate action.

As for the session storage a few things come to mind.
If we can be sure that Xfce always uses Xfce sessions (I don't know, can you mix and match as with window managers/compositors?) then you could just hardcode the session handling and do it the same way as the action buttons (which I assume honor the saved session setting).
Another option would be to add a wrapper script for xfce-session-logout that reads the corresponding setting from wherever that's stored and passes --fast if necessary. This way the user could still change the command because it'd be just an ordinary command.
Comment 9 Graeme Gott editbugs 2018-09-08 17:54:01 CEST
I wrote several versions and spent a lot of time arguing myself in circles, but in the end I prefer to not add a bash script or be creative about the session logout command. I have simply added "--fast" by default, and those that want to save their sessions can remove it.

I have kept it as one-click buttons with a confirmation dialog that can be turned off.
Comment 10 Peter Feichtinger 2018-09-08 20:00:03 CEST
This is great, thanks a lot!

Bug #14639

Reported by:
Peter Feichtinger
Reported on: 2018-08-29
Last modified on: 2018-09-08

People

Assignee:
Graeme Gott
CC List:
0 users

Version

Version:
unspecified

Attachments

Additional information