better swaybar status

This commit is contained in:
Rudis Muiznieks 2024-06-13 21:40:54 -05:00
parent 23a036ff41
commit 05a976e654
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
4 changed files with 64 additions and 20 deletions

View File

@ -1,17 +1,60 @@
#!/usr/bin/env bash #!/usr/bin/env bash
status=$( c_dark="#181825"
c_sep="#313244"
c_bar="#89b4fa"
c_on="#a6e3a1"
c_off="#f38ba8"
c_icon="#6c7086"
separator="<span foreground='$c_sep'>󰄾 </span>"
print_stat() {
icon=$1
content=$2
if [ "$icon" = "░" ]; then
icon=' '
fi
echo -n "<span background='$c_dark' foreground='$c_bar'>$icon</span>"
printf "%3d%%" "$content"
}
print_icon() {
icon=$1
echo -n "<span foreground='$c_icon'>$icon </span>"
}
read -r -d '' -a cpu < <(sicli -i cpu -p0)
read -r -d '' -a ram < <(sicli -i memory -p0)
read -r -d '' -a disk1 < <(sicli -i disk -p0 -r /)
read -r -d '' -a disk2 < <(sicli -i disk -p0 -r /home)
timew="$(timew summary | tail -n2 | head -n1 | awk '{ print $1 }' | sed 's/:[0-9]\+$//')"
if [ "$timew" = "No" ]; then
timew="0:00"
fi
if [ "$(timew get dom.active)" = "1" ]; then if [ "$(timew get dom.active)" = "1" ]; then
echo -n '+' timew="<span foreground='$c_on'>+$timew</span>"
else else
echo -n '-' timew="<span foreground='$c_off'>-$timew</span>"
fi fi
time=$(timew summary | tail -n2 | head -n1 | awk '{ print $1 }' | sed 's/:[0-9]\+$//')
if [ "$time" != "No" ]; then clock=$(date +'%a %b %d %H:%M')
echo -n "$time"
else status=$(
echo -n '0:00' #echo -n "$blue $cpu $separator $blue󰘚 $ram $separator $blue $disk1 $blue$disk2 $separator "
fi print_icon ""
echo -n ' | ' print_stat "${cpu[0]}" "${cpu[1]}"
date +'%a %b %d %H:%M' echo -n " $separator "
print_icon "󰘚"
print_stat "${ram[0]}" "${ram[1]}"
echo -n " $separator "
print_icon "󰉉"
print_stat "${disk1[0]}" "${disk1[1]}"
echo -n ' '
print_stat "${disk2[0]}" "${disk2[1]}"
echo -n " $separator "
print_icon "󱎫"
echo -n "$timew"
echo -n " $separator <span foreground='$c_icon'>󰥔</span> $clock"
) )
echo "$status" echo "$status"

View File

@ -3,13 +3,7 @@ set $term foot
set $menu fuzzel set $menu fuzzel
set $wobpipe /run/user/1000/wobpipe set $wobpipe /run/user/1000/wobpipe
exec dbus-update-activation-environment \ exec dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
PATH LD_LIBRARY_PATH \
DISPLAY WAYLAND_DISPLAY SWAYSOCK \
XDG_CURRENT_DESKTOP=sway \
MOZ_ENABLE_WAYLAND=1 \
ELECTRON_OZONE_PLATFORM_HINT=wayland \
QT_QPA_PLATFORMTHEME=qt6ct
exec mkfifo $wobpipe exec mkfifo $wobpipe
exec tail -f $wobpipe | wob exec tail -f $wobpipe | wob

View File

@ -2,6 +2,7 @@ bar {
position top position top
font monospace 13 font monospace 13
status_command while ~/skynet/scripts/swaystatus.sh; do sleep 1; done status_command while ~/skynet/scripts/swaystatus.sh; do sleep 1; done
pango_markup enabled
colors { colors {
background $base background $base

View File

@ -5,6 +5,12 @@ export HISTSIZE=100000
export HISTFILE="$HOME/.zsh_history" export HISTFILE="$HOME/.zsh_history"
export SAVEHIST=$HISTSIZE export SAVEHIST=$HISTSIZE
# wayland env
export XDG_CURRENT_DESKTOP=sway
export MOZ_ENABLE_WAYLAND=1
export ELECTRON_OZONE_PLATFORM_HINT=wayland
export QT_QPA_PLATFORMTHEME=qt6ct
# set zsh options and features # set zsh options and features
setopt autocd setopt autocd
autoload -Uz compinit && compinit autoload -Uz compinit && compinit