diff options
| author | Robert Günzler <r@gnzler.io> | 2021-05-31 16:40:10 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2021-05-31 16:43:35 +0200 |
| commit | f9a2f1f9b6bb223dd1f52cf78392c2dd640730f3 (patch) | |
| tree | 3faf261fe5ae95e5dead6ee01936b201291319ba /.config | |
| parent | ae795bd39751b6c385193c1fc99a0f88e399e2d6 (diff) | |
waybar: various updates
* add extension to config file * covid: use tail vs head for historical data * remove network.vpn * gamma: change name from gammastep
Diffstat (limited to '.config')
| -rw-r--r-- | .config/waybar/config.jsonc (renamed from .config/waybar/config) | 38 | ||||
| -rwxr-xr-x | .config/waybar/modules/covid.sh | 2 | ||||
| -rw-r--r-- | .config/waybar/modules/gamma.go (renamed from .config/waybar/modules/gammastep.go) | 50 | ||||
| -rwxr-xr-x | .config/waybar/modules/weather.sh | 3 | ||||
| -rw-r--r-- | .config/waybar/style.css | 40 |
5 files changed, 57 insertions, 76 deletions
diff --git a/.config/waybar/config b/.config/waybar/config.jsonc index 544661d..b117c3b 100644 --- a/.config/waybar/config +++ b/.config/waybar/config.jsonc @@ -1,13 +1,13 @@ -// vim: ft=json commentstring=//\ %s { "layer": "top", "position": "top", "height": 25, "gtk-layer-shell": true, - "modules-left": ["sway/mode", "sway/workspaces", "sway/window", "custom/mpris"], + // "modules-left": ["sway/mode", "sway/workspaces", "sway/window", "custom/mpris"], + "modules-left": ["sway/mode", "sway/workspaces", "custom/mpris"], "modules-center": ["custom/weather", "clock#local", "clock#utc", "custom/toggl", "custom/todo"], - "modules-right": ["tray", "custom/covid", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "backlight", "custom/gammastep", "pulseaudio", "network#vpn", "network#tailscale", "network", "battery"], + "modules-right": ["tray", "custom/covid", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "backlight", "custom/gamma", "pulseaudio", "network#tailscale", "network", "battery"], "sway/workspaces": { "disable-scroll": true, @@ -103,18 +103,10 @@ "tooltip-format-disconnected": "disconnected", "on-click": "swx -t -f iwctl" }, - "network#vpn": { - "interface": "wg0", - "format": "", - "tooltip-format": "{ifname}: {ipaddr}/{cidr}", - "tooltip-format-disconnected": "disconnected", - "on-click": "doas wg-quick up wg0", - "on-click-right": "doas wg-quick down wg0" - }, "network#tailscale": { "interface": "tailscale0", - "format": "", - "tooltip-format": "{ifname}: {ipaddr}/{cidr}", + "format": "", + "tooltip-format": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}", "tooltip-format-disconnected": "disconnected", "on-click": "doas rc-service tailscale start", "on-click-right": "doas rc-service tailscale stop" @@ -163,17 +155,17 @@ "escape": true, "return-type": "json" }, - "custom/gammastep": { + "custom/gamma": { "format": "{icon}", "format-icons": { "day": "", "night": "" }, - "exec-if": "pgrep gammastep", - "exec": "$HOME/.config/waybar/modules/waybar-gammastep", + "exec-if": "pgrep wlsunset", + "exec": "env GAMMA_COMMAND='wlsunset -l $HOME_LAT -L $HOME_LON -p' $HOME/.config/waybar/modules/waybar-gamma", "return-type": "json", - "on-click": "pkill -x -USR1 gammastep", - "on-click-right": "pkill -x -HUP waybar-gammastep" + "on-click": "pkill -x -USR1 gamma", + "on-click-right": "pkill -x -HUP waybar-gamma" }, "custom/weather": { "format": "{icon} {percentage}℃", @@ -197,7 +189,7 @@ "tooltip": true, // "signal": 4, // "on-click-right": "pkill -SIGRTMIN+5 waybar", - "on-click": "swx -t env REPORT=1 $HOME/.config/waybar/modules/weather.sh Berlin" + "on-click": "swx -t env REPORT=1 $HOME/.config/waybar/modules/weather.sh" }, "custom/covid": { "format": "{icon} {}", @@ -214,5 +206,11 @@ "interval": 86400, "tooltip": true, "return-type": "json" - } + }, + // "custom/im": { + // "format": "{}", + // "exec": "printf ''", + // "exec-if": "pgrep anthywl", + // "interval": 5 + // } } diff --git a/.config/waybar/modules/covid.sh b/.config/waybar/modules/covid.sh index 558c2c5..9f1860c 100755 --- a/.config/waybar/modules/covid.sh +++ b/.config/waybar/modules/covid.sh @@ -71,7 +71,7 @@ tooltip=" last update: ${last_update} history (${trend_arrow}): -$(awk -F, '{print $1 " " $2}' ${HISTFILE} | head -n10) +$(awk -F, '{print $1 " " $2}' ${HISTFILE} | tail -n10) " jq -nr \ diff --git a/.config/waybar/modules/gammastep.go b/.config/waybar/modules/gamma.go index c855e1b..2a91cdb 100644 --- a/.config/waybar/modules/gammastep.go +++ b/.config/waybar/modules/gamma.go @@ -30,12 +30,6 @@ func main() { log.Printf("error: %v", e) os.Exit(1) } - // if err := Prctl(PR_SET_PDEATHSIG, - // SIGTERM, - // 0, 0, 0); err != nil { - // fmt.Fprintln(os.Stderr, err) - // os.Exit(1) - // } lookup() for { @@ -43,11 +37,9 @@ func main() { case sig := <-update: switch sig { case SIGUSR1: - // redshift off - printJson("day", "day") + printJson("day") case SIGUSR2: - // redshift on - printJson("night", "night") + printJson("night") case SIGHUP: lookup() } @@ -58,37 +50,27 @@ func main() { } } -func printJson(state, tooltip string) { +func printJson(phase string) { _ = json.NewEncoder(os.Stdout).Encode(map[string]interface{}{ - "class": state, - "alt": state, - "tooltip": "gammastep: " + tooltip, - "text": state, + "class": phase, + "alt": phase, + "tooltip": "gamma: " + phase, + "text": phase, }) } func lookup() { - b, err := exec.Command("gammastep", "-p").CombinedOutput() + cmdEnv, ok := os.LookupEnv("GAMMA_COMMAND") + if !ok { + printJson("unknown") + return + } + log.Println(cmdEnv) + b, err := exec.Command("bash", "-c", cmdEnv).Output() if err != nil { log.Printf("error: %v", err) return } - var period string - var fds = strings.Fields(string(b)) - for idx, f := range fds { - if f == "Period:" { - period = fds[idx+1] - break - } - } - switch period { - case "Night": - printJson("night", "night") - case "Transition": - printJson("night", "transition") - case "Daytime": - printJson("day", "day") - default: - printJson("unknown", "unknown") - } + phase := strings.TrimSpace(string(b)) + printJson(phase) } diff --git a/.config/waybar/modules/weather.sh b/.config/waybar/modules/weather.sh index 0b83de1..929732b 100755 --- a/.config/waybar/modules/weather.sh +++ b/.config/waybar/modules/weather.sh @@ -5,7 +5,8 @@ set -e loc=$1 if [ -z "${loc}" ]; then # use /etc/localtime - loc=$(basename "$(readlink -f /etc/localtime)") + # loc=$(basename "$(readlink -f /etc/localtime)") + loc="${HOME_LAT},${HOME_LON}" fi if [ -n "$REPORT" ]; then diff --git a/.config/waybar/style.css b/.config/waybar/style.css index 74b13af..f315b12 100644 --- a/.config/waybar/style.css +++ b/.config/waybar/style.css @@ -65,7 +65,6 @@ #idle_inhibitor, #backlight, #custom-gammastep, -#network.vpn, #network.tailscale, #custom-covid { color: #777777; @@ -76,13 +75,12 @@ #backlight:hover, #idle_inhibitor:hover, #network:hover, -#network.vpn:hover, #network.tailscale:hover, #pulseaudio:hover, #custom-mpris:hover, #custom-gammastep:hover, #custom-todo:hover { - background: red; + /* background: red; */ color: @foreground; transition-property: background; transition-duration: 0.1s; @@ -99,7 +97,7 @@ color: @foreground; background: @accentdarker; transition-property: background; - transition-duration: 0.1s; + transition-duration: 0.01s; } #workspaces button.urgent { color: @background; @@ -110,7 +108,7 @@ background: @accent; color: @foreground; transition-property: background, color; - transition-duration: 0.1s; + transition-duration: 0.01s; /* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ box-shadow: inherit; @@ -119,7 +117,7 @@ #workspaces button.urgent:hover { background: @foreground; transition-property: background; - transition-duration: 0.1s; + transition-duration: 0.01s; } #window { @@ -195,17 +193,12 @@ label:focus { border-top: 1px solid @urgent; color: @dimmed; } -#network.vpn.disconnected { - border-top: 1px solid @dimmeddarker; -} -#network.vpn:not(.disconnected) { - color: @foreground; - border-top: 1px solid @color11; -} +#network.tailscale.disabled, #network.tailscale.disconnected { border-top: 1px solid @dimmeddarker; } -#network.tailscale:not(.disconnected) { +#network.tailscale.ethernet, +#network.tailscale.linked { color: @foreground; border-top: 1px solid @color14; } @@ -214,6 +207,9 @@ label:focus { border-top: 1px solid @urgent; color: @dimmed; } +#pulseaudio.bluetooth { + border-top: 1px solid @color04; +} #temperature {} #temperature.critical { @@ -224,8 +220,7 @@ label:focus { #tray {} -#idle_inhibitor { -} +#idle_inhibitor {} #idle_inhibitor.activated { color: @foreground; border-top: 1px solid @color02; @@ -233,8 +228,14 @@ label:focus { #custom-mpris { color: @foreground; +} +#custom-mpris.playing { border-top: 1px solid @color04; } +#custom-mpris.paused { + border-top: 1px solid @color04; + font-style: italic; +} #custom-toggl { color: @foreground; @@ -262,7 +263,7 @@ label:focus { color: @background; } } -#custom-gammastep.night { +#custom-gamma.night { border-top: 1px solid @color12; color: @foreground; animation-name: flash; @@ -270,11 +271,10 @@ label:focus { animation-timing-function: linear; animation-iteration-count: 1; } -#custom-gammastep.day { +#custom-gamma.day { color: @dimmed; } -#custom-gammastep.off, -#custom-gammastep.unknown { +#custom-gamma.off { border-top: 1px solid @urgent; color: @dimmed; } |