Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion desktop-environment/polybar/shades/modules.ini
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,9 @@ interval = 10.0
;;date = %Y-%m-%d%

; Optional time format
time = " %a, %d %b %Y"
; Wrapped in a click action (%% escapes % for strftime): left click opens
; the Google Calendar PWA (or the site, if none is installed).
time = "%%{A1:~/.config/polybar/shades/scripts/calendar.sh &:} %a, %d %b %Y%%{A}"

; Available tags:
; <label> (default)
Expand Down
22 changes: 22 additions & 0 deletions desktop-environment/polybar/shades/scripts/calendar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Open the Google Calendar PWA if one is installed, otherwise fall back to
# calendar.google.com in the default browser.
#
# Browsers install PWAs as desktop entries named
# <browser>-<app-id>-<profile>.desktop, so the filename can't be pinned;
# match on the entry's Name= instead, which is the site's app name.

apps_dir="${XDG_DATA_HOME:-$HOME/.local/share}/applications"

desktop_file=$(grep -lis '^Name=Google Calendar' "$apps_dir"/*.desktop 2>/dev/null | head -n 1)

if [[ -n "$desktop_file" ]]; then
if command -v gtk-launch >/dev/null; then
exec gtk-launch "$(basename "$desktop_file" .desktop)"
elif command -v gio >/dev/null; then
exec gio launch "$desktop_file"
fi
fi

exec xdg-open "https://calendar.google.com/"
Loading