Skip to content

Instantly share code, notes, and snippets.

@vilkoz
Created February 28, 2020 18:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vilkoz/4086bac5b0f88c563c2a9d31a79af570 to your computer and use it in GitHub Desktop.
Save vilkoz/4086bac5b0f88c563c2a9d31a79af570 to your computer and use it in GitHub Desktop.
Polibar plugin for date with onclick pop-up calendar
#!/bin/bash
# ~/.config/polybar/clickable_date
day=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f3)
month=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f2)
year=$(timedatectl | grep "Local" | cut -d ":" -f2 | cut -d " " -f3 | cut -d "-" -f1)
time=$(timedatectl | grep "Local" | awk '{print $5}' | cut -d ":" -f1,2)
echo "$day-$month-$year $time"
# .config/i3/config
for_window [class="clickable_date_window"] floating toggle
for_window [class="clickable_date_window"] resize set 150px 200px
for_window [class="clickable_date_window"] move position mouse
--- a/.config/polybar/config
+++ b/.config/polybar/config
@@ -58,7 +58,7 @@ font-2 = fontawesome:pixelsize=10;1
;modules-left = bspwm i3
modules-left = i3
modules-center = mpd xwindow
-modules-right = xkeyboard filesystem xbacklight volume memory cpu wlan eth battery temperature date powermenu
+modules-right = xkeyboard filesystem xbacklight volume disk_io memory cpu wlan eth battery temperature clickable_date powermenu
tray-position = right
tray-padding = 5
@@ -440,4 +461,14 @@ bar-used-empty = █
bar-used-empty-font = 5
bar-used-empty-foreground = #44
format-underline = ${colors.primary}
+
+[module/clickable_date]
+type = custom/script
+exec = ~/.config/polybar/clickable_date
+click-right = notify-send 'click'
+; click-left = termite -e 'watch ncal' --class 'clickable_date_window'" &
+click-left = termite -e 'watch ncal' -t 'calendar' --class 'clickable_date_window'
+interval = 60
+format-underline = ${colors.primary}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment