From 5e82b5487f9f2b0753428bd98fb448a38698b88d Mon Sep 17 00:00:00 2001 From: liv Date: Sat, 10 Aug 2024 14:15:25 +0200 Subject: [PATCH] refine hyprland configuration --- home/common/desktop/default.nix | 12 ++++++ home/common/desktop/kitty.nix | 14 +++++++ home/desktop/hyprland/default.nix | 65 +++++++++++++++++++++++++++++-- 3 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 home/common/desktop/default.nix create mode 100644 home/common/desktop/kitty.nix diff --git a/home/common/desktop/default.nix b/home/common/desktop/default.nix new file mode 100644 index 0000000..80d1f03 --- /dev/null +++ b/home/common/desktop/default.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: { + imports = [ + ./kitty.nix + ]; + + home.packages = with pkgs; [ + # programs + firefox # you need a web browser + ]; + + fonts.fontconfig.enable = true; +} diff --git a/home/common/desktop/kitty.nix b/home/common/desktop/kitty.nix new file mode 100644 index 0000000..b907133 --- /dev/null +++ b/home/common/desktop/kitty.nix @@ -0,0 +1,14 @@ +{ config, inputs, pkgs, ... }: { + programs.kitty = { + enable = true; + font = { + name = "JetBrains Mono Nerd Font"; + package = pkgs.nerdfonts.override { fonts = ["JetBrainsMono"]; }; + size = 11; + }; + settings = { + editor = config.home.sessionVariables.EDITOR; + window_padding_width = 10; + }; + }; +} diff --git a/home/desktop/hyprland/default.nix b/home/desktop/hyprland/default.nix index 479f0be..a8a2396 100644 --- a/home/desktop/hyprland/default.nix +++ b/home/desktop/hyprland/default.nix @@ -1,5 +1,9 @@ { lib, config, inputs, pkgs, ... }: { + imports = [ + ../../common/desktop + ]; + wayland.windowManager.hyprland = { enable = true; systemd = { @@ -10,18 +14,73 @@ general = { gaps_in = 15; gaps_out = 20; - border_size = 2.7; - cursor_inactive_timeout = 4; + border_size = 2; }; + cursor.inactive_timeout = 4; animations = { enabled = true; }; bind = let terminal = "${pkgs.kitty}/bin/kitty"; + workspaces = [ + "1" + "2" + "3" + "4" + "5" + ]; + directions = rec { + left = "l"; + right = "r"; + up = "u"; + down = "d"; + h = left; + l = right; + k = up; + j = down; + }; in [ "SUPER,Return,exec,${terminal}" - ]; + "SUPERSHIFT,q,killactive" # exit program + "SUPERSHIFT,e,exit" # exit hyprland + + "SUPER,s,togglesplit" # horizontal split + "SUPER,f,fullscreen,1" # borderless window + "SUPERSHIFT,f,fullscreen,0" # proper fullscreen + "SUPERSHIFT,space,togglefloating" # floating window + + "SUPER,minus,splitratio,-0.25" # split gets slightly smaller + "SUPERSHIFT,minus,splitratio,-0.3333333" # split gets smaller + "SUPER,equal,splitratio,0.25" # split gets slightly larger + "SUPERSHIFT,equal,splitratio,0.3333333" # split gets larger + + "SUPER,g,togglegroup" # make a window group + "SUPER,t,lockactivegroup,toggle" # lock/unlock the current group + "SUPER,tab,changegroupactive,f" # switch to next window in group + "SUPERSHIFT,tab,changegroupactive,p" # switch to prev window in group + + "SUPER,dead_grave,workspace,previous" # prev workspace + "SUPER,dead_grave,workspace,next" # next workspace + + "SUPER,u,togglespecialworkspace" # toggle special workspace + "SUPERSHIFT,u,movetoworkspacesilent,special" # move to special workspace + ] + ++ + # change workspace + (map (n: "SUPER,${n},workspace,name:${n}") workspaces) + ++ + # move window to workspace + (map (n: "SUPERSHIFT,${n},movetoworkspacesilent,name:${n}") workspaces) + ++ + # move focus + (lib.mapAttrsToList (key: direction: "SUPER,${key},movefocus,${direction}") directions) + ++ + # swap windows + (lib.mapAttrsToList (key: direction: "SUPERSHIFT,${key},swapwindow,${direction}") directions) + ++ + # move windows + (lib.mapAttrsToList (key: direction: "SUPERCONTROL,${key},movewindoworgroup,${direction}") directions); }; }; }