Better react to multi-monitor setups
diff --git a/modules/displays.nix b/modules/displays.nix
index 9c40a53..136c784 100644
--- a/modules/displays.nix
+++ b/modules/displays.nix
@@ -1,4 +1,4 @@
-{ lib, ... }: {
+{ lib, pkgs, ... }: {
config = {
boot.kernelParams = [
"video=eDP-1:2256x1440@60"
@@ -14,27 +14,38 @@
EndSection
'';
};
- home.services.grobi = {
- enable = true;
- rules = [
- {
- name = "Docked";
- outputs_connected = [ "HDMI-A-1" "eDP-1" ];
- configure_column = [ "HDMI-A-1" "eDP-1" ];
+ home = {
+ services.grobi = {
+ enable = true;
+ rules = (map
+ (output: {
+ name = "Docked (${output})";
+ outputs_connected = [ output "eDP-1" ];
+ configure_command = "xrandr --output eDP-1 --primary --mode 2256x1504 --pos 0x2160 --rotate normal --output ${output} --mode 3840x2160 --pos 1366x0 --rotate normal";
- atomic = true;
- primary = "eDP-1";
- }
- {
- name = "Free";
- outputs_connected = [ "eDP-1" ];
- outputs_disconnected = [ "HDMI-A-1" ];
- configure_single = "eDP-1";
- }
- {
- name = "Fallback";
- configure_single = "eDP-1";
- }
- ];
+ atomic = true;
+ primary = "eDP-1";
+ })
+ ([ "HDMI-A-1" "HDMI-A-1-0" ] ++
+ (map (num: "DP-" + toString num) (lib.range 1 8))
+ )) ++ [
+ {
+ name = "Free";
+ outputs_connected = [ "eDP-1" ];
+ outputs_disconnected = [ "HDMI-A-1" ];
+ configure_single = "eDP-1";
+ }
+ {
+ name = "Fallback";
+ configure_single = "eDP-1";
+ }
+ ];
+ };
+
+ home.file.".config/prelaunch/desktop-portals.sh".text = ''
+ ${pkgs.grobi}/bin/grobi watch -v
+ '';
+ home.file.".config/prelaunch/desktop-portals.sh".executable = true;
+ systemd.user.services.grobi.Install.WantedBy = lib.mkForce [ ];
};
}
diff --git a/modules/polybar.nix b/modules/polybar.nix
index e062be9..f174a55 100644
--- a/modules/polybar.nix
+++ b/modules/polybar.nix
@@ -2,28 +2,23 @@
home = {
services.polybar = {
enable = true;
- settings = {
+ settings = (builtins.listToAttrs (map
+ (output: {
+ name = "bar/${output}";
+ value = {
+ "inherit" = "docked base";
+ monitor = output;
+ };
+ })
+ ([ "HDMI-A-1" "HDMI-A-1-0" ] ++
+ (map (num: "DP-" + toString num) (lib.range 1 8))
+ ))) //
+ {
"bar/main" = {
"inherit" = "base";
tray.position = "right";
};
- "bar/dp1" = {
- "inherit" = "dp base";
- monitor = "DP-1";
- };
- "bar/dp2" = {
- "inherit" = "dp base";
- monitor = "DP-2";
- };
- "bar/dp3" = {
- "inherit" = "dp base";
- monitor = "DP-3";
- };
- "bar/dp4" = {
- "inherit" = "dp base";
- monitor = "DP-4";
- };
- dp = {
+ docked = {
monitor-strict = false;
};
base = {
diff --git a/modules/xmonad/xmonad.hs b/modules/xmonad/xmonad.hs
index b3b8609..553522c 100644
--- a/modules/xmonad/xmonad.hs
+++ b/modules/xmonad/xmonad.hs
@@ -60,7 +60,7 @@
modifierKey = mod4Mask -- Use Super as our mod key
-statusBar = "pkill polybar; polybar main; polybar dp1; polybar dp2; polybar dp3; polybar dp4"
+statusBar = "pkill polybar; polybar main; ${{builtins.concatStringsSep '' '' (map (num: ''polybar DP-'' + toString num + ''; '')(lib.range 1 8))}} polybar HDMI-A-1-0; polybar HDMI-A-1"
compositor = "pkill picom; picom"
background = "pkill show; show ~/.xmonad/wallpaper.glsl > /dev/null"
colorSelection = "xcolor | xclip -sel clip"