cornflake/home-manager/hyprland/default.nix
2026-01-04 14:22:14 +09:00

255 lines
6.5 KiB
Nix

{
pkgs,
lib,
config,
...
}:
let
inherit (lib) mkOption recursiveUpdate types optionals;
rosePineHyprcursor = pkgs.callPackage ./rose-pine-hyprcursor.nix { };
defaultInput = {
kb_layout = "us";
kb_variant = "";
kb_model = "";
kb_options = "";
kb_rules = "";
follow_mouse = true;
touchpad = {
natural_scroll = true;
};
natural_scroll = true;
sensitivity = 0.0;
};
wallpaperCommand = config.hare.hyprland.wallpaperCommand;
baseSettings = {
exec-once = [
# "/usr/lib/polkit-kde-authentication-agent-1"
# "dunst"
"swww-daemon"
# "copyq --start-server"
# "wl-paste --type text --watch cliphist store"
# "wl-paste --type image --watch cliphist store"
"eww daemon"
"eww open bar"
"eww open roundedEdge"
];
exec =
optionals (wallpaperCommand != null) [
wallpaperCommand
]
++ [
"dconf write /org/gnome/desktop/interface/gtk-theme 'Adwaita Dark'"
"dconf write /org/gnome/desktop/interface/icon-theme 'Adwaita Dark'"
"dconf write /org/gnome/desktop/interface/document-font-name 'Noto Sans Medium 11'"
"dconf write /org/gnome/desktop/interface/font-name 'Noto Sans Medium 11'"
"dconf write /org/gnome/desktop/interface/monospace-font-name 'Noto Sans Mono Medium 11'"
];
ecosystem.no_update_news = true;
input = defaultInput;
general = {
layout = "dwindle";
allow_tearing = true;
};
dwindle = {
pseudotile = true;
preserve_split = true;
};
misc = {
force_default_wallpaper = false;
disable_hyprland_logo = true;
disable_splash_rendering = true;
};
windowrulev2 = [
"animation windowsIn 0,title:^(.*wofi.*)$"
"float,title:^(.*feh.*)$"
"center,title:^(.*feh.*)$"
"float,title:^(Picture.*)$"
"pin,title:^(Picture.*)$"
"immediate, class:^(Terraria)$"
"idleinhibit fullscreen, class:^(steam_app.*)$"
];
workspace = [
"1, monitor:DP-2, default:true"
"r[2-9], monitor:DP-2"
"name:sub, monitor:DP-1, default:true"
];
"$menu" = "uwsm app -- $(tofi-drun)";
"$terminal" = "wezterm";
"$lock" = "hyprlock";
bindm = [
# Window Movement & Resizing
"SUPER, mouse:272, movewindow"
"SUPER, mouse:273, resizewindow"
];
bind = [
# basic
"SUPER, return, exec, $menu"
"SUPER, E, exec, $terminal"
"SUPER, Q, killactive,"
"SUPER, L, exec, $lock"
"SUPER_SHIFT, M, exec, loginctl terminate-user $USER"
# prsc
", Print, exec, hyprshot -m window -m active --clipboard-only"
# Clipboard
"SUPER, C, exec, copyq show"
"SUPER, V, exec, clipman pick -t dmenu"
# Window navigation
"SUPER, F, fullscreen,"
"SUPER, Y, pin"
"SUPER, I, togglefloating,"
"SUPER, O, togglesplit," # dwindle
"SUPER, P, pseudo," # dwindle
# Window focus
"SUPER, mouse_down, cyclenext, next"
"SUPER, mouse_up, cyclenext, prev"
"SUPER, left, movefocus, l"
"SUPER, right, movefocus, r"
"SUPER, up, movefocus, u"
"SUPER, down, movefocus, d"
"SUPER_SHIFT, left, movewindow, l"
"SUPER_SHIFT, right, movewindow, r"
"SUPER_SHIFT, up, movewindow, u"
"SUPER_SHIFT, down, movewindow, d"
# workspaces
"SUPER, 1, workspace, 1"
"SUPER, 2, workspace, 2"
"SUPER, 3, workspace, 3"
"SUPER_CTRL, left, workspace, m-1"
"SUPER_CTRL, right, workspace, m+1"
"SUPER_CTRL_SHIFT, left, workspace, r-1"
"SUPER_CTRL_SHIFT, right, workspace, r+1"
]
++ (
# workspaces
# binds $mod + [shift +] {1..9} to [move to] workspace {1..9}
builtins.concatLists (
builtins.genList (
i:
let
ws = i + 1;
in
[
"SUPER, code:1${toString i}, workspace, ${toString ws}"
"SUPER SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}"
]
) 9
)
);
};
defaultStyle = {
general = {
gaps_in = 4;
gaps_out = 7;
border_size = 3;
"col.active_border" = "rgba(6e848cee) rgba(eeeeffee) 90deg";
"col.inactive_border" = "rgba(595959aa)";
};
decoration = {
rounding = 10;
blur = {
enabled = true;
size = 6;
passes = 2;
noise = 0.01;
contrast = 0.8;
brightness = 0.5;
vibrancy = 0.25;
vibrancy_darkness = 0.1;
};
shadow = {
enabled = false;
range = 4;
render_power = 3;
color = "rgba(1a1a1aee)";
};
dim_inactive = false;
};
animations = {
enabled = true;
animation = [
"windowsIn, 1, 1, default, popin 90%"
"windowsOut, 1, 100, default, popin 80%"
"windowsMove, 1, 3, default"
"border, 1, 10, default"
"borderangle, 1, 8, default"
"fade, 1, 7, default"
"workspaces, 1, 5, default, slidefade 10%"
];
};
};
styleSettings = recursiveUpdate defaultStyle config.hare.hyprland.style;
inputSettings = recursiveUpdate defaultInput config.hare.hyprland.input;
in
{
options.hare.hyprland.style = mkOption {
type = types.attrs;
default = { };
description = "Overlay of Hyprland style tweaks that will be merged on top of the base settings.";
};
options.hare.hyprland.input = mkOption {
type = types.attrs;
default = { };
description = "Overrides for the Hyprland input block (e.g., sensitivity, accel profiles).";
};
options.hare.hyprland.wallpaperCommand = mkOption {
type = types.nullOr types.str;
default = null;
description = "Command to set the wallpaper (e.g., \"swww img <path>\"); appended to Hyprland's exec list when provided.";
};
config = {
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = false;
settings = recursiveUpdate (recursiveUpdate baseSettings styleSettings) {
input = inputSettings;
};
plugins = [
];
};
home.packages = [
rosePineHyprcursor
]
++ (with pkgs; [
swww
eww
]);
home.sessionVariables = {
HYPRCURSOR_THEME = "rose-pine-hyprcursor";
HYPRCURSOR_SIZE = "24";
XCURSOR_SIZE = "24";
GTK_BACKEND = "wayland";
QT_QPA_PLATFORM = "wayland;xcb";
QT_QPA_PLATFORMTHEME = "qt5ct";
XDG_SESSION_TYPE = "wayland";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
};
};
}