feat(greetd): add option to only show on main monitor
This commit is contained in:
parent
3a3c8457da
commit
cd6d62efc5
4 changed files with 55 additions and 10 deletions
|
@ -14,6 +14,22 @@
|
|||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
mainMonitor = mkOption {
|
||||
description = ''
|
||||
The name of the main monitor used for Hyprland and Regreet
|
||||
'';
|
||||
default = "null";
|
||||
type = types.nullOr types.str;
|
||||
};
|
||||
|
||||
greetdDupe = mkOption {
|
||||
description = ''
|
||||
If we should duplicate regreet on all monitors
|
||||
'';
|
||||
default = true;
|
||||
type = types.nullOr types.bool;
|
||||
};
|
||||
|
||||
fontSize = mkOption {
|
||||
type = types.nullOr types.float;
|
||||
};
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
services.device-vars = {
|
||||
username = "matt";
|
||||
configDir = "/home/matt/.nix/devices/binto/config";
|
||||
mainMonitor = "DP-5";
|
||||
greetdDupe = false;
|
||||
fontSize = 12.5;
|
||||
};
|
||||
|
||||
|
|
|
@ -4,24 +4,41 @@
|
|||
config,
|
||||
...
|
||||
}: let
|
||||
# Nix stuff
|
||||
optionals = lib.lists.optionals;
|
||||
isNvidia = config.hardware.nvidia.modesetting.enable;
|
||||
user = config.services.device-vars.username;
|
||||
vars = config.services.device-vars;
|
||||
|
||||
hyprBin = "${config.home-manager.users.${user}
|
||||
.wayland.windowManager.hyprland.finalPackage}/bin";
|
||||
# Executables' paths
|
||||
regreetBin = "${lib.getExe config.programs.regreet.package}";
|
||||
hyprBin = "${config.home-manager.users.${vars.username}
|
||||
.wayland.windowManager.hyprland.finalPackage}/bin";
|
||||
|
||||
style = pkgs.writeText "style.css" ''${builtins.readFile ./style.css}'';
|
||||
|
||||
setupMonitors = pkgs.writeShellScriptBin "setupMonitors" ''
|
||||
# Show Regreet on all monitors
|
||||
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
|
||||
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .name'))
|
||||
main="${vars.mainMonitor}"
|
||||
|
||||
for (( i=1; i<''${#names[@]}; i++ )); do
|
||||
${hyprBin}/hyprctl keyword monitor ''${names[$i]},preferred,auto,1,mirror,''${names[0]}
|
||||
if [[ $(echo "$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"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
# Check if user wants Regreet only on main monitor
|
||||
setupMonitors = if vars.mainMonitor != null && !vars.greetdDupe
|
||||
then "${hyprBin}/hyprctl dispatch focusmonitor ${vars.mainMonitor}"
|
||||
else "${dupeMonitors}/bin/dupeMonitors";
|
||||
|
||||
# Get css for regreet
|
||||
style = pkgs.writeText "style.css" ''${builtins.readFile ./style.css}'';
|
||||
|
||||
# Setup Hyprland as regreet's compositor
|
||||
hyprConf =
|
||||
pkgs.writeText "greetd-hypr-config"
|
||||
(lib.strings.concatStrings ((optionals isNvidia [
|
||||
|
@ -32,8 +49,8 @@
|
|||
"env = WLR_NO_HARDWARE_CURSORS,1\n"
|
||||
])
|
||||
++ [
|
||||
"exec-once = ${setupMonitors}/bin/setupMonitors &&"
|
||||
" swww init --no-cache &&"
|
||||
"exec-once = ${setupMonitors} &&"
|
||||
" sleep 1; swww init --no-cache &&"
|
||||
" swww img -t none ${pkgs.dracula-theme}/wallpapers/waves.png\n"
|
||||
|
||||
"${builtins.readFile ./hyprland.conf}\n"
|
||||
|
|
|
@ -13,6 +13,16 @@ input {
|
|||
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
|
||||
}
|
||||
|
||||
device:razer-razer-naga-pro {
|
||||
sensitivity = -0.5
|
||||
accel_profile = "flat"
|
||||
}
|
||||
|
||||
device:razer-razer-naga-pro-1 {
|
||||
sensitivity = -0.5
|
||||
accel_profile = "flat"
|
||||
}
|
||||
|
||||
env = XCURSOR_SIZE,24
|
||||
exec-once=hyprctl setcursor Dracula-cursors 24
|
||||
|
||||
|
|
Loading…
Reference in a new issue