Skip to content

Add app id setting for linux#1963

Merged
hecrj merged 2 commits into
iced-rs:masterfrom
tarkah:feat/linux-app-id
Jul 26, 2023
Merged

Add app id setting for linux#1963
hecrj merged 2 commits into
iced-rs:masterfrom
tarkah:feat/linux-app-id

Conversation

@tarkah

@tarkah tarkah commented Jul 21, 2023

Copy link
Copy Markdown
Member

This adds a new platform specific window setting on linux to set application_id. This allows the user to reliably tie their application to the XDG spec for .desktop file, where icon can be specified.

Without this, the application id (on X11, this is WMClass) is set to the executable name so renaming the application breaks proper .desktop usage.

Comment thread winit/src/settings.rs
Comment on lines +199 to +220
#[cfg(target_os = "linux")]
{
#[cfg(feature = "x11")]
{
use winit::platform::x11::WindowBuilderExtX11;

window_builder = window_builder.with_name(
&self.platform_specific.application_id,
&self.platform_specific.application_id,
);
}
#[cfg(feature = "wayland")]
{
use winit::platform::wayland::WindowBuilderExtWayland;

window_builder = window_builder.with_name(
&self.platform_specific.application_id,
&self.platform_specific.application_id,
);
}
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This technically sets the same field twice by default since both features are enabled. I confirmed they both set the same field internally, but I felt this was easier to read than 3 different sets of cfg attributes to determine which import is used.

@hecrj hecrj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks 🙇

@hecrj hecrj added the feature New feature or request label Jul 26, 2023
@hecrj hecrj added this to the 0.10.0 milestone Jul 26, 2023
@hecrj hecrj added the shell label Jul 26, 2023
@hecrj hecrj force-pushed the feat/linux-app-id branch from 88fc193 to 13c8d96 Compare July 26, 2023 18:16
@hecrj hecrj enabled auto-merge July 26, 2023 18:16
@hecrj hecrj merged commit 07f091d into iced-rs:master Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request shell

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants