! 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 support for desktop actions
Status:
RESOLVED: FIXED
Severity:
enhancement

Comments

Description Danila Poyarkov 2014-11-02 04:58:06 CET
The "Desktop Action" entry is not parsed in .desktop files. This feature is required to add Unity-like actions on right-click in XFCE launchers. Maybe it would be better to improve GIO's GDesktopAppInfo parser and use it instead of XFCE4Util.
Comment 1 Yan Pas 2015-03-29 15:01:30 CEST
Agree. This feature is implemented in KDE, Unity, Dockbarx and Cinnamon.

Example (Actions on right click: play, puase, stop)
/usr/share/applications/clementine.desktop looks like:

[Desktop Entry]
Version=1.0
Type=Application
Name=Clementine
GenericName=Clementine Music Player
GenericName[pl]=Odtwarzacz muzyki Clementine
GenericName[pt]=Reprodutor de músicas Clementine
Comment=Plays music and last.fm streams
Comment[pl]=Odtwarzanie muzyki i strumieni last.fm
Comment[pt]=Reprodução de músicas e emissões last.fm
Exec=clementine %U
TryExec=clementine
Categories=AudioVideo;Player;Qt;
...

[Play Shortcut Group]
Name=Play
Exec=clementine --play
TargetEnvironment=Unity
Name[af]=Speel
Name[be]=Прайграць
....

[Pause Shortcut Group]
Name=Pause
Exec=clementine --pause
TargetEnvironment=Unity
Name[pl]=Pauza
Name[ru]=Приостановить
....

[Stop Shortcut Group]
Name=Stop
Exec=clementine --stop
TargetEnvironment=Unity
Name[br]=Paouez
Name[ru]=Остановить
Comment 2 Danila Poyarkov 2015-04-01 00:20:53 CEST
Created attachment 6155 
Added support for desktop actions
Comment 3 Danila Poyarkov 2015-04-01 00:21:31 CEST
Please review the patch.
Comment 4 Matias De lellis 2015-04-01 15:34:53 CEST
Hi,

Before, I was a fan of this feature, but then understood that these just was wrong thought, or at least badly implemented.

Following the example of Clementine.

What sense does display the "play" option, if clementine really is playing music, or if playlist is empty?
What sense does display the "pause" option, if not playing music.?
What sense does display the "next" option, if there is no any next song?

The worst part is:
What sense does any of these options if clementine is not running?.

So, in general I think it is a misuse of the developers add these options to a music player but unfortunately it was the example used in ubuntu. :S

For these actions that depend on the state of the programs should not use static actions. We need to define another standard with dbus.

A good example of static action would be: "Open file", "Open CD audio", "Add podcasd" or "Add streaming". Functions that are independent of the status of the player, and in any case, can open the player and do the actions.

Regards,
Matias.

p.s: I started writing to avoid implement this feature, but second thought, the characteristic is good. Just is that there is an abuse of the developers.

So, +1. No tested but the patch looks good. =)
Comment 5 Danila Poyarkov 2015-04-01 16:15:51 CEST
To be honest, I've implemented this feature mostly to be able to use the "Open new window in incognito mode" action in Chromium and the "Text document" action in LibreOffice, which seems to be very useful and time-saving to me. I've even added suppport of non-standart "X-Ayatana-Desktop-Shortcuts" entry for that case.

P. S. There already is a D-Bus interface for the media players. http://specifications.freedesktop.org/mpris-spec/latest/
See also: https://launchpad.net/ubuntu/+source/indicator-sound
Comment 6 Matias De lellis 2015-04-01 16:43:09 CEST
> To be honest, I've implemented this feature mostly to be able to use the "Open
> new window in incognito mode" action in Chromium and the "Text document" action > in LibreOffice.

Yes.
These are excellent examples of a good use of the feature. and for this +1 to the addition of your patch. The abuse of the characteristic is another discussion and irrelevant to this bug. Sorry for starting this discussion. ;)

> I've even added suppport of non-standart "X-Ayatana-Desktop-Shortcuts" entry
> for that case.

Please. No. Even ubuntu apps are migrating to the implementation of freedektop. So is preferable wait until chromium migrate. =)

> P. S. There already is a D-Bus interface for the media players.
> http://specifications.freedesktop.org/mpris-spec/latest/
> See also: https://launchpad.net/ubuntu/+source/indicator-sound

Yes.. 
I know it well: https://github.com/matiasdelellis/libmpris2client =)

However we need something more generic, because the music players are not the only ones who need dynamic actions. Ubuntu also has a good implementation, but is not yet standard.

Regards.
Matias.
Comment 7 Danila Poyarkov 2015-04-01 17:04:27 CEST
Created attachment 6160 
Minor fix for garcon_menu_item_reload_from_file

There was a little bug in garcon_menu_item_reload_from_file.
Comment 8 Landry Breuil editbugs 2015-04-04 16:09:42 CEST
Simon, Sean, opinion on this ?
Comment 9 Eric Koegel editbugs 2016-06-03 08:01:18 CEST
Thanks for these patches. I squashed them and merged them to master in:
commit aec77533132eb324180ef771e15226a752573eae
Author: Danila Poyarkov <dannotemail@gmail.com>
Date:   Wed Jun 1 19:55:22 2016 +0300

    Added desktop actions support (bug #11268)
    
    * Minor changes by Eric, mostly dropping the changes
    to the test-display-menu since it has changed and
    fixing a couple g_return_if_fail macros which needed
    to be g_return_val_if_fail.
    
    Signed-off-by: Eric Koegel <eric.koegel@gmail.com>

http://git.xfce.org/xfce/garcon/commit/?id=aec77533132eb324180ef771e15226a752573eae

A couple commits later, I added it as an option to the garcon-gtk menu so it will show up on the xfce4-panel if configured and added custom icon support for desktop actions. Several applications like Parole support it.

Thanks again!

Bug #11268

Reported by:
Danila Poyarkov
Reported on: 2014-11-02
Last modified on: 2016-06-03

People

Assignee:
Jannis Pohlmann
CC List:
8 users

Version

Version:
unspecified

Attachments

Added support for desktop actions (41.06 KB, patch)
2015-04-01 00:20 CEST , Danila Poyarkov
dannotemail : review? ( jannis )
Minor fix for garcon_menu_item_reload_from_file (728 bytes, patch)
2015-04-01 17:04 CEST , Danila Poyarkov
dannotemail : review? ( jannis )

Additional information