diff options
Diffstat (limited to 'home-config/waybar')
-rw-r--r-- | home-config/waybar/config | 18 | ||||
-rwxr-xr-x | home-config/waybar/custom_cmus.lua | 58 | ||||
-rwxr-xr-x | home-config/waybar/custom_newsboat.sh | 12 | ||||
-rw-r--r-- | home-config/waybar/style.css | 1 |
4 files changed, 6 insertions, 83 deletions
diff --git a/home-config/waybar/config b/home-config/waybar/config index d4b2c7a..a11ec45 100644 --- a/home-config/waybar/config +++ b/home-config/waybar/config @@ -7,8 +7,6 @@ ], "modules-center": [], "modules-right": [ - "custom/cmus", - "custom/newsboat", "cpu", "memory", "temperature", @@ -28,22 +26,27 @@ "spacing": 10 }, "clock": { - "format": "{:%Y-%m-%d %a %H:%M}" + "interval": 1, + "format": "{:%Y-%m-%d %a %H:%M:%S}" }, "cpu": { + "interval": 1, "format": " {usage}%", "tooltip": false }, "memory": { + "interval": 1, "format": " {}%", "tooltip": false }, "temperature": { + "interval": 1, "thermal-zone": 1, "critical-threshold": 80, "format": " {temperatureC}°" }, "battery": { + "interval": 1, "states": { "warning": 30, "critical": 15 @@ -73,14 +76,5 @@ "format-disconnected": " disconnected", "max-length": 50, "on-click": "nm-connection-editor", - }, - "custom/cmus": { - "return-type": "json", - "exec": "$HOME/.config/waybar/custom_cmus.lua 2> /dev/null" - }, - "custom/newsboat": { - "format": " {}", - "exec": "$HOME/.config/waybar/custom_newsboat.sh 2> /dev/null", - "on-click": "alacritty -e newsboat -r" } } diff --git a/home-config/waybar/custom_cmus.lua b/home-config/waybar/custom_cmus.lua deleted file mode 100755 index e7ee033..0000000 --- a/home-config/waybar/custom_cmus.lua +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env lua - -json = require("dkjson") -posix = require("posix") - -function htmlescape(s) - s = string.gsub(s, "&", "&") - s = string.gsub(s, "<", "<") - s = string.gsub(s, ">", ">") - return s -end - -function timefmt(n) - local s = n % 60 - local m = math.floor(n / 60) - return string.format("%d:%02d", m, s) -end - -function output(text, tooltip) - text = htmlescape(text) - tooltip = htmlescape(tooltip) - print(json.encode{text=text, tooltip=tooltip, class="custom-cmus"}) -end - -function getstat(status, name) - for _, line in ipairs(status) do - if string.match(line, "^" .. name) then - return string.sub(line, string.len(name)+2) - end - end -end - -while true do - local pipe = io.popen("cmus-remote -Q") - local status = {} - for line in pipe:lines() do - table.insert(status, line) - end - local success = pipe:close() - if not success then - output(" Not running", "Not running") - elseif getstat(status, "status") == "stopped" then - output(" Not running", "Not running") - else - local playing = getstat(status, "status") - local symbol = ({playing="", paused=""})[playing] - local title = getstat(status, "tag title") - local artist = getstat(status, "tag artist") - local duration = getstat(status, "duration") - local position = getstat(status, "position") - local text = string.format("%s %s (%s)", symbol, title, timefmt(position)) - local tooltip = string.format("%s - %s (%s / %s)", - artist, title, timefmt(position), timefmt(duration) - ) - output(text, tooltip) - end - posix.sleep(1) -end diff --git a/home-config/waybar/custom_newsboat.sh b/home-config/waybar/custom_newsboat.sh deleted file mode 100755 index 1ac8428..0000000 --- a/home-config/waybar/custom_newsboat.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -while :; do - until newsboat -x reload >/dev/null; do - sleep 1; - done - until unread="$(newsboat -x print-unread)"; do - sleep 1; - done - echo "$unread" | awk '{ print $1 }' - sleep 300 -done diff --git a/home-config/waybar/style.css b/home-config/waybar/style.css index 2c716a4..9e23184 100644 --- a/home-config/waybar/style.css +++ b/home-config/waybar/style.css @@ -30,7 +30,6 @@ button { } #workspaces button { - padding: 0 5px; color: #c7c6c3; background-color: rgba(0, 0, 0, 0); } |