Switch from catppuccin to ayu mirage for various tools, switch from p10k to starship, self made tmux and sway statusbar update
This commit is contained in:
parent
886818cd1f
commit
93e41aef46
11 changed files with 412 additions and 1874 deletions
|
|
@ -1,64 +1,76 @@
|
|||
#!/bin/sh
|
||||
#!/bin/zsh
|
||||
# Icons
|
||||
vpn_icon=""
|
||||
wifi_icon=" "
|
||||
brightness_icon=""
|
||||
bluetooth_icon=""
|
||||
keyboard_icon="⌨"
|
||||
date_icon=""
|
||||
|
||||
while true; do
|
||||
# VPN (Mullvad)
|
||||
vpn_status=$(mullvad status)
|
||||
# Example output:
|
||||
# -------------------------
|
||||
# Connected
|
||||
# Relay: se-mma-wg-101
|
||||
# Features: Quantum Resistance
|
||||
# Visible location: Sweden, Malmö. IPv4: 45.83.220.204
|
||||
# -------------------------
|
||||
is_connected=$(echo "$vpn_status" | grep -oP "Connected" | wc -l)
|
||||
if [ $is_connected -eq 1 ]; then
|
||||
is_connected=$(echo "$vpn_status" | grep -c "Connected")
|
||||
if [ "$is_connected" -eq 1 ]; then
|
||||
visible_location=$(echo "$vpn_status" | grep -oP "Visible location:\s+\K.*" | cut -d. -f1)
|
||||
vpn_status="VPN: $visible_location"
|
||||
vpn_display="$vpn_icon $visible_location"
|
||||
else
|
||||
vpn_status="VPN: Disconnected"
|
||||
vpn_display="$vpn_icon Disconnected"
|
||||
fi
|
||||
|
||||
# Network status
|
||||
ssid=$(nmcli -t -f ACTIVE,SSID dev wifi | grep -E '^yes' | cut -d: -f2)
|
||||
if [ -z "$ssid" ]; then
|
||||
network_status="WiFi: Disconnected"
|
||||
network_display="$wifi_icon Disconnected"
|
||||
else
|
||||
network_status="WiFi: $ssid"
|
||||
network_display="$wifi_icon $ssid"
|
||||
fi
|
||||
|
||||
# Date and time
|
||||
date_time=$(date +"%Y-%m-%d %H:%M")
|
||||
# Date/time
|
||||
date_time_icon="$date_icon $(date +"%a %b %d, %H:%M")"
|
||||
|
||||
# Battery status and power consumption
|
||||
battery_path="/sys/class/power_supply/macsmc-battery"
|
||||
if [ -d "$battery_path" ]; then
|
||||
battery_capacity=$(cat $battery_path/capacity)
|
||||
power_consumption=$(cat $battery_path/power_now) # in microwatts
|
||||
power_consumption_watts=$(echo "scale=2; $power_consumption / 1000000" | bc)
|
||||
battery="Battery: $battery_capacity% ($power_consumption_watts W)"
|
||||
else
|
||||
battery="Battery: N/A"
|
||||
fi
|
||||
# Battery
|
||||
battery=$("$HOME/.config/confutils/get-battery.sh")
|
||||
|
||||
# Brightness status
|
||||
# Brightness
|
||||
brightness=$(brightnessctl | grep -oP '[0-9]+(?=%)')
|
||||
brightness_status="Brightness: $brightness%"
|
||||
brightness_display="$brightness_icon $brightness%"
|
||||
|
||||
bluetooth_device=$(bluetoothctl devices Connected | awk '{$1=$2=""; print $0}' | sed 's/^ *//g')
|
||||
# Bluetooth
|
||||
bluetooth_device=$(bluetoothctl devices Connected \
|
||||
| awk '{$1=$2=""; print $0}' \
|
||||
| sed 's/^ *//g')
|
||||
if [ -z "$bluetooth_device" ]; then
|
||||
bluetooth_status=""
|
||||
bluetooth_display=""
|
||||
else
|
||||
bluetooth_status="Bluetooth: $bluetooth_device"
|
||||
bluetooth_display="$bluetooth_icon $bluetooth_device"
|
||||
fi
|
||||
|
||||
# Combine all statuses
|
||||
# Keyboard layout
|
||||
language_index=$(swaymsg -t get_inputs | jq -r '.[] | select(.type=="keyboard") | .xkb_active_layout_index' | head -n 1)
|
||||
if [ "$language_index" -eq 0 ]; then
|
||||
keyboard_layout="US"
|
||||
else
|
||||
keyboard_layout="SE"
|
||||
fi
|
||||
keyboard_display="$keyboard_icon $keyboard_layout"
|
||||
|
||||
# Combine all statuses, separated by tabs (\t).
|
||||
# - In zsh, you can do literal tabs with $'\t'
|
||||
final_status=""
|
||||
if [ -n "$bluetooth_status" ]; then
|
||||
final_status="$bluetooth_status | "
|
||||
if [ -n "$bluetooth_display" ]; then
|
||||
final_status="$bluetooth_display"
|
||||
fi
|
||||
final_status="$final_status$brightness_status | $battery | $vpn_status | $network_status | $date_time "
|
||||
echo "$final_status"
|
||||
|
||||
space=" "
|
||||
final_status="$final_status$space$brightness_display"
|
||||
final_status="$final_status$space$battery"
|
||||
final_status="$final_status$space$keyboard_display"
|
||||
final_status="$final_status$space$vpn_display"
|
||||
final_status="$final_status$space$network_display"
|
||||
final_status="$final_status$space$date_time_icon"
|
||||
final_status="$final_status "
|
||||
|
||||
echo "$final_status"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue