abandon cosmic, try hyprland, run screaming, niri time

This commit is contained in:
atagen 2024-11-11 23:14:32 +11:00
parent 55013f738c
commit cd61813078
21 changed files with 846 additions and 200 deletions

View file

@ -14,5 +14,6 @@
nautilus
thunderbird
keepassxc
wofi
];
}

97
home/modules/hyprland.nix Normal file
View file

@ -0,0 +1,97 @@
{
pkgs,
lib,
inputs,
...
}: let
rice = pkgs.rice;
palette = pkgs.lib.nix-rice.palette.toRGBShortHex rice.palette;
in {
programs.hyprlock = {
# enable = true;
};
services.hypridle = {
# enable = true;
};
services.hyprpaper = {
# enable = true;
};
wayland.windowManager.hyprland = {
enable = true;
package = inputs.hyprland.packages.x86_64-linux.hyprland;
systemd = {
enable = true;
variables = ["--all"];
};
settings = {
"$mainMod" = "SUPER";
general = let
inherit (rice.borders) thickness;
inherit (palette) normal;
in {
inherit (rice.borders) gaps_in gaps_out;
border_size = thickness;
layout = "dwindle";
"col.inactive_border" = "rgb(${normal.black})";
"col.active_border" = "rgb(${normal.yellow})";
"col.nogroup_border" = "rgb(${normal.black})";
"col.nogroup_border_active" = "rgb(${normal.yellow})";
snap.enabled = true;
};
cursor = {
no_hardware_cursors = true;
};
decoration = {
inherit (rice.borders) rounding;
blur.enabled = false;
shadow.enabled = false;
};
# input.numlock_by_default = true;
# groups = let
# inherit (palette) normal;
# in {
# "col.border_active" = "rgb(${normal.red})";
# "col.border_inactive" = "rgb(${normal.black})";
# "col.border_locked_active" = "rgb(${normal.red})";
# "col.border_locked_inactive" = "rgb(${normal.black})";
# };
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
vrr = 0;
mouse_move_enables_dpms = true;
key_press_enables_dpms = true;
layers_hog_keyboard_focus = true;
background_color = "rgb(${palette.normal.black})";
};
dwindle = {
pseudotile = true;
force_split = 2;
preserve_split = true;
};
monitor = [
"DP-1, 2560x1440@165, 1080x0, 1"
"HDMI-A-2, 1920x1080@60, auto-left, 1"
"Unknown-1, disable"
];
bind = let
makeDirBind = bind: extraMods:
lib.mapAttrsToList (key: dir: "$mainMod${extraMods}, ${key}, ${bind}, ${dir}")
{
h = "l";
j = "d";
k = "u";
l = "r";
};
in
[
"$mainMod, Return, exec, ${lib.getExe pkgs.kitty}"
]
++ makeDirBind "movefocus" ""
++ makeDirBind "movewindow" "+SHIFT";
};
};
}

View file

@ -1,7 +1,140 @@
{...}: {
programs.niri = {
enable = true;
settings = {
{
pkgs,
lib,
config,
...
}: let
services = let
inherit (pkgs) ironbar swaynotificationcenter;
in [
ironbar
swaynotificationcenter
];
errata = let
inherit (pkgs) anyrun;
in [
anyrun
];
extraServices = let
inherit (pkgs) swayidle swaylock swaybg systemd niri-unstable;
in [
{
name = "swaybg";
value = "${lib.getExe swaybg} -m fill -i /home/${config.mainUser}/.nix/wallpaper.jpg";
}
{
name = "swayidle";
value = let
lock = lib.getExe pkgs.swaylock;
niri = lib.getExe niri-unstable;
systemctl = lib.getExe' systemd "systemctl";
in ''
${lib.getExe swayidle} -w \
timeout 1200 '${systemctl} suspend' \
timeout 601 '${niri} msg action power-off-monitors' \
timeout 600 '${lock} -f' \
before-sleep '${lock} -f'
'';
}
];
in {
home.packages = errata;
ezServices = let
attrify =
map (entry: {
name = "${entry.pname}";
value = "${lib.getExe entry}";
})
services;
in
builtins.listToAttrs (
attrify
++ extraServices
);
programs.niri.settings = let
inherit (lib) range nameValuePair mapAttrs';
inherit (builtins) listToAttrs replaceStrings;
inherit (config.lib.niri) actions;
in {
binds = let
hBinds = {
H = "left";
L = "right";
};
vBinds = {
J = "down";
K = "up";
};
makeDirBind = mods: cmd: keys:
mapAttrs' (
key: dir:
nameValuePair
"${mods}+${key}"
{action = actions."${replaceStrings ["$DIR"] ["${dir}"] "${cmd}"}";}
)
keys;
makeWsBind = mods: cmd:
listToAttrs (map (num: {
name = "${mods}+${builtins.toString num}";
value = {action."${cmd}" = num;};
}) (range 0 6));
in
{
"Mod+D".action.spawn = "anyrun";
"Mod+F".action.spawn = "firefox";
"Mod+E".action.spawn = "nautilus";
"Mod+Return".action.spawn = "kitty";
"Mod+Shift+E".action.spawn = "wlogout";
"Mod+Shift+Q".action = actions.close-window;
"Mod+Shift+S".action = actions.screenshot;
"Mod+R".action = actions.switch-preset-column-width;
"Mod+Shift+Space".action = actions.maximize-column;
}
// makeDirBind "Mod" "focus-window-or-workspace-$DIR" vBinds
// makeDirBind "Mod" "focus-column-or-monitor-$DIR" hBinds
// makeDirBind "Mod+Shift" "move-window-to-workspace-$DIR" vBinds
// makeDirBind "Mod+Shift" "move-column-$DIR-or-to-monitor-$DIR" hBinds
// makeDirBind "Mod+Ctrl" "consume-or-expel-window-$DIR" hBinds
// makeWsBind "Mod" "focus-workspace"
// makeWsBind "Mod+Shift" "move-window-to-workspace";
prefer-no-csd = true;
outputs = {
"Unknown-1".enable = false;
"HDMI-A-2" = {
transform.rotation = 90;
scale = 1;
};
"DP-1" = {
variable-refresh-rate = true;
scale = 1;
};
};
input = {
warp-mouse-to-focus = true;
workspace-auto-back-and-forth = true;
};
cursor = {
hide-after-inactive-ms = 5000;
hide-when-typing = true;
size = 16;
};
layout = {
always-center-single-column = true;
gaps = 24;
default-column-width.proportion = 0.5;
preset-column-widths =
map
(p: {proportion = p;})
[
(2.0 / 3.0)
0.5
(1.0 / 3.0)
];
};
};
programs.swaylock = {
enable = true;
settings.color = (pkgs.lib.nix-rice.palette.toRGBShortHex pkgs.rice.palette).normal.black;
};
}

View file

@ -13,13 +13,9 @@
gtk = with pkgs;
with rice; {
enable = true;
# theme = with gtk-theme; {
# inherit package name;
# };
# theme = {
# name = "adw-gtk3-dark";
# package = adw-gtk3; # cosmic
# };
theme = with gtk-theme; {
inherit package name;
};
iconTheme = with icons; {
inherit package name;
};