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