mirror of
https://github.com/Fluffy-Bean/dots.git
synced 2025-06-29 20:46:16 +00:00
Server Status thingy
This commit is contained in:
parent
848aa53c6a
commit
d5081812ae
6 changed files with 66 additions and 4 deletions
|
@ -51,17 +51,17 @@ foreground = ${colors.foreground}
|
||||||
font-0 = Rubik:size=11:weight=Medium;2
|
font-0 = Rubik:size=11:weight=Medium;2
|
||||||
font-1 = Iosevka Nerd Font:size=18;4
|
font-1 = Iosevka Nerd Font:size=18;4
|
||||||
font-2 = Material:size=13;3
|
font-2 = Material:size=13;3
|
||||||
font-3 = Material:size=13;2
|
font-3 = Material:size=13;1
|
||||||
|
|
||||||
|
|
||||||
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
||||||
;; BAR SETUP
|
;; BAR SETUP
|
||||||
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
||||||
modules-left = dateL date dateR space timeL time timeR
|
modules-left = dateL date dateR space timeL time timeR space1 serverL servers serverR
|
||||||
modules-center = spotifyL spotify spotifyR
|
modules-center = spotifyL spotify spotifyR
|
||||||
modules-right = sysiconL dnd updates network bluetooth sysiconR space1 volumeL volume volumeR space2 powerL power powerR
|
modules-right = sysiconL dnd updates network bluetooth sysiconR space2 volumeL volume volumeR space3 powerL power powerR
|
||||||
|
|
||||||
;; Theres also dnd and mic modules that I don't really use
|
;; Theres also dnd and mic modules that I don't use so much
|
||||||
|
|
||||||
|
|
||||||
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
||||||
|
|
|
@ -13,6 +13,12 @@ content-background = ${colors.sepback}
|
||||||
content-foreground = ${colors.modback}
|
content-foreground = ${colors.modback}
|
||||||
content = "%{T2}%{T-}"
|
content = "%{T2}%{T-}"
|
||||||
|
|
||||||
|
[module/serverL]
|
||||||
|
type = custom/text
|
||||||
|
content-background = ${colors.sepback}
|
||||||
|
content-foreground = ${colors.modback}
|
||||||
|
content = "%{T2}%{T-}"
|
||||||
|
|
||||||
[module/spotifyL]
|
[module/spotifyL]
|
||||||
type = custom/text
|
type = custom/text
|
||||||
content-background = ${colors.background}
|
content-background = ${colors.background}
|
||||||
|
|
|
@ -9,6 +9,12 @@ content = "%{T2}%{T-}"
|
||||||
|
|
||||||
[module/timeR]
|
[module/timeR]
|
||||||
type = custom/text
|
type = custom/text
|
||||||
|
content-background = ${colors.sepback}
|
||||||
|
content-foreground = ${colors.modback}
|
||||||
|
content = "%{T2}%{T-}"
|
||||||
|
|
||||||
|
[module/serverR]
|
||||||
|
type = custom/text
|
||||||
content-background = ${colors.background}
|
content-background = ${colors.background}
|
||||||
content-foreground = ${colors.modback}
|
content-foreground = ${colors.modback}
|
||||||
content = "%{T2}%{T-}"
|
content = "%{T2}%{T-}"
|
||||||
|
|
32
polybar/scripts/server_status.sh
Executable file
32
polybar/scripts/server_status.sh
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#Script made by Fluffy, use/modify to your needs!
|
||||||
|
#Twitter: fluffybeanUwU
|
||||||
|
#Website: gay.fluffybean.gay
|
||||||
|
#GitHub: Fluffy-Bean
|
||||||
|
|
||||||
|
server_list=$(cat ~/.config/polybar/scripts/server_list.txt)
|
||||||
|
server_status=()
|
||||||
|
|
||||||
|
for server in $server_list
|
||||||
|
do
|
||||||
|
ip=$(ping -W 1 -c 1 -4 $server)
|
||||||
|
if [ $(echo $ip | grep "1 received" | wc -c) -eq 0 ]
|
||||||
|
then
|
||||||
|
server_status+=("%{F#666}%{F-}")
|
||||||
|
else
|
||||||
|
if [ $(echo $ip | grep "0% packet loss" | wc -c) -eq 0 ]
|
||||||
|
then
|
||||||
|
server_status+=("%{F#B66467}%{F-}")
|
||||||
|
else
|
||||||
|
server_status+=("")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $(echo $server_status | wc -c) -eq 0 ]
|
||||||
|
then
|
||||||
|
echo "Error: No servers/IPs in server_list.txt"
|
||||||
|
else
|
||||||
|
echo "${server_status[*]}"
|
||||||
|
fi
|
|
@ -15,3 +15,8 @@ content = " "
|
||||||
type = custom/text
|
type = custom/text
|
||||||
content-background = ${colors.sepback}
|
content-background = ${colors.sepback}
|
||||||
content = " "
|
content = " "
|
||||||
|
|
||||||
|
[module/space3]
|
||||||
|
type = custom/text
|
||||||
|
content-background = ${colors.sepback}
|
||||||
|
content = " "
|
||||||
|
|
|
@ -26,6 +26,19 @@ label = "%time%"
|
||||||
format-background = ${colors.modback}
|
format-background = ${colors.modback}
|
||||||
|
|
||||||
|
|
||||||
|
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
||||||
|
;; Servers
|
||||||
|
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
||||||
|
[module/servers]
|
||||||
|
type = custom/script
|
||||||
|
interval = 5
|
||||||
|
|
||||||
|
format-background = ${colors.modback}
|
||||||
|
;format-padding = 1
|
||||||
|
|
||||||
|
exec = ~/.config/polybar/scripts/server_status.sh
|
||||||
|
|
||||||
|
|
||||||
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
||||||
;; SPOTIFY
|
;; SPOTIFY
|
||||||
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue