2023-11-22 15:33:16 -05:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
2023-10-19 17:05:13 -04:00
|
|
|
}: let
|
2023-11-25 19:24:33 -05:00
|
|
|
# Nix stuff
|
2023-11-25 17:13:46 -05:00
|
|
|
optionals = lib.lists.optionals;
|
|
|
|
isNvidia = config.hardware.nvidia.modesetting.enable;
|
2023-11-25 03:24:12 -05:00
|
|
|
|
2023-11-25 19:24:33 -05:00
|
|
|
# Executables' paths
|
2023-10-19 19:36:47 -04:00
|
|
|
regreetBin = "${lib.getExe config.programs.regreet.package}";
|
2023-12-01 14:12:33 -05:00
|
|
|
hyprBin = "${config
|
|
|
|
.home-manager
|
|
|
|
.users
|
|
|
|
.${config.vars.user}
|
|
|
|
.wayland
|
|
|
|
.windowManager
|
|
|
|
.hyprland
|
|
|
|
.finalPackage}/bin";
|
2023-10-19 19:36:47 -04:00
|
|
|
|
2023-11-25 19:24:33 -05:00
|
|
|
# Show Regreet on all monitors
|
|
|
|
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
|
2023-11-25 17:13:46 -05:00
|
|
|
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .name'))
|
2023-12-01 14:12:33 -05:00
|
|
|
main="${config.vars.mainMonitor}"
|
2023-10-19 19:36:47 -04:00
|
|
|
|
2023-11-25 19:24:33 -05:00
|
|
|
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
|
2023-11-25 17:13:46 -05:00
|
|
|
done
|
|
|
|
'';
|
2023-10-19 19:36:47 -04:00
|
|
|
|
2023-11-25 19:24:33 -05:00
|
|
|
# Check if user wants Regreet only on main monitor
|
2023-12-01 14:12:33 -05:00
|
|
|
setupMonitors =
|
|
|
|
if (config.vars.mainMonitor != null && !config.vars.greetdDupe)
|
|
|
|
then "${hyprBin}/hyprctl dispatch focusmonitor ${config.vars.mainMonitor}"
|
2023-11-25 19:24:33 -05:00
|
|
|
else "${dupeMonitors}/bin/dupeMonitors";
|
|
|
|
|
|
|
|
# Get css for regreet
|
|
|
|
style = pkgs.writeText "style.css" ''${builtins.readFile ./style.css}'';
|
|
|
|
|
|
|
|
# Setup Hyprland as regreet's compositor
|
2023-11-25 17:13:46 -05:00
|
|
|
hyprConf =
|
|
|
|
pkgs.writeText "greetd-hypr-config"
|
|
|
|
(lib.strings.concatStrings ((optionals isNvidia [
|
|
|
|
"env = LIBVA_DRIVER_NAME,nvidia\n"
|
|
|
|
"env = XDG_SESSION_TYPE,wayland\n"
|
|
|
|
"env = GBM_BACKEND,nvidia-drm\n"
|
|
|
|
"env = __GLX_VENDOR_LIBRARY_NAME,nvidia\n"
|
|
|
|
"env = WLR_NO_HARDWARE_CURSORS,1\n"
|
|
|
|
])
|
|
|
|
++ [
|
2023-11-25 19:24:33 -05:00
|
|
|
"exec-once = ${setupMonitors} &&"
|
|
|
|
" sleep 1; swww init --no-cache &&"
|
2023-11-25 17:13:46 -05:00
|
|
|
" swww img -t none ${pkgs.dracula-theme}/wallpapers/waves.png\n"
|
2023-11-23 01:08:59 -05:00
|
|
|
|
2023-11-25 17:13:46 -05:00
|
|
|
"${builtins.readFile ./hyprland.conf}\n"
|
2023-10-19 17:05:13 -04:00
|
|
|
|
2023-11-25 17:13:46 -05:00
|
|
|
"exec-once = ${regreetBin} -s ${style};"
|
|
|
|
" ${hyprBin}/hyprctl dispatch exit"
|
|
|
|
]));
|
2023-10-19 17:05:13 -04:00
|
|
|
in {
|
2023-10-19 19:36:47 -04:00
|
|
|
users.users.greeter = {
|
|
|
|
packages = with pkgs; [
|
|
|
|
dracula-theme
|
|
|
|
flat-remix-icon-theme
|
2023-11-03 23:05:46 -04:00
|
|
|
swww
|
2023-10-19 19:36:47 -04:00
|
|
|
gtk3
|
|
|
|
glib
|
|
|
|
];
|
|
|
|
};
|
2023-10-19 17:05:13 -04:00
|
|
|
|
2023-10-19 19:36:47 -04:00
|
|
|
# See overlay
|
2023-10-19 17:05:13 -04:00
|
|
|
programs.regreet = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
GTK = {
|
|
|
|
cursor_theme_name = "Dracula-cursors";
|
|
|
|
font_name = "Sans Serif";
|
|
|
|
icon_theme_name = "Flat-Remix-Violet-Dark";
|
|
|
|
theme_name = "Dracula";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.greetd = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
default_session = {
|
2023-10-19 19:36:47 -04:00
|
|
|
command = "${hyprBin}/Hyprland --config ${hyprConf}";
|
2023-10-19 17:05:13 -04:00
|
|
|
user = "greeter";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# unlock GPG keyring on login
|
|
|
|
services.gnome.gnome-keyring.enable = true;
|
|
|
|
security.pam.services.greetd.enableGnomeKeyring = true;
|
|
|
|
}
|