zed icon indicating copy to clipboard operation
zed copied to clipboard

Windows & Linux: Support `set_dock_menu` equivalents across platforms in a unified way

Open versecafe opened this issue 9 months ago • 2 comments

Check for existing issues

  • [X] Completed

Describe the feature

Add support for set_dock_menu to Windows and Linux called Dock : MacOS, Desktop Launcher Actions : Linux, Taskbar Customization : Windows

Windows

Called User Tasks form a menu that supports

  • icon
  • title
  • description
  • action (program + arguments)

Linux ~

Writing to .desktop file allows custom actions within some linux desktop environments

  • title
  • action (program + arguments)

More information at freedesktop.org # Table 2. Standard Keys

Key Goal

Avoid fragmenting implementations of this into a per OS custom system and falling into the same pit electron has when handling dock menus

If applicable, add mockups / screenshots to help present your vision of the feature

Linux Sample

image

Windows Sample

image

versecafe avatar May 20 '24 23:05 versecafe

https://github.com/zed-industries/zed/pull/9919 (and the PR it follows-up) https://github.com/zed-industries/zed/pull/12067 established the API as

https://github.com/zed-industries/zed/blob/ba1d28f160459bc13c6ec9f044afff1f97fae294/crates/gpui/src/platform.rs#L138-L139

So far, only macOS code provides impls for the methods, but nominally the issue is implemented already — there's a unified way to set menu items and recently opened files. Other platforms are sure welcome to add those, and that sure happens eventually, so should we close the issue?

SomeoneToIgnore avatar May 21 '24 04:05 SomeoneToIgnore

Unfortunately, I don't think it's possible to add desktop actions dynamically on linux, they are the equivalent of the dock menu but they work more like iOS when you long press an app on the homescreen, in that they are accessible even when Zed is closed. They are currently only used once with a constant value, so it should be simple to add it (for reference, this is vscode's desktop file with the same action), avoiding duplicating action definitions and having it work for arbitrary GPUI applications sounds complicated and depends on their build/packaging scripts...

For recent files, I found this ancient Recent File Storage Specification which sounds like it might be used by desktops, but then this Desktop Bookmark Specification seems to replace it. It could've sworn this was supported on gnome but apparently not, I'm still trying to decipher what spec is used, I found this gnome extension that uses Gtk.RecentManager which uses gio's recent://, and on the KDE side I found this which and the backend code it's referring to.

bbb651 avatar May 21 '24 12:05 bbb651