From eca6f4504b9af6c0f6628bafeeb29c1f59e25f97 Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Sat, 1 Apr 2023 22:18:50 +0100 Subject: [PATCH] Initial Hyprland configuration --- flake.lock | 104 ++++++++++++++++++- flake.nix | 6 +- users/tsv/home.nix | 7 ++ users/tsv/hyprland/hyprland.conf | 159 ++++++++++++++++++++++++++++++ users/tsv/hyprland/hyprpaper.conf | 4 + 5 files changed, 278 insertions(+), 2 deletions(-) create mode 100644 users/tsv/hyprland/hyprland.conf create mode 100644 users/tsv/hyprland/hyprpaper.conf diff --git a/flake.lock b/flake.lock index bd5caca..0d0b02c 100644 --- a/flake.lock +++ b/flake.lock @@ -96,6 +96,48 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1680374250, + "narHash": "sha256-j1cZaupLBnrYtMzEZMM18ARH4fv8e7SYnuuHSgNV27s=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "88a96110b73d74cbef37a60378941fa4f7318f1f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671839510, + "narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "lowdown-src": { "flake": false, "locked": { @@ -185,6 +227,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1679172431, + "narHash": "sha256-XEh5gIt5otaUbEAPUY5DILUTyWe1goAyeqQtmwaFPyI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1603d11595a232205f03d46e635d919d1e1ec5b9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1680125544, "narHash": "sha256-mlqo1r+TZUOuypWdrZHluxWL+E5WzXlUXNZ9Y0WLDFU=", @@ -232,7 +290,8 @@ "inputs": { "devenv": "devenv", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_2" + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_3" } }, "utils": { @@ -249,6 +308,49 @@ "repo": "flake-utils", "type": "github" } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1679340088, + "narHash": "sha256-/1KiYoBivDj8HC/eVK2Tr2WYkVdKJxq2Lb0tQs0qqJo=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "1d64e12391a638201c679e71d4e22bb45e5faa8e", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673116118, + "narHash": "sha256-eR0yDSkR2XYMesfdRWJs25kAdXET2mbNNHu5t+KUcKA=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "d479c846531fd0e1d2357c9588b8310a2b859ef2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 092e671..d1c9711 100644 --- a/flake.nix +++ b/flake.nix @@ -8,9 +8,10 @@ inputs.nixpkgs.follows = "nixpkgs"; }; devenv.url = "github:cachix/devenv/latest"; + hyprland.url = "github:hyprwm/Hyprland"; }; - outputs = inputs@{ nixpkgs, home-manager, devenv, ... }: { + outputs = inputs@{ nixpkgs, home-manager, devenv, hyprland, ... }: { nixosConfigurations = { ritchie = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -20,6 +21,9 @@ modules = [ ./system/configuration.nix + hyprland.nixosModules.default + { programs.hyprland.enable = true; } + home-manager.nixosModules.home-manager { home-manager = { useGlobalPkgs = true; diff --git a/users/tsv/home.nix b/users/tsv/home.nix index 97e403a..3193190 100644 --- a/users/tsv/home.nix +++ b/users/tsv/home.nix @@ -28,6 +28,7 @@ chromium delta # Nice diffing pager for Git docker-compose + feh firefox fzf gcc @@ -38,6 +39,7 @@ gimp heroku htop + hyprpaper imagemagick kde-gruvbox kitty @@ -59,8 +61,11 @@ toot unzip w3m + waybar wine winetricks + wireplumber + wlr-randr zoom-us ]; @@ -112,6 +117,8 @@ xdg.configFile."kitty/gruvbox_dark_soft.conf".source = ./kitty/gruvbox_dark_soft.conf; xdg.configFile."aerc/aerc.conf".source = ./aerc/aerc.conf; xdg.configFile."aerc/accounts.conf".source = ./aerc/accounts.conf; + xdg.configFile."hypr/hyprland.conf".source = ./hyprland/hyprland.conf; + xdg.configFile."hypr/hyprpaper.conf".source = ./hyprland/hyprpaper.conf; home.file.".ssh/config".source = ./ssh/config; home.file.".LESS_TERMCAP".source = ./LESS_TERMCAP; services.syncthing.enable = true; diff --git a/users/tsv/hyprland/hyprland.conf b/users/tsv/hyprland/hyprland.conf new file mode 100644 index 0000000..a19437c --- /dev/null +++ b/users/tsv/hyprland/hyprland.conf @@ -0,0 +1,159 @@ +# NVidia stuff +#env = LIBVA_DRIVER_NAME,nvidia +#env = XDG_SESSION_TYPE,wayland +#env = GBM_BACKEND,nvidia-drm +#env = __GLX_VENDOR_LIBRARY_NAME,nvidia +#env = WLR_NO_HARDWARE_CURSORS,1 + +monitor=eDP-1, preferred, auto, 1 +monitor=DP-1, preferred, auto, auto, transform, 1 + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more + +# Execute your favorite apps at launch +exec-once = waybar & hyprpaper & kitty + +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +# Some default env vars. +env = XCURSOR_SIZE,24 + +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = us + kb_variant = + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 20 + border_size = 2 + col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 10 + blur = yes + blur_size = 3 + blur_passes = 1 + blur_new_optimizations = on + + drop_shadow = yes + shadow_range = 4 + shadow_render_power = 3 + col.shadow = rgba(1a1a1aee) +} + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = off +} + +# Example per-device config +# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more +device:epic-mouse-v1 { + sensitivity = -0.5 +} + +# Example windowrule v1 +# windowrule = float, ^(kitty)$ +# Example windowrule v2 +# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = SUPER + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Q, exec, kitty +bind = $mainMod, C, killactive, +bind = $mainMod, M, exit, +bind = $mainMod, E, exec, dolphin +bind = $mainMod, V, togglefloating, +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle + +# Move focus with mainMod + vi direction keys +bind = $mainMod, h, movefocus, l +bind = $mainMod, l, movefocus, r +bind = $mainMod, k, movefocus, u +bind = $mainMod, j, movefocus, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow diff --git a/users/tsv/hyprland/hyprpaper.conf b/users/tsv/hyprland/hyprpaper.conf new file mode 100644 index 0000000..a53221b --- /dev/null +++ b/users/tsv/hyprland/hyprpaper.conf @@ -0,0 +1,4 @@ +preload = ~/img/wallpaper/carina_nebula.jpg +wallpaper = eDP-1,~/img/wallpaper/carina_nebula.jpg +wallpaper = DP-1,~/img/wallpaper/carina_nebula.jpg +