feat: allow use of desc: id for mainMonitor
This commit is contained in:
parent
6893948ade
commit
0d75b0d487
4 changed files with 12 additions and 7 deletions
|
@ -27,9 +27,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
mainMonitor = mkOption {
|
mainMonitor = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.str;
|
||||||
description = ''
|
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";
|
default = "null";
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
vars = {
|
vars = {
|
||||||
user = "matt";
|
user = "matt";
|
||||||
hostName = "binto";
|
hostName = "binto";
|
||||||
mainMonitor = "DP-5";
|
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
|
||||||
greetdDupe = false;
|
greetdDupe = false;
|
||||||
fontSize = 12.5;
|
fontSize = 12.5;
|
||||||
};
|
};
|
||||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
|
@ -23,16 +23,20 @@
|
||||||
|
|
||||||
# Show Regreet on all monitors
|
# Show Regreet on all monitors
|
||||||
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
|
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
|
||||||
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .name'))
|
|
||||||
main="${config.vars.mainMonitor}"
|
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]}"
|
main="''${names[0]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for (( i=0; i<''${#names[@]}; i++ )); do
|
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
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue