diff options
Diffstat (limited to 'modules/desktop')
| -rw-r--r-- | modules/desktop/default.nix | 9 | ||||
| -rw-r--r-- | modules/desktop/dunst.nix | 43 | ||||
| -rw-r--r-- | modules/desktop/hyprland/hyprlock.nix | 113 | ||||
| -rw-r--r-- | modules/desktop/sway/default.nix | 117 | ||||
| -rw-r--r-- | modules/desktop/sway/swayidle.nix | 45 | ||||
| -rw-r--r-- | modules/desktop/sway/swaylock.nix | 26 | ||||
| -rw-r--r-- | modules/desktop/waybar.nix | 130 |
7 files changed, 483 insertions, 0 deletions
diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix new file mode 100644 index 0000000..636e917 --- /dev/null +++ b/modules/desktop/default.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + imports = [ + ./sway + ./dunst.nix + ./waybar.nix + ]; +} diff --git a/modules/desktop/dunst.nix b/modules/desktop/dunst.nix new file mode 100644 index 0000000..46e6445 --- /dev/null +++ b/modules/desktop/dunst.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + pkgs, + username, + ... +}: + +{ + options.nx.desktop.dunst.enable = lib.mkEnableOption "Enable dunst notification"; + config = lib.mkIf config.nx.desktop.dunst.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/desktop/hyprland/hyprlock.nix b/modules/desktop/hyprland/hyprlock.nix new file mode 100644 index 0000000..425f83c --- /dev/null +++ b/modules/desktop/hyprland/hyprlock.nix @@ -0,0 +1,113 @@ +{ + config, + lib, + username, + ... +}: + +{ + options.nx.desktop.hyprlock.enable = lib.mkEnableOption "Hyprlock is a screen locker for Hyprland."; + config = lib.mkIf config.nx.desktop.hyprlock.enable { + 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 <b>($ATTEMPTS)</b>"; + 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/desktop/sway/default.nix b/modules/desktop/sway/default.nix new file mode 100644 index 0000000..7de94a6 --- /dev/null +++ b/modules/desktop/sway/default.nix @@ -0,0 +1,117 @@ +{ + config, + username, + lib, + pkgs, + ... +}: + +let + mod = config.home-manager.users.${username}.wayland.windowManager.sway.config.modifier; +in +{ + imports = [ + ./swayidle.nix + ./swaylock.nix + ]; + + options.nx.desktop.sway.enable = lib.mkEnableOption "Enable sway and setup"; + config = lib.mkIf config.nx.desktop.sway.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 = lib.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/desktop/sway/swayidle.nix b/modules/desktop/sway/swayidle.nix new file mode 100644 index 0000000..0708abc --- /dev/null +++ b/modules/desktop/sway/swayidle.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + username, + ... +}: + +{ + options.nx.desktop.swayidle.enable = lib.mkEnableOption "Enable swayidle configuration" // { + default = config.nx.desktop.sway.enable; + }; + config = lib.mkIf config.nx.desktop.swayidle.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/desktop/sway/swaylock.nix b/modules/desktop/sway/swaylock.nix new file mode 100644 index 0000000..66e418b --- /dev/null +++ b/modules/desktop/sway/swaylock.nix @@ -0,0 +1,26 @@ +{ + config, + username, + lib, + ... +}: + +{ + options.nx.desktop.swaylock.enable = lib.mkEnableOption "Enable and setup swaylock" // { + default = config.nx.desktop.sway.enable; + }; + config = lib.mkIf config.nx.desktop.swaylock.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/desktop/waybar.nix b/modules/desktop/waybar.nix new file mode 100644 index 0000000..874b50f --- /dev/null +++ b/modules/desktop/waybar.nix @@ -0,0 +1,130 @@ +{ + config, + lib, + username, + ... +}: + +{ + options.nx.desktop.waybar.enable = lib.mkEnableOption "Enable and configure Waybar"; + config = lib.mkIf config.nx.desktop.waybar.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; + } + ''; + }; + }; + }; +} |
