From f10217bbae93f191098cf0bdafb26ef21635ccb1 Mon Sep 17 00:00:00 2001 From: langedev Date: Mon, 20 Nov 2023 01:31:41 -0800 Subject: [PATCH] Add hyprland --- flake.lock | 129 +++++++++++++++++++++++++++++++++++- flake.nix | 10 ++- home.nix | 1 + programs/hypr/default.conf | 52 +++++++++++++++ programs/hypr/default.nix | 9 +++ programs/hypr/keybinds.conf | 50 ++++++++++++++ 6 files changed, 248 insertions(+), 3 deletions(-) create mode 100644 programs/hypr/default.conf create mode 100644 programs/hypr/default.nix create mode 100644 programs/hypr/keybinds.conf diff --git a/flake.lock b/flake.lock index e1632a9..4336bb3 100644 --- a/flake.lock +++ b/flake.lock @@ -20,7 +20,70 @@ "type": "github" } }, + "hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "nixpkgs": "nixpkgs", + "systems": "systems", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1700397206, + "narHash": "sha256-ityVJcy3I/E8soXctwWveg58+cXOSQXhDIcU6YR2gjI=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "646f4bc63861e03b01fed3833bb65d1d014e1bf3", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1698134075, + "narHash": "sha256-foCD+nuKzfh49bIoiCBur4+Fx1nozo+4C/6k8BYk4sg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8efd5d1e283604f75a808a20e6cde0ef313d07d4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1699825797, "narHash": "sha256-W2m42mVt4/O6CJFbECPfLApmi8bO+qscbmSeEKrSHEg=", @@ -39,7 +102,71 @@ "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "wlroots": { + "flake": false, + "locked": { + "host": "gitlab.freedesktop.org", + "lastModified": 1699292815, + "narHash": "sha256-HXu98PyBMKEWLqiTb8viuLDznud/SdkdJsx5A5CWx7I=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5de9e1a99d6642c2d09d589aa37ff0a8945dcee1", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "5de9e1a99d6642c2d09d589aa37ff0a8945dcee1", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1697981233, + "narHash": "sha256-y8q4XUwx+gVK7i2eLjfR32lVo7TYvEslyzrmzYEaPZU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "22e7a65ff9633e1dedfa5317fdffc49f68de2ff2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index ec6e780..d9d68e4 100644 --- a/flake.nix +++ b/flake.nix @@ -4,20 +4,26 @@ inputs = { # Specify the source of Home Manager and Nixpkgs. nixpkgs.url = "github:langedev/nixpkgs/nixos-unstable"; + home-manager = { url = "github:langedev/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + + hyprland.url = "github:hyprwm/Hyprland"; }; - outputs = { nixpkgs, home-manager, ... }: + outputs = { nixpkgs, home-manager, hyprland, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; in { homeConfigurations."pan" = home-manager.lib.homeManagerConfiguration { inherit pkgs; - modules = [ ./home.nix ]; + modules = [ + hyprland.homeManagerModules.default + ./home.nix + ]; }; }; } diff --git a/home.nix b/home.nix index b5b997e..6ce9508 100644 --- a/home.nix +++ b/home.nix @@ -8,6 +8,7 @@ xdg.enable = true; imports = [ + ./programs/hypr ./programs/alacritty ./programs/pywal ./programs/fish diff --git a/programs/hypr/default.conf b/programs/hypr/default.conf new file mode 100644 index 0000000..4b1dc22 --- /dev/null +++ b/programs/hypr/default.conf @@ -0,0 +1,52 @@ +monitor=,preferred,auto,1 +monitor=HDMI-A-1,disable + +exec-once = swww init +exec-once = swww img $HOME/med/pix/bg.png + +input { + kb_layout = us + follow_mouse = 1 + accel_profile = flat + sensitivity = 0.2 # -1.0 - 1.0, 0 means no modification. +} + +general { + gaps_in = 3 + gaps_out = 3 + border_size = 2 + col.active_border = rgb(F5C2E7) + col.inactive_border = rgb(1E1D2F) + + layout = master +} + +decoration { + rounding = 2 + blur { + size = 12 + } +} + +animations { + enabled = yes + + animation = windows, 1, 4, default, popin 50% + animation = windowsOut, 1, 4, default, popin 50% + animation = windowsMove, 1, 3, default + animation = border, 1, 3, default + animation = fade, 1, 3, default + animation = workspaces, 1, 3, default +} + +master { + no_gaps_when_only = true + new_is_master = false +} + +Binds { + workspace_back_and_forth = true +} + +windowrule = opacity 0.9 0.9,^(Alacritty)$ +windowrule = opacity 0.94 0.94,^(discord)$ diff --git a/programs/hypr/default.nix b/programs/hypr/default.nix new file mode 100644 index 0000000..510e74b --- /dev/null +++ b/programs/hypr/default.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.extraConfig = '' + ${builtins.readFile ./default.conf} + ${builtins.readFile ./keybinds.conf} + ''; +} diff --git a/programs/hypr/keybinds.conf b/programs/hypr/keybinds.conf new file mode 100644 index 0000000..4ed1c58 --- /dev/null +++ b/programs/hypr/keybinds.conf @@ -0,0 +1,50 @@ +$mainMod = SUPER + +# Exec programs +bind = $mainMod, return, exec, alacritty +bind = $mainMod SHIFT, return, exec, rofi -show run +# bind = $mainMod SHIFT, P, exec, screenshot + +# Hyprland Management +bind = $mainMod SHIFT, Q, exit, + +# Bars stuff +bind = $mainMod, TAB, exec, eww open --toggle + +# Workspace / Monitor Management +bind = $mainMod, h, focusmonitor, l +bind = $mainMod, l, focusmonitor, r +bind = $mainMod, j, cyclenext, +bind = $mainMod, k, cyclenext, prev + +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 + +# Window Management +bind = $mainMod, C, killactive, + +bind = $mainMod, F, togglefloating, +bind = $mainMod SHIFT, F, fullscreen, + +bind = $mainMod SHIFT, 1, movetoworkspacesilent, 1 +bind = $mainMod SHIFT, 2, movetoworkspacesilent, 2 +bind = $mainMod SHIFT, 3, movetoworkspacesilent, 3 +bind = $mainMod SHIFT, 4, movetoworkspacesilent, 4 +bind = $mainMod SHIFT, 5, movetoworkspacesilent, 5 +bind = $mainMod SHIFT, 6, movetoworkspacesilent, 6 +bind = $mainMod SHIFT, 7, movetoworkspacesilent, 7 +bind = $mainMod SHIFT, 8, movetoworkspacesilent, 8 +bind = $mainMod SHIFT, 9, movetoworkspacesilent, 9 +bind = $mainMod SHIFT, 0, movetoworkspacesilent, 10 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow