diff options
author | Freya Murphy <freya@freyacat.org> | 2025-06-27 16:39:14 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-06-27 16:39:14 -0400 |
commit | 2e4c4298cf84f94d68387e8076fd430e9968ce6c (patch) | |
tree | 2a43fa6d4659fe2585c75aeec3ee4d5e0a42de2e | |
parent | fmt (diff) | |
download | dotfiles-nix-2e4c4298cf84f94d68387e8076fd430e9968ce6c.tar.gz dotfiles-nix-2e4c4298cf84f94d68387e8076fd430e9968ce6c.tar.bz2 dotfiles-nix-2e4c4298cf84f94d68387e8076fd430e9968ce6c.zip |
refactor
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | home/default.nix | 4 | ||||
-rw-r--r-- | hosts/kaworu/default.nix | 16 | ||||
-rw-r--r-- | hosts/shinji/default.nix | 16 | ||||
-rw-r--r-- | hosts/thinkpad/default.nix | 16 | ||||
-rw-r--r-- | modules/apps/alacritty.nix (renamed from modules/terminal/alacritty.nix) | 2 | ||||
-rw-r--r-- | modules/apps/astal.nix | 47 | ||||
-rw-r--r-- | modules/apps/default.nix | 23 | ||||
-rw-r--r-- | modules/apps/hyprlock.nix (renamed from modules/desktop/hyprlock.nix) | 2 | ||||
-rw-r--r-- | modules/apps/kitty.nix (renamed from modules/terminal/kitty.nix) | 2 | ||||
-rw-r--r-- | modules/apps/mako.nix (renamed from modules/desktop/mako.nix) | 2 | ||||
-rw-r--r-- | modules/apps/waybar/default.nix (renamed from modules/desktop/waybar/default.nix) | 2 | ||||
-rw-r--r-- | modules/apps/waybar/style.nix (renamed from modules/desktop/waybar/style.nix) | 0 | ||||
-rw-r--r-- | modules/apps/wofi/default.nix (renamed from modules/desktop/wofi/default.nix) | 2 | ||||
-rw-r--r-- | modules/apps/wofi/style.nix (renamed from modules/desktop/wofi/style.nix) | 0 | ||||
-rw-r--r-- | modules/browsers/default.nix (renamed from modules/browser/default.nix) | 2 | ||||
-rw-r--r-- | modules/browsers/firefox/default.nix (renamed from modules/browser/firefox/default.nix) | 2 | ||||
-rw-r--r-- | modules/browsers/firefox/extraPrefs.nix (renamed from modules/browser/firefox/extraPrefs.nix) | 0 | ||||
-rw-r--r-- | modules/browsers/firefox/policy.nix (renamed from modules/browser/firefox/policy.nix) | 0 | ||||
-rw-r--r-- | modules/browsers/firefox/policyExtensions.nix (renamed from modules/browser/firefox/policyExtensions.nix) | 0 | ||||
-rw-r--r-- | modules/browsers/firefox/policyPrefs.nix (renamed from modules/browser/firefox/policyPrefs.nix) | 0 | ||||
-rw-r--r-- | modules/browsers/firefox/userChrome.nix (renamed from modules/browser/firefox/userChrome.nix) | 0 | ||||
-rw-r--r-- | modules/default.nix | 6 | ||||
-rw-r--r-- | modules/desktop/astal.nix | 24 | ||||
-rw-r--r-- | modules/desktop/hypridle.nix | 45 | ||||
-rw-r--r-- | modules/desktop/hyprland.nix | 351 | ||||
-rw-r--r-- | modules/desktop/hyprpaper.nix | 22 | ||||
-rw-r--r-- | modules/desktops/default.nix (renamed from modules/desktop/default.nix) | 22 | ||||
-rw-r--r-- | modules/desktops/hyprland/binds.nix | 132 | ||||
-rw-r--r-- | modules/desktops/hyprland/default.nix | 40 | ||||
-rw-r--r-- | modules/desktops/hyprland/env.nix | 12 | ||||
-rw-r--r-- | modules/desktops/hyprland/idle.nix | 36 | ||||
-rw-r--r-- | modules/desktops/hyprland/plugins.nix | 45 | ||||
-rw-r--r-- | modules/desktops/hyprland/settings.nix | 117 | ||||
-rw-r--r-- | modules/desktops/hyprland/wallpaper.nix | 13 | ||||
-rw-r--r-- | modules/desktops/wayland.nix | 21 | ||||
-rw-r--r-- | modules/gaming/homestuck.nix | 3 | ||||
-rw-r--r-- | modules/options.nix | 5 | ||||
-rw-r--r-- | modules/terminal/default.nix | 17 | ||||
-rw-r--r-- | options.nix | 1 | ||||
-rw-r--r-- | pkgs/astal/src/launcher.lua | 2 | ||||
-rw-r--r-- | pkgs/astal/src/shell.lua | 1 | ||||
-rw-r--r-- | pkgs/astal/src/widget/deck/notifications.lua | 1 | ||||
-rw-r--r-- | pkgs/astal/src/widget/launcher.lua | 10 | ||||
-rw-r--r-- | system/desktop.nix | 2 |
45 files changed, 538 insertions, 530 deletions
@@ -53,7 +53,7 @@ buildSystem = file: system: inputs.nixpkgs.lib.nixosSystem { inherit system; - specialArgs = {inherit self inputs;}; + specialArgs = {inherit self inputs system;}; modules = [ options ./home diff --git a/home/default.nix b/home/default.nix index faa4993..e173c48 100644 --- a/home/default.nix +++ b/home/default.nix @@ -3,10 +3,10 @@ config, pkgs, inputs, + system, ... }: let inherit (lib) optionals; - system = pkgs.stdenv.hostPlatform.system; in { imports = [ inputs.home-manager.nixosModules.home-manager @@ -36,7 +36,7 @@ in { inputs.talc.packages.${system}.talc ] ++ (with pkgs; - optionals config.desktop.enable [ + optionals config.desktops.enable [ # social discord element-desktop diff --git a/hosts/kaworu/default.nix b/hosts/kaworu/default.nix index c9a2361..18bfc8e 100644 --- a/hosts/kaworu/default.nix +++ b/hosts/kaworu/default.nix @@ -15,16 +15,17 @@ ]; # modules - browser = { + apps = { + astal = true; + hyprlock = true; + kitty = true; + }; + browsers = { firefox = true; }; - desktop = { + desktops = { enable = true; - astal = true; hyprland = true; - hyprlock = true; - hypridle = true; - hyprpaper = true; }; development = { c = true; @@ -36,9 +37,6 @@ minecraft = true; steam = true; }; - terminal = { - kitty = true; - }; # modules bluetooth = true; diff --git a/hosts/shinji/default.nix b/hosts/shinji/default.nix index 4d7f434..8051429 100644 --- a/hosts/shinji/default.nix +++ b/hosts/shinji/default.nix @@ -37,16 +37,17 @@ ]; # modules - browser = { + apps = { + astal = true; + hyprlock = true; + kitty = true; + }; + browsers = { firefox = true; }; - desktop = { + desktops = { enable = true; - astal = true; hyprland = true; - hyprlock = true; - hypridle = true; - hyprpaper = true; }; development = { c = true; @@ -59,9 +60,6 @@ minecraft = true; steam = true; }; - terminal = { - kitty = true; - }; # modules battery = true; diff --git a/hosts/thinkpad/default.nix b/hosts/thinkpad/default.nix index b2986ba..9d600dc 100644 --- a/hosts/thinkpad/default.nix +++ b/hosts/thinkpad/default.nix @@ -15,24 +15,22 @@ ]; # modules - browser = { + apps = { + astal = true; + hyprlock = true; + kitty = true; + }; + browsers = { firefox = true; }; - desktop = { + desktops = { enable = true; - astal = true; hyprland = true; - hyprlock = true; - hypridle = true; - hyprpaper = true; }; gaming = { homestuck = true; minecraft = true; }; - terminal = { - kitty = true; - }; # modules battery = true; diff --git a/modules/terminal/alacritty.nix b/modules/apps/alacritty.nix index 27a8150..b50e142 100644 --- a/modules/terminal/alacritty.nix +++ b/modules/apps/alacritty.nix @@ -4,7 +4,7 @@ ... }: let inherit (lib) mkIf; - cfg = config.terminal; + cfg = config.apps; in { config = mkIf cfg.alacritty { default.terminal = lib.mkDefault "alacritty"; diff --git a/modules/apps/astal.nix b/modules/apps/astal.nix new file mode 100644 index 0000000..e57263e --- /dev/null +++ b/modules/apps/astal.nix @@ -0,0 +1,47 @@ +{ + lib, + config, + pkgs, + inputs, + system, + ... +}: let + astal = inputs.self.packages.${system}; + inherit (lib) mkIf; + cfg = config.apps; +in { + config = mkIf cfg.astal { + default.appLauncher = lib.mkDefault "astal-launcher"; + + home-manager.users.${config.user} = { + home.packages = [ + astal.astal.shell + astal.astal.launcher + ]; + + systemd.user.services.astal = { + Unit = { + Description = "Custom Gtk Lua Shell."; + PartOf = [ + config.default.session + "tray.target" + ]; + After = [config.default.session]; + ConditionEnvironment = "WAYLAND_DISPLAY"; + }; + + Service = { + ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID"; + ExecStart = "${astal.astal.shell}/bin/astal-shell"; + KillMode = "mixed"; + Restart = "on-failure"; + }; + + Install.WantedBy = [ + config.default.session + "tray.target" + ]; + }; + }; + }; +} diff --git a/modules/apps/default.nix b/modules/apps/default.nix new file mode 100644 index 0000000..7100897 --- /dev/null +++ b/modules/apps/default.nix @@ -0,0 +1,23 @@ +{lib, ...}: let + inherit (lib) mkEnableOption; +in { + imports = [ + ./waybar + ./wofi + ./alacritty.nix + ./astal.nix + ./hyprlock.nix + ./kitty.nix + ./mako.nix + ]; + + options.apps = { + alacritty = mkEnableOption "Enable the alacritty terminal."; + astal = mkEnableOption "Enable the astal gtk shell."; + kitty = mkEnableOption "Enable the kitty terminal."; + mako = mkEnableOption "Enable the mako notification daemon."; + hyprlock = mkEnableOption "Enable the hyprlock lockscreen."; + waybar = mkEnableOption "Enable the waybar bar."; + wofi = mkEnableOption "Enable the wofi launcher."; + }; +} diff --git a/modules/desktop/hyprlock.nix b/modules/apps/hyprlock.nix index 8be2856..4a844e3 100644 --- a/modules/desktop/hyprlock.nix +++ b/modules/apps/hyprlock.nix @@ -9,7 +9,7 @@ trans = "rgba(0,0,0,0)"; inherit (lib) mkIf; - cfg = config.desktop; + cfg = config.apps; in { config = mkIf cfg.hyprlock { default.lockScreen = lib.mkDefault "hyprlock"; diff --git a/modules/terminal/kitty.nix b/modules/apps/kitty.nix index cee0e72..03f981a 100644 --- a/modules/terminal/kitty.nix +++ b/modules/apps/kitty.nix @@ -4,7 +4,7 @@ ... }: let inherit (lib) mkIf; - cfg = config.terminal; + cfg = config.apps; in { config = mkIf cfg.kitty { default.terminal = lib.mkDefault "kitty"; diff --git a/modules/desktop/mako.nix b/modules/apps/mako.nix index 5a24e56..62e5712 100644 --- a/modules/desktop/mako.nix +++ b/modules/apps/mako.nix @@ -4,7 +4,7 @@ ... }: let inherit (lib) mkIf; - cfg = config.desktop; + cfg = config.apps; in { config = mkIf cfg.mako { home-manager.users.${config.user} = { diff --git a/modules/desktop/waybar/default.nix b/modules/apps/waybar/default.nix index c2d6927..ecbbcd4 100644 --- a/modules/desktop/waybar/default.nix +++ b/modules/apps/waybar/default.nix @@ -4,7 +4,7 @@ ... }: let inherit (lib) mkIf; - cfg = config.desktop; + cfg = config.apps; in { config = mkIf cfg.waybar { home-manager.users.${config.user} = { diff --git a/modules/desktop/waybar/style.nix b/modules/apps/waybar/style.nix index 21a8de5..21a8de5 100644 --- a/modules/desktop/waybar/style.nix +++ b/modules/apps/waybar/style.nix diff --git a/modules/desktop/wofi/default.nix b/modules/apps/wofi/default.nix index aa04495..6036dd1 100644 --- a/modules/desktop/wofi/default.nix +++ b/modules/apps/wofi/default.nix @@ -4,7 +4,7 @@ ... }: let inherit (lib) mkIf; - cfg = config.desktop; + cfg = config.apps; in { config = mkIf cfg.wofi { default.appLauncher = lib.mkDefault "wofi --show drun --prompt 'Seach Programs'"; diff --git a/modules/desktop/wofi/style.nix b/modules/apps/wofi/style.nix index 75a0a21..75a0a21 100644 --- a/modules/desktop/wofi/style.nix +++ b/modules/apps/wofi/style.nix diff --git a/modules/browser/default.nix b/modules/browsers/default.nix index 0621d62..bf18d34 100644 --- a/modules/browser/default.nix +++ b/modules/browsers/default.nix @@ -9,7 +9,7 @@ in { ./firefox ]; - options.browser = { + options.browsers = { firefox = mkEnableOption "Enable the firefox browser."; }; } diff --git a/modules/browser/firefox/default.nix b/modules/browsers/firefox/default.nix index 7655c62..51f9000 100644 --- a/modules/browser/firefox/default.nix +++ b/modules/browsers/firefox/default.nix @@ -11,7 +11,7 @@ }; inherit (lib) mkIf; - cfg = config.browser; + cfg = config.browsers; in { config = mkIf cfg.firefox { default.browser = lib.mkDefault "firefox"; diff --git a/modules/browser/firefox/extraPrefs.nix b/modules/browsers/firefox/extraPrefs.nix index 74db984..74db984 100644 --- a/modules/browser/firefox/extraPrefs.nix +++ b/modules/browsers/firefox/extraPrefs.nix diff --git a/modules/browser/firefox/policy.nix b/modules/browsers/firefox/policy.nix index e222553..e222553 100644 --- a/modules/browser/firefox/policy.nix +++ b/modules/browsers/firefox/policy.nix diff --git a/modules/browser/firefox/policyExtensions.nix b/modules/browsers/firefox/policyExtensions.nix index f3dcd09..f3dcd09 100644 --- a/modules/browser/firefox/policyExtensions.nix +++ b/modules/browsers/firefox/policyExtensions.nix diff --git a/modules/browser/firefox/policyPrefs.nix b/modules/browsers/firefox/policyPrefs.nix index 73d2781..73d2781 100644 --- a/modules/browser/firefox/policyPrefs.nix +++ b/modules/browsers/firefox/policyPrefs.nix diff --git a/modules/browser/firefox/userChrome.nix b/modules/browsers/firefox/userChrome.nix index ab93747..ab93747 100644 --- a/modules/browser/firefox/userChrome.nix +++ b/modules/browsers/firefox/userChrome.nix diff --git a/modules/default.nix b/modules/default.nix index fe039de..ffc8466 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,10 +1,10 @@ {...}: { imports = [ - ./browser - ./desktop + ./apps + ./browsers + ./desktops ./development ./gaming - ./terminal ./virt ./options.nix ]; diff --git a/modules/desktop/astal.nix b/modules/desktop/astal.nix deleted file mode 100644 index 2f7f0f3..0000000 --- a/modules/desktop/astal.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - lib, - config, - pkgs, - inputs, - ... -}: let - system = pkgs.stdenv.hostPlatform.system; - astal = inputs.self.packages.${system}; - - inherit (lib) mkIf; - cfg = config.desktop; -in { - config = mkIf cfg.astal { - default.appLauncher = lib.mkDefault "astal-launcher"; - - home-manager.users.${config.user} = { - home.packages = [ - astal.astal.shell - astal.astal.launcher - ]; - }; - }; -} diff --git a/modules/desktop/hypridle.nix b/modules/desktop/hypridle.nix deleted file mode 100644 index ff77aad..0000000 --- a/modules/desktop/hypridle.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkIf; - cfg = config.desktop; -in { - config = mkIf cfg.hypridle { - home-manager.users.${config.user} = { - services.hypridle = { - enable = true; - - settings = { - general = { - lock_cmd = "pidof ${config.default.lockScreen} || ${config.default.lockScreen}"; - before_sleep_cmd = "loginctl lock-session"; - after_sleep_cmd = "hyprctl dispatch dpms on"; - ignore_dbus_inhibit = false; - }; - - listener = [ - # dim screen - { - timeout = 150; - on-timeout = "brightnessctl -s set 10"; - on-resume = "brightnessctl -r"; - } - # lock - { - timeout = 300; - on-timeout = "loginctl lock-session"; - } - # turn off screen - { - timeout = 350; - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - ]; - }; - }; - }; - }; -} diff --git a/modules/desktop/hyprland.nix b/modules/desktop/hyprland.nix deleted file mode 100644 index 3b04a8c..0000000 --- a/modules/desktop/hyprland.nix +++ /dev/null @@ -1,351 +0,0 @@ -{ - config, - pkgs, - lib, - inputs, - ... -}: let - system = pkgs.stdenv.hostPlatform.system; - hyprland = inputs.hyprland.packages.${system}; - hyprland-plugins = inputs.hyprland-plugins.packages.${system}; - hy3 = inputs.hy3.packages.${system}; - - text = "rgb(${config.theme.colors.text})"; - base = "rgb(${config.theme.colors.base})"; - surface = "rgb(${config.theme.colors.surface})"; - primary = "rgb(${config.theme.colors.primary})"; - - debug = false; - - inherit (lib) mkIf; - cfg = config.desktop; -in { - config = mkIf cfg.hyprland { - environment = { - variables = { - HYPRLAND_TRACE = - if debug - then "1" - else "0"; - AQ_TRACE = - if debug - then "1" - else "0"; - - XDG_CURRENT_DESKTOP = "Hyprland"; - XDG_SESSION_TYPE = "wayland"; - XDG_SESSION_DESKTOP = "Hyprland"; - LIBSEAT_BACKEND = "logind"; - }; - sessionVariables = { - XCURSOR_THEME = "Adwaita"; - XCURSOR_SIZE = "24"; - - MOZ_ENABLE_WAYLAND = "1"; - MOZ_USE_XINPUT = "1"; - _JAVA_AWT_WM_NONREPARENTING = "1"; - }; - }; - - xdg.portal = { - enable = true; - xdgOpenUsePortal = true; - config = { - common.default = ["gtk"]; - hyprland.default = ["gtk" "hyprland"]; - }; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - pkgs.xdg-desktop-portal-wlr - hyprland.xdg-desktop-portal-hyprland - ]; - }; - - programs.xwayland.enable = true; - - home-manager.users.${config.user} = { - wayland.windowManager.hyprland = { - enable = true; - package = hyprland.hyprland; - - xwayland.enable = true; - systemd.enable = true; - - # Plugins - plugins = [ - hyprland-plugins.hyprexpo - hy3.hy3 - ]; - - # Config - settings = { - # Debug - debug.disable_logs = ! debug; - debug.disable_time = ! debug; - debug.enable_stdout_logs = debug; - - # Monitors - monitor = - map ( - monitor: "${monitor.name}, highres, auto, ${toString monitor.scale}, bitdepth, ${toString monitor.bitdepth}" - ) - config.monitors; - - # Autostart - exec-once = config.autoRun; - - # General - general = { - gaps_in = config.theme.innerGap; - gaps_out = config.theme.outerGap; - layout = "hy3"; - resize_on_border = "yes"; - extend_border_grab_area = 20; - border_size = config.theme.borderWidth; - "col.active_border" = "${primary}"; - "col.inactive_border" = "${surface}"; - }; - - # Gestures - gestures = { - workspace_swipe = true; - workspace_swipe_fingers = 3; - workspace_swipe_forever = true; - workspace_swipe_cancel_ratio = 0.15; - }; - - # Decoration - decoration = { - rounding = config.theme.outerRadius; - shadow.enabled = false; - blur = { - enabled = config.theme.blur; - size = 4; - passes = 2; - noise = 0.008; - contrast = 0.8916; - brightness = 0.8; - }; - }; - - # Animations - animations = { - enabled = true; - - bezier = [ - "windowIn, 0.06, 0.71, 0.25, 1" - "windowResize, 0.04, 0.67, 0.38, 1" - ]; - - animation = [ - "windowsIn, 1, 3, windowIn, slide #popin 20%" - "windowsOut, 1, 3, windowIn, slide #popin 70%" - "windowsMove, 1, 2.5, windowResize" - "border, 1, 10, default" - "borderangle, 1, 8, default" - "fade, 1, 3, default" - "workspaces, 1, 6, default" - "layers, 1, 5, windowIn, slide" - ]; - }; - - # Input - input = { - kb_layout = "us"; - kb_variant = ""; - kb_model = ""; - kb_options = "gtp:alt_shift_toggle, compose:ralt"; - kb_rules = ""; - follow_mouse = 1; - touchpad = { - natural_scroll = "yes"; - }; - sensitivity = 0; - }; - - # Keybinds - "$mod" = "SUPER"; - bind = [ - # Launch programs - - "$mod, W, exec, ${config.default.browser}" - "$mod, D, exec, ${config.default.appLauncher}" - "$mod, L, exec, ${config.default.lockScreen}" - "$mod, Return, exec, ${config.default.terminal}" - ", Print, exec, grimblast copy area" - - # Misc - - "$mod SHIFT, L, exit" - "$mod, tab, hyprexpo:expo, toggle" - - # Window operations - - "$mod SHIFT, Q, killactive" - "$mod SHIFT, SPACE, togglefloating" - "$mod, F, fullscreen" - "$mod, J, togglesplit" - - # Move focus with mod + arrow keys - - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - - # Move window across workspace with mod + arrow keys - - "$mod SHIFT, left, hy3:movewindow, l" - "$mod SHIFT, right, hy3:movewindow, r" - "$mod SHIFT, up, hy3:movewindow, u" - "$mod SHIFT, down, hy3:movewindow, d" - - # Switch workspaces with mod + [0-9] - - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - - # Move active window to a workspace with mod + SHIFT + [0-9] - - "$mod SHIFT, 1, movetoworkspacesilent, 1" - "$mod SHIFT, 2, movetoworkspacesilent, 2" - "$mod SHIFT, 3, movetoworkspacesilent, 3" - "$mod SHIFT, 4, movetoworkspacesilent, 4" - "$mod SHIFT, 5, movetoworkspacesilent, 5" - "$mod SHIFT, 6, movetoworkspacesilent, 6" - "$mod SHIFT, 7, movetoworkspacesilent, 7" - "$mod SHIFT, 8, movetoworkspacesilent, 8" - "$mod SHIFT, 9, movetoworkspacesilent, 9" - "$mod SHIFT, 0, movetoworkspacesilent, 10" - - # Move to tab - - "LALT, 1, hy3:focustab, index, 01" - "LALT, 2, hy3:focustab, index, 02" - "LALT, 3, hy3:focustab, index, 03" - "LALT, 4, hy3:focustab, index, 04" - "LALT, 5, hy3:focustab, index, 05" - "LALT, 6, hy3:focustab, index, 06" - "LALT, 7, hy3:focustab, index, 07" - "LALT, 8, hy3:focustab, index, 08" - "LALT, 9, hy3:focustab, index, 09" - "LALT, 0, hy3:focustab, index, 10" - - "$mod SHIFT, B, hy3:makegroup, h" - "$mod SHIFT, V, hy3:makegroup, v" - "$mod SHIFT, C, hy3:changegroup, toggletab" - - # Scroll through existing workspaces with mod + scroll - - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - ]; - - bindn = [ - # Focus windows with scroll wheel or middle click - - ", mouse:272, hy3:focustab, mouse" - ", mouse_down, hy3:focustab, l, require_hovered" - ", mouse_up, hy3:focustab, r, require_hovered" - ]; - - bindm = [ - # Move/resize windows with mod + LMB/RMB and dragging - - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - - binde = [ - # Audio - - # raise volume - ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" - # lower volume - ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - # mute speaker - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - # mute mic - ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" - - # Media - - # play - ", XF86AudioPlay, exec, playerctl play-pause" - # next - ", XF86AudioNext, exec, playerctl next" - # prev - ", XF86AudioPrev, exec, playerctl previous" - - # Backlight - - ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" - ", XF86MonBrightnessUp, exec, brightnessctl set 5%+" - ]; - - # Plugin configuration - plugin = { - # hy3 - hy3 = { - tabs = { - height = 24; - text_height = 9; - text_padding = 10; - padding = 2; - render_text = true; - text_font = "monospace"; - radius = config.theme.outerRadius; - border_width = config.theme.borderWidth; - - "col.active" = "${base}"; - "col.active.border" = "${primary}"; - "col.active.text" = "${text}"; - "col.inactive" = "${base}"; - "col.inactive.border" = "${surface}"; - "col.inactive.text" = "${text}"; - }; - - autotile = { - enable = true; - }; - }; - }; - - # XWayland - xwayland = { - force_zero_scaling = "true"; - use_nearest_neighbor = "false"; - }; - - # Misc - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - key_press_enables_dpms = true; - mouse_move_enables_dpms = true; - enable_anr_dialog = false; - vrr = 1; - }; - - # Ecosystem - ecosystem = { - no_update_news = true; - no_donation_nag = true; - }; - - # Experimental - experimental = { - xx_color_management_v4 = true; - }; - }; # end settings - }; # end hyprland - }; # end home-manager - }; -} diff --git a/modules/desktop/hyprpaper.nix b/modules/desktop/hyprpaper.nix deleted file mode 100644 index 045ae62..0000000 --- a/modules/desktop/hyprpaper.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (lib) mkIf; - cfg = config.desktop; -in { - config = mkIf cfg.hyprpaper { - home-manager.users.${config.user} = { - services.hyprpaper = { - enable = true; - - settings = { - preload = config.theme.wallpaper; - wallpaper = ",${config.theme.wallpaper}"; - splash = false; - }; - }; - }; - }; -} diff --git a/modules/desktop/default.nix b/modules/desktops/default.nix index cab72f8..37197c2 100644 --- a/modules/desktop/default.nix +++ b/modules/desktops/default.nix @@ -6,29 +6,17 @@ ... }: let inherit (lib) mkEnableOption mkIf optionals; - cfg = config.desktop; + cfg = config.desktops; in { imports = [ - ./waybar - ./wofi - ./astal.nix - ./hypridle.nix - ./hyprland.nix - ./hyprlock.nix - ./hyprpaper.nix - ./mako.nix + ./hyprland + ./wayland.nix ]; - options.desktop = { + options.desktops = { enable = mkEnableOption "Enable baseline desktop utils and programs."; - astal = mkEnableOption "Enable the astal gtk shell."; - hypridle = mkEnableOption "Enable the hypridle daemon."; + wayland = mkEnableOption "Enable wayland desktop components."; hyprland = mkEnableOption "Install the Hyprland desktop."; - hyprlock = mkEnableOption "Enable the hyprlock lockscreen."; - hyprpaper = mkEnableOption "Enable the hyprpaper wallpaper daemon."; - mako = mkEnableOption "Enable the mako notification daemon."; - waybar = mkEnableOption "Enable the waybar bar."; - wofi = mkEnableOption "Enable the wofi launcher."; }; config = mkIf cfg.enable { diff --git a/modules/desktops/hyprland/binds.nix b/modules/desktops/hyprland/binds.nix new file mode 100644 index 0000000..90447f0 --- /dev/null +++ b/modules/desktops/hyprland/binds.nix @@ -0,0 +1,132 @@ +{config, ...}: { + home-manager.users.${config.user} = { + wayland.windowManager.hyprland.settings = { + # Keybinds + "$mod" = "SUPER"; + bind = [ + # Launch programs + + "$mod, W, exec, ${config.default.browser}" + "$mod, D, exec, ${config.default.appLauncher}" + "$mod, L, exec, ${config.default.lockScreen}" + "$mod, Return, exec, ${config.default.terminal}" + ", Print, exec, grimblast copy area" + + # Misc + + "$mod SHIFT, L, exit" + "$mod, tab, hyprexpo:expo, toggle" + + # Window operations + + "$mod SHIFT, Q, killactive" + "$mod SHIFT, SPACE, togglefloating" + "$mod, F, fullscreen" + "$mod, J, togglesplit" + + # Move focus with mod + arrow keys + + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + + # Move window across workspace with mod + arrow keys + + "$mod SHIFT, left, hy3:movewindow, l" + "$mod SHIFT, right, hy3:movewindow, r" + "$mod SHIFT, up, hy3:movewindow, u" + "$mod SHIFT, down, hy3:movewindow, d" + + # Switch workspaces with mod + [0-9] + + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + + # Move active window to a workspace with mod + SHIFT + [0-9] + + "$mod SHIFT, 1, movetoworkspacesilent, 1" + "$mod SHIFT, 2, movetoworkspacesilent, 2" + "$mod SHIFT, 3, movetoworkspacesilent, 3" + "$mod SHIFT, 4, movetoworkspacesilent, 4" + "$mod SHIFT, 5, movetoworkspacesilent, 5" + "$mod SHIFT, 6, movetoworkspacesilent, 6" + "$mod SHIFT, 7, movetoworkspacesilent, 7" + "$mod SHIFT, 8, movetoworkspacesilent, 8" + "$mod SHIFT, 9, movetoworkspacesilent, 9" + "$mod SHIFT, 0, movetoworkspacesilent, 10" + + # Move to tab + + "LALT, 1, hy3:focustab, index, 01" + "LALT, 2, hy3:focustab, index, 02" + "LALT, 3, hy3:focustab, index, 03" + "LALT, 4, hy3:focustab, index, 04" + "LALT, 5, hy3:focustab, index, 05" + "LALT, 6, hy3:focustab, index, 06" + "LALT, 7, hy3:focustab, index, 07" + "LALT, 8, hy3:focustab, index, 08" + "LALT, 9, hy3:focustab, index, 09" + "LALT, 0, hy3:focustab, index, 10" + + "$mod SHIFT, B, hy3:makegroup, h" + "$mod SHIFT, V, hy3:makegroup, v" + "$mod SHIFT, C, hy3:changegroup, toggletab" + + # Scroll through existing workspaces with mod + scroll + + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + ]; + + bindn = [ + # Focus windows with scroll wheel or middle click + + ", mouse:272, hy3:focustab, mouse" + ", mouse_down, hy3:focustab, l, require_hovered" + ", mouse_up, hy3:focustab, r, require_hovered" + ]; + + bindm = [ + # Move/resize windows with mod + LMB/RMB and dragging + + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + binde = [ + # Audio + + # raise volume + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+" + # lower volume + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + # mute speaker + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + # mute mic + ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + + # Media + + # play + ", XF86AudioPlay, exec, playerctl play-pause" + # next + ", XF86AudioNext, exec, playerctl next" + # prev + ", XF86AudioPrev, exec, playerctl previous" + + # Backlight + + ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ", XF86MonBrightnessUp, exec, brightnessctl set 5%+" + ]; + }; + }; +} diff --git a/modules/desktops/hyprland/default.nix b/modules/desktops/hyprland/default.nix new file mode 100644 index 0000000..cc1122c --- /dev/null +++ b/modules/desktops/hyprland/default.nix @@ -0,0 +1,40 @@ +{ + inputs, + config, + system, + lib, + ... +}: let + inherit (lib) mkIf mkDefault; + cfg = config.desktops; +in { + imports = [ + ./binds.nix + ./env.nix + ./idle.nix + ./plugins.nix + ./settings.nix + ./wallpaper.nix + ]; + + config = mkIf cfg.hyprland { + desktops.wayland = true; + default.session = mkDefault "hyprland-session.target"; + + xdg.portal = { + extraPortals = [ + inputs.hyprland.packages.${system}.xdg-desktop-portal-hyprland + ]; + }; + + home-manager.users.${config.user} = { + wayland.windowManager.hyprland = { + enable = true; + package = inputs.hyprland.packages.${system}.hyprland; + + xwayland.enable = true; + systemd.enable = true; + }; + }; + }; +} diff --git a/modules/desktops/hyprland/env.nix b/modules/desktops/hyprland/env.nix new file mode 100644 index 0000000..7ff3eb7 --- /dev/null +++ b/modules/desktops/hyprland/env.nix @@ -0,0 +1,12 @@ +{config,...}: { + home-manager.users.${config.user} = { + wayland.windowManager.hyprland.settings = { + env = [ + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_TYPE,wayland" + "XDG_SESSION_DESKTOP,Hyprland" + "MOZ_ENABLE_WAYLAND,1" + ]; + }; + }; +} diff --git a/modules/desktops/hyprland/idle.nix b/modules/desktops/hyprland/idle.nix new file mode 100644 index 0000000..53c447b --- /dev/null +++ b/modules/desktops/hyprland/idle.nix @@ -0,0 +1,36 @@ +{config, ...}: { + home-manager.users.${config.user} = { + services.hypridle = { + enable = config.desktops.hyprland; + + settings = { + general = { + lock_cmd = "pidof ${config.default.lockScreen} || ${config.default.lockScreen}"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + ignore_dbus_inhibit = false; + }; + + listener = [ + # dim screen + { + timeout = 150; + on-timeout = "brightnessctl -s set 10"; + on-resume = "brightnessctl -r"; + } + # lock + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + # turn off screen + { + timeout = 350; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + ]; + }; + }; + }; +} diff --git a/modules/desktops/hyprland/plugins.nix b/modules/desktops/hyprland/plugins.nix new file mode 100644 index 0000000..b218e74 --- /dev/null +++ b/modules/desktops/hyprland/plugins.nix @@ -0,0 +1,45 @@ +{ + inputs, + config, + system, + ... +}: let + hyprland-plugins = inputs.hyprland-plugins.packages.${system}; + hy3 = inputs.hy3.packages.${system}; +in { + home-manager.users.${config.user} = { + wayland.windowManager.hyprland = { + plugins = [ + hyprland-plugins.hyprexpo + hy3.hy3 + ]; + + settings.plugin = { + # hy3 + hy3 = { + tabs = { + height = 24; + text_height = 9; + text_padding = 10; + padding = 2; + render_text = true; + text_font = "monospace"; + radius = config.theme.outerRadius; + border_width = config.theme.borderWidth; + + "col.active" = "rgb(${config.theme.colors.base})"; + "col.active.border" = "rgb(${config.theme.colors.primary})"; + "col.active.text" = "rgb(${config.theme.colors.text})"; + "col.inactive" = "rgb(${config.theme.colors.base})"; + "col.inactive.border" = "rgb(${config.theme.colors.surface})"; + "col.inactive.text" = "rgb(${config.theme.colors.text})"; + }; + + autotile = { + enable = true; + }; + }; + }; + }; + }; +} diff --git a/modules/desktops/hyprland/settings.nix b/modules/desktops/hyprland/settings.nix new file mode 100644 index 0000000..fdeeadc --- /dev/null +++ b/modules/desktops/hyprland/settings.nix @@ -0,0 +1,117 @@ +{ + config, + pkgs, + lib, + inputs, + ... +}: { + home-manager.users.${config.user} = { + wayland.windowManager.hyprland.settings = { + # Monitors + monitor = + map ( + monitor: "${monitor.name}, highres, auto, ${toString monitor.scale}, bitdepth, ${toString monitor.bitdepth}" + ) + config.monitors; + + # Autostart + exec-once = config.autoRun; + + # General + general = { + gaps_in = config.theme.innerGap; + gaps_out = config.theme.outerGap; + layout = "hy3"; + resize_on_border = "yes"; + extend_border_grab_area = 20; + border_size = config.theme.borderWidth; + "col.active_border" = "rgb(${config.theme.colors.primary})"; + "col.inactive_border" = "rgb(${config.theme.colors.surface})"; + }; + + # Gestures + gestures = { + workspace_swipe = true; + workspace_swipe_fingers = 3; + workspace_swipe_forever = true; + workspace_swipe_cancel_ratio = 0.15; + }; + + # Decoration + decoration = { + rounding = config.theme.outerRadius; + shadow.enabled = false; + blur = { + enabled = config.theme.blur; + size = 4; + passes = 2; + noise = 0.008; + contrast = 0.8916; + brightness = 0.8; + }; + }; + + # Animations + animations = { + enabled = true; + + bezier = [ + "windowIn, 0.06, 0.71, 0.25, 1" + "windowResize, 0.04, 0.67, 0.38, 1" + ]; + + animation = [ + "windowsIn, 1, 3, windowIn, slide #popin 20%" + "windowsOut, 1, 3, windowIn, slide #popin 70%" + "windowsMove, 1, 2.5, windowResize" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 3, default" + "workspaces, 1, 6, default" + "layers, 1, 5, windowIn, slide" + ]; + }; + + # Input + input = { + kb_layout = "us"; + kb_variant = ""; + kb_model = ""; + kb_options = "gtp:alt_shift_toggle, compose:ralt"; + kb_rules = ""; + follow_mouse = 1; + touchpad = { + natural_scroll = "yes"; + }; + sensitivity = 0; + }; + + # XWayland + xwayland = { + force_zero_scaling = "true"; + use_nearest_neighbor = "false"; + }; + + # Misc + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + key_press_enables_dpms = true; + mouse_move_enables_dpms = true; + enable_anr_dialog = false; + vrr = 1; + }; + + # Ecosystem + ecosystem = { + no_update_news = true; + no_donation_nag = true; + }; + + # Experimental + experimental = { + xx_color_management_v4 = true; + }; + }; # end hyprland + }; # end home-manager +} diff --git a/modules/desktops/hyprland/wallpaper.nix b/modules/desktops/hyprland/wallpaper.nix new file mode 100644 index 0000000..b877774 --- /dev/null +++ b/modules/desktops/hyprland/wallpaper.nix @@ -0,0 +1,13 @@ +{config, ...}: { + home-manager.users.${config.user} = { + services.hyprpaper = { + enable = config.desktops.hyprland; + + settings = { + preload = config.theme.wallpaper; + wallpaper = ",${config.theme.wallpaper}"; + splash = false; + }; + }; + }; +} diff --git a/modules/desktops/wayland.nix b/modules/desktops/wayland.nix new file mode 100644 index 0000000..ceef20a --- /dev/null +++ b/modules/desktops/wayland.nix @@ -0,0 +1,21 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (lib) mkIf; + cfg = config.desktops; +in { + config = mkIf cfg.wayland { + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-wlr + ]; + }; + + programs.xwayland.enable = true; + }; +} diff --git a/modules/gaming/homestuck.nix b/modules/gaming/homestuck.nix index 12641a4..681325b 100644 --- a/modules/gaming/homestuck.nix +++ b/modules/gaming/homestuck.nix @@ -1,13 +1,12 @@ { lib, config, - pkgs, inputs, + system, ... }: let inherit (lib) mkIf; cfg = config.gaming; - system = pkgs.stdenv.hostPlatform.system; in { config = mkIf cfg.homestuck { home-manager.users.${config.user} = { diff --git a/modules/options.nix b/modules/options.nix index 78b7776..d158d53 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -366,6 +366,11 @@ in { type = types.str; description = "Default terminal launch command."; }; + session = mkOption { + type = types.str; + description = "Default systemd graphical session target."; + default = "wayland-session.target"; + }; }; # diff --git a/modules/terminal/default.nix b/modules/terminal/default.nix deleted file mode 100644 index 8d97a01..0000000 --- a/modules/terminal/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - ... -}: let - inherit (lib) mkEnableOption; -in { - imports = [ - ./alacritty.nix - ./kitty.nix - ]; - - options.terminal = { - alacritty = mkEnableOption "Enable the alacritty terminal."; - kitty = mkEnableOption "Enable the kitty terminal."; - }; -} diff --git a/options.nix b/options.nix index 6514c2e..a015b26 100644 --- a/options.nix +++ b/options.nix @@ -30,7 +30,6 @@ # programs to auto run in gui autoRun = [ - "astal-shell" "wl-clip-persist -c both" "thunderbird" "discord --enable-features=UseOzonePlatform --ozone-platform=wayland" diff --git a/pkgs/astal/src/launcher.lua b/pkgs/astal/src/launcher.lua index 75d9d72..cc16bb9 100644 --- a/pkgs/astal/src/launcher.lua +++ b/pkgs/astal/src/launcher.lua @@ -1,8 +1,6 @@ local App = require("astal.gtk3.app") -local lib = require("lib") App:start({ - css = lib.src("main.css"), main = function() error("must start astal-shell first") end, diff --git a/pkgs/astal/src/shell.lua b/pkgs/astal/src/shell.lua index 4baede7..417f754 100644 --- a/pkgs/astal/src/shell.lua +++ b/pkgs/astal/src/shell.lua @@ -1,6 +1,5 @@ local App = require("astal.gtk3.app") local lib = require("lib") -local Variable = require("astal").Variable local Bar = require("widget.bar") local Corners = require("widget.corners") diff --git a/pkgs/astal/src/widget/deck/notifications.lua b/pkgs/astal/src/widget/deck/notifications.lua index 7788f0b..81a5c04 100644 --- a/pkgs/astal/src/widget/deck/notifications.lua +++ b/pkgs/astal/src/widget/deck/notifications.lua @@ -1,7 +1,6 @@ local astal = require("astal") local Widget = require("astal.gtk3").Widget local Gtk = require("astal.gtk3").Gtk -local Variable = require("astal").Variable local Notifd = astal.require("AstalNotifd") local lib = require("lib") local bind = astal.bind diff --git a/pkgs/astal/src/widget/launcher.lua b/pkgs/astal/src/widget/launcher.lua index 5258dc2..66fa4b0 100644 --- a/pkgs/astal/src/widget/launcher.lua +++ b/pkgs/astal/src/widget/launcher.lua @@ -25,17 +25,17 @@ local list = text(function(text) return lib.slice(apps:exact_query(text), 0, MAX_ENTRIES) end) -function on_show() +local function on_show() text:set("") selection:set(0) entry:get():grab_focus() end -function hide() +local function hide() visible:set(false) end -function on_enter() +local function on_enter() local found = apps:exact_query(text:get())[selection:get() + 1] if found then found:launch() @@ -43,7 +43,7 @@ function on_enter() end end -function update_pos(change_x, change_y) +local function update_pos(change_x, change_y) local pos = selection:get() local pos_x = (pos % WIDTH) + change_x local pos_y = math.floor(pos / WIDTH) + change_y @@ -57,7 +57,7 @@ function update_pos(change_x, change_y) selection:set(pos) end -function on_key_press(self, event) +local function on_key_press(_, event) if event.keyval == Gdk.KEY_Escape then hide() elseif event.keyval == Gdk.KEY_Return then diff --git a/system/desktop.nix b/system/desktop.nix index 33b3d24..4141637 100644 --- a/system/desktop.nix +++ b/system/desktop.nix @@ -5,7 +5,7 @@ }: let inherit (lib) mkIf; in { - config = mkIf config.desktop.enable { + config = mkIf config.desktops.enable { # nix-ld programs.nix-ld.enable = true; |