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

core: detect what desktop environment the user is using #4343

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

jcollie
Copy link
Collaborator

@jcollie jcollie commented Jan 2, 2025

No description provided.

Copy link
Collaborator

@tristan957 tristan957 left a comment

Choose a reason for hiding this comment

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

It's XDG_CURRENT_DESKTOP

@jcollie
Copy link
Collaborator Author

jcollie commented Jan 2, 2025

It's XDG_CURRENT_DESKTOP

XDG_CURRENT_DESKTOP is wierd, it can actually be a list of up to 3 desktop names. I have no idea why you would want that but that's what it's documented to be. XDG_SESSION_DESKTOP is just the current DE.

Copy link
Contributor

@rhodes-b rhodes-b left a comment

Choose a reason for hiding this comment

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

this could also potentially be a good time / place to also print what OS someone is using

its typically found in /etc/*release on many distros not sure how much this covers

I know you talked about that before

@jcollie
Copy link
Collaborator Author

jcollie commented Jan 2, 2025

this could also potentially be a good time / place to also print what OS someone is using

its typically found in /etc/*release on many distros not sure how much this covers

I know you talked about that before

Yeah I've thought about that but /etc/os-release is not super easy to parse (I believe basically it's a list of shell environment variables). So I don't think that it's necessary to do that at this point. It's definitely out of scope for this PR.

@anund
Copy link
Contributor

anund commented Jan 2, 2025

May want to grab XDG_SESSION_TYPE as additional information in the other case. Wandering around a few vms with default, perhaps incorrect, configuration XDG_SESSION_DESKTOP wasn't always set. (plasma,gnome,hyprland seem ok).

@jcollie
Copy link
Collaborator Author

jcollie commented Jan 2, 2025

May want to grab XDG_SESSION_TYPE as additional information in the other case. Wandering around a few vms with default, perhaps incorrect, configuration XDG_SESSION_DESKTOP wasn't always set. (plasma,gnome,hyprland seem ok).

We're mainly concerned with gnome/not gnome at this point. If we ever need to detect a specific DE other than Gnome we can refine this check. We can add XDG_SESSION_TYPE in the future if it's needed.

src/cli/version.zig Outdated Show resolved Hide resolved
src/os/desktop.zig Show resolved Hide resolved
@mitchellh
Copy link
Contributor

Can you please rebase, there are conflicts

1 similar comment
@mitchellh
Copy link
Contributor

Can you please rebase, there are conflicts

@jcollie
Copy link
Collaborator Author

jcollie commented Jan 3, 2025

Can you please rebase, there are conflicts

Done, and done.

@mitchellh mitchellh enabled auto-merge January 3, 2025 00:30
@mitchellh mitchellh merged commit a10b45f into ghostty-org:main Jan 3, 2025
24 checks passed
@github-actions github-actions bot added this to the 1.0.2 milestone Jan 3, 2025
@jcollie jcollie deleted the detect-desktop branch January 3, 2025 01:11
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

Successfully merging this pull request may close these issues.

5 participants