system/modules/home-manager/configs/window-manager/hyprland/default.nix

172 lines
3.9 KiB
Nix
Raw Normal View History

2024-04-22 23:43:16 +03:00
{ config, pkgs, lib, ... }:
let
cfg = config.local.window-manager.hyprland;
2024-04-23 11:51:15 +03:00
easyfocus = pkgs.callPackage ./easyfocus-hyprland.nix { };
2024-04-22 23:43:16 +03:00
in
{
options.local.window-manager.hyprland = with lib; {
2024-04-23 18:17:06 +03:00
enable = mkEnableOption "hyprland window manager";
2024-04-22 23:43:16 +03:00
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs.unstable; [
wl-clipboard
dmenu-wayland
];
2024-04-23 11:51:15 +03:00
xdg.configFile."easyfocus-hyprland/config.yaml".text = ''
chars: 'aoeuhtns'
window_background_color: '1d1f21'
window_background_opacity: 0.2
label_background_color: '1d1f21'
label_background_opacity: 1.0
label_text_color: 'c5c8c6'
focused_background_color: '285577'
focused_background_opacity: 1.0
focused_text_color: 'ffffff'
font_family: monospace
font_weight: bold
font_size: 60px
label_padding_x: 16
label_padding_y: 16
label_border_radius: 4
label_margin_x: 4
label_margin_y: 50
2024-04-23 11:51:15 +03:00
'';
2024-04-22 23:43:16 +03:00
wayland.windowManager.hyprland = {
enable = true;
package = pkgs.unstable.hyprland;
systemd.enable = true;
xwayland.enable = true;
settings = {
# monitors
2024-04-23 11:51:15 +03:00
monitor = ",preferred,auto,1";
2024-04-22 23:43:16 +03:00
# env
env = [
"XCURSOR_SIZE,24"
"HYPRCURSOR_SIZE,24"
];
# look and feel
general = {
gaps_in = 5;
gaps_out = 20;
2024-04-23 11:51:15 +03:00
border_size = 1;
2024-04-22 23:43:16 +03:00
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
"col.inactive_border" = "rgba(595959aa)";
resize_on_border = false;
allow_tearing = false;
layout = "master";
};
decoration = {
rounding = 5;
active_opacity = 1.0;
inactive_opacity = 1.0;
drop_shadow = false;
blur = {
enabled = false;
};
};
animations = {
enabled = false;
};
master = {
orientation = "top";
new_is_master = false;
};
gestures = {
workspace_swipe = false;
};
2024-04-23 11:51:15 +03:00
xwayland = {
force_zero_scaling = true;
};
2024-04-22 23:43:16 +03:00
2024-04-23 11:51:15 +03:00
"$terminal" = "wezterm start";
2024-04-22 23:43:16 +03:00
"$browser" = "librewolf";
"$menu" = "dmenu-wl_run";
2024-04-23 12:55:20 +03:00
"$m1" = "ALT_L";
"$m4" = "MOD4";
2024-04-22 23:43:16 +03:00
bind = lib.flatten [
# programs
2024-04-23 12:55:20 +03:00
"$m1 SHIFT, Return, exec, $terminal"
"$m1 SHIFT, B, exec, $browser"
"$m1 SHIFT, S, exec, flameshot gui"
"$m1, P, exec, $menu"
2024-04-22 23:43:16 +03:00
2024-04-23 11:51:15 +03:00
# focus
(lib.flip lib.mapAttrsToList { k = "prev"; j = "next"; } (k: d: [
2024-04-23 12:55:20 +03:00
"$m1, ${k}, layoutmsg, cycle${d}"
"$m1 SHIFT, ${k}, layoutmsg, swap${d}"
2024-04-23 11:51:15 +03:00
]))
2024-04-23 12:55:20 +03:00
"$m1, Return, layoutmsg, swapwithmaster, master"
"$m1, S, exec, ${easyfocus}/bin/easyfocus-hyprland"
2024-04-23 11:51:15 +03:00
# comma (,)
2024-04-23 12:55:20 +03:00
"$m1, code:44, layoutmsg, addmaster"
2024-04-23 11:51:15 +03:00
# period (.)
2024-04-23 12:55:20 +03:00
"$m1, code:46, layoutmsg, removemaster"
2024-04-23 11:51:15 +03:00
# windows
2024-04-23 12:55:20 +03:00
"$m4 SHIFT, C, killactive"
"$m1, Space, fullscreen, 0"
2024-04-23 11:51:15 +03:00
# workspaces
2024-04-22 23:43:16 +03:00
(lib.flip map [ 1 2 3 4 5 6 7 8 9 0 ] (i:
let wid = if i == 0 then 10 else i; in
[
# switch warkspaces with mod + [0-9]
2024-04-23 12:55:20 +03:00
"$m1, ${toString i}, workspace, ${toString wid}"
2024-04-22 23:43:16 +03:00
# move active window to a workspace with mod + shift + [0-9]
2024-04-23 12:55:20 +03:00
"$m1 SHIFT, ${toString i}, movetoworkspacesilent, ${toString wid}"
2024-04-22 23:43:16 +03:00
]
))
2024-04-23 11:51:15 +03:00
2024-04-23 12:55:20 +03:00
# system
"$m4, L, exec, waylock"
"$m4 SHIFT, Q, exit"
2024-04-22 23:43:16 +03:00
];
bindm = [
2024-04-23 12:55:20 +03:00
"$m1, mouse:272, movewindow"
"$m1, mouse:273, resizewindow"
2024-04-22 23:43:16 +03:00
];
input = let kb = config.home.keyboard; in {
kb_model = kb.model;
kb_layout = kb.layout;
kb_variant = kb.variant;
kb_options = lib.head kb.options;
};
};
};
};
}