2024-01-10 11:54:07 +01:00
|
|
|
{ inputs
|
|
|
|
, lib
|
|
|
|
, config
|
|
|
|
, pkgs
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
{
|
|
|
|
options =
|
|
|
|
let
|
|
|
|
inherit (lib) mkOption types;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
hyprland = {
|
|
|
|
mod = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "SUPER";
|
|
|
|
};
|
|
|
|
|
|
|
|
autoStart = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
};
|
|
|
|
|
|
|
|
primaryMonitor = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
monitors = mkOption {
|
|
|
|
type = types.listOf (types.submodule {
|
|
|
|
options = {
|
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
width = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
};
|
|
|
|
height = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
};
|
|
|
|
refreshRate = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 60;
|
|
|
|
};
|
|
|
|
x = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 0;
|
|
|
|
};
|
|
|
|
y = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 0;
|
|
|
|
};
|
|
|
|
transform = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 0;
|
|
|
|
};
|
|
|
|
vrr = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 0;
|
|
|
|
};
|
|
|
|
enabled = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = [ ];
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = mkOption {
|
|
|
|
type = types.attrsOf types.str;
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
sensitivity = mkOption {
|
|
|
|
type = types.float;
|
|
|
|
default = 0.0;
|
|
|
|
};
|
|
|
|
|
|
|
|
keyboard = {
|
|
|
|
layout = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "us";
|
|
|
|
};
|
|
|
|
|
|
|
|
variant = mkOption {
|
|
|
|
type = types.str;
|
2024-07-25 19:29:32 +02:00
|
|
|
default = "";
|
2024-01-10 11:54:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
options = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
layout = mkOption { type = types.str; };
|
|
|
|
|
|
|
|
layerRules = mkOption {
|
|
|
|
type = types.attrsOf (types.listOf types.str);
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
windowRules = mkOption {
|
|
|
|
type = types.attrsOf (types.listOf types.str);
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
windowRulesV2 = mkOption {
|
|
|
|
type = types.attrsOf (types.listOf types.str);
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
binds = mkOption {
|
|
|
|
type = types.attrsOf types.str;
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
mouseBinds = mkOption {
|
|
|
|
type = types.attrsOf types.str;
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config =
|
|
|
|
let
|
|
|
|
cfg = config.hyprland;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
wl-clipboard
|
|
|
|
cliphist
|
|
|
|
ulauncher
|
|
|
|
];
|
|
|
|
|
|
|
|
wayland.windowManager.hyprland = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
monitor = map
|
|
|
|
(m:
|
|
|
|
let
|
|
|
|
resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}";
|
|
|
|
position = "${toString m.x}x${toString m.y}";
|
|
|
|
vrr = if m.vrr != 0 then ",vrr,${toString m.vrr}" else "";
|
|
|
|
transform = if m.transform != 0 then ",transform,${toString m.transform}" else "";
|
|
|
|
in
|
|
|
|
"${m.name},${if m.enabled then "${resolution},${position},1${vrr}${transform}" else "disable"}"
|
|
|
|
)
|
|
|
|
(cfg.monitors)
|
|
|
|
# Automatically detect newly connected monitors
|
|
|
|
++ [ ",preferred,auto,auto" ];
|
|
|
|
|
|
|
|
exec-once = [
|
|
|
|
"${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store"
|
|
|
|
"${pkgs.ulauncher}/bin/ulauncher --no-window-shadow --hide-window"
|
|
|
|
"${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"
|
|
|
|
# kde-connect (somehow, wasnt working well last time)
|
|
|
|
] ++ cfg.autoStart;
|
|
|
|
|
|
|
|
env = lib.mapAttrsToList (k: v: "${toString k},${v}") cfg.environment;
|
|
|
|
|
|
|
|
input = {
|
|
|
|
kb_layout = cfg.keyboard.layout;
|
|
|
|
kb_variant = cfg.keyboard.variant;
|
|
|
|
kb_options = cfg.keyboard.options;
|
|
|
|
|
|
|
|
follow_mouse = 1;
|
|
|
|
|
|
|
|
touchpad = {
|
|
|
|
natural_scroll = "yes";
|
|
|
|
};
|
|
|
|
|
|
|
|
sensitivity = cfg.sensitivity;
|
|
|
|
accel_profile = "flat";
|
|
|
|
};
|
|
|
|
|
|
|
|
general = {
|
2024-07-25 19:29:32 +02:00
|
|
|
gaps_in = 5;
|
|
|
|
gaps_out = 10;
|
2024-01-10 11:54:07 +01:00
|
|
|
|
2024-07-25 19:29:32 +02:00
|
|
|
border_size = 1;
|
|
|
|
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
|
|
|
|
"col.inactive_border" = "rgba(595959aa)";
|
2024-01-10 11:54:07 +01:00
|
|
|
|
|
|
|
layout = cfg.layout;
|
|
|
|
};
|
|
|
|
|
2024-02-29 10:34:02 +01:00
|
|
|
misc = {
|
|
|
|
force_default_wallpaper = 2;
|
|
|
|
};
|
|
|
|
|
2024-01-10 11:54:07 +01:00
|
|
|
decoration = {
|
2024-07-25 19:29:32 +02:00
|
|
|
rounding = 5;
|
2024-01-10 11:54:07 +01:00
|
|
|
|
|
|
|
blur = {
|
2024-07-25 19:29:32 +02:00
|
|
|
enabled = "yes";
|
|
|
|
size = 3;
|
|
|
|
passes = 1;
|
2024-01-10 11:54:07 +01:00
|
|
|
new_optimizations = "on";
|
|
|
|
};
|
|
|
|
|
2024-07-25 19:29:32 +02:00
|
|
|
drop_shadow = "yes";
|
|
|
|
shadow_range = 4;
|
|
|
|
shadow_render_power = 3;
|
|
|
|
"col.shadow" = "rgba(1a1a1aee)";
|
2024-01-10 11:54:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
gestures = {
|
|
|
|
workspace_swipe = "on";
|
|
|
|
};
|
|
|
|
|
|
|
|
animations = {
|
2024-07-25 19:29:32 +02:00
|
|
|
enabled = "yes";
|
2024-01-10 11:54:07 +01:00
|
|
|
|
|
|
|
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
|
|
|
|
|
2024-07-25 19:29:32 +02:00
|
|
|
bezier = [
|
|
|
|
"myBezier, 0.05, 0.9, 0.1, 1.05"
|
|
|
|
];
|
2024-01-10 11:54:07 +01:00
|
|
|
|
|
|
|
animation = [
|
2024-07-25 19:29:32 +02:00
|
|
|
"windows, 1, 3, myBezier"
|
|
|
|
"windowsOut, 1, 3, default, popin 80%"
|
|
|
|
"border, 1, 5, default"
|
|
|
|
"borderangle, 1, 4, default"
|
|
|
|
"fade, 1, 3, default"
|
|
|
|
"workspaces, 1, 2, default"
|
2024-01-10 11:54:07 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
layerrule =
|
|
|
|
let
|
|
|
|
y = ident: value: "${value},${ident}";
|
|
|
|
x = ident: values: map (y ident) values;
|
|
|
|
in
|
|
|
|
lib.flatten (lib.mapAttrsToList x cfg.layerRules);
|
|
|
|
|
|
|
|
workspace =
|
|
|
|
let
|
|
|
|
# Create one work space for each non primary monitor
|
|
|
|
perMonitorWorkspaces = map
|
2024-07-25 19:29:32 +02:00
|
|
|
(m: "name:${m.name}, monitor:${m.name}")
|
2024-01-10 11:54:07 +01:00
|
|
|
(lib.filter
|
|
|
|
(m: m.name != cfg.primaryMonitor)
|
|
|
|
cfg.monitors
|
|
|
|
);
|
|
|
|
|
|
|
|
# Create 10 work spaces on the primary monitor
|
|
|
|
primaryMonitorWorkspaces = map (i: "${toString i}, monitor:${cfg.primaryMonitor}") (lib.range 1 10);
|
|
|
|
|
|
|
|
in
|
|
|
|
primaryMonitorWorkspaces ++ perMonitorWorkspaces;
|
|
|
|
|
|
|
|
bind =
|
|
|
|
let
|
|
|
|
# Create binds to switch workspaces and move windows between them
|
|
|
|
workspaceBinds =
|
2024-07-25 19:29:32 +02:00
|
|
|
lib.flatten
|
|
|
|
(map
|
|
|
|
(i:
|
|
|
|
let
|
|
|
|
k = if i == 10 then 0 else i;
|
|
|
|
in
|
|
|
|
[
|
|
|
|
"${cfg.mod}, ${toString k}, workspace, ${toString i}"
|
|
|
|
"${cfg.mod} SHIFT, ${toString k}, movetoworkspace, ${toString i}"
|
|
|
|
]
|
2024-01-10 11:54:07 +01:00
|
|
|
)
|
2024-07-25 19:29:32 +02:00
|
|
|
(lib.range 1 10)
|
|
|
|
);
|
2024-01-10 11:54:07 +01:00
|
|
|
|
|
|
|
# Create binds to manage wiwdows
|
2024-07-25 19:29:32 +02:00
|
|
|
windowManagementBinds = [
|
|
|
|
"${cfg.mod} SHIFT, Q, killactive"
|
|
|
|
"${cfg.mod}, F, togglefloating"
|
|
|
|
"${cfg.mod} SHIFT, F, fullscreen"
|
|
|
|
];
|
2024-01-10 11:54:07 +01:00
|
|
|
|
|
|
|
configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.binds;
|
|
|
|
in
|
|
|
|
configBinds ++ workspaceBinds ++ windowManagementBinds;
|
|
|
|
|
|
|
|
bindm =
|
|
|
|
let
|
2024-07-25 19:29:32 +02:00
|
|
|
windowManagementBinds = [
|
2024-01-10 11:54:07 +01:00
|
|
|
"${cfg.mod}, mouse:272, movewindow"
|
|
|
|
"${cfg.mod}, mouse:273, resizewindow"
|
2024-07-25 19:29:32 +02:00
|
|
|
];
|
2024-01-10 11:54:07 +01:00
|
|
|
|
|
|
|
configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.mouseBinds;
|
|
|
|
|
|
|
|
in
|
|
|
|
configBinds ++ windowManagementBinds;
|
|
|
|
|
|
|
|
windowrule =
|
|
|
|
let
|
|
|
|
y = ident: value: "${value},${ident}";
|
|
|
|
x = ident: values: map (y ident) values;
|
|
|
|
in
|
|
|
|
lib.flatten (lib.mapAttrsToList x cfg.windowRules);
|
|
|
|
|
|
|
|
windowrulev2 =
|
|
|
|
let
|
|
|
|
y = ident: value: "${value},${ident}";
|
|
|
|
x = ident: values: map (y ident) values;
|
|
|
|
in
|
|
|
|
lib.flatten (lib.mapAttrsToList x cfg.windowRulesV2);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|