Update all polybar scripts

This commit is contained in:
Thomas Dehaeze 2019-12-16 11:38:04 +01:00
parent df05138340
commit a190968fe5

View File

@ -83,7 +83,7 @@
modules-left = i3 xwindow
modules-center =
modules-right = pulseaudio wireless-network xbacklight nordvpn lockscreen dunst unread_mail cpu battery temperature date
modules-right = pulseaudio wireless-network xbacklight screenshot redshift nordvpn lockscreen dunst unread_mail cpu battery temperature date
tray-position = right
tray-padding = 0
@ -338,18 +338,18 @@
label-font = 2
format-underline = ${colors.background}
click-left = termite -e "tmux -L neomutt attach" &
click-left = ~/.config/polybar/scripts/mail-open.sh
format = <label>
exec = ~/.config/polybar/scripts/unread_mails.sh
exec = ~/.config/polybar/scripts/mail-status.sh
interval = 1
#+END_SRC
** Unread Mail Scripts
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/unread_mails.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/mail-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
mails=$(du -a ~/.mail/*/Inbox/new/* 2>/dev/null | sed -n '$=')
@ -360,6 +360,16 @@
fi
#+end_src
** Open Mails
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/mail-open.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
termite -e "tmux -L neomutt attach" &
#+end_src
* Redshift
#+BEGIN_SRC conf
[module/redshift]
@ -367,31 +377,37 @@
label-font = 2
format-underline = ${colors.background}
click-left = ~/.config/polybar/scripts/redshift.sh toggle
click-left = ~/.config/polybar/scripts/redshift-toggle.sh
format = <label>
exec = ~/.config/polybar/scripts/redshift.sh
interval = 1
exec = ~/.config/polybar/scripts/redshift-status.sh
interval = 2
#+END_SRC
** Redshift Scripts
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/redshift.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/redshift-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if pgrep -x "redshift" >/dev/null; then
echo "";
echo "";
else
echo "";
echo "";
fi
#+end_src
if [ "$1" = "toggle" ]; then
if pgrep -x "redshift" >/dev/null; then
killall redshift;
else
nohup redshift > /dev/null 2>&1 &
fi
** Toggle Redshift
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/redshift-toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if pgrep -x "redshift" >/dev/null; then
killall redshift;
else
nohup redshift > /dev/null 2>&1 &
fi
#+end_src
@ -401,18 +417,18 @@
type = custom/script
format-underline = ${colors.background}
click-left = ~/bin/vpntoggle
click-left = ~/.config/polybar/scripts/nordvpn-toggle.sh
format = <label>
exec = ~/.config/polybar/scripts/nordvpn.sh
exec = ~/.config/polybar/scripts/nordvpn-status.sh
interval = 2
#+END_SRC
** Nordvpn Status script
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/nordvpn.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/nordvpn-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
vpnstatus=`nordvpn status`;
@ -425,18 +441,20 @@
fi
#+END_SRC
* TODO Caffeine
#+BEGIN_SRC conf
[module/caffeine]
type = custom/script
label-font = 2
format-underline = ${colors.background}
click-left = xautolock -disable && dunstify --replace=87901 "Lock Disabled"
click-right = xautolock -enable && dunstify --replace=87901 "Lock Enabled"
format = <label>
exec = echo -e "\uf0f4"
interval = 1
** Nordvpn Toggle
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/nordvpn-toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
if [[ $(nordvpn status) == *"Connected"* ]]; then
nordvpn disconnect && dunstify --replace=23198 "VPN" "Disconnected";
else
country=`cat ~/bin/nordvpn_countries.txt | sed 's/\s*\t\s*/ /g ; s/\s/\n/g ; s/_/ /g ; /^[a-zA-Z]/!d ; s/\(.*\)/\L\1/' | rofi -i -dmenu | sed 's/\s/_/g'`;
dunstify --replace=23198 "VPN" "Connecting to $country...";
nordvpn connect $country && dunstify --replace=23198 "VPN" "Connected to $country";
fi
#+END_SRC
* Dunst
@ -445,18 +463,18 @@
type = custom/script
format-underline = ${colors.background}
click-left = ~/bin/notifToggle
click-left = ~/.config/polybar/scripts/dunst-toggle.sh
format = <label>
exec = ~/.config/polybar/scripts/dunst.sh
exec = ~/.config/polybar/scripts/dunst-status.sh
interval = 2
#+END_SRC
** Dunst Status script
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/dunst.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/dunst-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
tmpfile="/tmp/dunststatus";
@ -464,14 +482,35 @@
if grep -q "on" $tmpfile; then
echo "";
elif grep -q "off" $tmpfile; then
echo "%{F#FB4934}%{F-}";
echo "";
fi
else
echo "";
fi
#+END_SRC
* Dunst
** Dunst Toggle
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/dunst-toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
tmpfile="/tmp/dunststatus";
if [ -f $tmpfile ]; then
if grep -q "on" $tmpfile; then
killall -SIGUSR1 dunst && echo "off" > $tmpfile;
elif grep -q "off" $tmpfile; then
killall -SIGUSR2 dunst && echo "on" > $tmpfile;
dunstify --replace=16549 "Dunst" "Activated";
fi
else
killall -SIGUSR1 dunst && echo "off" > $tmpfile;
fi
#+END_SRC
* Lock Screen
#+BEGIN_SRC conf
[module/lockscreen]
type = custom/script
@ -479,22 +518,22 @@
format-underline = ${colors.background}
click-left = ~/scripts/lockscreen-toggle.sh
format = <label>
exec = ~/.config/polybar/scripts/lockscreen.sh
exec = ~/.config/polybar/scripts/lockscreen-status.sh
interval = 2
#+END_SRC
** Lock screen Status script
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/lockscreen.sh
:header-args: :tangle ~/.config/polybar/scripts/lockscreen-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
if pgrep -x "xautolock" >/dev/null
then
echo "";
echo "";
else
echo "%{F#FB4934}%{F-}";
echo "";
fi
#+END_SRC
@ -506,8 +545,8 @@ https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweather
[module/weather]
type = custom/script
exec = ~/.config/polybar/scripts/weather.sh
click-left = ~/.config/polybar/scripts/weatheropen.sh
exec = ~/.config/polybar/scripts/weather-status.sh
click-left = ~/.config/polybar/scripts/weather-open.sh
interval = 600
label-font = 3
@ -515,7 +554,7 @@ click-left = ~/.config/polybar/scripts/weatheropen.sh
** Script to retrieve the weather
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/weather.sh
:header-args: :tangle ~/.config/polybar/scripts/weather-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
@ -619,7 +658,7 @@ click-left = ~/.config/polybar/scripts/weatheropen.sh
** TODO Open Weather Webpage
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/weatheropen.sh
:header-args: :tangle ~/.config/polybar/scripts/weather-open.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
@ -675,17 +714,17 @@ click-left = ~/.config/polybar/scripts/weatheropen.sh
#+BEGIN_SRC conf
[module/screenshot]
type = custom/text
content = ""
click-left = ~/scripts/screenshot.sh
content = ""
click-left = ~/bin/screenshot
#+END_SRC
* Scripts
** Launch
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/launch.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/launch.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
# Terminate already running bar instances
@ -702,11 +741,11 @@ click-left = ~/.config/polybar/scripts/weatheropen.sh
#+end_src
** Toggle
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/toggle.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
# Usage : toggle.sh top