Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Window icon #301

Open
3 of 4 tasks
terrarier2111 opened this issue Mar 1, 2024 · 6 comments
Open
3 of 4 tasks

Support Window icon #301

terrarier2111 opened this issue Mar 1, 2024 · 6 comments

Comments

@terrarier2111
Copy link
Member

terrarier2111 commented Mar 1, 2024

  • Windows
  • MacOS
  • Linux (X11)
  • Linux (Wayland)
@skillman623
Copy link

Protocol specification for Wayland.
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

I am running Wayland and can test this.

@skillman623
Copy link

skillman623 commented Mar 1, 2024

Icons can be stored at one of three paths according to the spec. We should check for the existence of the folders and, should the path exist, copy the Leafish icon there. The folder paths should be checked in the following order:

  • $HOME/.icons
  • $XDG_DATA_DIRS/icons
  • /usr/share/pixmaps

For Ubuntu, it looks like we can place the icon in /home/$USER/.local/share/icons in the respective folder (based on the resolution).
If this path is consistent on all major distros, we wouldn't need root to load the icon.

@terrarier2111
Copy link
Member Author

Icons can be stored at one of three paths according to the spec. We should check for the existence of the folders and, should the path exist, copy the Leafish icon there. The folder paths should be checked in the following order:

* [ ]  $HOME/.icons

* [ ]   $XDG_DATA_DIRS/icons

* [ ]  /usr/share/pixmaps

For Ubuntu, it looks like we can place the icon in /home/$USER/.local/share/icons in the respective folder (based on the resolution). If this path is consistent on all major distros, we wouldn't need root to load the icon.

Does it load the icon based on the window name?

@skillman623
Copy link

It's based on the application name if it's placed at one of those directories.
See the table here. The two options seem to be either to place any icon you need in the legacy hicolor theme folder, or to create a .desktop file that the window manager can pull information from, located at either /usr/share/applications , /usr/local/share/applications, or ~/. local/share/applications.

For dynamically changing the icon, we will have to wait for winit to add this feature for wayland as it's currently unsupported.
It looks like an API hit implementation is in the works in staging for freedesktop 2 weeks ago but as it's not final it could be a while until its supported.

@skillman623
Copy link

The required upstream patch was merged here
Next is seeing if winit has implemented the change or if we should roll our own fix.

@skillman623
Copy link

Winit still doesn't support setting the icon on Wayland via set_window_icon.

It seems like creating a file and copying it to the correct path is the method that most apps are using, although it is possible to handle this with Wayland calls directly, although only in Wayland staging for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants