summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradam <56338480+adastx@users.noreply.github.com>2022-10-30 19:39:55 +0100
committeradam <56338480+adastx@users.noreply.github.com>2022-10-30 19:39:55 +0100
commit13aa86e8d1080c24afdeac51fbb8235990c8a001 (patch)
treef401944da6d0db2b5c01af284945bee0c8ec3988
parent82e2195e2e191b9885b32a888f013a945e066ab1 (diff)
polybar: major cleanup, wttr.in forecast
-rw-r--r--.config/polybar/config.ini170
-rwxr-xr-x.local/bin/statusbar/sb-forecast48
-rwxr-xr-x.local/bin/statusbar/sb-packages (renamed from .local/bin/updates)2
3 files changed, 121 insertions, 99 deletions
diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini
index f77024e..837f956 100644
--- a/.config/polybar/config.ini
+++ b/.config/polybar/config.ini
@@ -9,176 +9,150 @@ orange = #fab387
red = #f38ba8
black = #000
white = #FFF
-gray = #999
+gray = #99a0ba
alert = #bd2c40
-
-# i3wm
focused-bg = #254183
unfocused-bg = #2c2c39
visible-bg = #182858
[bar/bar1]
-monitor-fallback = eDP-1
-width = 100%
-height = 28
+bottom = false
+enable-ipc = true
fixed-center = true
-bottom = true
-
-background = ${colors.bg}
-foreground = ${colors.fg}
-
-module-margin-right = 2
-
-padding-left = 2
-padding-right = 2
-
-font-0 = Averia Libre:style=bold:size=15;4
-font-1 = WeatherIcons:size=14;6
-font-2 = Font Awesome 5 Free Solid:size=14;4
-font-3 = Font Awesome 5 Pro Solid:size=14;4
-font-4 = Font Awesome 5 Free Regular:size=14;4
-font-5 = MaterialIcons:size=16;7
+monitor-fallback = eDP-1
+cursor-click = pointer
modules-left = i3 xwindow
-modules-center =
-modules-right = weather updates-pacman-aurhelper xkeyboard pulseaudio battery date
+modules-right = forecast packages xkeyboard pulseaudio battery network date
-tray-maxsize = 25
-tray-position = none
+font-0 = Averia Libre:style=bold:size=15;4
+font-1 = Font Awesome 6 Pro Solid:size=14;5
-cursor-click = pointer
-cursor-scroll = ns-resize
+background = ${colors.bg}
+foreground = ${colors.fg}
-enable-ipc = true
+height = 28
+padding-left = 2
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
-format = <label-layout><label-indicator>
-format-spacing = 1
+format = <label-layout> <label-indicator>
+format-padding = 2
-label-layout-padding = 2
-label-layout-foreground = ${colors.yellow}
+label-indicator = %icon%
+label-indicator-foreground = ${colors.red}
-label-indicator-padding = 2
-label-indicator-background = ${colors.alert}
-label-indicator-foreground = ${colors.white}
+indicator-icon-0 = caps lock;;
[module/i3]
type = internal/i3
format = <label-state> <label-mode>
index-sort = true
wrapping-scroll = false
-
-; Only show workspaces on the same output as the bar
pin-workspaces = true
+label-separator = " "
+label-unfocused = %index%
+label-focused = %index%
+label-visible = %index%
+label-urgent = %index%
+
+label-unfocused-padding = 3
+label-focused-padding = 3
+label-visible-padding = 3
+label-urgent-padding = 3
label-mode-padding = 3
-label-mode-foreground = ${colors.black}
+
label-mode-background = ${colors.purple}
+label-mode-foreground = ${colors.black}
-; focused = Active workspace on focused monitor
-label-focused = %index%
label-focused-background = ${colors.focused-bg}
label-focused-foreground = ${colors.yellow}
-label-focused-padding = 3
-; unfocused = Inactive workspace on any monitor
-label-unfocused = %index%
label-unfocused-background = ${colors.unfocused-bg}
-label-unfocused-padding = 3
-
-; visible = Active workspace on unfocused monitor
-label-visible = %index%
label-visible-background = ${colors.visible-bg}
-label-visible-padding = ${self.label-focused-padding}
-
-; urgent = Workspace with urgency hint set
-label-urgent = %index%
label-urgent-background = ${colors.alert}
-label-urgent-padding = 3
-
-label-separator = " "
[module/battery]
type = internal/battery
-full-at = 99
battery = BAT0
adapter = ADP1
-poll-interval = 5
+format-discharging = <ramp-capacity>
format-charging = <label-charging>
-format-discharging = <ramp-capacity> <label-discharging>
-format-full = <ramp-capacity> <label-full>
-
-format-charging-foreground = ${colors.red}
-format-discharging-foreground = ${colors.red}
-format-full-foreground = ${colors.red}
+format-full = <label-full>
-label-charging = " %percentage%"
-label-discharging = %percentage%
-label-full = %percentage%
+ramp-capacity-0 = 
+ramp-capacity-1 = 
+ramp-capacity-2 = 
+ramp-capacity-3 = 
+ramp-capacity-4 = 
-label-charging-padding = 2
-label-discharging-padding-right = 2
-label-full-padding-right = 2
+label-charging = 
+label-full = 
-ramp-capacity-padding-left = 2
-ramp-capacity-0 = " "
-ramp-capacity-1 = " "
-ramp-capacity-2 = " "
-ramp-capacity-3 = " "
-ramp-capacity-4 = " "
+format-discharging-padding = 2
+format-charging-padding = 2
+format-full-padding = 2
[module/date]
type = internal/date
interval = 5
-date-alt = ""
-date = "%a, %d %b "
-
-time-alt = %H:%M
-time = %H:%M
-
label = %date%%time%
label-foreground = ${colors.blue}
label-padding = 2
+date = "%a, %d %b "
+date-alt = ""
+
+time = %H:%M
+time-alt = %H:%M
+
[module/pulseaudio]
type = internal/pulseaudio
-format-volume = <label-volume>
+format-volume = <ramp-volume>
-label-volume = " %percentage%"
-label-volume-foreground = ${colors.green}
-label-volume-padding = 2
-
-label-muted = " muted"
+label-muted = 
label-muted-foreground = ${colors.gray}
label-muted-padding = 2
+ramp-volume-padding = 2
+ramp-volume-0 = 
+ramp-volume-1 = 
+ramp-volume-2 = 
+
[module/xwindow]
type = internal/xwindow
format-padding = 3
label-maxlen = 50
-[module/updates-pacman-aurhelper]
+[module/packages]
type = custom/script
-exec = ~/.local/bin/updates
-interval = 600
+exec = ~/.local/bin/statusbar/sb-packages
format-foreground = ${colors.orange}
format-padding = 2
+interval = 600
-[module/weather]
+[module/forecast]
type = custom/script
-exec = ~/.local/bin/forecast
-interval = 600
+exec = ~/.local/bin/statusbar/sb-forecast
format-foreground = ${colors.purple}
format-padding = 2
+interval = 600
+
+click-left = ~/.local/bin/statusbar/sb-forecast --browser
+
+[module/network]
+type = internal/network
+interface-type = wireless
+interval = 3.0
-[settings]
-screenchange-reload = true
+label-connected = 
+label-disconnected = 
-[global/wm]
-margin-top = 5
-margin-bottom = 5
+label-connected-padding = 2
+label-disconnected-padding = 2
+label-disconnected-foreground = ${colors.gray}
diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast
new file mode 100755
index 0000000..ec3e590
--- /dev/null
+++ b/.local/bin/statusbar/sb-forecast
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+LOCATION=$(<$XDG_CONFIG_HOME/forecast/location)
+
+main () {
+ case "$1" in
+ -b|--browser)
+ xdg-open https://wttr.in/$LOCATION
+ exit 0 ;;
+ esac
+
+ res=$(curl -sf wttr.in/$LOCATION?format="%x+%t") || exit 1
+ arr=($res)
+
+ icon=$(condition_icon ${arr[0]})
+ temp=$(temperature ${arr[1]})
+ echo $icon $temp
+}
+
+condition_icon () {
+ case "$1" in
+ 'mm') echo  ;;
+ '=') echo  ;;
+ '///') echo  ;;
+ '//') echo  ;;
+ '**') echo  ;;
+ '*/*') echo  ;;
+ '/') echo  ;;
+ '.') echo  ;;
+ 'x') echo  ;;
+ 'x/') echo  ;;
+ '*') echo  ;;
+ '*/') echo  ;;
+ 'm') echo  ;;
+ 'o') echo  ;;
+ '/!/') echo  ;;
+ '!/') echo  ;;
+ '*!*') echo  ;;
+ 'mmm') echo  ;;
+ *) echo ? ;;
+ esac
+}
+
+temperature () {
+ echo $1 | sed 's/+//' | sed 's/C//'
+}
+
+main "$@"
diff --git a/.local/bin/updates b/.local/bin/statusbar/sb-packages
index 7af054a..bbdefb1 100755
--- a/.local/bin/updates
+++ b/.local/bin/statusbar/sb-packages
@@ -18,5 +18,5 @@ aur_ignored=$($HOME/.local/bin/aurignored | wc -l)
updates=$((updates_arch + updates_aur - $aur_ignored))
if [ "$updates" -gt 0 ]; then
- echo " $updates"
+ echo " $updates"
fi