Skip to content

Instantly share code, notes, and snippets.

@tott
Created November 24, 2018 20:59
Show Gist options
  • Save tott/7125b5cfa1bd48d8da0e9ad89256c802 to your computer and use it in GitHub Desktop.
Save tott/7125b5cfa1bd48d8da0e9ad89256c802 to your computer and use it in GitHub Desktop.
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