From 6174f3650cf42aaf008012e828d5a1f8e2ce037f Mon Sep 17 00:00:00 2001 From: Leander Scherer Date: Thu, 8 Jan 2026 02:48:11 +0100 Subject: refactor(modules): separate nixos/home-manager modules, use standard option conventions --- modules/hosts/desktop/cinnamon/default.nix | 38 ++++++ modules/hosts/desktop/default.nix | 14 +++ modules/hosts/desktop/dunst.nix | 47 +++++++ modules/hosts/desktop/gnome/dconf.nix | 20 +++ modules/hosts/desktop/gnome/default.nix | 39 ++++++ modules/hosts/desktop/hyprland/default.nix | 183 ++++++++++++++++++++++++++++ modules/hosts/desktop/hyprland/hyprlock.nix | 122 +++++++++++++++++++ modules/hosts/desktop/kde/default.nix | 26 ++++ modules/hosts/desktop/labwc/default.nix | 155 +++++++++++++++++++++++ modules/hosts/desktop/labwc/sfwbar.nix | 142 +++++++++++++++++++++ modules/hosts/desktop/sway/default.nix | 119 ++++++++++++++++++ modules/hosts/desktop/sway/swayidle.nix | 49 ++++++++ modules/hosts/desktop/sway/swaylock.nix | 30 +++++ modules/hosts/desktop/waybar.nix | 134 ++++++++++++++++++++ 14 files changed, 1118 insertions(+) create mode 100644 modules/hosts/desktop/cinnamon/default.nix create mode 100644 modules/hosts/desktop/default.nix create mode 100644 modules/hosts/desktop/dunst.nix create mode 100644 modules/hosts/desktop/gnome/dconf.nix create mode 100644 modules/hosts/desktop/gnome/default.nix create mode 100644 modules/hosts/desktop/hyprland/default.nix create mode 100644 modules/hosts/desktop/hyprland/hyprlock.nix create mode 100644 modules/hosts/desktop/kde/default.nix create mode 100644 modules/hosts/desktop/labwc/default.nix create mode 100644 modules/hosts/desktop/labwc/sfwbar.nix create mode 100644 modules/hosts/desktop/sway/default.nix create mode 100644 modules/hosts/desktop/sway/swayidle.nix create mode 100644 modules/hosts/desktop/sway/swaylock.nix create mode 100644 modules/hosts/desktop/waybar.nix (limited to 'modules/hosts/desktop') diff --git a/modules/hosts/desktop/cinnamon/default.nix b/modules/hosts/desktop/cinnamon/default.nix new file mode 100644 index 0000000..356bf42 --- /dev/null +++ b/modules/hosts/desktop/cinnamon/default.nix @@ -0,0 +1,38 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkIf mkForce; + cfg = config.nx.desktop.cinnamon; +in +{ + options.nx.desktop.cinnamon = { + enable = mkEnableOption "Enable Cinnamon desktop environment"; + }; + + config = mkIf cfg.enable { + services.xserver.enable = true; + services.xserver.displayManager.lightdm.enable = true; + services.xserver.desktopManager.cinnamon.enable = true; + + services.speechd.enable = mkForce false; + services.orca.enable = mkForce true; + + environment.systemPackages = with pkgs; [ + nemo-preview + ]; + + environment.variables.QT_QPA_PLATFORMTHEME = "qt5ct"; + + services.xserver.xkb = { + layout = "de"; + variant = ""; + }; + + console.keyMap = "de"; + }; +} diff --git a/modules/hosts/desktop/default.nix b/modules/hosts/desktop/default.nix new file mode 100644 index 0000000..137b68c --- /dev/null +++ b/modules/hosts/desktop/default.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + imports = [ + #./sway + #./dunst.nix + #./waybar.nix + #./gnome + ./cinnamon + ./kde + #./labwc + #./hyprland + ]; +} diff --git a/modules/hosts/desktop/dunst.nix b/modules/hosts/desktop/dunst.nix new file mode 100644 index 0000000..4c5f74e --- /dev/null +++ b/modules/hosts/desktop/dunst.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + pkgs, + username, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.dunst; +in +{ + options.nx.desktop.dunst.enable = mkEnableOption "Enable dunst notification"; + config = mkIf cfg.enable { + home-manager.users.${username} = { + home.packages = with pkgs; [ + libnotify + ]; + + services.dunst = { + enable = true; + settings = { + global = { + font = "monospace 10"; + offset = "(15, 15)"; + frame_width = 0; + }; + urgency_low = { + foreground = "#FFFFFF"; + background = "#000000E6"; + }; + + urgency_normal = { + foreground = "#FFFFFF"; + background = "#000000E6"; + }; + + urgency_critical = { + foreground = "#FFFFFF"; + background = "#000000E6"; + }; + }; + }; + }; + }; +} diff --git a/modules/hosts/desktop/gnome/dconf.nix b/modules/hosts/desktop/gnome/dconf.nix new file mode 100644 index 0000000..74b9b4a --- /dev/null +++ b/modules/hosts/desktop/gnome/dconf.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + username, + ... +}: + +let + inherit (lib) mkIf; + cfg = config.nx.desktop.gnome; +in +{ + config = mkIf cfg.enable { + home-manager.users."${username}".dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + }; + }; +} diff --git a/modules/hosts/desktop/gnome/default.nix b/modules/hosts/desktop/gnome/default.nix new file mode 100644 index 0000000..2aa62ed --- /dev/null +++ b/modules/hosts/desktop/gnome/default.nix @@ -0,0 +1,39 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.gnome; +in +{ + imports = [ + ./dconf.nix + ]; + + options.nx.desktop.gnome = { + enable = mkEnableOption "Enable GNOME desktop environment"; + }; + + config = mkIf cfg.enable { + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; + services.gnome.core-developer-tools.enable = false; + services.gnome.games.enable = false; + + environment.gnome.excludePackages = with pkgs; [ + gnome-tour + gnome-user-docs + epiphany + ]; + + environment.systemPackages = with pkgs; [ + gnomeExtensions.pop-shell + gnomeExtensions.blur-my-shell + gnome-tweaks + ]; + }; +} diff --git a/modules/hosts/desktop/hyprland/default.nix b/modules/hosts/desktop/hyprland/default.nix new file mode 100644 index 0000000..2bc2525 --- /dev/null +++ b/modules/hosts/desktop/hyprland/default.nix @@ -0,0 +1,183 @@ +{ + config, + username, + lib, + pkgs, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.hyprland; +in +{ + imports = [ + ./hyprlock.nix + ]; + + options.nx.desktop.hyprland.enable = mkEnableOption "Enable hyprland and setup"; + config = mkIf cfg.enable { + nx.desktop.hyprlock.enable = true; + home-manager.users.${username} = { + home.packages = with pkgs; [ + hyprshot + hyprpicker + ]; + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = true; + xwayland.enable = true; + settings = { + monitor = [ + "DP-1,highrr,0x0,auto" + ]; + + "$background" = "rgba(000000FF)"; + "$accent" = "rgba(FFFFFFFF)"; + + exec-once = [ + ]; + + env = [ + "XCURSOR_SIZE,24" + ]; + + input = { + kb_layout = "de"; + follow_mouse = 1; + touchpad = { + natural_scroll = "yes"; + }; + }; + + "device:logitech-g-pro--1" = { + sensitivity = -0.5; + }; + + general = { + gaps_in = 5; + gaps_out = 10; + border_size = 2; + "col.active_border" = "$accent"; + "col.inactive_border" = "$background"; + layout = "dwindle"; + }; + + decoration = { + rounding = 5; + active_opacity = 0.8; + inactive_opacity = 0.7; + + blur = { + enabled = true; + size = 4; + passes = 4; + ignore_opacity = true; + contrast = 1.1; + brightness = 1.0; + }; + + drop_shadow = false; + shadow_range = 30; + shadow_render_power = 4; + "col.shadow" = "$background"; + }; + + animations = { + enabled = "yes"; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + misc = { + disable_hyprland_logo = true; + vrr = 1; + }; + + dwindle = { + pseudotile = "yes"; + preserve_split = "yes"; + }; + + master = { + new_is_master = true; + }; + + xwayland = { + force_zero_scaling = true; + }; + + windowrulev2 = [ + "noborder,class:(steam)" + ]; + + "$mod" = "SUPER"; + + bind = [ + "$mod, l, exec, hyprlock" + "$mod, s, exec, hyprshot --mode region" + "$mod, r, exec, wofi --show run" + "$mod, d, exec, wofi --show drun" + "$mod, c, exec, hyprpicker -r -a" + "$mod, return, exec, kitty" + "$mod, q, killactive," + "$mod, m, exit," + "$mod, f, fullscreen" + "$mod, v, togglefloating," + "$mod, P, pseudo," + + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%-" + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + + ", XF86AudioPlay, exec, playerctl play-pause" + ", XF86AudioNext, exec, playerctl next" + ", XF86AudioPrev, exec, playerctl previous" + ", XF86Audiostop, exec, playerctl stop" + + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + + "$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" + "$mod, 0, workspace, 10" + + "$mod SHIFT, 1, movetoworkspace, 1" + "$mod SHIFT, 2, movetoworkspace, 2" + "$mod SHIFT, 3, movetoworkspace, 3" + "$mod SHIFT, 4, movetoworkspace, 4" + "$mod SHIFT, 5, movetoworkspace, 5" + "$mod SHIFT, 6, movetoworkspace, 6" + "$mod SHIFT, 7, movetoworkspace, 7" + "$mod SHIFT, 8, movetoworkspace, 8" + "$mod SHIFT, 9, movetoworkspace, 9" + "$mod SHIFT, 0, movetoworkspace, 10" + + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + ]; + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + }; + }; + }; + }; +} diff --git a/modules/hosts/desktop/hyprland/hyprlock.nix b/modules/hosts/desktop/hyprland/hyprlock.nix new file mode 100644 index 0000000..2d2ab03 --- /dev/null +++ b/modules/hosts/desktop/hyprland/hyprlock.nix @@ -0,0 +1,122 @@ +{ + config, + lib, + username, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.hyprlock; +in +{ + options.nx.desktop.hyprlock.enable = mkEnableOption "Hyprlock is a screen locker for Hyprland." // { + default = config.nx.desktop.hyprland.enable; + }; + config = mkIf cfg.enable { + programs.hyprlock = { + enable = true; + }; + home-manager.users.${username}.programs.hyprlock = { + enable = true; + settings = { + general = { + immediate_render = true; + }; + + background = [ + { + monitor = ""; + path = "/etc/nixos/images/pond.jpg"; + } + ]; + + input-field = [ + { + monitor = ""; + size = "300, 30"; + outline_thickness = 0; + dots_size = 0.25; + dots_spacing = 0.55; + dots_center = true; + dots_rounding = -1; + outer_color = "rgba(242, 243, 244, 0)"; + inner_color = "rgba(242, 243, 244, 0)"; + font_color = "rgba(242, 243, 244, 0.75)"; + fade_on_empty = false; + placeholder_text = ""; + hide_input = false; + check_color = "rgba(204, 136, 34, 0)"; + fail_color = "rgba(204, 34, 34, 0)"; + fail_text = "$FAIL ($ATTEMPTS)"; + fail_transition = 300; + capslock_color = -1; + numlock_color = -1; + bothlock_color = -1; + invert_numlock = false; + swap_font_color = false; + position = "0, -468"; + halign = "center"; + valign = "center"; + } + ]; + + label = [ + { + monitor = ""; + text = ''cmd[update:1000] echo "$(date +"%A, %B %d")"''; + color = "rgba(242, 243, 244, 0.75)"; + font_size = 20; + position = "0, 405"; + halign = "center"; + valign = "center"; + } + { + monitor = ""; + text = ''cmd[update:1000] echo "$(date +"%k:%M")"''; + color = "rgba(242, 243, 244, 0.75)"; + font_size = 93; + position = "0, 310"; + halign = "center"; + valign = "center"; + } + { + monitor = ""; + text = "${username}"; + color = "rgba(242, 243, 244, 0.75)"; + font_size = 12; + position = "0, -407"; + halign = "center"; + valign = "center"; + } + { + monitor = ""; + text = "Enter Password"; + color = "rgba(242, 243, 244, 0.75)"; + font_size = 10; + position = "0, -438"; + halign = "center"; + valign = "center"; + } + ]; + + image = [ + { + monitor = ""; + path = "/etc/nixos/images/pf.jpg"; + border_color = "0xffdddddd"; + border_size = 0; + size = 73; + rounding = -1; + rotate = 0; + reload_time = -1; + reload_cmd = ""; + position = "0, -353"; + halign = "center"; + valign = "center"; + } + ]; + }; + }; + }; +} diff --git a/modules/hosts/desktop/kde/default.nix b/modules/hosts/desktop/kde/default.nix new file mode 100644 index 0000000..d53e1c8 --- /dev/null +++ b/modules/hosts/desktop/kde/default.nix @@ -0,0 +1,26 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.kde; +in +{ + + options.nx.desktop.kde.enable = mkEnableOption "Enable kde"; + config = mkIf cfg.enable { + services.displayManager.sddm.enable = true; + services.displayManager.sddm.wayland.enable = true; + services.desktopManager.plasma6.enable = true; + security.pam.services.sddm.enableKwallet = true; + + environment.plasma6.excludePackages = with pkgs.kdePackages; [ + elisa + kate + ]; + }; +} diff --git a/modules/hosts/desktop/labwc/default.nix b/modules/hosts/desktop/labwc/default.nix new file mode 100644 index 0000000..fd7c062 --- /dev/null +++ b/modules/hosts/desktop/labwc/default.nix @@ -0,0 +1,155 @@ +{ + config, + username, + pkgs, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.labwc; + + gruvbox-openbox = pkgs.stdenv.mkDerivation { + pname = "gruvbox-openbox"; + version = "0-unstable-2024-02-14"; + + src = pkgs.fetchFromGitHub { + owner = "nathanielevan"; + repo = "gruvbox-openbox"; + rev = "master"; + hash = "sha256-61BsD/DK6OOJLKwdY03HL1pCG1DJcIE9bsFPAVFfcIY="; + }; + + installPhase = '' + mkdir -p $out/share/themes + cp -r gruvbox-dark $out/share/themes/ + cp -r gruvbox-material-dark $out/share/themes/ + cp -r gruvbox-material-dark-blocks $out/share/themes/ + ''; + }; +in +{ + imports = [ + ./sfwbar.nix + ]; + + options.nx.desktop.labwc.enable = mkEnableOption "Enable labwc"; + config = mkIf cfg.enable { + home-manager.users.${username} = { + home.packages = with pkgs; [ + labwc-tweaks + labwc-gtktheme + gruvbox-material-gtk-theme + gruvbox-dark-icons-gtk + swaybg + wl-clipboard + + gruvbox-openbox + ]; + + services.cliphist.enable = true; + + gtk = { + enable = true; + theme = { + name = "Gruvbox-Material-Dark"; + package = pkgs.gruvbox-material-gtk-theme; + }; + iconTheme = { + name = "Gruvbox-Dark"; + package = pkgs.gruvbox-dark-icons-gtk; + }; + cursorTheme = { + name = "Adwaita"; + package = pkgs.adwaita-icon-theme; + }; + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + gtk4.extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + }; + + services.kanshi = { + enable = true; + profiles = { + home = { + outputs = [ + { + criteria = "DP-1"; + mode = "1920x1080@240"; + position = "1920,0"; + } + ]; + }; + }; + }; + + wayland.windowManager.labwc = { + enable = true; + autostart = [ + "${pkgs.sfwbar}/bin/sfwbar" + "${pkgs.swaybg}/bin/swaybg -m fill -i /home/${username}/Developer/nix/images/pond.jpg & disown" + ]; + environment = [ + "XKB_DEFAULT_LAYOUT=de" + "XCURSOR_SIZE=24" + "XDG_CURRENT_DESKTOP=wlroots" + ]; + + menu = [ + ]; + + rc = { + core = { + decoration = "server"; + gap = 5; + adaptiveSync = "no"; + reuseOutputMode = "yes"; + }; + + theme = { + # "gruvbox-dark", "gruvbox-material-dark", "gruvbox-material-dark-blocks" + name = "gruvbox-material-dark-blocks"; + }; + + keyboard = { + default = true; + keybind = [ + { + "@key" = "W-Return"; + action = { + "@name" = "Execute"; + "@command" = "kitty"; + }; + } + { + "@key" = "W-F4"; + action = { + "@name" = "None"; + }; + } + ]; + }; + + mouse = { + default = true; + context = { + "@name" = "Root"; + mousebind = { + "@button" = "Right"; + "@action" = "Press"; + action = { + "@name" = "ShowMenu"; + "@menu" = "root-menu"; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/hosts/desktop/labwc/sfwbar.nix b/modules/hosts/desktop/labwc/sfwbar.nix new file mode 100644 index 0000000..7021374 --- /dev/null +++ b/modules/hosts/desktop/labwc/sfwbar.nix @@ -0,0 +1,142 @@ +{ + config, + username, + pkgs, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.sfwbar; +in +{ + options.nx.desktop.sfwbar.enable = mkEnableOption "Enable sfwbar" // { + default = config.nx.desktop.labwc.enable; + }; + + config = mkIf cfg.enable { + home-manager.users.${username} = { + home.packages = with pkgs; [ + sfwbar + gtk-layer-shell + ]; + + # CONFIGURATION + xdg.configFile."sfwbar/sfwbar.config".text = '' + # Term setup + Set Term = "foot" + Set ThicknessHint = "20px" + + # Actions + TriggerAction "SIGRTMIN+1", SwitcherEvent "forward" + TriggerAction "SIGRTMIN+2", SwitcherEvent "back" + + # Initialization + Function("SfwbarInit") { + SetLayer "top" + SetMirror "*" + SetExclusiveZone "auto" + } + + # Placer (Window positioning) + placer { + xorigin = 5 + yorigin = 5 + xstep = 5 + ystep = 5 + children = true + } + + # Task Switcher + switcher { + interval = 700 + icons = true + labels = false + cols = 5 + } + + # Load Standard Library Winops + include("${pkgs.sfwbar}/share/sfwbar/winops.widget") + + # Main Layout + layout { + + # Start Menu + include("${pkgs.sfwbar}/share/sfwbar/startmenu.widget") + + # Show Desktop + include("${pkgs.sfwbar}/share/sfwbar/showdesktop.widget") + + # Taskbar + taskbar { + rows = 1 + icons = true + labels = false + sort = false + action[3] = Menu "winops" + action[Drag] = Focus + } + + # Spacer + label { + value = "" + style = "spacer" + } + + # Pager + pager { + rows = 1 + pins = "1","2","3","4" + preview = true + action[Drag] = WorkspaceActivate + } + + # System Monitors + #include("${pkgs.sfwbar}/share/sfwbar/cpu.widget") + #include("${pkgs.sfwbar}/share/sfwbar/memory.widget") + + # Tray + tray { + rows = 1 + } + + # --- MODULES --- + #include("${pkgs.sfwbar}/share/sfwbar/upower.widget") + #include("${pkgs.sfwbar}/share/sfwbar/battery-svg.widget") + + #include("${pkgs.sfwbar}/share/sfwbar/idle.widget") + #include("${pkgs.sfwbar}/share/sfwbar/backlight.widget") + include("${pkgs.sfwbar}/share/sfwbar/volume.widget") + #include("${pkgs.sfwbar}/share/sfwbar/network-module.widget") + #include("${pkgs.sfwbar}/share/sfwbar/sway-lang.widget") + + # Clock + grid { + style = "clock_grid" + label { + value = Time("%H:%M") + tooltip = Time("%H:%M\n%x") + } + } + } + #CSS + + #spacer { + -GtkWidget-hexpand: true; + } + + button#taskbar_item { + padding: 5px; + border-radius: 0px; + border-width: 0px; + -GtkWidget-hexpand: false; + } + + button#taskbar_item:hover { + background-color: rgba(255, 255, 255, 0.1); + } + ''; + }; + }; +} diff --git a/modules/hosts/desktop/sway/default.nix b/modules/hosts/desktop/sway/default.nix new file mode 100644 index 0000000..c149c21 --- /dev/null +++ b/modules/hosts/desktop/sway/default.nix @@ -0,0 +1,119 @@ +{ + config, + username, + lib, + pkgs, + ... +}: + +let + inherit (lib) mkEnableOption mkIf mkOptionDefault; + mod = config.home-manager.users.${username}.wayland.windowManager.sway.config.modifier; + cfg = config.nx.desktop.sway; +in +{ + imports = [ + ./swayidle.nix + ./swaylock.nix + ]; + + options.nx.desktop.sway.enable = mkEnableOption "Enable sway and setup"; + config = mkIf cfg.enable { + home-manager.users.${username} = { + home.packages = with pkgs; [ + wmenu + swaybg + sway-contrib.grimshot + wl-clipboard + xdg-utils + ]; + + wayland.windowManager.sway = { + enable = true; + systemd = { + enable = true; + xdgAutostart = true; + }; + config = { + input = { + "*" = { + xkb_layout = "de"; + }; + }; + + output = { + DP-1 = { + resolution = "1920x1080@240Hz"; + bg = "/etc/nixos/images/pond.jpg fill"; + }; + }; + + gaps = { + inner = 15; + }; + + window = { + titlebar = false; + border = 0; + }; + + modifier = "Mod4"; + + keybindings = mkOptionDefault { + "${mod}+q" = "kill"; + "${mod}+Shift+s" = "exec grimshot savecopy area"; + "XF86AudioPlay" = "exec playerctl play-pause"; + "XF86AudioPrev" = "exec playerctl previous"; + "XF86AudioNext" = "exec playerctl next"; + "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ +5%"; + "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ -5%"; + "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_DEVICE@ toggle"; + }; + + menu = "${pkgs.wmenu}/bin/wmenu-run -b -N 000000E6"; + terminal = "${pkgs.foot}/bin/foot"; + defaultWorkspace = "workspace number 1"; + + bars = [ + { + "command" = "${pkgs.waybar}/bin/waybar"; + } + ]; + }; + checkConfig = false; + wrapperFeatures.base = true; + wrapperFeatures.gtk = true; + }; + + home.sessionVariables = { + XDG_CURRENT_DESKTOP = "sway"; + XDG_SCREENSHOTS_DIR = "~/Pictures/Screenshots/"; + }; + + gtk = { + enable = true; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + gtk3.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + gtk4.extraConfig = { + Settings = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + }; + + home.pointerCursor = { + gtk.enable = true; + name = "Adwaita"; + package = pkgs.adwaita-icon-theme; + size = 24; + }; + }; + }; +} diff --git a/modules/hosts/desktop/sway/swayidle.nix b/modules/hosts/desktop/sway/swayidle.nix new file mode 100644 index 0000000..df8dbdc --- /dev/null +++ b/modules/hosts/desktop/sway/swayidle.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + username, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.swayidle; +in +{ + options.nx.desktop.swayidle.enable = mkEnableOption "Enable swayidle configuration" // { + default = config.nx.desktop.sway.enable; + }; + config = mkIf cfg.enable { + home-manager.users."${username}" = { + services.swayidle = { + enable = true; + timeouts = [ + { + timeout = 300; + command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; + } + { + timeout = 600; + command = "${pkgs.sway}/bin/swaymsg 'output * dpms off"; + resumeCommand = "${pkgs.sway}/bin/swaymsg output * dpms on"; + } + { + timeout = 900; + command = "${pkgs.systemd}/bin/systemctl suspend"; + } + ]; + events = [ + { + event = "after-resume"; + command = "${pkgs.sway}/bin/swaymsg output * dpms on"; + } + { + event = "before-sleep"; + command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; + } + ]; + }; + }; + }; +} diff --git a/modules/hosts/desktop/sway/swaylock.nix b/modules/hosts/desktop/sway/swaylock.nix new file mode 100644 index 0000000..9ba43a1 --- /dev/null +++ b/modules/hosts/desktop/sway/swaylock.nix @@ -0,0 +1,30 @@ +{ + config, + username, + lib, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.swaylock; +in +{ + options.nx.desktop.swaylock.enable = mkEnableOption "Enable and setup swaylock" // { + default = config.nx.desktop.sway.enable; + }; + config = mkIf cfg.enable { + home-manager.users."${username}" = { + programs.swaylock = { + enable = true; + settings = { + font = "monospace 12"; + color = "00000000"; + ring-color = "ffffffff"; + key-hl-color = "ff0000ff"; + bs-hl-color = "ff0000ff"; + }; + }; + }; + }; +} diff --git a/modules/hosts/desktop/waybar.nix b/modules/hosts/desktop/waybar.nix new file mode 100644 index 0000000..23b0f59 --- /dev/null +++ b/modules/hosts/desktop/waybar.nix @@ -0,0 +1,134 @@ +{ + config, + lib, + username, + ... +}: + +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.desktop.waybar; +in +{ + options.nx.desktop.waybar.enable = mkEnableOption "Enable and configure Waybar"; + config = mkIf cfg.enable { + home-manager.users."${username}" = { + programs.waybar = { + enable = true; + settings = { + mainBar = { + height = 32; + layer = "top"; + position = "bottom"; + modules-center = [ "mpris" ]; + modules-left = [ "sway/workspaces" ]; + modules-right = [ + "privacy" + "tray" + "battery" + "pulseaudio" + "network" + "bluetooth" + "clock" + ]; + + mpris = { + format = "{title}"; + tooltip-format = "{artist} - {album}"; + }; + + tray = { + spacing = 10; + }; + + privacy = { + icon-size = 16; + }; + + cpu = { + format = "󰻠"; + tooltip = true; + }; + + memory = { + format = ""; + }; + + temperature = { + critical-threshold = 80; + format = ""; + }; + + network = { + format-disconnect = "󰌙"; + format-ethernet = "󰌘"; + format-wifi = "{icon}"; + format-icons = [ + "󰤟" + "󰤢" + "󰤥" + "󰤨" + ]; + + tooltip-format-wifi = "{essid} | {signalStrength}%"; + tooltip-format-ethernet = "{ifname}"; + }; + + bluetooth = { + format = " {status}"; + format-disabled = ""; + format-no-controller = ""; + format-connected = " {device_alias}"; + tooltip = false; + }; + + clock = { + format-alt = "{:%Y-%m-%d}"; + tooltip-format = "{:%Y-%m-%d | %H:%M}"; + }; + + pulseaudio = { + format = "{icon}"; + format-icons = { + default = [ + "" + "" + "" + ]; + }; + tooltip-format = "{desc} | {volume}%"; + }; + }; + }; + + style = '' + * { + border: none; + border-radius: 0; + font-family: monospace; + font-size: 12px; + background: none; + } + + window#waybar { + background: rgba(0, 0, 0, 0.9); + } + + #workspaces button { + padding-left: 5px; + padding-right: 5px; + } + + #workspaces button.focused { + font-weight: bold; + } + + #clock, #pulseaudio, #tray, #network, #battery, #bluetooth, #cpu, #memory, #temperature, #custom-expand, #group-expand { + padding-left: 10px; + padding-right: 10px; + } + ''; + }; + }; + }; +} -- cgit v1.3.1