From 993945b13ee4465cdedca51d66d2d33ec0b0d679 Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Wed, 15 Nov 2023 14:56:43 +0200 Subject: [PATCH] refactor(waybar): move modules to sep files --- config/waybar/config | 147 +++++--------------------------- config/waybar/modules/hypr.json | 34 ++++++++ config/waybar/modules/info.json | 68 +++++++++++++++ 3 files changed, 124 insertions(+), 125 deletions(-) create mode 100644 config/waybar/modules/hypr.json create mode 100644 config/waybar/modules/info.json diff --git a/config/waybar/config b/config/waybar/config index 58a7c75..654ac02 100644 --- a/config/waybar/config +++ b/config/waybar/config @@ -1,129 +1,26 @@ -// vim: ft=jsonc { - "position": "top", - "layer": "top", - "height": 14, - "margin-top": 0, - "margin-bottom": 0, - "margin-left": 0, - "margin-right": 0, - "modules-left": [ - "hyprland/workspaces", - "hyprland/window" - ], - "modules-center": [ - "clock", - "cpu" - ], - "modules-right": [ - "memory", - "tray", - "hyprland/language", - "backlight", - "battery", - "pulseaudio", - "network" - ], + "position": "top", + "layer": "top", + "height": 14, + "margin-top": 0, + "margin-bottom": 0, + "margin-left": 0, + "margin-right": 0, - // modules - "clock": { - "format": " {:%a, %d %b %H:%M}", - "tooltip": "true", - "tooltip-format": "{:%Y %B}\n{calendar}", - "on-click": "morgen" - }, + "include": [ + "~/.config/waybar/modules/hypr.json", + "~/.config/waybar/modules/info.json" + ], - "hyprland/workspaces": { - "active-only": false, - "all-outputs": true, - "disable-scroll": false, - "on-scroll-up": "hyprctl dispatch workspace -1", - "on-scroll-down": "hyprctl dispatch workspace +1", - "format": "{icon}", - "on-click": "activate", - "sort-by-number": true, - "persistent_workspaces": { "*": 9 }, - "format-icons": { - "urgent": "", - "default": "", - "1": "󰅨", - "2": "󰖟", - "3": "", - "4": "󰠮", - "5": "", - "6": "󰅨", - "7": "󰎄" - } - }, - - "hyprland/window": { - "max-length": "40" - }, - - "battery": { - "format":"{icon} {capacity}%", - "format-charging":"{icon} {capacity}%", - "format-plugged": "{capacity}% ", - "format-alt": "{icon} {time}", - "format-icons": ["", "", "", "", ""], - "tooltip": false, - "states": { - "good": 95, - "warning": 30, - "critical": 15 - } - }, - - "memory": { - "format": "󰍛 {used}%", - "interval": 5 - }, - - "cpu": { - "format": "󰻠 {usage}%", - "format-alt": "󰻠 {avg_frequency} GHz", - "interval": 5 - }, - - "network": { - "format-wifi": "󰤨 {essid}", - "format-linked": " {ifname} (No IP)", - "format-disconnected": "󰤭", - "format-alt": "󰤨 {ifname}: {ipaddr}/{cidr}", - "tooltip-format": "{essid}", - "on-click-right": "nm-connection-editor", - "tooltip": false - }, - - "tray": { - "icon-size": 16, - "spacing": 5 - }, - - "backlight": { - "format": "{icon} {percent}%", - "format-icons": ["", "", "", "", "", "", "", "", ""], - "on-scroll-up": "brightnessctl set +10%", - "on-scroll-down": "brightnessctl set 10%-", - "tooltip": false - }, - - "pulseaudio": { - "format": "{icon} {volume}%", - "format-muted": "󰝟", - "format-icons": { - "default": ["󰕿", "󰖀", "󰕾"], - "headphone": "" - }, - "on-click": "pavucontrol", - "tooltip": false, - "on-scroll-up": "wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+", - "on-scroll-down": "wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-" - }, - - "hyprland/language": { - "format": "󰌌 {}", - "format-uk": "укр", - "format-en": "eng" - } + "modules-left": ["hyprland/workspaces", "hyprland/window"], + "modules-center": ["clock", "cpu"], + "modules-right": [ + "memory", + "tray", + "hyprland/language", + "backlight", + "battery", + "pulseaudio", + "network" + ] } diff --git a/config/waybar/modules/hypr.json b/config/waybar/modules/hypr.json new file mode 100644 index 0000000..8b15754 --- /dev/null +++ b/config/waybar/modules/hypr.json @@ -0,0 +1,34 @@ +{ + "hyprland/window": { + "max-length": "40" + }, + + "hyprland/workspaces": { + "active-only": false, + "all-outputs": true, + "disable-scroll": false, + "on-scroll-up": "hyprctl dispatch workspace -1", + "on-scroll-down": "hyprctl dispatch workspace +1", + "format": "{icon}", + "on-click": "activate", + "sort-by-number": true, + "persistent_workspaces": { "*": 9 }, + "format-icons": { + "urgent": "", + "default": "", + "1": "󰅨", + "2": "󰖟", + "3": "", + "4": "󰠮", + "5": "", + "6": "󰅨", + "7": "󰎄" + } + }, + + "hyprland/language": { + "format": "󰌌 {}", + "format-uk": "укр", + "format-en": "eng" + } +} diff --git a/config/waybar/modules/info.json b/config/waybar/modules/info.json new file mode 100644 index 0000000..5fec9a3 --- /dev/null +++ b/config/waybar/modules/info.json @@ -0,0 +1,68 @@ +{ + "tray": { + "icon-size": 16, + "spacing": 10 + }, + "clock": { + "format": " {:%a, %d %b %H:%M}", + "tooltip": "true", + "tooltip-format": "{:%Y %B}\n{calendar}", + "on-click": "morgen" + }, + + "battery": { + "format": "{icon} {capacity}%", + "format-charging": "{icon} {capacity}%", + "format-plugged": "{capacity}% ", + "format-alt": "{icon} {time}", + "format-icons": ["", "", "", "", ""], + "tooltip": false, + "states": { + "good": 95, + "warning": 30, + "critical": 15 + } + }, + + "memory": { + "format": "󰍛 {used}%", + "interval": 5 + }, + + "cpu": { + "format": "󰻠 {usage}%", + "format-alt": "󰻠 {avg_frequency} GHz", + "interval": 5 + }, + + "network": { + "format-wifi": "󰤨 {essid}", + "format-linked": " {ifname} (No IP)", + "format-disconnected": "󰤭", + "format-alt": "󰤨 {ifname}: {ipaddr}/{cidr}", + "tooltip-format": "{essid}", + "on-click-right": "nm-connection-editor", + "tooltip": false + }, + + "backlight": { + "format": "{icon} {percent}%", + "format-icons": ["", "", "", "", "", "", "", "", ""], + "on-scroll-up": "brightnessctl set +10%", + "on-scroll-down": "brightnessctl set 10%-", + "tooltip": false + }, + + "pulseaudio": { + "format": "{icon} {volume}%", + "format-muted": "󰝟", + "format-icons": { + "default": ["󰕿", "󰖀", "󰕾"], + "headphone": "" + }, + "on-click": "pavucontrol", + "tooltip": false, + "on-scroll-up": "wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+", + "on-scroll-down": "wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-" + } +}