xpra icon
Bug tracker and wiki

Opened 3 months ago

Closed 4 weeks ago

#1961 closed enhancement (fixed)

easier start-command: expose applications

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 2.5
Component: core Version: 2.3.x
Keywords: Cc:

Description

We can use python-xdg Menu to get the list of .desktop applications.
And inotify to watch for changes.
Then if the client supports it, we send the list of commands - and maybe inline a small version of the icon?

Then the start-command dialog can offer a menu.

(on mswindows, we could use Programmatically access All Users Start Menu, macos: not sure)

Change History (17)

comment:1 Changed 3 months ago by Antoine Martin

Milestone: 3.02.5
Status: newassigned

comment:2 Changed 2 months ago by Antoine Martin

Done in r20699.

Still TODO:

comment:3 Changed 2 months ago by mjharkin

Really like this feature but think it could be more accessible from the main tray menu. What do you think?

Forgive my horrible Python coding but a quick example is here:
https://github.com/mjharkin/Xpra/commit/63daf5a7e48f704bf0e8df0462c3d7fcad7b0f02

comment:4 Changed 8 weeks ago by Antoine Martin

Owner: changed from Antoine Martin to mjharkin
Status: assignednew

Updates:

  • r20811 python3 compatibility
  • r20813: forward icon data, add "start" tray menu, etc..

@mjharkin: is that good enough? I've renamed the menu entry to "start" amongst other changes.

Still TODO:

  • some icons are missing - not sure why, especially for categories
  • the cost of sending the icons can be high (hundreds of KB), so it might be worth using a dedicated packet for "xdg-data" to avoid slowing down the initial "hello" packet - could also be used with inotify to send updates when the menu data changes (ie: application added or removed)
  • not sure we should keep the "start command" menu entry under server, it is mostly redundant now
  • we could recycle it to add a "custom command" menu entry, maybe at the bottom of the category list?

comment:5 Changed 8 weeks ago by mjharkin

I think start.png is missing from the r20813 commit.
I've the same issue with category icons.
Otherwise looks great.
Thanks.

comment:6 Changed 8 weeks ago by Antoine Martin

Owner: changed from mjharkin to Antoine Martin
Status: newassigned
  • r20827 adds the missing icon
  • r20826 tries harder to find icons for all the applications and categories (ugly and slow filesystem glob since pyxdg doesn't seem to want to find them..)

The only other change I would like to get in this release is the move to a separate "xdg-data" packet.

comment:7 Changed 7 weeks ago by Antoine Martin

r20846 avoid errors with win32 clients: convert xpm icons to png server-side before sending.

comment:8 Changed 7 weeks ago by Antoine Martin

code made more resilient in r20850: found some xpm icons that pillow could not load, we now log a warning and continue without.

comment:9 Changed 7 weeks ago by Antoine Martin

  • r20853: load xdg data in the background so we don't slow down the first connection by loading the menus synchronously then
  • r20852: show which icon filename caused the error
Last edited 7 weeks ago by Antoine Martin (previous) (diff)

comment:10 Changed 7 weeks ago by mjharkin

With the changes for xpm load failure handling r20850, if the icon fails to load there is no menu item created. Could this be changed to load with a default icon or no icon?

Thanks.

comment:11 Changed 7 weeks ago by Antoine Martin

mjharkin: try r20882, which should also fix the icon loading for tricky 'xpm' files: we now try loading with GTK first, and fallback to Pillow only if that fails. (and failures won't fail the whole desktop entry)

comment:12 Changed 7 weeks ago by mjharkin

Looks good. Icons load correctly now.

Thanks.

comment:13 Changed 7 weeks ago by mjharkin

XDG commands can also include %f %F %u %U placeholders.
(https://portland.freedesktop.org/xdg-utils-1.1.0-rc1/scripts/html/xdg-desktop-menu.html)

I think it's best to remove them on the client side, incase we want to use them later on.

Something like this should fix the issue for now:

In gtk_tray_menu_base.py->make_applaunch_menu_item()

import re
...
command = re.sub('\%[fFuU]', '', command)

comment:14 Changed 7 weeks ago by Antoine Martin

mjharkin: thanks, applied in r20913.
Yes, those could eventually be used to support "open with xyz on server".

comment:15 Changed 6 weeks ago by Antoine Martin

Resolution: fixed
Status: assignedclosed

Packaging fix for win32 in r20966.

comment:16 Changed 5 weeks ago by totaamwin32

Resolution: fixed
Status: closedreopened

Some SVG icons must have text in them, because the win32 builds moan about fonts:

(Xpra:4056): Pango-WARNING **: couldn't load font "Bitstream Vera Sans Not-Rotated 11.7294921875", \
    falling back to "Sans Not-Rotated 11.7294921875", expect ugly output.

Avoid SVG? Convert to bitmap icons on the fly? Find a way to silence the warning?
Just ignore it?

Some relevant info: Pango unable to find fonts with librsvg

Last edited 5 weeks ago by totaamwin32 (previous) (diff)

comment:17 Changed 4 weeks ago by Antoine Martin

Resolution: fixed
Status: reopenedclosed

Let's ignore the warning since we can't silence it: https://stackoverflow.com/a/18955845/428751: I found out this is currently not possible and a known bug within either gobject-introspection or glib, since g_log_set_handler is not bindable, links to gobject-introspection: g_log_set_handler is not available

Note: See TracTickets for help on using tickets.