Browse Source

Added dzen2 calendar popup scripts for panel.

master
Daniel Sissom 5 years ago
parent
commit
e919395e51
Signed by untrusted user who does not match committer: djsissom GPG Key ID: 2C30FFB796852389
3 changed files with 78 additions and 1 deletions
  1. + 1
    - 1
      bspwm/panel/panel_bar
  2. + 68
    - 0
      bspwm/panel/scripts/calendar
  3. + 9
    - 0
      bspwm/panel/scripts/togglecal

+ 1
- 1
bspwm/panel/panel_bar

@ -67,5 +67,5 @@ while read -r line ; do
wm_infos="$wm_infos%{F-} %{F-}"
;;
esac
printf "%s\n" "%{S+}%{l}  $title%{c}$wm_infos%{r}$sys_infos ⏻ "
printf "%s\n" "%{S+}%{l}  $title%{c}$wm_infos%{r}%{A:togglecal:}$sys_infos%{A} ⏻ "
done

+ 68
- 0
bspwm/panel/scripts/calendar

@ -0,0 +1,68 @@
#!/usr/bin/env sh
#source $HOME/.cache/wal/colors.sh
color0="#000000"
color5="#FFFFFF"
pkill -f "dzen2 -title-name calendar"
ORIG_IFS=$IFS
IFS=" " read current_month current_year <<< $(date +"%m %Y")
IFS=$ORIG_IFS
screen=1
OPTS=`getopt -o m:y:s: -- "$@"`
eval set -- "$OPTS"
# <<<
while true; do
case "$1" in
-m ) month="$2"; shift 2 ;;
-y ) year="$2"; shift 2 ;;
-s ) screen="$2"; shift 2 ;;
-- ) shift; break ;;
* ) break ;;
esac
done
month=${month:-$current_month}
year=${year:-$current_year}
if (( month > 12)); then
month=1
((year++))
fi
if ((month < 1)); then
month=12
((year--))
fi
back="^ca(1, calendar -m $((month-1)) -y $year)<^ca()"
next="^ca(1, calendar -m $((month+1)) -y $year)>^ca()"
out=$(cal $month $year | sed "1s/^ /$back/; 1s/ $/$next/")
lines=$(echo "$out" | wc -l)
if test "$month" -eq "$current_month" && test "$year" -eq "$current_year"; then
out=$(echo "$out" | sed "2,$ s/$(date +%e)/^fg($color0)^bg($color5)\0^fg()^bg()/")
fi
echo "$out" | dzen2 \
-title-name "calendar" \
-bg "$color0" \
-fg "$color5" \
-x "-242" \
-y "20" \
-h 30 \
-l $((lines-1)) \
-w 240 \
-fn "Source Code Pro" \
-e "onstart=uncollapse;button3=exit" \
-ta c \
-sa c \
-xs $screen \
-p &

+ 9
- 0
bspwm/panel/scripts/togglecal

@ -0,0 +1,9 @@
#!/usr/bin/env sh
wm_name='calendar'
if xdo id -a "$wm_name" > /dev/null; then
xdo kill $(xdo id -a "$wm_name")
else
calendar &
fi

Loading…
Cancel
Save