Created
May 1, 2020 13:11
-
-
Save iainlane/8653aa10baf651afe0638cb722baf4d8 to your computer and use it in GitHub Desktop.
am I in...?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using GLib; | |
| private bool in_desktop (string desktop) { | |
| var env = GLib.Environment.get_variable("XDG_CURRENT_DESKTOP"); | |
| if (env == null) | |
| return false; | |
| var desktop_parts = env.split(":"); | |
| return desktop in desktop_parts; | |
| } | |
| public int main (string[] args) { | |
| print("Am I in GNOME? " + (in_desktop("GNOME") ? "yes" : "no") + "\n"); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment