diff --git a/common/vars.nix b/common/vars.nix index edc72d83..8389fba6 100644 --- a/common/vars.nix +++ b/common/vars.nix @@ -27,9 +27,10 @@ }; mainMonitor = mkOption { - type = types.nullOr types.str; + type = types.str; description = '' - The name of the main monitor used for Hyprland and Regreet + The name of the main monitor used for Hyprland + and Regreet which also uses Hyprland ''; default = "null"; }; diff --git a/devices/binto/default.nix b/devices/binto/default.nix index 48534de3..05e99db5 100644 --- a/devices/binto/default.nix +++ b/devices/binto/default.nix @@ -18,7 +18,7 @@ vars = { user = "matt"; hostName = "binto"; - mainMonitor = "DP-5"; + mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D"; greetdDupe = false; fontSize = 12.5; }; diff --git a/flake.lock b/flake.lock index 14f90613..75e1c73f 100644 --- a/flake.lock +++ b/flake.lock @@ -358,11 +358,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1701737536, - "narHash": "sha256-xSmfHhhCL9mAta5jKfcbJxYjCoD2MdLPBMjBUWvYAJI=", + "lastModified": 1701790877, + "narHash": "sha256-xNjSypJirandCE1/OLFwndGYhFdoSqcbjW77rVZ86uI=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "3bb9c7c5cf4f2ee30bf821501499f2308d616f94", + "rev": "37d7a8c64dfabfe81330c819c24fd6b13b292194", "type": "github" }, "original": { @@ -749,11 +749,11 @@ }, "nur": { "locked": { - "lastModified": 1701780125, - "narHash": "sha256-HtNkw7mbLPkxmSoz57FNXEMioFMIBp7yDy88dE3HsZA=", + "lastModified": 1701798379, + "narHash": "sha256-o+uFCoZalr5csUdWD84I2ELd78VGxt9+8PZbJXwaHA8=", "owner": "nix-community", "repo": "NUR", - "rev": "77fbdb7bff2c28e35f755144d9313faf3f8121ed", + "rev": "e3ef2421e85a36a8b5650cfb3cc9096f53059609", "type": "github" }, "original": { diff --git a/modules/greetd/default.nix b/modules/greetd/default.nix index 17f00b0f..c4db153f 100644 --- a/modules/greetd/default.nix +++ b/modules/greetd/default.nix @@ -23,16 +23,20 @@ # Show Regreet on all monitors dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" '' - names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .name')) main="${config.vars.mainMonitor}" + names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .description')) - if [[ $(echo "$main") == "null" ]]; then + if [[ "$main" == "null" ]]; then main="''${names[0]}" fi for (( i=0; i<''${#names[@]}; i++ )); do - if [[ ''${names[$i]} != "$main" ]]; then - ${hyprBin}/hyprctl keyword monitor ''${names[$i]},preferred,auto,1,mirror,"$main" + + name=$(echo "''${names[$i]}" | sed 's/.*(\(.*\))/\1/') + desc=$(echo "''${names[$i]}" | sed 's/ (.*//') + + if [[ "$name" != "$main" && "desc:$desc" != "$main" ]]; then + ${hyprBin}/hyprctl keyword monitor "$name",preferred,auto,1,mirror,"$main" fi done '';