hyprland.nix
· 5.4 KiB · Nix
Raw
{
lib,
config,
pkgs,
osConfig,
...
}:
let
cfg = config.home.ltp.hyprland;
inherit (lib)
mkEnableOption
types
mkOption
mkIf
lists
;
workspaces = [
"1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
];
directions = [
"left"
"down"
"up"
"right"
];
in
{
imports = [
./cliphist
./dunst
./hyprpaper
./rofi
./waybar
];
options.home.ltp.hyprland = {
enable = mkEnableOption {
default = false;
type = types.bool;
};
cursors = {
package = mkOption {
default = null;
type = types.package;
};
name = mkOption {
default = null;
type = types.str;
};
size = mkOption {
default = 24;
type = types.int;
};
};
};
config = mkIf cfg.enable {
# Service for brightness and volume indication, also provides lightctl + volumectl
services.avizo = {
enable = true;
settings = {
default = {
# needs adjusting
background = "rgba(69,71,90, 0.8)";
border-color = "rgba(69, 71, 90, 0.8)";
border-radius = 10;
};
};
};
home.packages = builtins.attrValues { inherit (pkgs) nautilus alacritty tela-circle-icon-theme; };
home.pointerCursor = {
inherit (cfg.cursors) name;
inherit (cfg.cursors) package;
inherit (cfg.cursors) size;
gtk.enable = true;
x11.enable = true;
x11.defaultCursor = cfg.cursors.name;
};
gtk = {
enable = true;
theme = {
package = pkgs.orchis-theme;
name = "Orchis-Grey-Dark";
};
iconTheme = {
package = pkgs.tela-icon-theme;
name = "Tela-blue-dark";
};
cursorTheme = {
inherit (cfg.cursors) package;
inherit (cfg.cursors) name;
};
};
wayland.windowManager.hyprland = {
enable = true;
plugins = builtins.attrValues { inherit (pkgs.hyprlandPlugins) hy3 hyprspace; };
settings = {
"$mod" = "SUPER";
"$terminal" = "alacritty";
"$fileManager" = "nautilus";
env = [
"XCURSOR_SIZE, 24"
"NIXOS_OZONE_WL, 1"
];
exec-once =
let
execlist = [
"hyprctl setcursor ${cfg.cursors.name} ${builtins.toString cfg.cursors.size}"
"waybar"
"nm-applet"
(mkIf osConfig.ltp.network.tailscale.enable "tailscale-systray")
];
in
execlist;
general = {
layout = "hy3";
gaps_in = 5;
gaps_out = 13;
border_size = 0;
};
decoration = {
rounding = 10;
inactive_opacity = 0.8;
dim_inactive = true;
#drop shadow settings
drop_shadow = true;
shadow_range = 20;
shadow_render_power = 3;
shadow_ignore_window = true;
"col.shadow" = "rgba(00000045)";
};
hy3 =
{
};
misc = {
force_default_wallpaper = 0;
disable_hyprland_logo = false;
};
input = {
kb_layout = "gb";
touchpad = {
natural_scroll = false;
};
};
layerrule = [
"dimaround, rofi"
"blur, rofi"
"blur, waybar"
"ignorealpha 0, waybar"
];
windowrulev2 = [
"float, title:(Welcome to JetBrains Rider)"
];
bind =
let
movewindow = lists.forEach directions (i: "SUPER_SHIFT, ${i}, hy3:movewindow, ${i}");
movefocus = lists.forEach directions (i: "$mod, ${i}, hy3:movefocus, ${i}");
movetoworkspace = lists.forEach workspaces (i: "SUPER_SHIFT, ${i}, movetoworkspace, ${i}");
switchtoworkspace = lists.forEach workspaces (i: "$mod, ${i}, workspace, ${i}");
controlbinds = [
", XF86AudioRaiseVolume, exec, volumectl -u up"
", XF86AudioLowerVolume, exec, volumectl -u down"
", XF86AudioMute, exec, volumectl toggle-mute"
", XF86MonBrightnessUp, exec, lightctl up"
", XF86MonBrightnessDown, exec, lightctl down"
];
generalbinds = [
"$mod, RETURN, exec, $terminal"
"$mod, E, exec, $fileManager -w"
#"$mod, V, hy3:makegroup, v, force_ephemeral"
"SUPER_SHIFT, Q, hy3:killactive"
"$mod, F, fullscreen"
"SUPER_SHIFT, F, fullscreen, 1"
];
hyprspacebinds = [
"$mod, O, overview:toggle"
];
in
movewindow
++ movefocus
++ movetoworkspace
++ switchtoworkspace
++ controlbinds
++ generalbinds
++ hyprspacebinds;
};
extraConfig = ''
bind = $mod, R, submap, resize
# will start a submap called "resize"
submap = resize
# sets repeatable binds for resizing the active window
binde = , right, resizeactive, 10 0
binde = , left, resizeactive, -10 0
binde = , up, resizeactive, 0 -10
binde = , down, resizeactive, 0 10
# use reset to go back to the global submap
bind = , escape, submap, reset
# will reset the submap, which will return to the global submap
submap = reset
'';
};
};
}
| 1 | { |
| 2 | lib, |
| 3 | config, |
| 4 | pkgs, |
| 5 | osConfig, |
| 6 | ... |
| 7 | }: |
| 8 | |
| 9 | let |
| 10 | cfg = config.home.ltp.hyprland; |
| 11 | |
| 12 | inherit (lib) |
| 13 | mkEnableOption |
| 14 | types |
| 15 | mkOption |
| 16 | mkIf |
| 17 | lists |
| 18 | ; |
| 19 | |
| 20 | workspaces = [ |
| 21 | "1" |
| 22 | "2" |
| 23 | "3" |
| 24 | "4" |
| 25 | "5" |
| 26 | "6" |
| 27 | "7" |
| 28 | "8" |
| 29 | "9" |
| 30 | ]; |
| 31 | directions = [ |
| 32 | "left" |
| 33 | "down" |
| 34 | "up" |
| 35 | "right" |
| 36 | ]; |
| 37 | in |
| 38 | { |
| 39 | imports = [ |
| 40 | ./cliphist |
| 41 | ./dunst |
| 42 | ./hyprpaper |
| 43 | ./rofi |
| 44 | ./waybar |
| 45 | ]; |
| 46 | |
| 47 | options.home.ltp.hyprland = { |
| 48 | enable = mkEnableOption { |
| 49 | default = false; |
| 50 | type = types.bool; |
| 51 | }; |
| 52 | |
| 53 | cursors = { |
| 54 | package = mkOption { |
| 55 | default = null; |
| 56 | type = types.package; |
| 57 | }; |
| 58 | |
| 59 | name = mkOption { |
| 60 | default = null; |
| 61 | type = types.str; |
| 62 | }; |
| 63 | |
| 64 | size = mkOption { |
| 65 | default = 24; |
| 66 | type = types.int; |
| 67 | }; |
| 68 | }; |
| 69 | }; |
| 70 | |
| 71 | config = mkIf cfg.enable { |
| 72 | # Service for brightness and volume indication, also provides lightctl + volumectl |
| 73 | services.avizo = { |
| 74 | enable = true; |
| 75 | settings = { |
| 76 | default = { |
| 77 | # needs adjusting |
| 78 | background = "rgba(69,71,90, 0.8)"; |
| 79 | border-color = "rgba(69, 71, 90, 0.8)"; |
| 80 | border-radius = 10; |
| 81 | }; |
| 82 | }; |
| 83 | }; |
| 84 | |
| 85 | home.packages = builtins.attrValues { inherit (pkgs) nautilus alacritty tela-circle-icon-theme; }; |
| 86 | |
| 87 | home.pointerCursor = { |
| 88 | inherit (cfg.cursors) name; |
| 89 | inherit (cfg.cursors) package; |
| 90 | inherit (cfg.cursors) size; |
| 91 | gtk.enable = true; |
| 92 | x11.enable = true; |
| 93 | x11.defaultCursor = cfg.cursors.name; |
| 94 | }; |
| 95 | |
| 96 | gtk = { |
| 97 | enable = true; |
| 98 | theme = { |
| 99 | package = pkgs.orchis-theme; |
| 100 | name = "Orchis-Grey-Dark"; |
| 101 | }; |
| 102 | iconTheme = { |
| 103 | package = pkgs.tela-icon-theme; |
| 104 | name = "Tela-blue-dark"; |
| 105 | }; |
| 106 | cursorTheme = { |
| 107 | inherit (cfg.cursors) package; |
| 108 | inherit (cfg.cursors) name; |
| 109 | }; |
| 110 | }; |
| 111 | |
| 112 | wayland.windowManager.hyprland = { |
| 113 | enable = true; |
| 114 | |
| 115 | plugins = builtins.attrValues { inherit (pkgs.hyprlandPlugins) hy3 hyprspace; }; |
| 116 | |
| 117 | settings = { |
| 118 | "$mod" = "SUPER"; |
| 119 | "$terminal" = "alacritty"; |
| 120 | "$fileManager" = "nautilus"; |
| 121 | |
| 122 | env = [ |
| 123 | "XCURSOR_SIZE, 24" |
| 124 | "NIXOS_OZONE_WL, 1" |
| 125 | ]; |
| 126 | |
| 127 | exec-once = |
| 128 | let |
| 129 | execlist = [ |
| 130 | "hyprctl setcursor ${cfg.cursors.name} ${builtins.toString cfg.cursors.size}" |
| 131 | "waybar" |
| 132 | "nm-applet" |
| 133 | (mkIf osConfig.ltp.network.tailscale.enable "tailscale-systray") |
| 134 | ]; |
| 135 | in |
| 136 | execlist; |
| 137 | |
| 138 | general = { |
| 139 | layout = "hy3"; |
| 140 | gaps_in = 5; |
| 141 | gaps_out = 13; |
| 142 | border_size = 0; |
| 143 | }; |
| 144 | |
| 145 | decoration = { |
| 146 | rounding = 10; |
| 147 | inactive_opacity = 0.8; |
| 148 | dim_inactive = true; |
| 149 | |
| 150 | #drop shadow settings |
| 151 | drop_shadow = true; |
| 152 | shadow_range = 20; |
| 153 | shadow_render_power = 3; |
| 154 | shadow_ignore_window = true; |
| 155 | "col.shadow" = "rgba(00000045)"; |
| 156 | }; |
| 157 | |
| 158 | hy3 = |
| 159 | { |
| 160 | }; |
| 161 | |
| 162 | misc = { |
| 163 | force_default_wallpaper = 0; |
| 164 | disable_hyprland_logo = false; |
| 165 | }; |
| 166 | |
| 167 | input = { |
| 168 | kb_layout = "gb"; |
| 169 | |
| 170 | touchpad = { |
| 171 | natural_scroll = false; |
| 172 | }; |
| 173 | }; |
| 174 | |
| 175 | layerrule = [ |
| 176 | "dimaround, rofi" |
| 177 | "blur, rofi" |
| 178 | "blur, waybar" |
| 179 | "ignorealpha 0, waybar" |
| 180 | ]; |
| 181 | |
| 182 | windowrulev2 = [ |
| 183 | "float, title:(Welcome to JetBrains Rider)" |
| 184 | ]; |
| 185 | |
| 186 | bind = |
| 187 | let |
| 188 | movewindow = lists.forEach directions (i: "SUPER_SHIFT, ${i}, hy3:movewindow, ${i}"); |
| 189 | movefocus = lists.forEach directions (i: "$mod, ${i}, hy3:movefocus, ${i}"); |
| 190 | movetoworkspace = lists.forEach workspaces (i: "SUPER_SHIFT, ${i}, movetoworkspace, ${i}"); |
| 191 | switchtoworkspace = lists.forEach workspaces (i: "$mod, ${i}, workspace, ${i}"); |
| 192 | controlbinds = [ |
| 193 | ", XF86AudioRaiseVolume, exec, volumectl -u up" |
| 194 | ", XF86AudioLowerVolume, exec, volumectl -u down" |
| 195 | ", XF86AudioMute, exec, volumectl toggle-mute" |
| 196 | ", XF86MonBrightnessUp, exec, lightctl up" |
| 197 | ", XF86MonBrightnessDown, exec, lightctl down" |
| 198 | ]; |
| 199 | generalbinds = [ |
| 200 | "$mod, RETURN, exec, $terminal" |
| 201 | "$mod, E, exec, $fileManager -w" |
| 202 | #"$mod, V, hy3:makegroup, v, force_ephemeral" |
| 203 | "SUPER_SHIFT, Q, hy3:killactive" |
| 204 | "$mod, F, fullscreen" |
| 205 | "SUPER_SHIFT, F, fullscreen, 1" |
| 206 | ]; |
| 207 | hyprspacebinds = [ |
| 208 | "$mod, O, overview:toggle" |
| 209 | ]; |
| 210 | in |
| 211 | movewindow |
| 212 | ++ movefocus |
| 213 | ++ movetoworkspace |
| 214 | ++ switchtoworkspace |
| 215 | ++ controlbinds |
| 216 | ++ generalbinds |
| 217 | ++ hyprspacebinds; |
| 218 | }; |
| 219 | |
| 220 | extraConfig = '' |
| 221 | |
| 222 | bind = $mod, R, submap, resize |
| 223 | |
| 224 | # will start a submap called "resize" |
| 225 | submap = resize |
| 226 | |
| 227 | # sets repeatable binds for resizing the active window |
| 228 | binde = , right, resizeactive, 10 0 |
| 229 | binde = , left, resizeactive, -10 0 |
| 230 | binde = , up, resizeactive, 0 -10 |
| 231 | binde = , down, resizeactive, 0 10 |
| 232 | |
| 233 | # use reset to go back to the global submap |
| 234 | bind = , escape, submap, reset |
| 235 | |
| 236 | # will reset the submap, which will return to the global submap |
| 237 | submap = reset |
| 238 | ''; |
| 239 | }; |
| 240 | }; |
| 241 | } |
| 242 |