Improve few polybar scripts
This commit is contained in:
parent
1571bc6b34
commit
6b5b8b92f4
@ -359,7 +359,7 @@
|
||||
click-right = ~/.config/polybar/scripts/mail-refresh.sh
|
||||
format = <label>
|
||||
exec = ~/.config/polybar/scripts/mail-status.sh
|
||||
interval = 1
|
||||
interval = 2
|
||||
#+END_SRC
|
||||
|
||||
** Unread Mail Scripts
|
||||
@ -387,10 +387,10 @@
|
||||
#+begin_src bash
|
||||
dunstify --replace=98465 "Mails " "Syncing...";
|
||||
~/scripts/checkmail.sh -q && \
|
||||
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` && \
|
||||
if [ "$mail_nb" -eq "0" ]; then
|
||||
dunstify --replace=98465 "Mails " "No new mail";
|
||||
fi
|
||||
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` && \
|
||||
if [ "$mail_nb" -eq "0" ]; then
|
||||
dunstify --replace=98465 "Mails " "No new mail";
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
** Open Mails
|
||||
@ -410,7 +410,7 @@
|
||||
|
||||
format-underline = ${colors.bg}
|
||||
click-left = ~/.config/polybar/scripts/news-open.sh
|
||||
click-right = ~/.config/polybar/scripts/news-refresh.sh
|
||||
click-right = ~/.config/polybar/scripts/news-refresh.sh &
|
||||
format = <label>
|
||||
exec = ~/.config/polybar/scripts/news-status.sh
|
||||
interval = 60
|
||||
@ -439,11 +439,15 @@
|
||||
:header-args+: :shebang "#!/usr/bin/env bash"
|
||||
:END:
|
||||
#+begin_src bash
|
||||
dunstify --replace=38492 "Newsboat " "Reloading...";
|
||||
if pgrep -x "newsboat" >/dev/null; then
|
||||
dunstify --replace=38492 "Newsboat " "Already running";
|
||||
else
|
||||
dunstify --replace=38492 "Newsboat " "Reloading...";
|
||||
|
||||
newsboat -x reload && /
|
||||
news_nb=`newsboat -x print-unread | cut -d " " -f1` && \
|
||||
dunstify --replace=38492 "Newsboat " "$news_nb Unread News";
|
||||
newsboat -x reload && /
|
||||
news_nb=`newsboat -x print-unread | cut -d " " -f1` && \
|
||||
dunstify --replace=38492 "Newsboat " "$news_nb Unread News";
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
** Open Newsboat
|
||||
@ -468,7 +472,7 @@
|
||||
interval = 2
|
||||
#+END_SRC
|
||||
|
||||
** Redshift Scripts
|
||||
** Redshift - Status
|
||||
:PROPERTIES:
|
||||
:header-args: :tangle ~/.config/polybar/scripts/redshift-status.sh
|
||||
:header-args+: :comments both :mkdirp yes
|
||||
@ -490,9 +494,11 @@
|
||||
:END:
|
||||
#+begin_src bash
|
||||
if pgrep -x "redshift" >/dev/null; then
|
||||
killall redshift;
|
||||
killall redshift && \
|
||||
dunstify --replace=36492 "Redshift 望" "Turned off";
|
||||
else
|
||||
nohup redshift > /dev/null 2>&1 &
|
||||
dunstify --replace=36492 "Redshift 望" "Starting...";
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
@ -535,11 +541,15 @@
|
||||
tmpfile="/tmp/vpnstatus";
|
||||
|
||||
if [ -f $tmpfile ] && grep -q "on" $tmpfile; then
|
||||
nordvpn disconnect && dunstify --replace=23198 "VPN" "Disconnected" && echo "off" > $tmpfile;
|
||||
nordvpn disconnect && \
|
||||
dunstify --replace=23198 "VPN" "Disconnected" && \
|
||||
echo "off" > $tmpfile;
|
||||
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" && echo "on" > $tmpfile;
|
||||
nordvpn connect $country && \
|
||||
dunstify --replace=23198 "VPN" "Connected to $country" && \
|
||||
echo "on" > $tmpfile;
|
||||
fi
|
||||
#+END_SRC
|
||||
|
||||
@ -581,8 +591,9 @@
|
||||
:END:
|
||||
#+BEGIN_SRC bash
|
||||
dunstify --replace=64654 'Packages ' "Refreshing..."
|
||||
|
||||
yay -Sy > /dev/null 2>&1 && \
|
||||
package_nb=`yay -Qu 2> /dev/null | wc -l`;
|
||||
package_nb=`yay -Qu 2> /dev/null | wc -l`;
|
||||
|
||||
if [ "$package_nb" -eq "0" ]; then
|
||||
dunstify --replace=64654 'Packages ' "No upgrade available"
|
||||
@ -642,15 +653,15 @@
|
||||
#+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
|
||||
if [ -f $tmpfile ] && grep -q "off" $tmpfile ; then
|
||||
killall -SIGUSR2 dunst && \
|
||||
echo "on" > $tmpfile;
|
||||
dunstify --replace=16549 "Notifications " "Activated";
|
||||
else
|
||||
killall -SIGUSR1 dunst && echo "off" > $tmpfile;
|
||||
dunstify --replace=16549 "Notifications " "Deactivated";
|
||||
sleep 1 && \
|
||||
killall -SIGUSR1 dunst && \
|
||||
echo "off" > $tmpfile;
|
||||
fi
|
||||
#+END_SRC
|
||||
|
||||
@ -691,13 +702,12 @@
|
||||
:END:
|
||||
|
||||
#+begin_src bash
|
||||
if pgrep -x "xautolock" >/dev/null
|
||||
then
|
||||
pkill xautolock;
|
||||
dunstify --replace=13602 'Lock Screen' 'Desactivated'
|
||||
if pgrep -x "xautolock" >/dev/null ; then
|
||||
pkill xautolock && \
|
||||
dunstify --replace=13602 'Lock Screen ' 'Desactivated'
|
||||
else
|
||||
xautolock -locker "~/scripts/lockscreen.sh" -detectsleep -time 30 -notify 60 -notifier "dunstify --replace=31846 -u critical -t 10000 -- 'Locking Screen' '60 seconds'" &
|
||||
dunstify --replace=13602 'Lock Screen' 'Activated'
|
||||
dunstify --replace=13602 'Lock Screen ' 'Activated'
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
@ -779,9 +789,11 @@
|
||||
connection=$(sudo wg show "$config" 2>/dev/null | head -n 1 | awk '{print $NF }')
|
||||
|
||||
if [ "$connection" = "$config" ]; then
|
||||
sudo wg-quick down "$config" && dunstify --replace=83244 "Wireguard" "Disconnected from $config"
|
||||
sudo wg-quick down "$config" && \
|
||||
dunstify --replace=83244 "Wireguard" "Disconnected from $config"
|
||||
else
|
||||
sudo wg-quick up "$config" && dunstify --replace=83244 "Wireguard" "Connected to $config"
|
||||
sudo wg-quick up "$config" && \
|
||||
dunstify --replace=83244 "Wireguard" "Connected to $config"
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user