I had this cool idea to show the currently focused application on my system (i use gnome on ubuntu btw) as part of my GitHub status.
Implementation
I first went into GitHub settings and created a PAT (NOT fine-grained) with the user
scope.
Then, I found a command on GitHub to get the focused window class under Wayland in GNOME (e.g. firefox
, Code
, Org.gnome.Software
) and passed that into os.popen()
I then used GPT to generate Python code to send the GraphQL API request (although similar code for TS/JS is available in this GitHub repo)
I also added some code to map an application name to an emoji with fallbacks.
Just wrap that in a while True:
loop and you’re done—
Almost, there are a few things missing:
adding more user friendly names for apps like
Org.gnome.Software
(Ubuntu Software), but that’s something for a future point in time.clear status after some time