polybar scripts relocation
This commit is contained in:
parent
e87850317a
commit
3ee447043d
|
|
@ -1,60 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
bluetooth_print() {
|
|
||||||
bluetoothctl | while read -r; do
|
|
||||||
if [ "$(systemctl is-active "bluetooth.service")" = "active" ]; then
|
|
||||||
printf '#1'
|
|
||||||
|
|
||||||
devices_paired=$(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2)
|
|
||||||
counter=0
|
|
||||||
|
|
||||||
echo "$devices_paired" | while read -r line; do
|
|
||||||
device_info=$(bluetoothctl info "$line")
|
|
||||||
|
|
||||||
if echo "$device_info" | grep -q "Connected: yes"; then
|
|
||||||
device_alias=$(echo "$device_info" | grep "Alias" | cut -d ' ' -f 2-)
|
|
||||||
|
|
||||||
if [ $counter -gt 0 ]; then
|
|
||||||
printf ", %s" "$device_alias"
|
|
||||||
else
|
|
||||||
printf " %s" "$device_alias"
|
|
||||||
fi
|
|
||||||
|
|
||||||
counter=$((counter + 1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf '\n'
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo "#2"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
bluetooth_toggle() {
|
|
||||||
if bluetoothctl show | grep -q "Powered: no"; then
|
|
||||||
bluetoothctl power on >> /dev/null
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
devices_paired=$(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2)
|
|
||||||
echo "$devices_paired" | while read -r line; do
|
|
||||||
bluetoothctl connect "$line" >> /dev/null
|
|
||||||
done
|
|
||||||
else
|
|
||||||
devices_paired=$(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2)
|
|
||||||
echo "$devices_paired" | while read -r line; do
|
|
||||||
bluetoothctl disconnect "$line" >> /dev/null
|
|
||||||
done
|
|
||||||
|
|
||||||
bluetoothctl power off >> /dev/null
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
--toggle)
|
|
||||||
bluetooth_toggle
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
bluetooth_print
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
|
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
STATUS=$(expressvpn status | cut -d " " -f 1)
|
|
||||||
IP=$(ip route get 8.8.8.8 | head -1 | awk '{print $7}')
|
|
||||||
SSID=$(nmcli -f SSID | head -1 | cut -d " " -f 4)
|
|
||||||
|
|
||||||
if [ "$STATUS" != "Not" ]; then
|
|
||||||
echo " ${IP} "
|
|
||||||
|
|
||||||
elif [ "$SSID" = "ASUS_5G" ] || [ "$SSID" = "ASUS" ]; then
|
|
||||||
echo " ${IP} "
|
|
||||||
|
|
||||||
elif [ "$SSID" = "OP3T" ] || [ "$SSID" = "Samsung" ]; then
|
|
||||||
echo " ${IP} "
|
|
||||||
|
|
||||||
elif [ "$SSID" != "ASUS_5G" ] || [ "$SSID" != "ASUS" ] || [ "$SSID" != "OP3T" ] || [ "$SSID" != "Samsung" ] ; then
|
|
||||||
echo " ${IP} "
|
|
||||||
fi
|
|
||||||
|
|
@ -118,16 +118,16 @@ content-background = #00000000
|
||||||
|
|
||||||
[module/bluetoothctl]
|
[module/bluetoothctl]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/.config/Scripts/bluetoothctl.sh
|
exec = ~/.config/polybar/scripts/bluetoothctl.sh
|
||||||
tail = true
|
tail = true
|
||||||
click-left = ~/.config/Scripts/bluetoothctl.sh --toggle
|
click-left = ~/.config/polybar/scripts/bluetoothctl.sh --toggle
|
||||||
label = " %output% "
|
label = " %output% "
|
||||||
label-foreground = ${colors.color0}
|
label-foreground = ${colors.color0}
|
||||||
label-background = ${colors.color6}
|
label-background = ${colors.color6}
|
||||||
|
|
||||||
[module/expressvpn-status]
|
[module/expressvpn-status]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/.config/Scripts/expressvpn-status.sh
|
exec = ~/.config/polybar/scripts/expressvpn-status.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
;format-foreground = #E5E9F0
|
;format-foreground = #E5E9F0
|
||||||
;format-backgound = #5E81AC
|
;format-backgound = #5E81AC
|
||||||
|
|
@ -139,11 +139,11 @@ label-background = ${colors.color3}
|
||||||
type = custom/script
|
type = custom/script
|
||||||
tail = true
|
tail = true
|
||||||
label = " %output% "
|
label = " %output% "
|
||||||
exec = ~/.config/Scripts/pavolume.sh --listen
|
exec = ~/.config/polybar/scripts/pavolume.sh --listen
|
||||||
click-right = exec pavucontrol
|
click-right = exec pavucontrol
|
||||||
click-left = ~/.config/Scripts/pavolume.sh --togmute
|
click-left = ~/.config/polybar/scripts/pavolume.sh --togmute
|
||||||
scroll-up = ~/.config/Scripts/pavolume.sh --up
|
scroll-up = ~/.config/polybar/scripts/pavolume.sh --up
|
||||||
scroll-down = ~/.config/Scripts/pavolume.sh --down
|
scroll-down = ~/.config/polybar/scripts/pavolume.sh --down
|
||||||
format-foreground = ${colors.color0}
|
format-foreground = ${colors.color0}
|
||||||
format-background = ${colors.color6}
|
format-background = ${colors.color6}
|
||||||
|
|
||||||
|
|
@ -164,10 +164,10 @@ label-unmounted-foreground = ${colors.foreground-alt}
|
||||||
[module/redshift]
|
[module/redshift]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
format-prefix = " "
|
format-prefix = " "
|
||||||
exec = source ~/.config/Scripts/redshift/env.sh && ~/.config/Scripts/redshift/redshift.sh temperature
|
exec = source ~/.config/polybar/scripts/redshift/env.sh && ~/.config/polybar/scripts/redshift/redshift.sh temperature
|
||||||
click-left = source ~/.config/Scripts/redshift/env.sh && ~/.config/Scripts/redshift/redshift.sh toggle
|
click-left = source ~/.config/polybar/scripts/redshift/env.sh && ~/.config/polybar/scripts/redshift/redshift.sh toggle
|
||||||
scroll-up = source ~/.config/Scripts/redshift/env.sh && ~/.config/Scripts/redshift/redshift.sh increase
|
scroll-up = source ~/.config/polybar/scripts/redshift/env.sh && ~/.config/polybar/scripts/redshift/redshift.sh increase
|
||||||
scroll-down = source ~/.config/Scripts/redshift/env.sh && ~/.config/Scripts/redshift/redshift.sh decrease
|
scroll-down = source ~/.config/polybar/scripts/redshift/env.sh && ~/.config/polybar/scripts/redshift/redshift.sh decrease
|
||||||
interval=0.5
|
interval=0.5
|
||||||
format-foreground = ${colors.color0}
|
format-foreground = ${colors.color0}
|
||||||
format-background = ${colors.color6}
|
format-background = ${colors.color6}
|
||||||
|
|
@ -175,7 +175,7 @@ format-background = ${colors.color6}
|
||||||
[module/backlight]
|
[module/backlight]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
interval = 0.2
|
interval = 0.2
|
||||||
exec = ~/.config/Scripts/backlight.sh
|
exec = ~/.config/polybar/scripts/backlight.sh
|
||||||
scroll-up = exec light -A 5
|
scroll-up = exec light -A 5
|
||||||
scroll-down = exec light -U 5
|
scroll-down = exec light -U 5
|
||||||
format-prefix = " "
|
format-prefix = " "
|
||||||
|
|
@ -187,9 +187,9 @@ label-background = ${colors.color3}
|
||||||
|
|
||||||
[module/popup-calendar]
|
[module/popup-calendar]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/.config/Scripts/popup-calendar.sh
|
exec = ~/.config/polybar/scripts/popup-calendar.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
click-left = ~/.config/Scripts/popup-calendar.sh --popup
|
click-left = ~/.config/polybar/scripts/popup-calendar.sh --popup
|
||||||
format-prefix = " "
|
format-prefix = " "
|
||||||
format-prefix-foreground = ${colors.color0}
|
format-prefix-foreground = ${colors.color0}
|
||||||
format-prefix-background = ${colors.color15}
|
format-prefix-background = ${colors.color15}
|
||||||
|
|
@ -242,7 +242,7 @@ ramp-foreground = ${colors.foreground}
|
||||||
|
|
||||||
[module/pkg]
|
[module/pkg]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = "~/.config/Scripts/arch-updates.sh -s"
|
exec = "~/.config/polybar/scripts/arch/arch-updates.sh -s"
|
||||||
tail = true
|
tail = true
|
||||||
format = "<label> "
|
format = "<label> "
|
||||||
format-prefix = " "
|
format-prefix = " "
|
||||||
|
|
@ -250,15 +250,15 @@ format-prefix-foreground = ${colors.color0}
|
||||||
format-foreground = ${colors.color0}
|
format-foreground = ${colors.color0}
|
||||||
format-background = ${colors.color9}
|
format-background = ${colors.color9}
|
||||||
click-left = st -e yay --noconfirm -Syu
|
click-left = st -e yay --noconfirm -Syu
|
||||||
click-right = "~/.config/Scripts/arch-updates.sh -c&"
|
click-right = "~/.config/polybar/scripts/arch/arch-updates.sh -c&"
|
||||||
click-middle = "~/.config/Scripts/arch-updates.sh -n"
|
click-middle = "~/.config/polybar/scripts/arch/arch-updates.sh -n"
|
||||||
|
|
||||||
[module/openweather]
|
[module/openweather]
|
||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/.config/Scripts/openweather.sh
|
exec = ~/.config/polybar/scripts/openweather.sh
|
||||||
tail = true
|
tail = true
|
||||||
interval = 600
|
interval = 600
|
||||||
click-left = ~/.config/Scripts/wttr.sh
|
click-left = ~/.config/polybar/scripts/wttr.sh
|
||||||
format = <label>
|
format = <label>
|
||||||
format-foreground = ${colors.color0}
|
format-foreground = ${colors.color0}
|
||||||
format-background = ${colors.color5}
|
format-background = ${colors.color5}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
path=${HOME}/.config/polybar/scripts/arch
|
||||||
|
#trap 'exit' SIGINT
|
||||||
|
|
||||||
|
function main_loop {
|
||||||
|
while true; do
|
||||||
|
echo '' > ~/.config/polybar/scripts/arch/status
|
||||||
|
check_for_updates
|
||||||
|
sleep 600
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function status {
|
||||||
|
echo $$ > ${path}polybar_updates.pid
|
||||||
|
while true; do
|
||||||
|
cat ~/.config/polybar/scripts/arch/status
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_for_updates {
|
||||||
|
checkupdates | nl -w2 -s '. ' >| ${path}repo.pkgs
|
||||||
|
yay -Qu --aur | nl -w2 -s '. ' >| ${path}aur.pkgs
|
||||||
|
updates=$(cat ${path}*.pkgs | wc -l)
|
||||||
|
|
||||||
|
echo "0" >| ${path}status
|
||||||
|
[ $updates -gt 0 ] && echo "%{F#e60053}$updates" >| ${path}status
|
||||||
|
|
||||||
|
>| ${path}packages
|
||||||
|
[ -s ${path}repo.pkgs ] && cat ${path}repo.pkgs >> ${path}packages
|
||||||
|
[ -s ${path}repo.pkgs ] && [ -s ${path}aur.pkgs ] && printf "\n" >> ${path}packages
|
||||||
|
[ -s ${path}aur.pkgs ] && sed '1iAUR Updates' ${path}aur.pkgs >> ${path}packages
|
||||||
|
}
|
||||||
|
|
||||||
|
function notify {
|
||||||
|
if [[ $(cat ~/.config/polybar/scripts/arch/status) -eq 0 ]]
|
||||||
|
then
|
||||||
|
twmnc "Updates 0"
|
||||||
|
else
|
||||||
|
twmnc Updates "$(cat ~/.config/polybar/scripts/arch/packages)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function upgrade {
|
||||||
|
kitty -e yay --noconfirm -Syu
|
||||||
|
echo "0" > ~/.config/polybar/scripts/arch/status
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[[ $# -eq 0 ]] && main_loop
|
||||||
|
[[ $1 == "-s" ]] && status
|
||||||
|
[[ $1 == "-c" ]] && echo '' > ~/.config/polybar/scripts/arch/status && check_for_updates
|
||||||
|
[[ $1 == "-n" ]] && notify
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
export REDSHIFT=off
|
||||||
|
export REDSHIFT_TEMP=3500
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
envFile=~/.config/polybar/scripts/env.sh
|
||||||
|
changeValue=300
|
||||||
|
|
||||||
|
changeMode() {
|
||||||
|
sed -i "s/REDSHIFT=$1/REDSHIFT=$2/g" $envFile
|
||||||
|
REDSHIFT=$2
|
||||||
|
echo $REDSHIFT
|
||||||
|
}
|
||||||
|
|
||||||
|
changeTemp() {
|
||||||
|
if [ "$2" -gt 1000 ] && [ "$2" -lt 25000 ]
|
||||||
|
then
|
||||||
|
sed -i "s/REDSHIFT_TEMP=$1/REDSHIFT_TEMP=$2/g" $envFile
|
||||||
|
redshift -x
|
||||||
|
redshift -O $((REDSHIFT_TEMP+changeValue))
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
toggle)
|
||||||
|
if [ "$REDSHIFT" = on ];
|
||||||
|
then
|
||||||
|
changeMode "$REDSHIFT" off
|
||||||
|
redshift -x
|
||||||
|
else
|
||||||
|
changeMode "$REDSHIFT" on
|
||||||
|
redshift -O "$REDSHIFT_TEMP"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
increase)
|
||||||
|
changeTemp $((REDSHIFT_TEMP)) $((REDSHIFT_TEMP+changeValue))
|
||||||
|
;;
|
||||||
|
decrease)
|
||||||
|
changeTemp $((REDSHIFT_TEMP)) $((REDSHIFT_TEMP-changeValue));
|
||||||
|
;;
|
||||||
|
temperature)
|
||||||
|
case $REDSHIFT in
|
||||||
|
on)
|
||||||
|
printf "%dK" "$REDSHIFT_TEMP"
|
||||||
|
;;
|
||||||
|
off)
|
||||||
|
printf "off"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Loading…
Reference in New Issue