Instantly share code, notes, and snippets.

Embed
What would you like to do?
polybar popup calendar
polybar config
[module/date]
type = custom/script
exec = ~/scripts/popup-calendar.sh
interval = 5
click-left = ~/scripts/popup-calendar.sh --popup
format-background = ${colors.alt-background}
format-foreground = ${colors.alt-foreground}
label = %output:25%
~/scripts/popup-calendar.sh
#!/bin/sh
WIDTH=270
HEIGHT=274
BOTTOM=false
DATE="$(date +"  %a, %d %b  %H:%M ")"
case "$1" in
--popup)
eval "$(xdotool getmouselocation --shell)"
if [ $BOTTOM = true ]; then
: $(( pos_y = Y - HEIGHT - 20 ))
: $(( pos_x = X - (WIDTH / 2) ))
else
: $(( pos_y = Y + 20 ))
: $(( pos_x = X - (WIDTH / 2) ))
fi
urxvt -geometry 38x18+$pos_x+$pos_y --title calendar -e dialog --no-shadow --no-lines --no-cancel --week-start 1 --clear --calendar "" 1 40
;;
*)
echo "$DATE"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment