From b123eab5aa8d69786f9af73167a9d98bd008ebcf Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 2 May 2023 15:25:23 +0100 Subject: [PATCH] Restructure waybar config Move module and common layout config into separate files to be imported Use different monitor bar setup for dual screens --- .../desktop/wayland/config/hypr/hyprland.conf | 4 +- .../desktop/wayland/config/hypr/keybinds.conf | 1 - .../wayland/config/hypr/window-rules.conf | 29 ++-- .../desktop/wayland/config/waybar/common.json | 4 + .../wayland/config/waybar/config-H0615 | 6 - .../wayland/config/waybar/config-H0615.json | 18 +++ .../wayland/config/waybar/config-hyprland | 26 ---- .../desktop/wayland/config/waybar/config-sway | 27 ---- .../config/waybar/{config => config.json} | 0 .../desktop/wayland/config/waybar/layout.json | 11 ++ .../wayland/config/waybar/modules.json | 145 ++++++++++++++++++ 11 files changed, 194 insertions(+), 77 deletions(-) create mode 100644 nixos/home/desktop/wayland/config/waybar/common.json delete mode 100644 nixos/home/desktop/wayland/config/waybar/config-H0615 create mode 100644 nixos/home/desktop/wayland/config/waybar/config-H0615.json delete mode 100644 nixos/home/desktop/wayland/config/waybar/config-hyprland delete mode 100644 nixos/home/desktop/wayland/config/waybar/config-sway rename nixos/home/desktop/wayland/config/waybar/{config => config.json} (100%) create mode 100644 nixos/home/desktop/wayland/config/waybar/layout.json create mode 100644 nixos/home/desktop/wayland/config/waybar/modules.json diff --git a/nixos/home/desktop/wayland/config/hypr/hyprland.conf b/nixos/home/desktop/wayland/config/hypr/hyprland.conf index 931dabfa..79d593d3 100644 --- a/nixos/home/desktop/wayland/config/hypr/hyprland.conf +++ b/nixos/home/desktop/wayland/config/hypr/hyprland.conf @@ -10,8 +10,8 @@ exec-once = waybar -c ~/.config/waybar/config-hyprland exec-once = eww daemon # Source a file (multi-file configs) -source = ~/.config/hypr/keybinds.conf -source = ~/.config/hypr/window-rules.conf +source = ./keybinds.conf +source = ./window-rules.conf # Some default env vars. env = XCURSOR_SIZE,24 diff --git a/nixos/home/desktop/wayland/config/hypr/keybinds.conf b/nixos/home/desktop/wayland/config/hypr/keybinds.conf index d26a2c29..e924dccd 100644 --- a/nixos/home/desktop/wayland/config/hypr/keybinds.conf +++ b/nixos/home/desktop/wayland/config/hypr/keybinds.conf @@ -65,7 +65,6 @@ bind = $mainMod SHIFT, 6, movetoworkspace, 6 bind = $mainMod SHIFT, 7, movetoworkspace, 7 bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 -bind = $mainMod SHIFT, 0, movetoworkspace, 10 bind = $mainMod, period, workspace, m+1 bind = $mainMod, comma, workspace, m-1 diff --git a/nixos/home/desktop/wayland/config/hypr/window-rules.conf b/nixos/home/desktop/wayland/config/hypr/window-rules.conf index 43619ea1..d4c95635 100644 --- a/nixos/home/desktop/wayland/config/hypr/window-rules.conf +++ b/nixos/home/desktop/wayland/config/hypr/window-rules.conf @@ -1,6 +1,7 @@ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more windowrule = float, ^(thunar)$ windowrule = float, ^(pavucontrol)$ +windowrule = float, ^(Signal)$ windowrule = center, ^(pavucontrol)$ windowrule = float, ^(.blueman-manager-wrapped)$ windowrule = center, ^(.blueman-manager-wrapped)$ @@ -11,22 +12,20 @@ windowrule = move 2% 6%, ^(otpclient)$ windowrule = float, title:^(Zoom)(.*)$ windowrule = center, title:^(Zoom)(.*)$ +windowrulev2 = tile,class:^(Nxplayer.bin)$,title:^(NoMachine)(.*)$ windowrulev2 = float,class:^(Nxplayer.bin)$,title:^(NoMachine)$ windowrulev2 = center,class:^(Nxplayer.bin)$,title:^(NoMachine)$ windowrule = workspace 1, ^(neovide)$ -windowrule = workspace 2, ^(firefox)$ -windowrule = workspace 2, ^(librewolf)$ -windowrule = workspace 2, ^(Chromium-browser)$ -windowrule = workspace 3, ^(org.kde.dolphin)$ -windowrule = workspace 4, ^(thunderbird)$ -windowrule = workspace 4, ^(Mailspring)$ -windowrule = workspace 4, ^(Microsoft Teams - Preview)$ -windowrule = workspace 5, ^(Element)$ -windowrule = workspace 5, ^(Signal)$ -windowrule = workspace 5, ^(discord)$ -windowrule = workspace 5, title:^(Zoom)(.*)$ -windowrule = workspace 6, ^(Steam)$ -windowrule = workspace 6, ^(steamwebhelper)$ -windowrule = workspace 7, ^(Bitwarden)$ -windowrule = workspace 8, ^(Nxplayer.bin)$ +windowrule = monitor 1, ^(neovide)$ +windowrule = workspace 2, ^(firefox|librewolf)$ +windowrule = monitor 1, ^(firefox|librewolf)$ +windowrule = workspace 3, ^(Microsoft Teams - Preview)$ +windowrule = monitor 1, ^(Microsoft Teams - Preview)$ +windowrule = workspace 3, ^(Element|Signal|discord)$ +windowrule = workspace 3, title:^(Zoom)(.*)$ +windowrule = monitor 1, title:^(Zoom)(.*)$ +windowrule = monitor 1, ^(Steam)$ +windowrule = monitor 1, ^(steamwebhelper)$ +windowrule = workspace 4, ^(Nxplayer.bin)$ +windowrule = monitor 1, ^(Nxplayer.bin)$ diff --git a/nixos/home/desktop/wayland/config/waybar/common.json b/nixos/home/desktop/wayland/config/waybar/common.json new file mode 100644 index 00000000..a7c5ede9 --- /dev/null +++ b/nixos/home/desktop/wayland/config/waybar/common.json @@ -0,0 +1,4 @@ +{ +} + +// vim: ft=json diff --git a/nixos/home/desktop/wayland/config/waybar/config-H0615 b/nixos/home/desktop/wayland/config/waybar/config-H0615 deleted file mode 100644 index 091f95e7..00000000 --- a/nixos/home/desktop/wayland/config/waybar/config-H0615 +++ /dev/null @@ -1,6 +0,0 @@ -{ - "include": "~/.config/waybar/config-hyprland", - "output": "HDMI-A-1" -} - -// vim: ft=json diff --git a/nixos/home/desktop/wayland/config/waybar/config-H0615.json b/nixos/home/desktop/wayland/config/waybar/config-H0615.json new file mode 100644 index 00000000..970f7492 --- /dev/null +++ b/nixos/home/desktop/wayland/config/waybar/config-H0615.json @@ -0,0 +1,18 @@ +[ + { + "include": ["~/.config/waybar/modules.json", "~/.config/waybar/layout.json"], + "output": "HDMI-A-1", + "modules-left": ["custom/launcher", "cpu", "memory", "temperature"], + "modules-center": ["wlr/workspaces"], + "modules-right": ["pulseaudio", "network", "backlight", "clock", "tray", "custom/power"], + }, + { + "include": ["~/.config/waybar/modules.json", "~/.config/waybar/layout.json"], + "output": "DP-1", + "modules-left": ["custom/launcher"], + "modules-center": ["wlr/workspaces"], + "modules-right": ["custom/power"] + } +] + +// vim: ft=json diff --git a/nixos/home/desktop/wayland/config/waybar/config-hyprland b/nixos/home/desktop/wayland/config/waybar/config-hyprland deleted file mode 100644 index dd61dd9b..00000000 --- a/nixos/home/desktop/wayland/config/waybar/config-hyprland +++ /dev/null @@ -1,26 +0,0 @@ -{ - "include": "~/.config/waybar/config", - "modules-center": ["wlr/workspaces"], - // Modules configuration - "wlr/workspaces": { - "disable-scroll": true, - "all-outputs": true, - "format": "{icon}", - "format-icons": { - "1": "", - "2": "", - "3": "", - "4": "", - "5": "", - "6": "", - "7": "", - "8": "", - "9": "", - "urgent": "", - "focused": "", - "default": "" - } - } -} - -// vim: ft=json diff --git a/nixos/home/desktop/wayland/config/waybar/config-sway b/nixos/home/desktop/wayland/config/waybar/config-sway deleted file mode 100644 index 92402cbb..00000000 --- a/nixos/home/desktop/wayland/config/waybar/config-sway +++ /dev/null @@ -1,27 +0,0 @@ -{ - "include": "./config", - "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"], - "modules-center": ["sway/window"], - // Modules configuration - "sway/workspaces": { - "disable-scroll": true, - "all-outputs": true, - "format": "{icon}", - "format-icons": { - "1": "", - "2": "󰊯", - "3": "", - "4": "", - "5": "", - "6": "", - "7": "", - "8": "", - "9": "", - "urgent": "", - "focused": "", - "default": "" - } - }, -} - -// vim: ft=json diff --git a/nixos/home/desktop/wayland/config/waybar/config b/nixos/home/desktop/wayland/config/waybar/config.json similarity index 100% rename from nixos/home/desktop/wayland/config/waybar/config rename to nixos/home/desktop/wayland/config/waybar/config.json diff --git a/nixos/home/desktop/wayland/config/waybar/layout.json b/nixos/home/desktop/wayland/config/waybar/layout.json new file mode 100644 index 00000000..8e420901 --- /dev/null +++ b/nixos/home/desktop/wayland/config/waybar/layout.json @@ -0,0 +1,11 @@ +{ + "layer": "top", + "position": "top", + "spacing": 10, + "margin-top": 10, + "margin-left": 20, + "margin-right": 20, + "margin-bottom": 5, +} + +// vim: ft=json diff --git a/nixos/home/desktop/wayland/config/waybar/modules.json b/nixos/home/desktop/wayland/config/waybar/modules.json new file mode 100644 index 00000000..f3e63096 --- /dev/null +++ b/nixos/home/desktop/wayland/config/waybar/modules.json @@ -0,0 +1,145 @@ +{ + // Modules configuration + "custom/launcher":{ + "format": "󰀻", + "on-click": "rofi -show drun" + }, + "keyboard-state": { + "numlock": true, + "capslock": true, + "format": "{name} {icon}", + "format-icons": { + "locked": "", + "unlocked": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "clock": { + "timezone": "Europe/London", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%Y-%m-%d}" + }, + "cpu": { + "format": "{usage}% 󰻠", + "tooltip": false + }, + "memory": { + "format": "{}% 󰍛" + }, + "temperature": { + // "thermal-zone": 2, + // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", + "critical-threshold": 80, + // "format-critical": "{temperatureC}°C {icon}", + "format": "{temperatureC}°C {icon}", + "format-icons": ["󱃃", "󰔏", "󱃂"] + }, + "backlight": { + // "device": "acpi_video1", + "format": "{percent}% {icon}", + "format-icons": ["", "", "", "", "", "", "", "", ""] + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-charging": "{capacity}% 󰂄", + "format-plugged": "{capacity}% 󰚥", + "format-alt": "{time} {icon}", + "format-icons": ["󱃍", "󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] + }, + "battery#bat2": { + "bat": "BAT2" + }, + "network": { + "format-wifi": "{essid} ({signalStrength}%) 󰖩", + "format-ethernet": "Connected 󰈁", + "tooltip-format": "{ifname}", + "format-linked": "{ifname} (No IP) 󰈁", + "format-disconnected": "Disconnected 󰈂", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "bluetooth": { + "format": "󰂯 {status}", + "format-disabled": "󰂲 {status}", + "format-off": "󰂲 {status}", + "format-on": "󰂯 {status}", + "format-connected": "󰂱 {device_alias}", + "on-click": "blueman-manager" + }, + "pulseaudio": { + "scroll-step": 2, // %, can be a float + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": "󰝟 {icon} {format_source}", + "format-muted": "󰝟 {format_source}", + "format-source": "{volume}% 󰍬", + "format-source-muted": "󰍭", + "format-icons": { + "headphone": "󰋋", + "hands-free": "󰥰", + "headset": "󰋎", + "phone": "󰏲", + "portable": "󰏳", + "car": "󰄍", + "default": ["󰕿", "󰖀", "󰕾"] + }, + "on-click": "pavucontrol" + }, + "custom/power":{ + "format": "󰐥", + "on-click": "~/.dotfiles/scripts/powermenu" + }, + "wlr/workspaces": { + "on-click": "activate", + "disable-scroll": true, + "all-outputs": false, + "sort-by-number": true, + "format": "{icon}", + "format-icons": { + "1": "", + "2": "", + "3": "", + "4": "", + "urgent": "", + "focused": "", + "default": "" + }, + "persistent_workspaces": { + "1": [], + "2": [], + "3": [], + "4": [] + } + }, + "sway/workspaces": { + "on-click": "activate", + "disable-scroll": true, + "all-outputs": false, + "sort-by-number": true, + "format": "{icon}", + "format-icons": { + "1": "", + "2": "", + "3": "", + "4": "", + "urgent": "", + "focused": "", + "default": "" + }, + "persistent_workspaces": { + "1": [], + "2": [], + "3": [], + "4": [] + } + } +} + +// vim: ft=json