From 5db0283ba6fac2995ccad420db3aec7454b8cf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 27 Feb 2024 21:52:14 +0100 Subject: [PATCH] Add hyprland to hm --- home/default.nix | 3 +- home/hyprland/default.nix | 6 +++ home/hyprland/hyprland.nix | 96 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 home/hyprland/default.nix create mode 100644 home/hyprland/hyprland.nix diff --git a/home/default.nix b/home/default.nix index 63626c7..2cf0557 100644 --- a/home/default.nix +++ b/home/default.nix @@ -11,10 +11,11 @@ ./programs/tmux ./zsh ./packages - ./hyprland/waybar.nix + ./hyprland ]; firefox.enable = true; tmux.enable = true; + hyprland.enable = true; home = { username = "${user}"; homeDirectory = "/home/${user}"; diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix new file mode 100644 index 0000000..642a652 --- /dev/null +++ b/home/hyprland/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./hyprland.nix + ./waybar.nix + ]; +} diff --git a/home/hyprland/hyprland.nix b/home/hyprland/hyprland.nix new file mode 100644 index 0000000..b8f20f7 --- /dev/null +++ b/home/hyprland/hyprland.nix @@ -0,0 +1,96 @@ +{ inputs, pkgs, lib, ...}: { + options.hyprland.enable = lib.mkEnableOption "Hyprland"; + config = { + home.packages = with pkgs; [ + swww + wl-clipboard + cliphist + ]; + + wayland.windowManager.hyprland = { + enable = true; + settings = { + "$mainMod" = "SUPER"; + "$term" = "alacritty"; + + monitor = [ "eDP-1,1920x1080@60,0x0,1" ]; + input = { + kb_layout = "no"; + follow_mouse = 1; + }; + + decoration = { + rounding = 10; + drop_shadow = true; + shadow_range = 4; + shadow_render_power = 3; + blur = { + enabled = true; + size = 3; + passes = 1; + xray = true; + }; + }; + + general = { + gaps_in = 4; + gaps_out = 10; + border_size = 2; + layout = "dwindle"; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + dwindle = { + pseudotile = true; + preserve_split = true; + }; + master.new_is_master = true; + misc.force_default_wallpaper = -1; + + bind = [ + # term + "$mainMod,Return,exec,$term" + # rofi + "$mainMod,D,exec,rofi -show drun" + # hyprland + "$mainMod,Q,killactive," + "CTRLALT,Delete,exit," + "$mainMod,Space,togglefloating," + "$mainMod,F,fullscreen," + + # focus + "$mainMod,l,movefocus,l" + "$mainMod,h,movefocus,r" + "$mainMod,k,movefocus,u" + "$mainMod,j,movefocus,d" + + # move + "$mainMod,h,movewindow,l" + "$mainMod,l,movewindow,r" + "$mainMod,k,movewindow,u" + "$mainMod,j,movewindow,d" + ] ++ (builtins.concatLists (builtins.genList(x: + let + ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10)); + in [ + "$mainMod, ${ws}, workspace, ${toString( x + 1)}" + "ALT, ${ws}, workspace, ${toString( x + 1)}" + ]) 10)); + exec-once = [ + "waybar &" + ]; + }; + }; + }; +}