Add calendar module to polybar
This commit is contained in:
parent
981590ab78
commit
f7165e041f
@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
modules-left = i3 bspwm xwindow
|
modules-left = i3 bspwm xwindow
|
||||||
modules-center =
|
modules-center =
|
||||||
modules-right = pulseaudio wired-network wireless-network wireguard nordvpn loopback redshift lockscreen dunst packages unread_news unread_mail temperature battery date
|
modules-right = pulseaudio wired-network wireless-network wireguard nordvpn loopback redshift lockscreen dunst packages unread_news unread_mail calendar temperature battery date
|
||||||
|
|
||||||
wm-restack = i3
|
wm-restack = i3
|
||||||
|
|
||||||
@ -461,6 +461,61 @@
|
|||||||
$TERMINAL -e "tmux new-session -A -s newsboat newsboat"
|
$TERMINAL -e "tmux new-session -A -s newsboat newsboat"
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
* Calendar
|
||||||
|
#+BEGIN_SRC conf
|
||||||
|
[module/calendar]
|
||||||
|
type = custom/script
|
||||||
|
|
||||||
|
format-underline = ${colors.bg}
|
||||||
|
click-left = ~/.config/polybar/scripts/calendar-open.sh >/dev/null 2>%1 &
|
||||||
|
format = <label>
|
||||||
|
exec = ~/.config/polybar/scripts/calendar-status.sh
|
||||||
|
interval = 5
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Calendar Status Scripts
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args: :tangle ~/.config/polybar/scripts/calendar-status.sh
|
||||||
|
:header-args+: :comments both :mkdirp yes
|
||||||
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||||
|
:END:
|
||||||
|
|
||||||
|
#+begin_src bash
|
||||||
|
next_events=$(khal list "$(date +"%H:%M")" 23:59 --format "{start-time} - {title}" -df 'SKIPME' | grep -v 'SKIPME' | grep -v 'No events')
|
||||||
|
|
||||||
|
cal_icon=""
|
||||||
|
cal_nb=""
|
||||||
|
cal_desc=""
|
||||||
|
|
||||||
|
if [ -n "$next_events" ]; then
|
||||||
|
events_number="$(echo "$next_events" | wc -l)"
|
||||||
|
|
||||||
|
if [ "$events_number" -gt "1" ]; then
|
||||||
|
cal_nb=" ($events_number)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
next_timed_events=$(echo "$next_events" | sed -e '/^[^0-9]/d')
|
||||||
|
if [ -z "$next_timed_events" ]; then
|
||||||
|
# Only full day events
|
||||||
|
cal_desc=" $(echo "$next_events" | sed -e '/^[0-9]/d;s/^ - //' | head -n 1 | cut -c 1-15)"
|
||||||
|
else
|
||||||
|
cal_desc=" $(echo "$next_timed_events" | head -n 1 | cut -c 1-20)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${cal_icon}${cal_nb}${cal_desc}"
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Open Calendar
|
||||||
|
:PROPERTIES:
|
||||||
|
:header-args: :tangle ~/.config/polybar/scripts/calendar-open.sh
|
||||||
|
:header-args+: :comments both :mkdirp yes
|
||||||
|
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||||
|
:END:
|
||||||
|
#+begin_src bash
|
||||||
|
$TERMINAL --class="Floating" -e "khal interactive"
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Redshift
|
* Redshift
|
||||||
#+BEGIN_SRC conf
|
#+BEGIN_SRC conf
|
||||||
[module/redshift]
|
[module/redshift]
|
||||||
@ -818,7 +873,7 @@
|
|||||||
#+begin_src bash
|
#+begin_src bash
|
||||||
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
|
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
|
||||||
|
|
||||||
if [ $loopback -eq 0 ]; then
|
if [ "$loopback" -eq "0" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
echo "%{F#859900}%{F-}"
|
echo "%{F#859900}%{F-}"
|
||||||
@ -835,7 +890,7 @@
|
|||||||
#+begin_src bash
|
#+begin_src bash
|
||||||
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
|
loopback=$(pactl list 2>/dev/null | grep module-loopback | wc -l)
|
||||||
|
|
||||||
if [ $loopback -eq 0 ]; then
|
if [ "$loopback" -eq "0" ]; then
|
||||||
pactl load-module module-loopback latency_msec=1 && \
|
pactl load-module module-loopback latency_msec=1 && \
|
||||||
dunstify --replace=82244 "Loopback" "Enabled"
|
dunstify --replace=82244 "Loopback" "Enabled"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user