diff options
author | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-10-02 17:31:35 +0300 |
---|---|---|
committer | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-10-02 17:32:17 +0300 |
commit | a29235acb614f5070a3531c9417364c085dedd26 (patch) | |
tree | ef86588b76dc7ffbb9f1f58458f3fd3732c93f0a | |
parent | d4059b5e9ad8065a917e70c75930e35385cc3499 (diff) | |
download | nixos-configuration-a29235acb614f5070a3531c9417364c085dedd26.tar.gz nixos-configuration-a29235acb614f5070a3531c9417364c085dedd26.tar.bz2 nixos-configuration-a29235acb614f5070a3531c9417364c085dedd26.zip |
feat: further structure hyprland configuration
Added special keybind definition files
Created new hyprland-specific config dir
-rw-r--r-- | home-manager/stvnliu/hypr/default.nix | 2 | ||||
-rw-r--r-- | home-manager/stvnliu/hypr/hyprland.nix | 114 | ||||
-rw-r--r-- | home-manager/stvnliu/hypr/hyprland/binds.nix | 49 | ||||
-rw-r--r-- | home-manager/stvnliu/hypr/hyprland/default.nix | 68 | ||||
-rw-r--r-- | home-manager/stvnliu/hypr/hyprland/xf86_binds.nix | 10 |
5 files changed, 128 insertions, 115 deletions
diff --git a/home-manager/stvnliu/hypr/default.nix b/home-manager/stvnliu/hypr/default.nix index b23406f..bb8c931 100644 --- a/home-manager/stvnliu/hypr/default.nix +++ b/home-manager/stvnliu/hypr/default.nix @@ -5,7 +5,7 @@ ... }: { imports = [ - ./hyprland.nix + ./hyprland ./hyprpaper.nix ./hypridle.nix ./hyprlock.nix diff --git a/home-manager/stvnliu/hypr/hyprland.nix b/home-manager/stvnliu/hypr/hyprland.nix deleted file mode 100644 index dba67dd..0000000 --- a/home-manager/stvnliu/hypr/hyprland.nix +++ /dev/null @@ -1,114 +0,0 @@ -{ - config, - pkgs, - ... -}: { - home.packages = with pkgs; [foot]; - wayland.windowManager.hyprland = { - # Whether to enable Hyprland wayland compositor - enable = true; - # The hyprland package to use - package = pkgs.hyprland; - plugins = with pkgs.hyprlandPlugins; [ - hyprfocus - csgo-vulkan-fix - ]; - # Whether to enable XWayland - xwayland.enable = true; - settings = { - xwayland = {force_zero_scaling = true;}; - monitor = [ - #"eDP-1, 1920x1080@165,0x0,1" - "HDMI-A-1, 1920x1080@75, 2560x0, 1" - "eDP-1,preferred, auto, ${builtins.toString config.displayScale}" - ]; - general = { - border_size = 1; - gaps_in = 2.5; - gaps_out = 5; - }; - decoration = { - rounding = 5; - }; - input = { - # xset rate 250 50 replacement on wayland... - # FAST MODE LET'S GOOO - repeat_rate = 50; - repeat_delay = 250; - accel_profile = "flat"; - }; - exec-once = - config.myAutostartCommands - ++ [ - "[workspace special silent] ${pkgs.foot}/bin/foot -f 'BlexMono Nerd Font:size=16' -o colors.alpha=0.85 ${config.myShells.defaultShell}" - ]; - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - font_family = "monospace"; - focus_on_activate = true; # see if fixes mako daemon not focusing - }; - "$mod" = "SUPER"; - binde = [ - ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" - - # Example volume button that will activate even while an input inhibitor is active - ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - ]; - bind = let - terminalCmd = "${pkgs.foot}/bin/foot -f 'BlexMono Nerd Font:size=16' -o colors.alpha=0.85"; - screenshotLocation = "/home/${config.myUserName}/Screenshots/$(date '+%Y-%m-%d-%H-%M-%S').png"; - in - [ - "$mod SHIFT, L, exec, ${pkgs.wlogout}/bin/wlogout" - - "$mod SHIFT, Print, exec, ${pkgs.grimblast}/bin/grimblast copysave output ${screenshotLocation}" - ", Print, exec, ${pkgs.grimblast}/bin/grimblast copysave area ${screenshotLocation}" - "$mod, Print, exec, ${pkgs.grimblast}/bin/grimblast copy area" - - # special workspace keybinds - "$mod, S, togglespecialworkspace" - "$mod SHIFT, S, movetoworkspace, special" - - # keysyms for util functions - # Example volume button that allows press and hold, volume limited to 150% - "$mod, Q, killactive" - "$mod, D, exec, ${pkgs.fuzzel}/bin/fuzzel" - "$mod, F, fullscreen" - "$mod, E, exec, ${pkgs.pcmanfm}/bin/pcmanfm" - # foot terminal - "$mod, Return, exec, ${terminalCmd} ${config.myShells.defaultShell}" - "$mod SHIFT, Return, exec, [float] ${terminalCmd} ${config.myShells.defaultShell}" - - "$mod, N, exec, [float] ${terminalCmd} ${pkgs.networkmanager}/bin/nmtui" - - # vimkeys navigation - "$mod, H, movefocus, l" - "$mod, J, movefocus, d" - "$mod, K, movefocus, u" - "$mod, L, movefocus, r" - ] - ++ ( - # workspaces - # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} - builtins.concatLists (builtins.genList (x: let - ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10)); - in [ - "$mod, ${ws}, workspace, ${toString (x + 1)}" - "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" - ]) - 10) - ); - bindm = [ - # mouse movements - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - "$mod ALT, mouse:272, resizewindow" - ]; - }; - # Optional - # Whether to enable hyprland-session.target on hyprland startup - systemd = {enable = true;}; - }; - # ... -} diff --git a/home-manager/stvnliu/hypr/hyprland/binds.nix b/home-manager/stvnliu/hypr/hyprland/binds.nix new file mode 100644 index 0000000..d7c503a --- /dev/null +++ b/home-manager/stvnliu/hypr/hyprland/binds.nix @@ -0,0 +1,49 @@ +{ + config, + pkgs, +}: let + terminalCmd = "${pkgs.foot}/bin/foot -f '${config.desktopFontFullName}:size=16' -o colors.alpha=0.80"; + screenshotLocation = "/home/${config.myUserName}/Screenshots/$(date '+%Y-%m-%d-%H-%M-%S').png"; +in + [ + "$mod SHIFT, L, exec, ${pkgs.wlogout}/bin/wlogout" + + "$mod SHIFT, Print, exec, ${pkgs.grimblast}/bin/grimblast copysave output ${screenshotLocation}" + ", Print, exec, ${pkgs.grimblast}/bin/grimblast copysave area ${screenshotLocation}" + "$mod, Print, exec, ${pkgs.grimblast}/bin/grimblast copy area" + + # special workspace keybinds + "$mod, S, togglespecialworkspace" + "$mod SHIFT, S, movetoworkspace, special" + + # keysyms for util functions + # Example volume button that allows press and hold, volume limited to 150% + "$mod, Q, killactive" + "$mod, D, exec, ${pkgs.rofi}/bin/rofi -show drun" + "$mod, F, fullscreen" + "$mod, E, exec, ${pkgs.pcmanfm}/bin/pcmanfm" + # foot terminal + "$mod, Return, exec, ${terminalCmd} ${config.myShells.defaultShell}" + "$mod SHIFT, Return, exec, [float] ${terminalCmd} ${config.myShells.defaultShell}" + + # cmdline utilities + "$mod, N, exec, [float] ${terminalCmd} ${pkgs.networkmanager}/bin/nmtui" + "$mod, M, exec, [float] ${terminalCmd} ${pkgs.zenith}/bin/zenith" + + # vimkeys navigation + "$mod, H, movefocus, l" + "$mod, J, movefocus, d" + "$mod, K, movefocus, u" + "$mod, L, movefocus, r" + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList (x: let + ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10)); + in [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ]) + 10) + ) diff --git a/home-manager/stvnliu/hypr/hyprland/default.nix b/home-manager/stvnliu/hypr/hyprland/default.nix new file mode 100644 index 0000000..475d4e5 --- /dev/null +++ b/home-manager/stvnliu/hypr/hyprland/default.nix @@ -0,0 +1,68 @@ +{ + config, + pkgs, + ... +}: { + home.packages = with pkgs; [foot]; + wayland.windowManager.hyprland = { + # Whether to enable Hyprland wayland compositor + enable = true; + # The hyprland package to use + package = pkgs.hyprland; + plugins = with pkgs.hyprlandPlugins; [hyprfocus csgo-vulkan-fix]; + # Whether to enable XWayland + xwayland.enable = true; + settings = { + env = ["AQ_DRM_DEVICES, /dev/dri/card1:/dev/dri/card0"]; + xwayland = {force_zero_scaling = true;}; + monitor = [ + #"eDP-1, 1920x1080@165,0x0,1" + "HDMI-A-1, 1920x1080@75, 2560x0, 1" + "eDP-1,preferred, auto, ${builtins.toString config.displayScale}" + ]; + general = { + border_size = 1; + gaps_in = 2.5; + gaps_out = 5; + }; + decoration = {rounding = 5;}; + input = { + # xset rate 250 50 replacement on wayland... + # FAST MODE LET'S GOOO + repeat_rate = 50; + repeat_delay = 250; + accel_profile = "flat"; + }; + exec-once = + config.myAutostartCommands + ++ [ + "[workspace special silent] ${pkgs.foot}/bin/foot -f '${config.desktopFontFullName}:size=16' -o colors.alpha=0.80 ${config.myShells.defaultShell}" + ]; + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + font_family = "monospace"; + focus_on_activate = true; # see if fixes mako daemon not focusing + }; + "$mod" = "SUPER"; + binde = import ./xf86_binds.nix { + inherit config; + inherit pkgs; + }; + bind = import ./binds.nix { + inherit config; + inherit pkgs; + }; + bindm = [ + # mouse movements + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + "$mod ALT, mouse:272, resizewindow" + ]; + }; + # Optional + # Whether to enable hyprland-session.target on hyprland startup + systemd = {enable = true;}; + }; + # ... +} diff --git a/home-manager/stvnliu/hypr/hyprland/xf86_binds.nix b/home-manager/stvnliu/hypr/hyprland/xf86_binds.nix new file mode 100644 index 0000000..215a4a8 --- /dev/null +++ b/home-manager/stvnliu/hypr/hyprland/xf86_binds.nix @@ -0,0 +1,10 @@ +{ + pkgs, + config, +}: [ + ", XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause" + ", XF86AudioStop, exec, ${pkgs.playerctl}/bin/playerctl stop" + ", XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ", XF86AudioMute, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 0%" +] |