aboutsummaryrefslogtreecommitdiff
path: root/config/sway
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-03-21 22:32:21 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2025-03-21 22:32:21 +0100
commitf83eb579c255fc764c182a02e70c149d913e9b6a (patch)
tree800a57f5d8b32a8366599843925a623e5e11a92f /config/sway
parent97ffb49313d7dd51ad4ec1f8e15d02c0b8e0f490 (diff)
Add niri and firends
Diffstat (limited to 'config/sway')
-rw-r--r--config/sway/config21
-rwxr-xr-xconfig/sway/status.sh56
2 files changed, 65 insertions, 12 deletions
diff --git a/config/sway/config b/config/sway/config
index ae73b47..e9130d1 100644
--- a/config/sway/config
+++ b/config/sway/config
@@ -17,7 +17,7 @@ set $right l
set $term kitty
# Theme Variables
-set $font "InputSansCompressed Light 12"
+set $font "InputSansCompressed Light 10"
set $highlight #4F8FE6
set $background #0F261FF2
set $foreground #DAE6E3
@@ -26,7 +26,7 @@ set $danger #FA2B00
set $accent2 #4F8FE6
# Font
-font pango:InputSansCompressed Light 12
+font pango:InputSansCompressed Light 10
# class / border / bg / fg / indicator / child_border
client.focused $accent $accent $background $accent $accent
@@ -45,11 +45,15 @@ set $menu bemenu-run -n -H 26 --hp 10 --fn $font -p ">" --ff "$background" --tf
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
-exec swaybg -o \* -i ~/Pictures/wallpapers/lisa-congdon/Quilt_No._4_800x800.webp -m tile
+exec swaybg -o \* -i ~/Pictures/wallpapers/david-esquivel/the-heavy-we-love.jpg -m fill
# output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs
+### WOB Bar
+
+set $WOBSOCK $XDG_RUNTIME_DIR/wob.sock
+
### Idle configuration
#
# Example configuration:
@@ -232,6 +236,15 @@ set $laptop eDP-1
bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable
+### Media Keys
+
+bindsym XF86AudioRaiseVolume exec amixer sset Master 5%+ | sed -En 's/.*\[([0-9]+)%\].*/\1/p' | head -1 > $WOBSOCK
+bindsym XF86AudioLowerVolume exec amixer sset Master 5%- | sed -En 's/.*\[([0-9]+)%\].*/\1/p' | head -1 > $WOBSOCK
+bindsym XF86AudioMute exec amixer sset Master toggle | sed -En '/\[on\]/ s/.*\[([0-9]+)%\].*/\1/ p; /\[off\]/ s/.*/0/p' > $WOBSOCK
+
+bindsym XF86MonBrightnessDown exec brightnessctl set 5%- | sed -En 's/.*\(([0-9]+)%\).*/\1/p' > $WOBSOCK
+bindsym XF86MonBrightnessUp exec brightnessctl set +5% | sed -En 's/.*\(([0-9]+)%\).*/\1/p' > $WOBSOCK
+
#
# Status Bar:
#
@@ -241,7 +254,7 @@ bar {
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
- status_command while ~/.config/sway/status.sh; do sleep 1; done
+ status_command ~/.config/sway/status.sh
colors {
statusline #B5D1CC
diff --git a/config/sway/status.sh b/config/sway/status.sh
index b81c2d4..cad468e 100755
--- a/config/sway/status.sh
+++ b/config/sway/status.sh
@@ -1,9 +1,49 @@
-bat_capacity=$(cat /sys/class/power_supply/macsmc-battery/capacity)
-bat_status=$(cat /sys/class/power_supply/macsmc-battery/status)
-datestr=$(date +'%Y-%m-%d %H:%M')
-drive=$(df -h / --output=avail | tail -n 1 | awk '{$1=$1};1')
-wifi_status=$(nmcli -t -f IN-USE,BARS,SSID dev wifi | rg '^\*')
-wifi_bars=$(echo ${wifi_status} | cut -d':' -f 2)
-wifi_ssid=$(echo ${wifi_status} | cut -d':' -f 3)
+echo "{\"version\": 1}"
+echo "["
+echo "[]"
-echo "${wifi_bars} ${wifi_ssid} | ${drive} | ${bat_capacity}% [${bat_status:0:1}] | ${datestr}"
+while true; do
+ bat_capacity=$(cat /sys/class/power_supply/macsmc-battery/capacity)
+ bat_status=$(cat /sys/class/power_supply/macsmc-battery/status)
+ if [ "$bat_status" = "Discharging" ]; then
+ bat_color="#FA2B00"
+ else
+ bat_color="#23C17C"
+ fi
+ datestr=$(date +'%Y-%m-%d %H:%M')
+ drive=$(df -h / --output=avail | tail -n 1 | awk '{$1=$1};1')
+ wifi_status=$(nmcli -t -f IN-USE,BARS,SSID dev wifi | rg '^\*')
+ wifi_bars=$(echo ${wifi_status} | cut -d':' -f 2)
+ wifi_ssid=$(echo ${wifi_status} | cut -d':' -f 3)
+ vpn_status=$(mullvad status -j | jq -r .state)
+ if [ "$vpn_status" = "connected" ]; then
+ vpn_color="#23C17C"
+ else
+ vpn_color="#FA2B00"
+ fi
+
+cat << EOF
+,[
+ {
+ "full_text": "<span foreground=\"${vpn_color}\">${wifi_bars}</span> ${wifi_ssid}",
+ "markup": "pango",
+ },
+ {
+ "full_text": "<span font-weight=\"100\">${drive}</span>",
+ "markup": "pango",
+ },
+ {
+ "full_text": "<span foreground=\"${bat_color}\" font-weight=\"100\">${bat_capacity}%</span>",
+ "markup": "pango",
+ },
+ {
+ "full_text": "<span font-weight=\"300\">${datestr}</span>",
+ "color": "#FFFFFF",
+ "markup": "pango",
+ }
+]
+EOF
+
+ # Sleep for a second before updating again
+ sleep 1
+done