From c9cf321b340fa82481a7c73b887728b64bd365be Mon Sep 17 00:00:00 2001 From: TheWanderingCrow Date: Sat, 21 Sep 2024 15:57:53 -0400 Subject: [PATCH] Add hypr (x11) support --- hosts/Parzival-Mobile/default.nix | 1 + modules/core.nix | 4 + modules/hypr/default.nix | 20 +++-- modules/i3/default.nix | 15 ---- modules/programs.nix | 10 ++- modules/users/crow/home.nix | 1 + modules/users/crow/hypr.conf | 122 ++++++++++++++++++++++++++++++ 7 files changed, 152 insertions(+), 21 deletions(-) delete mode 100644 modules/i3/default.nix create mode 100644 modules/users/crow/hypr.conf diff --git a/hosts/Parzival-Mobile/default.nix b/hosts/Parzival-Mobile/default.nix index 66e8a67..208b48f 100644 --- a/hosts/Parzival-Mobile/default.nix +++ b/hosts/Parzival-Mobile/default.nix @@ -4,6 +4,7 @@ ../../modules ]; + hyprland.enable = true; hypr.enable = true; packages.mudding.enable = true; networking.hostName = "Parzival-Mobile"; diff --git a/modules/core.nix b/modules/core.nix index 80d4d5d..80f5698 100644 --- a/modules/core.nix +++ b/modules/core.nix @@ -9,6 +9,8 @@ enable = lib.mkEnableOption "enables packages"; core.enable = lib.mkEnableOption "enables required packages"; gui.enable = lib.mkEnableOption "enables gui+DE packages"; + wayland.enable = lib.mkEnableOption "enables wayland packages"; + x11.enable = lib.mkEnableOption "enables x11 packages"; programming.enable = lib.mkEnableOption "enables programming packages"; hacking.enable = lib.mkEnableOption "enables hacking packages"; mudding.enable = lib.mkEnableOption "enables mudding packages"; @@ -45,6 +47,8 @@ enable = lib.mkDefault true; core.enable = lib.mkDefault true; gui.enable = lib.mkDefault true; + wayland.enable = lib.mkDefault false; + x11.enable = lib.mkDefault false; programming.enable = lib.mkDefault true; hacking.enable = lib.mkDefault false; mudding.enable = lib.mkDefault false; diff --git a/modules/hypr/default.nix b/modules/hypr/default.nix index edc568f..7602ba5 100644 --- a/modules/hypr/default.nix +++ b/modules/hypr/default.nix @@ -1,15 +1,15 @@ { inputs, pkgs, lib, config, ...}: { - options.hypr.enable = lib.mkEnableOption "enables hyprland"; + options.hyprland.enable = lib.mkEnableOption "enables hyprland"; + options.hypr.enable = lib.mkEnableOption "enables hypr"; - config.programs.hyprland = lib.mkIf config.hypr.enable { + config.programs.hyprland = lib.mkIf config.hyprland.enable { enable = true; package = inputs.hyprland.packages.${pkgs.system}.hyprland; portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland; }; - - - config.environment = lib.mkIf config.hypr.enable { + + config.environment = lib.mkIf config.hyprland.enable { sessionVariables = { NIXOS_OZONE_WL = "1"; }; @@ -18,4 +18,14 @@ hyprcursor ]; }; + + config = lib.mkIf config.hypr.enable { + xserver = { + enable = true; + windowManager.hypr = { + enable = true; + }; + displayManager.startx.enable = true; + }; + }; } diff --git a/modules/i3/default.nix b/modules/i3/default.nix deleted file mode 100644 index 56cd58e..0000000 --- a/modules/i3/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ inputs, pkgs, lib, config, ...}: { - - options.i3.enable = lib.mkEnableOption "enables i3"; - - config = lib.mkIf config.i3.enable { - xserver = { - enable = true; - windowManager.i3 = { - enable = true; - configFile = ./i3.config; - }; - displayManager.lightdm.enable = false; - }; - }; -} diff --git a/modules/programs.nix b/modules/programs.nix index 650dd11..1fb4b87 100644 --- a/modules/programs.nix +++ b/modules/programs.nix @@ -46,9 +46,17 @@ # Utilities hyfetch gimp - foot + foot ] else [] ) + ++ ( + if config.packages.wayland.enable + then [] else [] + ) + ++ ( + if config.packages.x11.enable + then [] else [] + ) ++ ( if config.packages.programming.enable then [ diff --git a/modules/users/crow/home.nix b/modules/users/crow/home.nix index 54ddd47..930900f 100644 --- a/modules/users/crow/home.nix +++ b/modules/users/crow/home.nix @@ -4,6 +4,7 @@ homeDirectory = "/home/crow"; stateVersion = "24.05"; file.".config/hypr/hyprland.conf".source = ./hyprland.conf; + file.".config/hypr/hypr.conf".source = ./hypr.conf; }; xdg = { diff --git a/modules/users/crow/hypr.conf b/modules/users/crow/hypr.conf new file mode 100644 index 0000000..3750984 --- /dev/null +++ b/modules/users/crow/hypr.conf @@ -0,0 +1,122 @@ +# Hypr example config file +# +# +# =) + +gaps_in=5 +border_size=1 +gaps_out=20 +rounding=0 +max_fps=60 # max fps for updates of config & animations +focus_when_hover=1 # 0 - do not switch the focus when hover (only for tiling) +main_mod=SUPER # For moving, resizing +intelligent_transients=1 # keeps transients always on top. +no_unmap_saving=1 # disables saving unmapped windows (seems to break sometimes) +scratchpad_mon=0 # self-explanatory + +# Execs +# exec-once=/home/me/MyEpicShellScript # will exec the script only when the WM launches +# exec=/home/me/MyEpicShellScript # will exec the script every time the config is reloaded + +# Layout +layout=0 # 0 - dwindle (default), 1 - master +layout { + no_gaps_when_only=0 # disables gaps and borders when only window on screen +} + +# Bar config +Bar { + height=20 + monitor=0 + enabled=1 + mod_pad_in=8 + no_tray_saving=1 # using this doesnt save the tray between reloads but fixes an issue with the bar disappearing. + + font.main=Noto Sans + font.secondary=Noto Sans + + col.bg=0xff111111 + col.high=0xffff3333 + + module=left,X,0xff8000ff,0xffffffff,1,workspaces + module=pad,left,10 + module=left,,0xff7000dd,0xff7000dd,1,tray + module=right,X,0xffffffff,0xff00ff33,1000,$date +%a,\ %b\ %Y\ \ %I:%M\ %p$ +} + +# colors +col.active_border=0x77ff3333 +col.inactive_border=0x77222222 + +# status command +# deprecated +# status_command=date +%a,\ %b\ %Y\ \ %I:%M\ %p +# + +# animations +Animations { + enabled=1 # For windows + window_resize_speed=5 # This is for windows resizing + workspaces=1 # For workspace animations (fixed, enabling by default) + speed=5 # This is for workspaces + cheap=1 # highly recommended + borders=0 +} + +# example window rules, more in the wiki + +# windowrule=float,class:krunner +# windowrule=float,role:pop-up +# windowrule=float,role:task_dialog +# windowrule=monitor 0,class:krunner +# windowrule=size 500 50,class:krunner +# windowrule=move 700 500,class:krunner +# windowrule=pseudo,class:discord + +# keybinds +bind=SUPER,R,exec,dmenu_run +bind=SUPER,Q,exec,kitty +bind=SUPER,RETURN,exec,xterm +bind=SUPER,G,exec,google-chrome-stable + +bind=SUPER,C,killactive, + +bind=SUPER,LEFT,movewindow,l +bind=SUPER,RIGHT,movewindow,r +bind=SUPER,UP,movewindow,u +bind=SUPER,DOWN,movewindow,d + +bind=SUPER,LEFT,movefocus,l +bind=SUPER,RIGHT,movefocus,r +bind=SUPER,UP,movefocus,u +bind=SUPER,DOWN,movefocus,d + +bind=SUPER,F,fullscreen, + +bind=SUPER,1,workspace,1 +bind=SUPER,2,workspace,2 +bind=SUPER,3,workspace,3 +bind=SUPER,4,workspace,4 +bind=SUPER,5,workspace,5 +bind=SUPER,6,workspace,6 +bind=SUPER,7,workspace,7 +bind=SUPER,8,workspace,8 +bind=SUPER,9,workspace,9 + +bind=SUPERSHIFT,1,movetoworkspace,1 +bind=SUPERSHIFT,2,movetoworkspace,2 +bind=SUPERSHIFT,3,movetoworkspace,3 +bind=SUPERSHIFT,4,movetoworkspace,4 +bind=SUPERSHIFT,5,movetoworkspace,5 +bind=SUPERSHIFT,6,movetoworkspace,6 +bind=SUPERSHIFT,7,movetoworkspace,7 +bind=SUPERSHIFT,8,movetoworkspace,8 +bind=SUPERSHIFT,9,movetoworkspace,9 + +bind=SUPERSHIFT,S,movetoworkspace,scratchpad +bind=SUPER,S,scratchpad, + +bind=SUPER,SPACE,togglefloating, + +bind=SUPER,equal,splitratio,+ +bind=SUPER,minus,splitratio,-