polybar: add clickable calendar widget with PWA support - #18
Merged
Merged
Conversation
Wrap the date module's time string in a %{A1} action tag pointing at a
new calendar.sh, which launches the Google Calendar PWA when a browser
has installed one and falls back to calendar.google.com otherwise. PWA
desktop entries are found by Name= rather than filename, since browsers
name them <browser>-<app-id>-<profile>.desktop.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make the polybar date/time display clickable to open Google Calendar, with intelligent fallback to the web version.
Summary
Adds a new
calendar.shscript that intelligently launches Google Calendar, preferring the installed PWA (if available) over the web version. Wraps the polybar date display in a click action to invoke this script.Changes
New script:
desktop-environment/polybar/shades/scripts/calendar.shName=field in desktop entries (since PWA filenames are non-deterministic)gtk-launchorgio launchif availablexdg-open https://calendar.google.com/if no PWA is found or launch commands unavailableUpdated:
desktop-environment/polybar/shades/modules.ini%{A1:...%{A})%%escaping for strftimeImplementation notes
The script uses
grep -listo search desktop entry files for the PWA by its display name rather than filename, since browsers install PWAs with non-deterministic filenames likechromium-<app-id>-<profile>.desktop. This makes the solution robust across different browser and profile configurations.https://claude.ai/code/session_01NSrjNbSF3Pt7SDZkoh6DiH