From 3d32043a8973250ac01c0d4b19d788ae1fd07a4e Mon Sep 17 00:00:00 2001 From: Max Richter Date: Mon, 17 Jan 2022 14:48:30 +0100 Subject: [PATCH] feat: add mako notifications --- configs/mako/config | 27 +++++++++++++++++++++++++++ configs/sway/config | 1 + configs/waybar/config | 13 +++++++++++-- configs/waybar/cpu_speed.sh | 12 ++++++++++++ configs/waybar/mediaplayer.py | 6 +++--- configs/waybar/powermode.sh | 3 +++ 6 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 configs/mako/config create mode 100755 configs/waybar/cpu_speed.sh create mode 100644 configs/waybar/powermode.sh diff --git a/configs/mako/config b/configs/mako/config new file mode 100644 index 0000000..d3de07d --- /dev/null +++ b/configs/mako/config @@ -0,0 +1,27 @@ +sort=-time +layer=overlay +background-color=#ffffff +width=300 +height=110 +border-color=#000000 +border-radius=0 +icons=0 +max-icon-size=64 +default-timeout=5000 +ignore-timeout=1 +font=monospace 14 +text-color=#000000 + +[urgency=low] +border-color=#000000 + +[urgency=normal] +border-color=#d08770 + +[urgency=high] +border-color=#ff0000 +default-timeout=0 + +[category=mpd] +default-timeout=2000 +group-by=category diff --git a/configs/sway/config b/configs/sway/config index 87374c8..2f18e33 100644 --- a/configs/sway/config +++ b/configs/sway/config @@ -257,6 +257,7 @@ mode "resize" { bindsym $mod+r mode "resize" exec_always nm-applet --indicator +exec_always mako # # Status Bar: diff --git a/configs/waybar/config b/configs/waybar/config index 06eef37..b2ef8ac 100644 --- a/configs/waybar/config +++ b/configs/waybar/config @@ -2,8 +2,8 @@ "height": 20, "spacing": 4, "modules-left": ["sway/workspaces", "sway/mode"], - "modules-center": ["custom/media"], - "modules-right": ["pulseaudio", "network", "cpu", "memory", "battery", "custom/clock" ], + "modules-center": ["custom/media", "custom/clock"], + "modules-right": ["pulseaudio", "network", "custom/cpu_speed", "memory", "battery", "custom/clock" ], "sway/workspaces": { "disable-scroll": true, "all-outputs": true, @@ -145,6 +145,15 @@ }, "on-click": "pavucontrol" }, + "custom/cpu_speed": { + "interval": 10, + "return-type": "json", + "exec": "~/.config/waybar/cpu_speed.sh", + "format": "{icon} {}", + "format-icons": [""], + "escape": true, + "on-click": "terminator -e htop" +}, "custom/media": { "format": "{icon} {}", "return-type": "json", diff --git a/configs/waybar/cpu_speed.sh b/configs/waybar/cpu_speed.sh new file mode 100755 index 0000000..9dec0b8 --- /dev/null +++ b/configs/waybar/cpu_speed.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +class=cpu_speed +speed_mhz=$(lscpu | grep "CPU MHz" | sed --expression "s/CPU MHz:[[:space:]]*//g" | xargs printf "%.*f\n" 0) + +# speed_ghz=`echo $(($speed_mhz / 1000))` + +speed_ghz=`bc -l <<< "$speed_mhz / 1000"` + +info=$(echo $speed_ghz | xargs printf "%.*f\n" 2) + +echo -e "{\"text\":\""$info GHz"\", \"class\":\""$class"\"}" diff --git a/configs/waybar/mediaplayer.py b/configs/waybar/mediaplayer.py index 0a66a31..4206759 100755 --- a/configs/waybar/mediaplayer.py +++ b/configs/waybar/mediaplayer.py @@ -93,9 +93,9 @@ def main(): arguments = parse_arguments() # Initialize logging - LOG=expanduser("~")+"/.dotfiles/configs/waybar/media.log" - logging.basicConfig(level=logging.DEBUG, filename=LOG, - format='%(name)s %(levelname)s %(message)s') + # LOG=expanduser("~")+"/.dotfiles/configs/waybar/media.log" + # logging.basicConfig(level=logging.DEBUG, filename=LOG, + # format='%(name)s %(levelname)s %(message)s') # Logging is set by default to WARN and higher. # With every occurrence of -v it's lowered by one diff --git a/configs/waybar/powermode.sh b/configs/waybar/powermode.sh new file mode 100644 index 0000000..ea4324a --- /dev/null +++ b/configs/waybar/powermode.sh @@ -0,0 +1,3 @@ +MAX_FREQ=$(lscpu | grep "CPU max MHz" | sed --expression "s/CPU max MHz:[[:space:]]*//g" | xargs printf "%.*f\n" 0) +CURRENT_MAX_FREG=$(cpufreq-info | grep "c") +