split status bar on multi-monitor hosts

This commit is contained in:
Nickiel12 2023-11-17 11:40:02 -08:00
parent e99e9aa10c
commit 3f3079b99b
5 changed files with 149 additions and 59 deletions

View file

@ -1,47 +1,4 @@
(defwidget bar []
(centerbox :orientation "h"
(workspaces :current-idx current-workspace)
;; (music)
(center-clock)
(info)
))
(deflisten current-workspace :initial "1" "bash ./scripts/get-active-workspace")
(defwidget workspaces [current-idx]
(box
:halign "start"
:hexpand false
:class "bar-main"
:space-evenly true
:spacing "12"
:css "* {margin-left: 20px; margin-right: 20px;}"
(box
:class {current-idx == "1" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "2" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "3" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "4" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "5" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "6" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "7" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "8" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "9" ? "active-workspace" : "regular"}
(label :text ""))))
(defwidget info [] (defwidget info []
(box (box
@ -154,7 +111,7 @@
(defpoll volume :interval "1s" (defpoll volume :interval "1s"
{"pw-volume status | jaq '.percentage // -1'" ?: 500}) {"pw-volume status | jaq '.percentage // -1'" ?: 500})
(include "windows.yuck") (include "status_bars.yuck")
(include "./modules/center-clock.yuck") (include "./modules/center-clock.yuck")
(defvar open_vol_osd false) (defvar open_vol_osd false)

View file

@ -0,0 +1,138 @@
(defwidget bar_full []
(centerbox :orientation "h"
(full_workspaces :current-idx current-workspace)
(center-clock)
(info)
))
(deflisten current-workspace :initial "1" "bash ./scripts/get-active-workspace")
(defwidget full_workspaces [current-idx]
(box
:halign "start"
:hexpand false
:class "bar-main"
:space-evenly true
:spacing "12"
:css "* {margin-left: 20px; margin-right: 20px;}"
(box
:class {current-idx == "1" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "2" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "3" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "4" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "5" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "6" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "7" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "8" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "9" ? "active-workspace" : "regular"}
(label :text ""))))
(defwidget bar_left []
(centerbox :orientation "h"
(left_screen_workspaces :current-idx current-workspace)
(center-clock)
(info)
))
(defwidget left_screen_workspaces [current-idx]
(box
:halign "start"
:hexpand false
:class "bar-main"
:space-evenly true
:spacing "12"
:css "* {margin-left: 20px; margin-right: 20px;}"
(box
:class {current-idx == "1" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "3" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "5" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "7" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "9" ? "active-workspace" : "regular"}
(label :text ""))))
(defwidget bar_right []
(centerbox :orientation "h"
(right_screen_workspaces :current-idx current-workspace)
(center-clock)
(info)
))
(defwidget right_screen_workspaces [current-idx]
(box
:halign "start"
:hexpand false
:class "bar-main"
:space-evenly true
:spacing "12"
:css "* {margin-left: 20px; margin-right: 20px;}"
(box
:class {current-idx == "2" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "4" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "6" ? "active-workspace" : "regular"}
(label :text ""))
(box
:class {current-idx == "8" ? "active-workspace" : "regular"}
(label :text ""))))
(defwindow full_screen_bar
:monitor 0
:exclusive true
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar_full))
(defwindow left_screen_bar
:monitor 0
:exclusive true
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar_left))
(defwindow right_screen_bar
:monitor 1
:exclusive true
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar_right))

View file

@ -1,12 +0,0 @@
(defwindow bar
:monitor 1
:exclusive true
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))

View file

@ -6,6 +6,9 @@ let
monitor_config = import ./monitors.nix { hostname = hostname; }; monitor_config = import ./monitors.nix { hostname = hostname; };
two_monitor_hosts = [
"NicksNixDesktop"
];
in in
{ {
@ -44,10 +47,13 @@ in
exec-once = [ exec-once = [
"${pkgs.swww}/bin/swww init & sleep 0.5 & ${pkgs.swww}/bin/swww /home/nixolas/Downloads/RecountERD.png" "${pkgs.swww}/bin/swww init & sleep 0.5 & ${pkgs.swww}/bin/swww /home/nixolas/Downloads/RecountERD.png"
"eww open-many bar logout restart shutdown reboot_windows dash_music dash_computer_status" "eww open-many logout restart shutdown reboot_windows dash_music dash_computer_status"
"eww open dash_clock_bg;eww open dash_clock" # the order here matters "eww open dash_clock_bg;eww open dash_clock" # the order here matters
] ++ pkgs.lib.optionals (builtins.elem hostname two_monitor_hosts ) [
]; "eww open-many left_screen_bar right_screen_bar"
] ++ pkgs.lib.optionals (! builtins.elem hostname two_monitor_hosts ) [
"eww open full_screen_bar"
];
input = { input = {
kb_layout = "us"; kb_layout = "us";

View file

@ -24,6 +24,7 @@ in
"3,monitor:DP-2" "3,monitor:DP-2"
"5,monitor:DP-2" "5,monitor:DP-2"
"7,monitor:DP-2" "7,monitor:DP-2"
"9,monitor:DP-2"
] else [ ] else [
]; ];