2024-02-10 21:27:29 -05:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-06-27 00:56:27 -04:00
|
|
|
cfg = config.roles.desktop;
|
2024-06-24 12:30:49 -04:00
|
|
|
|
|
|
|
hyprland =
|
|
|
|
config
|
|
|
|
.home-manager
|
|
|
|
.users
|
2024-06-27 00:56:27 -04:00
|
|
|
.${cfg.user}
|
2024-06-24 12:30:49 -04:00
|
|
|
.wayland
|
|
|
|
.windowManager
|
|
|
|
.hyprland
|
|
|
|
.finalPackage;
|
2024-02-10 21:27:29 -05:00
|
|
|
|
|
|
|
# Show Regreet on all monitors
|
|
|
|
dupeMonitors = pkgs.writeShellApplication {
|
|
|
|
name = "dupeMonitors";
|
|
|
|
runtimeInputs = [hyprland pkgs.jq];
|
|
|
|
text = ''
|
2024-06-27 00:56:27 -04:00
|
|
|
main="${cfg.mainMonitor}"
|
2024-02-10 21:27:29 -05:00
|
|
|
names="($(hyprctl -j monitors | jq -r '.[] .description'))"
|
|
|
|
|
|
|
|
if [[ "$main" == "null" ]]; then
|
|
|
|
main="''${names[0]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for (( i=0; i<''${#names[@]}; i++ )); do
|
|
|
|
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
name=$(echo "''${names[$i]}" | sed 's/.*(\(.*\))/\1/')
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
desc=$(echo "''${names[$i]}" | sed 's/ (.*//')
|
|
|
|
|
|
|
|
if [[ "$name" != "$main" && "desc:$desc" != "$main" ]]; then
|
|
|
|
hyprctl keyword monitor "$name",preferred,auto,1,mirror,"$main"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
# Check if user wants the greeter only on main monitor
|
|
|
|
in {
|
|
|
|
setupMonitors =
|
2024-06-27 00:56:27 -04:00
|
|
|
if (cfg.mainMonitor != "null" && !cfg.displayManager.duplicateScreen)
|
|
|
|
then "hyprctl dispatch focusmonitor ${cfg.mainMonitor}"
|
2024-02-10 21:27:29 -05:00
|
|
|
else "${dupeMonitors}/bin/dupeMonitors";
|
|
|
|
}
|