Created
November 24, 2018 20:59
-
-
Save tott/7125b5cfa1bd48d8da0e9ad89256c802 to your computer and use it in GitHub Desktop.
polybar popup calendar
This file contains 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
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