dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit 427e6187810c7746f9ace1ff44268108e7f4ccb2 parent 77db84e7e27567e12cbe4f61e91e422f2cbe9435 Author: maydayv7 <maydayv7@gmail.com> Date: Sat, 27 Jan 2024 19:55:06 +0530 feat!: Add Hyprland Configuration /* Still WIP */ Also add `gui.{theme,icons,cursors,xorg}` and cleanup
Diffstat:
| M | README.md | | | 9 | ++++++--- |
| M | devices/vortex.nix | | | 4 | ++-- |
| A | files/colors/README.md | | | 26 | ++++++++++++++++++++++++++ |
| A | files/colors/catppuccin.yaml | | | 18 | ++++++++++++++++++ |
| M | files/flake.nix | | | 8 | +++++++- |
| A | files/ulauncher/themes/catppuccin/manifest.json | | | 12 | ++++++++++++ |
| A | files/ulauncher/themes/catppuccin/theme-gtk-3.20.css | | | 10 | ++++++++++ |
| A | files/ulauncher/themes/catppuccin/theme.css | | | 69 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | flake.lock | | | 6 | +++--- |
| M | modules/README.md | | | 16 | +++++++++++++--- |
| M | modules/apps/flatpak.nix | | | 2 | +- |
| M | modules/apps/office.nix | | | 26 | +++++++++++++++----------- |
| D | modules/gui/compositor.nix | | | 106 | ------------------------------------------------------------------------------- |
| M | modules/gui/default.nix | | | 32 | ++++++++++++++++++++------------ |
| M | modules/gui/desktop/gnome.nix | | | 13 | +++++-------- |
| A | modules/gui/desktop/hyprland/apps.nix | | | 197 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | modules/gui/desktop/hyprland/binds.nix | | | 101 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | modules/gui/desktop/hyprland/default.nix | | | 198 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | modules/gui/desktop/hyprland/theme.nix | | | 35 | +++++++++++++++++++++++++++++++++++ |
| M | modules/gui/desktop/pantheon.nix | | | 43 | ++++++++++++------------------------------- |
| D | modules/gui/desktop/xfce.nix | | | 263 | ------------------------------------------------------------------------------- |
| A | modules/gui/desktop/xfce/compositor.nix | | | 95 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | modules/gui/desktop/xfce/default.nix | | | 247 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| M | modules/gui/gtk.nix | | | 16 | +++++++++------- |
| M | modules/gui/launcher.nix | | | 23 | +++++++++++++++++------ |
| M | modules/gui/theme.nix | | | 66 | +++++++++++++++++++++++++++++++++++++++++++++++++++++------------- |
| M | modules/gui/wayland.nix | | | 2 | ++ |
| M | modules/gui/xorg.nix | | | 14 | ++++++++++++-- |
28 files changed, 1185 insertions(+), 472 deletions(-)
diff --git a/README.md b/README.md @@ -85,6 +85,7 @@ This [repository](https://github.com/maydayv7/dotfiles) contains the configurati | Terminal | [Blackbox](https://gitlab.gnome.org/raggesilver/blackbox), [`xfce4` Terminal](https://docs.xfce.org/apps/terminal/start) | | Browser | [Firefox](https://www.mozilla.org/en-US/firefox/) | | Desktop Environments | [GNOME](https://www.gnome.org), [XFCE](https://xfce.org/), [Pantheon](https://elementary.io/) | +| Compositors | [Hyprland](https://hyprland.org/), [Picom](https://github.com/yshui/picom) | ## Structure @@ -359,6 +360,7 @@ The [`home-manager`](https://github.com/nix-community/home-manager) module is us - ULauncher [Adwaita Theme](https://github.com/gabrbrand/adwaita-dark-ulauncher): ULauncher Theme based on GNOME Desktop's Adwaita Dark Theme - ULauncher [Arc Theme](https://github.com/tjquillan/Arc-Dark-ULauncher): An Arc Dark Theme for ULauncher - ULauncher [Elementary Theme](https://github.com/heidefinnischen/ULauncher-elementary): ULauncher Themes for Elementary OS +- [Catppuccin](https://github.com/catppuccin) Theme: A community-driven Pastel Theme consisting of 4 soothing warm Flavors with 26 eye-candy Colors each ### Important Links @@ -426,11 +428,12 @@ You can navigate to the `README`s present in the various directories to know mor - Overhaul XFCE Configuration - Use ULauncher - Use the Picom Compositor +- Add Hyprland Configuration - Add Pantheon Desktop Configuration - Add VS Code Extensions Repository - Fix Android Virtualisation -- Add AppImage Support -- Add `gui.gtk` Module +- Support running AppImages +- Add multiple `gui` Modules - Refactor and add `hardware.cpu` - Add `sql` Shell - Actually persist `~/.local/share/Trash` @@ -663,7 +666,7 @@ You can navigate to the `README`s present in the various directories to know mor </details> -> Last Updated: **December** 2023 +> Last Updated: **January** 2024 If you like this project, consider leaving a [star](https://github.com/maydayv7/dotfiles) diff --git a/devices/vortex.nix b/devices/vortex.nix @@ -40,8 +40,8 @@ }; gui = { - desktop = "xfce"; - wallpaper = "Sunrise"; + desktop = "hyprland"; + wallpaper = "Tetris"; }; # User V7 diff --git a/files/colors/README.md b/files/colors/README.md @@ -0,0 +1,26 @@ +### Base 16 Color Schemes + +The color schemes are specified according to the following format - + +```yaml +scheme: Name +author: Maker +base00: Base +base01: Mantle +base02: Surface0 +base03: Surface1 +base04: Surface2 +base05: Text +base06: Rosewater +base07: Lavender +base08: Red +base09: Peach +base0A: Yellow +base0B: Green +base0C: Teal +base0D: Blue +base0E: Mauve +base0F: Flamingo +``` + +(_or other equivalent colors_) diff --git a/files/colors/catppuccin.yaml b/files/colors/catppuccin.yaml @@ -0,0 +1,18 @@ +scheme: "Catppuccin Macchiato" +author: "maydayv7" +base00: "24273A" +base01: "1E2030" +base02: "363A4F" +base03: "494D64" +base04: "5B6078" +base05: "CAD3F5" +base06: "F4DBD6" +base07: "B7BDf8" +base08: "ED8796" +base09: "F5A97F" +base0A: "EED49F" +base0B: "A6DA95" +base0C: "8BD5CA" +base0D: "8AADF4" +base0E: "C5A0F6" +base0F: "F0C6C6" diff --git a/files/flake.nix b/files/flake.nix @@ -124,7 +124,13 @@ css = readFile ./xfce/gtk.css; panel = ./xfce/panel; terminal = readFile ./xfce/terminalrc; - settings = ./xfce/settings; + settings = + {directory = ./xfce/settings;} + // map.files { + directory = ./xfce/settings; + apply = readFile; + extension = ".xml"; + }; }; # My Personal Website diff --git a/files/ulauncher/themes/catppuccin/manifest.json b/files/ulauncher/themes/catppuccin/manifest.json @@ -0,0 +1,12 @@ +{ + "manifest_version": "1", + "name": "catppuccin", + "display_name": "Catppuccin Macchiato Blue", + "extend_theme": "light", + "css_file": "theme.css", + "css_file_gtk_3.20+": "theme-gtk-3.20.css", + "matched_text_hl_colors": { + "when_selected": "#8aadf4", + "when_not_selected": "#8aadf4" + } +} diff --git a/files/ulauncher/themes/catppuccin/theme-gtk-3.20.css b/files/ulauncher/themes/catppuccin/theme-gtk-3.20.css @@ -0,0 +1,10 @@ +@import url("theme.css"); + +.input { + caret-color: @caret_color; +} + +/* Workaround for GTK+ < 3.20 */ +.selected.item-box { + border: none; +} diff --git a/files/ulauncher/themes/catppuccin/theme.css b/files/ulauncher/themes/catppuccin/theme.css @@ -0,0 +1,69 @@ +/* Colors */ +@define-color backgroundColor #24273a; +@define-color accentColor #8aadf4; +@define-color textColor #cad3f5; +@define-color subTextColor #b8c0e0; + +/* App Window */ +.app { + background-color: @backgroundColor; + border-color: @accentColor; + border-radius: 14px; +} + +/* Input */ +.input { + color: @accentColor; +} + +/* Selected Text in Input */ +.input *:selected, +.input *:focus, +*:selected:focus { + background-color: alpha (@accentColor, 0.4); + color: @textColor; +} + +.item-text { + color: @textColor; +} + +.item-name { + color: @textColor; + font-size: 1.2rem; +} + +.selected.item-box { + background-color: alpha (@accentColor, 0.3); + border-radius: 14px; +} + +.selected.item-box .item-text { + color: @textColor; +} + +.selected.item-box .item-name { + color: @textColor; + font-size: 1.2rem; +} + +.item-shortcut { + color: @accentColor; +} + +.selected.item-box .item-shortcut { + color: @accentColor; + font-size: 1.1rem; +} + +.selected.item-box { + color: @accentColor; +} + +.prefs-btn { + opacity: 1; +} + +.prefs-btn:hover { + background-color: alpha (@accentColor, 1); +} diff --git a/flake.lock b/flake.lock @@ -660,11 +660,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1705316233, - "narHash": "sha256-HbrIkRykSVox4b5gTNHR4wtxAQSWjMnascQ3x3Ni8hk=", + "lastModified": 1706351967, + "narHash": "sha256-XYlemN1Icppx88mx9OC458GKGe8Biy7c9yfZmmU3pTk=", "owner": "maydayv7", "repo": "proprietary", - "rev": "e39f389a50d469b55cfde31ff9d28d6d575e405c", + "rev": "5126f8e99d61ce698566759c1493b9e8d4fada4f", "type": "github" }, "original": { diff --git a/modules/README.md b/modules/README.md @@ -30,17 +30,27 @@ Configuration [Builder](./configuration.nix) - `wallpaper`: Desktop Wallpaper Choice (taken from `files.wallpapers`) - `fonts` - - `enable`: Enable Fonts Configuration - `true / false` + - `theme` - + - `name`: GUI Application Theme + - `package`: Theme Package + - `icons` - + - `name`: Application Icons Theme - Ex. `Papirus` + - `package`: Icons Package - Ex. `pkgs.papirus-icon-theme` + - `cursors` - + - `name`: GUI Cursors Theme - Ex. `Bibata` + - `package`: Cursors Package - Ex. `pkgs.bibata-cursors` - `gtk` - - `enable`: Enable GTK Configuration - `true / false` - - `compositor` - - - `enable`: Enable Window Compositor - `true / false` - - `exclude`: Exclude focus state for specified windows - Ex. `[ "fullscreen" ]` - `launcher` - - `enable`: Enable Application Launcher - `true / false` + - `shadow`: Control Launcher Window Shadow - `true / false` + - `server`: Display Server to be used by Launcher - `"x11" / "wayland"` - `terminal`: Terminal to be used by Launcher - Ex. `[ "xterm" ]` - `theme`: Theme to be used by Launcher (Taken from `files.ulauncher.themes`) - `wayland` - - `enable`: Enable Wayland Configuration - `true / false` + - `xorg` - + - `enable`: Enable X11 Server Configuration - `true / false` - [`hardware`](./hardware): Module that configures device and additional hardware - diff --git a/modules/apps/flatpak.nix b/modules/apps/flatpak.nix @@ -21,7 +21,7 @@ in { environment.persist.directories = ["/var/lib/flatpak"]; user.persist.directories = [".cache/flatpak" ".local/share/flatpak" ".var/app"]; - ## TODO + #!# TODO #!# # Use system Dconf Settings /* [Environment] diff --git a/modules/apps/office.nix b/modules/apps/office.nix @@ -15,7 +15,6 @@ in { # Applications environment.systemPackages = with pkgs; [ # Productivity - easyeffects gimp gnome.simple-scan gscan2pdf @@ -61,17 +60,22 @@ in { ".cache/zoom" ]; - homeConfig.home.file = { - # Document Templates - "Templates" = { - source = files.templates; - recursive = true; - }; + homeConfig = { + # Utilities + services.easyeffects.enable = true; + + home.file = { + # Document Templates + "Templates" = { + source = files.templates; + recursive = true; + }; - # Font Rendering - ".local/share/fonts" = { - source = "${pkgs.custom.fonts}/share/fonts"; - recursive = true; + # Font Rendering + ".local/share/fonts" = { + source = "${pkgs.custom.fonts}/share/fonts"; + recursive = true; + }; }; }; }; diff --git a/modules/gui/compositor.nix b/modules/gui/compositor.nix @@ -1,106 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - inherit (lib) mkBefore mkEnableOption mkIf mkOption types; - cfg = config.gui.compositor; -in { - options.gui.compositor = { - enable = mkEnableOption "Enable Window Compositor"; - exclude = mkOption { - description = "Exclude focus state for specified windows"; - type = with types; listOf str; - example = ["fullscreen"]; - }; - }; - - ## Picom Configuration ## - config = mkIf cfg.enable { - services.picom = rec { - enable = true; - - # Driver - backend = "egl"; - vSync = true; - - # Shadows - shadow = true; - shadowExclude = [ - "name = 'cpt_frame_xcb_window'" - "class_g ?= 'zoom'" - "name *= 'Chrome'" - "class_g = 'firefox' && argb" - "class_g = 'thunderbird' && argb" - "_NET_WM_STATE@[*]:a = '_NET_WM_STATE_HIDDEN'" - ]; - - # Opacity - opacityRules = [ - "95:class_g = 'Code'" - "95:class_g = 'Ulauncher'" - ]; - wintypes = { - tooltip = {opacity = 0.8;}; - popup_menu = {opacity = 0.9;}; - dropdown_menu = {opacity = 0.9;}; - }; - - # Behaviour - fade = true; - settings = - { - inactive-dim = 0.1; - corner-radius = 10.0; - detect-client-opacity = true; - focus-exclude = - [ - "fullscreen" - "_NET_WM_STATE@[*]:a ^= '_NET_WM_STATE_MAXIMIZED'" - ] - ++ cfg.exclude; - } - // - # Blur - { - blur-method = "dual_kawase"; - blur-strength = 3; - blur-background-exclude = shadowExclude; - } - // - # Animations - { - animations = true; - animation-for-open-window = "zoom"; - animation-for-unmap-window = "squeeze"; - animation-for-transient-window = "slide-up"; - animation-stiffness-in-tag = 150; - animation-stiffness-tag-change = 90.0; - animation-window-mass = 0.2; - animation-dampening = 15; - animation-clamping = true; - animation-for-prev-tag = "minimize"; - enable-fading-prev-tag = true; - animation-for-next-tag = "slide-in-center"; - enable-fading-next-tag = true; - }; - - package = pkgs.unstable.picom.overrideAttrs (old: { - version = "11a"; - src = pkgs.fetchFromGitHub { - owner = "FT-Labs"; - repo = "picom"; - rev = "fe5b416ed6f43c31418d21dde7a9f20c12d7dfb0"; - sha256 = "sha256-KX+/nO/nJlUjsZwVg2/vQy+byYmtnKbtxuhyiq/tWg8="; - }; - }); - }; - - # Theme Fixes - user.homeConfig = { - gtk.gtk3.extraCss = mkBefore "decoration { box-shadow: none; }"; - programs.firefox.profiles.default.settings."browser.tabs.inTitlebar" = 0; - }; - }; -} diff --git a/modules/gui/default.nix b/modules/gui/default.nix @@ -7,8 +7,8 @@ }: let inherit (builtins) map; inherit (util.map.modules) list name; - inherit (lib) mkIf mkOption optional types; - enable = config.gui.desktop != ""; + inherit (lib) hasSuffix mkIf mkOption optional types; + inherit (config.gui) desktop; in { imports = list ./. ++ list ./desktop; @@ -21,16 +21,24 @@ in { config = { # Warning - warnings = optional (!enable) (options.gui.desktop.description + " is unset"); + warnings = optional (desktop == "") (options.gui.desktop.description + " is unset"); } - // (mkIf enable { - # Autostart Apps - user.persist.directories = [".config/autostart"]; + // (mkIf (desktop != "" && !(hasSuffix "-minimal" desktop)) + { + # Autostart Apps + user.persist.directories = [".config/autostart"]; - # Desktop Integration - xdg.portal = { - enable = true; - xdgOpenUsePortal = true; - }; - }); + # Utilities + programs.seahorse.enable = true; + services = { + gvfs.enable = true; + gnome.gnome-keyring.enable = true; + }; + + # Desktop Integration + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + }; + }); } diff --git a/modules/gui/desktop/gnome.nix b/modules/gui/desktop/gnome.nix @@ -57,6 +57,10 @@ in { fonts.enable = true; gtk.enable = true; wayland.enable = true; + theme = { + name = "adw-gtk3-dark"; + package = pkgs.adw-gtk3; + }; }; programs = { @@ -69,7 +73,6 @@ in { telepathy.enable = true; gnome = { core-developer-tools.enable = true; - gnome-keyring.enable = true; gnome-remote-desktop.enable = true; sushi.enable = true; }; @@ -79,13 +82,7 @@ in { user.homeConfig = { # Desktop Settings imports = [gnome.settings]; - - # GTK+ Theming stylix.targets.gnome.enable = true; - gtk.theme = { - name = "adw-gtk3-dark"; - package = pkgs.adw-gtk3; - }; # Default Applications xdg.mimeApps.defaultApplications = util.build.mime xdg.mime { @@ -93,7 +90,7 @@ in { calendar = ["org.gnome.Calendar.desktop"]; directory = ["org.gnome.Nautilus.desktop"]; image = ["org.gnome.Loupe.desktop"]; - magnet = ["transmission-gtk.desktop"]; + magnet = ["de.haeckerfelix.Fragments.desktop"]; mail = ["org.gnome.Geary.desktop"]; markdown = ["org.gnome.gitlab.somas.Apostrophe.desktop"]; pdf = ["org.gnome.Evince.desktop"]; diff --git a/modules/gui/desktop/hyprland/apps.nix b/modules/gui/desktop/hyprland/apps.nix @@ -0,0 +1,197 @@ +{ + config, + lib, + util, + pkgs, + files, + ... +}: +with files; let + inherit (config.stylix) fonts; + inherit (config.gui) wallpaper; + exists = app: builtins.elem app config.apps.list; + theme = import ./theme.nix pkgs; +in { + environment.systemPackages = with pkgs; [ + # Apps + geany + gthumb + mate.atril + mission-center + playerctl + transmission-gtk + xfce.thunar + lollypop + + # Utilities + grim + grimblast + slurp + wev + wl-screenrec + wlr-randr + ]; + + user = { + # Persisted Files + persist.directories = [ + ".config/geany" + ".config/mpv" + ".config/Thunar" + ".local/share/lollypop" + ]; + + homeConfig = { + # Default Applications + xdg.mimeApps.defaultApplications = util.build.mime files.xdg.mime { + audio = ["org.gnome.Lollypop.desktop"]; + directory = ["thunar.desktop"]; + image = ["org.gnome.gThumb.desktop"]; + magnet = ["transmission-gtk.desktop"]; + pdf = ["atril.desktop"]; + text = ["geany.desktop"]; + video = ["mpv.desktop"]; + }; + + # Theming + stylix.targets = { + hyprland.enable = true; + swaylock = { + enable = true; + useImage = true; + }; + }; + + # Configuration Files + home.file = { + # Wallpaper + ".config/hypr/hyprpaper.conf".text = '' + preload = ${wallpaper} + wallpaper = , ${wallpaper} + ''; + + # File Manager + ".config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml".text = xfce.settings.thunar; + }; + + # Utilities + services.playerctld.enable = true; + + # Terminal + programs.kitty = { + enable = true; + font = fonts.monospace // {size = fonts.sizes.terminal;}; + theme = with theme; "${name-alt}-${variant-alt}"; + settings = { + background_opacity = "0.9"; + placement_strategy = "center"; + + copy_on_select = "clipboard"; + scrollback_lines = 10000; + + enable_audio_bell = "no"; + visual_bell_duration = "0.1"; + }; + }; + + # Media + programs.firefox.enable = true; + programs.mpv = { + enable = true; + defaultProfiles = ["gpu-hq"]; + scripts = [pkgs.mpvScripts.mpris]; + }; + + # Locker + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + settings = { + clock = true; + indicator = true; + font = fonts.sansSerif.name; + grace = 10; + fade-in = 1; + effect-vignette = "0.3:1"; + }; + }; + + # Screen Idle + services.swayidle = { + enable = true; + events = [ + { + event = "before-sleep"; + command = "${pkgs.systemd}/bin/loginctl lock-session"; + } + { + event = "lock"; + command = "${pkgs.swaylock-effects}/bin/swaylock -f"; + } + ]; + timeouts = [ + { + timeout = 330; + command = "${pkgs.writeShellApplication { + name = "suspend"; # Only suspend if no audio is playing + runtimeInputs = with pkgs; [pipewire ripgrep systemd]; + text = '' + pw-cli i all | rg running + if [ $? == 1 ] + then + ${pkgs.systemd}/bin/systemctl suspend + fi + ''; + }}/bin/suspend"; + } + ]; + }; + + systemd.user.services = { + # Wallpaper Daemon + hyprpaper = { + Install.WantedBy = ["graphical-session.target"]; + Unit = { + Description = "Hyprland Wallpaper Daemon"; + PartOf = ["graphical-session.target"]; + }; + + Service = { + ExecStart = "${lib.getExe pkgs.hyprpaper}"; + Restart = "on-failure"; + }; + }; + + # Authorization Agent + polkit = { + Unit.Description = "polkit-gnome-authentication-agent-1"; + + Install = { + WantedBy = ["graphical-session.target"]; + Wants = ["graphical-session.target"]; + After = ["graphical-session.target"]; + }; + + Service = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + }; + + ## 3rd Party Apps Configuration + # Code Editor + programs.vscode = lib.mkIf (exists "vscode") { + extensions = with pkgs.vscode-extensions.catppuccin; [catppuccin-vsc catppuccin-vsc-icons]; + userSettings = with theme; { + "workbench.colorTheme" = "${name-alt} ${variant-alt}"; + "workbench.iconTheme" = "${name}-${variant}"; + "terminal.external.linuxExec" = "kitty"; + }; + }; + }; + }; +} diff --git a/modules/gui/desktop/hyprland/binds.nix b/modules/gui/desktop/hyprland/binds.nix @@ -0,0 +1,101 @@ +_: { + ## Keybindings + wayland.windowManager.hyprland.settings = { + "$mod" = "SUPER"; + bind = + [ + # Apps + "$mod, F, exec, thunar" + "$mod, T, exec, kitty" + "$mod, W, exec, firefox" + "$mod, Return, exec, missioncenter" + "$mod, slash, exec, ulauncher-toggle" + + # Compositor Commands + "$mod, Q, killactive," + "$mod, grave, fullscreen, 1" + "$mod SHIFT, grave, fullscreen," + "$mod, O, togglefloating," + "$mod, P, workspaceopt, allfloat" # Floating Mode + + # Focus Change + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + + # Window Switcher + "ALT, Tab, cyclenext," + "ALT, Tab, bringactivetotop," + "ALT CTRL, Tab, cyclenext, prev" + "ALT CTRL, Tab, bringactivetotop," + + # Cycle Workspaces + "$mod, period, workspace, m-1" + "$mod, comma, workspace, m+1" + + # Move Window to Workspace + "$mod SHIFT, period, movetoworkspace, m-1" + "$mod SHIFT, comma, movetoworkspace, m+1" + + # Cycle Monitors + "$mod SHIFT, period, focusmonitor, l" + "$mod SHIFT, comma, focusmonitor, r" + + # Send Focused Workspace to Monitor + "$mod SHIFT CTRL, period, movecurrentworkspacetomonitor, l" + "$mod SHIFT CTRL, comma, movecurrentworkspacetomonitor, r" + + # Screen Lock + "$mod, L, exec, loginctl lock-session" + + # Screenshot + ", Print, exec, grimblast --notify copysave area" + "CTRL, Print, exec, grimblast --notify --cursor copysave output" + "SHIFT, Print, exec, grimblast --notify --cursor copysave screen" + ] + ++ + # Workspaces + (with builtins; + concatLists (genList ( + num: let + key = toString (num + 1 - (((num + 1) / 10) * 10)); + workspace = toString (num + 1); + in [ + "$mod, ${key}, workspace, ${workspace}" + "$mod SHIFT, ${key}, movetoworkspace, ${workspace}" + ] + ) + 10)); + + # Mouse + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + "$mod CTRL, mouse:272, resizewindow" + ]; + + # Ignore Locked State + bindl = [ + # Media Controls + ", XF86AudioPlay, exec, playerctl play-pause" + ", XF86AudioPrev, exec, playerctl previous" + ", XF86AudioNext, exec, playerctl next" + + # Volume + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ]; + + # Repeat on Hold + bindle = [ + # Volume + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l '1.0' @DEFAULT_AUDIO_SINK@ 6%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume -l '1.0' @DEFAULT_AUDIO_SINK@ 6%-" + + # Backlight + ", XF86MonBrightnessUp, exec, brillo -q -u 300000 -A 5" + ", XF86MonBrightnessDown, exec, brillo -q -u 300000 -U 5" + ]; + }; +} diff --git a/modules/gui/desktop/hyprland/default.nix b/modules/gui/desktop/hyprland/default.nix @@ -0,0 +1,198 @@ +{ + config, + lib, + pkgs, + files, + ... +} @ args: let + inherit (config.gui) desktop; + inherit (config.stylix) cursor fonts; + inherit (lib) mkAfter mkIf mkMerge; + theme = import ./theme.nix pkgs; +in { + #!# WIP #!# + ## Hyprland Configuration ## + config = mkIf (desktop == "hyprland" || desktop == "hyprland-minimal") (mkMerge [ + { + # Session + gui = { + xorg.enable = false; + wayland.enable = true; + }; + + programs = { + hyprland = { + enable = true; + xwayland.enable = true; + }; + + regreet = { + enable = true; + package = pkgs.greetd.regreet.overrideAttrs (final: prev: { + SESSION_DIRS = "${config.services.xserver.displayManager.sessionData.desktops}/share"; + }); + + settings.commands = { + reboot = ["systemctl" "reboot"]; + poweroff = ["systemctl" "poweroff"]; + }; + }; + }; + } + + (mkIf (desktop == "hyprland") (import ./apps.nix args)) + (mkIf (desktop == "hyprland") { + # Boot Splash + boot.plymouth = { + theme = with theme; "${name}-${variant}"; + themePackages = [pkgs.catppuccin-plymouth]; + }; + + # Desktop Integration + gui = { + fonts.enable = true; + gtk.enable = true; + theme = theme.gtk; + inherit (theme) icons; + launcher = { + enable = true; + shadow = false; + theme = theme.name; + terminal = "kitty"; + }; + }; + + # Security + security.pam.services = { + greetd.enableGnomeKeyring = true; + swaylock.text = "auth include login"; + }; + + ## Essential Utilities + xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; + + # Battery + services.power-profiles-daemon.enable = true; + services.upower.enable = true; + + # Greeter + programs.regreet.settings.GTK = { + application_prefer_dark_theme = true; + cursor_theme_name = cursor.name; + font_name = "${fonts.sansSerif.name} 16"; + icon_theme_name = theme.icons.name; + theme_name = theme.gtk.name; + }; + + # Backlight + hardware.brillo.enable = true; + services.clight = { + enable = true; + settings = { + verbose = true; + backlight.disabled = true; + dpms.timeouts = [900 300]; + dimmer.timeouts = [870 270]; + gamma.long_transition = true; + screen.disabled = true; + }; + }; + + # Location + location.provider = "geoclue2"; + services.geoclue2.enable = true; + + ## Theming + # Color Scheme + stylix.base16Scheme = files.colors.catppuccin; + + # QT Theme + environment = with theme; { + systemPackages = [qt.package]; + etc."xdg/Kvantum/kvantum.kvconfig".text = mkAfter "theme=${qt.name}"; + }; + + ## User Configuration + user.homeConfig = { + imports = [./binds.nix]; + + ## Settings + wayland.windowManager.hyprland = { + enable = true; + settings = { + env = ["QT_WAYLAND_DISABLE_WINDOWDECORATION,1"]; + exec-once = [ + "hyprctl setcursor ${cursor.name} ${builtins.toString cursor.size}" + "systemctl --user start clight" + ]; + + # Display + monitor = ",preferred,auto,1"; + xwayland.force_zero_scaling = true; + + input = { + # Keyboard + kb_layout = "us"; + + # Mouse + follow_mouse = 1; # Focus on cursor move + accel_profile = "flat"; + touchpad = { + disable_while_typing = true; + natural_scroll = true; + tap-to-click = true; + tap-and-drag = true; + }; + }; + + gestures = { + workspace_swipe = true; + workspace_swipe_fingers = 3; + workspace_swipe_forever = true; + }; + + misc = { + disable_autoreload = true; + force_default_wallpaper = 0; + + # Graphics + vrr = 1; + no_direct_scanout = false; + }; + + general = + { + resize_on_border = true; + allow_tearing = config.hardware.cpu.mode == "powersave"; + } + // + # Visuals + { + gaps_in = 5; + gaps_out = 5; + border_size = 3; + }; + + decoration = { + rounding = 10; + drop_shadow = true; + shadow_ignore_window = true; + shadow_offset = "0 2"; + shadow_range = 20; + shadow_render_power = 3; + + blur = { + enabled = true; + brightness = 1.0; + contrast = 1.0; + noise = 0.02; + passes = 3; + size = 10; + }; + }; + }; + }; + }; + }) + ]); +} diff --git a/modules/gui/desktop/hyprland/theme.nix b/modules/gui/desktop/hyprland/theme.nix @@ -0,0 +1,35 @@ +pkgs: rec { + # Theming + name = "catppuccin"; + name-alt = "Catppuccin"; + + accent = "blue"; + accent-alt = "Blue"; + + variant = "macchiato"; + variant-alt = "Macchiato"; + + gtk = { + name = "${name-alt}-${variant-alt}-Standard-${accent-alt}-Dark"; + package = pkgs.catppuccin-gtk.override { + accents = [accent]; + inherit variant; + }; + }; + + qt = { + name = "${name-alt}-${variant-alt}-${accent-alt}"; + package = pkgs.catppuccin-kvantum.override { + accent = accent-alt; + variant = variant-alt; + }; + }; + + icons = { + name = "Papirus-Dark"; + package = pkgs.catppuccin-papirus-folders.override { + inherit accent; + flavor = variant; + }; + }; +} diff --git a/modules/gui/desktop/pantheon.nix b/modules/gui/desktop/pantheon.nix @@ -26,6 +26,17 @@ in { gui = { fonts.enable = true; gtk.enable = true; + icons.name = "ePapirus-Dark"; + theme = { + name = "io.elementary.stylesheet.blueberry"; + package = pkgs.pantheon.elementary-gtk-theme; + }; + + cursors = { + name = "elementary"; + package = pkgs.pantheon.elementary-icon-theme; + }; + launcher = { enable = true; theme = "elementary"; @@ -34,15 +45,10 @@ in { }; # Essential Utilities - services = { - gnome.gnome-keyring.enable = true; - pantheon.apps.enable = true; - }; - + services.pantheon.apps.enable = true; programs = { firefox.enable = true; pantheon-tweaks.enable = true; - seahorse.enable = true; }; # Panel Indicators @@ -89,22 +95,6 @@ in { user.homeConfig = { imports = [pantheon.dconf]; - # GTK+ Theme - gtk = { - theme = { - name = "io.elementary.stylesheet.blueberry"; - package = pkgs.pantheon.elementary-gtk-theme; - }; - - # Icons - iconTheme.name = mkForce "ePapirus-Dark"; - cursorTheme = { - name = "elementary"; - package = pkgs.pantheon.elementary-icon-theme; - size = 32; - }; - }; - # Default Applications xdg.mimeApps.defaultApplications = util.build.mime xdg.mime { audio = ["io.elementary.files.desktop"]; @@ -127,15 +117,6 @@ in { }; home = { - # Cursor Theme - pointerCursor = mkForce { - package = pkgs.pantheon.elementary-icon-theme; - name = "elementary"; - size = 32; - gtk.enable = true; - x11.enable = true; - }; - file = { # Plank Dock ".config/autostart/Dock.desktop".text = plank.autostart; diff --git a/modules/gui/desktop/xfce.nix b/modules/gui/desktop/xfce.nix @@ -1,263 +0,0 @@ -{ - config, - lib, - util, - pkgs, - files, - ... -}: -with files; let - inherit (config.gui) desktop wallpaper; - exists = app: builtins.elem app config.apps.list; - inherit (lib) mkAfter mkForce mkIf mkMerge; - - # GTK+ Theme - theme = { - name = "Arc-Dark"; - package = pkgs.arc-theme; - }; - - # Window Composition - compositor = config.hardware.cpu.mode != "powersave"; -in { - ## XFCE Desktop Configuration ## - config = mkIf (desktop == "xfce" || desktop == "xfce-minimal") (mkMerge [ - { - # Session - services.xserver = { - desktopManager.xfce = { - enable = true; - enableXfwm = true; - }; - - displayManager = { - defaultSession = "xfce"; - lightdm.greeters.gtk = { - clock-format = "%H:%M"; - indicators = [ - "~a11y" - "~language" - "~spacer" - "~clock" - "~spacer" - "~host" - "~spacer" - "~session" - "~power" - ]; - }; - }; - }; - } - - ## Full-Fledged XFCE Desktop Configuration - (mkIf (desktop == "xfce") { - # Desktop Integration - gui = - { - fonts.enable = true; - gtk.enable = true; - } - // - # Desktop Components - { - compositor = { - enable = compositor; - exclude = [ - "class_g='Xfwm4'" - "class_g='Xfce4-panel'" - ]; - }; - - launcher = { - enable = true; - theme = theme.name; - terminal = "xfce4-terminal"; - }; - }; - - # Essential Utilities - xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; - services = { - blueman.enable = true; - touchegg.enable = true; - gnome.gnome-keyring.enable = true; - xserver.displayManager.lightdm.greeters.gtk = {inherit theme;}; - }; - - programs = { - xfconf.enable = true; - seahorse.enable = true; - thunar = { - enable = true; - plugins = with pkgs.xfce; [ - thunar-archive-plugin - thunar-dropbox-plugin - thunar-volman - ]; - }; - }; - - environment = { - # Theming - etc."xdg/Kvantum/kvantum.kvconfig".text = mkAfter "theme=KvArcDark"; - variables."GTK_THEME" = theme.name; - - # Utilities - systemPackages = with pkgs.xfce // pkgs; [ - arc-kde-theme - galculator - gnome.file-roller - mate.atril - orage - pavucontrol - system-config-printer - transmission-gtk - xfce4-clipman-plugin - xfce4-docklike-plugin - xfce4-eyes-plugin - xfce4-notes-plugin - xfce4-panel-profiles - xfce4-pulseaudio-plugin - xfce4-sensors-plugin - xfce4-timer-plugin - xfce4-weather-plugin - xfce4-whiskermenu-plugin - xfce4-windowck-plugin - xorg.xkill - - (writeShellApplication { - name = "xfce4-panel-toggle"; - runtimeInputs = [xfce.xfconf]; - text = '' - for num in {0,1} - do - current=$(xfconf-query -c xfce4-panel -p /panels/panel-"$num"/autohide-behavior) - if [[ current -eq 1 ]]; then next=0; else next=1; fi - xfconf-query -c xfce4-panel -p /panels/panel-"$num"/autohide-behavior -s $next - done - ''; - }) - ]; - }; - - # Persisted Files - user.persist.directories = [ - ".config/Mousepad" - ".config/Thunar" - ".config/xfce4" - ".cache/xfce4" - ]; - - # Color Scheme - stylix.base16Scheme = colors.arc; - - ## User Configuration - user.homeConfig = { - # GTK+ Theming - stylix.targets.xfce.enable = false; - gtk = { - inherit theme; - gtk3.extraCss = xfce.css; - }; - - # Default Applications - xdg.mimeApps.defaultApplications = util.build.mime xdg.mime { - audio = ["org.xfce.Parole.desktop"]; - calendar = ["org.xfce.orage.desktop"]; - directory = ["thunar.desktop"]; - image = ["org.xfce.ristretto.desktop"]; - pdf = ["atril.desktop"]; - text = ["org.xfce.mousepad.desktop"]; - video = ["org.xfce.Parole.desktop"]; - }; - - home.file = - { - # Touchpad Gestures - ".config/touchegg/touchegg.conf".text = gestures; - } - # Desktop Settings - // util.map.folder { - directory = xfce.panel; - path = ".config/xfce4/panel"; - extension = ".rc"; - apply = text: {inherit text;}; - replace = { - placeholders = ["@font"]; - values = [config.stylix.fonts.sansSerif.name]; - }; - } - // util.map.folder { - directory = xfce.settings; - path = ".config/xfce4/xfconf/xfce-perchannel-xml"; - extension = ".xml"; - apply = text: { - inherit text; - force = true; - }; - replace = { - placeholders = [ - "@system" - "@wallpaper" - "@theme" - "@icons" - "@cursor" - "@font" - "@monospace" - "@compositor" - ]; - values = [ - path.system - wallpaper - theme.name - "Papirus-Dark" - config.stylix.cursor.name - config.stylix.fonts.sansSerif.name - config.stylix.fonts.monospace.name - ( - if compositor - then "false" - else "true" - ) - ]; - }; - } - ## 3rd Party Apps Configuration - // { - # Discord Arc Theme - ".config/BetterDiscord/data/stable/custom.css" = - mkIf (exists "discord") {text = ''@import url(https://rawcdn.githack.com/orblazer/discord-nordic/f3f6833c70d0b27b1cde986233b7009d61917812/nordic.theme.css);'';}; - }; - - # Code Editor - programs.vscode = mkIf (exists "vscode") { - extensions = [pkgs.code.vscode-marketplace.alvesvaren.arc-dark]; - userSettings = { - "workbench.colorTheme" = "Arc Dark Theme"; - "terminal.external.linuxExec" = "xfce4-terminal"; - }; - }; - }; - }) - - ## Minimal XFCE Desktop Configuration - (mkIf (desktop == "xfce-minimal") { - environment = { - # Utilities - systemPackages = [pkgs.epiphany]; - - # Excluded Packages - xfce.excludePackages = with pkgs; [ - tango-icon-theme - xfce4-icon-theme - xfwm4-themes - ]; - }; - - # Disabled Services - services.tumbler.enable = mkForce false; - services.accounts-daemon.enable = mkForce false; - }) - ]); -} diff --git a/modules/gui/desktop/xfce/compositor.nix b/modules/gui/desktop/xfce/compositor.nix @@ -0,0 +1,95 @@ +{ + lib, + pkgs, + ... +}: { + ## Picom Compositor Configuration ## + services.picom = rec { + enable = true; + + # Driver + backend = "egl"; + vSync = true; + + # Shadows + shadow = true; + shadowExclude = [ + "name = 'cpt_frame_xcb_window'" + "class_g ?= 'zoom'" + "name *= 'Chrome'" + "class_g = 'firefox' && argb" + "class_g = 'thunderbird' && argb" + "_NET_WM_STATE@[*]:a = '_NET_WM_STATE_HIDDEN'" + ]; + + # Opacity + opacityRules = [ + "95:class_g = 'Code'" + "95:class_g = 'Ulauncher'" + ]; + wintypes = { + tooltip = {opacity = 0.8;}; + popup_menu = {opacity = 0.9;}; + dropdown_menu = {opacity = 0.9;}; + }; + + # Behaviour + fade = true; + settings = + { + inactive-dim = 0.1; + corner-radius = 10.0; + detect-client-opacity = true; + focus-exclude = + [ + "fullscreen" + "_NET_WM_STATE@[*]:a ^= '_NET_WM_STATE_MAXIMIZED'" + ] + ++ [ + "class_g='Xfwm4'" + "class_g='Xfce4-panel'" + ]; + } + // + # Blur + { + blur-method = "dual_kawase"; + blur-strength = 3; + blur-background-exclude = shadowExclude; + } + // + # Animations + { + animations = true; + animation-for-open-window = "zoom"; + animation-for-unmap-window = "zoom"; + animation-for-transient-window = "slide-up"; + animation-stiffness-in-tag = 150; + animation-stiffness-tag-change = 90.0; + animation-window-mass = 0.2; + animation-dampening = 15; + animation-clamping = true; + animation-for-prev-tag = "minimize"; + enable-fading-prev-tag = true; + animation-for-next-tag = "slide-in-center"; + enable-fading-next-tag = true; + }; + + package = pkgs.unstable.picom.overrideAttrs (old: { + version = "11a"; + src = pkgs.fetchFromGitHub { + owner = "FT-Labs"; + repo = "picom"; + rev = "fe5b416ed6f43c31418d21dde7a9f20c12d7dfb0"; + sha256 = "sha256-KX+/nO/nJlUjsZwVg2/vQy+byYmtnKbtxuhyiq/tWg8="; + }; + }); + }; + + # Theme Fixes + gui.launcher.shadow = false; + user.homeConfig = { + gtk.gtk3.extraCss = lib.mkBefore "decoration { box-shadow: none; }"; + programs.firefox.profiles.default.settings."browser.tabs.inTitlebar" = 0; + }; +} diff --git a/modules/gui/desktop/xfce/default.nix b/modules/gui/desktop/xfce/default.nix @@ -0,0 +1,247 @@ +{ + config, + lib, + util, + pkgs, + files, + ... +} @ args: +with files; let + inherit (config.gui) desktop wallpaper; + exists = app: builtins.elem app config.apps.list; + inherit (lib) mkAfter mkForce mkIf mkMerge; + + # GTK+ Theme + theme = { + name = "Arc-Dark"; + package = pkgs.arc-theme; + }; + + # Window Composition + compositor = config.hardware.cpu.mode != "powersave"; +in { + ## XFCE Desktop Configuration ## + config = mkIf (desktop == "xfce" || desktop == "xfce-minimal") (mkMerge [ + { + # Session + services.xserver = { + desktopManager.xfce = { + enable = true; + enableXfwm = true; + }; + + displayManager = { + defaultSession = "xfce"; + lightdm.greeters.gtk = { + clock-format = "%H:%M"; + indicators = [ + "~a11y" + "~language" + "~spacer" + "~clock" + "~spacer" + "~host" + "~spacer" + "~session" + "~power" + ]; + }; + }; + }; + } + + ## Full-Fledged XFCE Desktop Configuration + (mkIf (desktop == "xfce" && compositor) (import ./compositor.nix args)) + (mkIf (desktop == "xfce") { + # Desktop Components + gui = { + fonts.enable = true; + gtk.enable = true; + inherit theme; + launcher = { + enable = true; + theme = theme.name; + terminal = "xfce4-terminal"; + }; + }; + + # Essential Utilities + xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; + services = { + blueman.enable = true; + touchegg.enable = true; + xserver.displayManager.lightdm.greeters.gtk = {inherit theme;}; + }; + + programs = { + xfconf.enable = true; + thunar = { + enable = true; + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-dropbox-plugin + thunar-volman + ]; + }; + }; + + environment = { + # QT Theme + etc."xdg/Kvantum/kvantum.kvconfig".text = mkAfter "theme=KvArcDark"; + + # Utilities + systemPackages = with pkgs.xfce // pkgs; [ + arc-kde-theme + galculator + gnome.file-roller + mate.atril + orage + pavucontrol + system-config-printer + transmission-gtk + xorg.xkill + + xfce4-clipman-plugin + xfce4-docklike-plugin + xfce4-eyes-plugin + xfce4-notes-plugin + xfce4-panel-profiles + xfce4-pulseaudio-plugin + xfce4-sensors-plugin + xfce4-timer-plugin + xfce4-weather-plugin + xfce4-whiskermenu-plugin + xfce4-windowck-plugin + (writeShellApplication { + name = "xfce4-panel-toggle"; + runtimeInputs = [xfce.xfconf]; + text = '' + for num in {0,1} + do + current=$(xfconf-query -c xfce4-panel -p /panels/panel-"$num"/autohide-behavior) + if [[ current -eq 1 ]]; then next=0; else next=1; fi + xfconf-query -c xfce4-panel -p /panels/panel-"$num"/autohide-behavior -s $next + done + ''; + }) + ]; + }; + + # Persisted Files + user.persist.directories = [ + ".config/Mousepad" + ".config/Thunar" + ".config/xfce4" + ".cache/xfce4" + ]; + + # Color Scheme + stylix.base16Scheme = colors.arc; + + ## User Configuration + user.homeConfig = { + # GTK+ Theming + stylix.targets.xfce.enable = false; + gtk = {gtk3.extraCss = xfce.css;}; + + # Default Applications + xdg.mimeApps.defaultApplications = util.build.mime xdg.mime { + audio = ["org.xfce.Parole.desktop"]; + calendar = ["org.xfce.orage.desktop"]; + directory = ["thunar.desktop"]; + image = ["org.xfce.ristretto.desktop"]; + magnet = ["transmission-gtk.desktop"]; + pdf = ["atril.desktop"]; + text = ["org.xfce.mousepad.desktop"]; + video = ["org.xfce.Parole.desktop"]; + }; + + home.file = + { + # Touchpad Gestures + ".config/touchegg/touchegg.conf".text = gestures; + } + # Desktop Settings + // util.map.folder { + directory = xfce.panel; + path = ".config/xfce4/panel"; + extension = ".rc"; + apply = text: {inherit text;}; + replace = { + placeholders = ["@font"]; + values = [config.stylix.fonts.sansSerif.name]; + }; + } + // util.map.folder { + inherit (xfce.settings) directory; + path = ".config/xfce4/xfconf/xfce-perchannel-xml"; + extension = ".xml"; + apply = text: { + inherit text; + force = true; + }; + replace = { + placeholders = [ + "@system" + "@wallpaper" + "@theme" + "@icons" + "@cursor" + "@font" + "@monospace" + "@compositor" + ]; + values = [ + path.system + wallpaper + theme.name + config.gui.icons.name + config.stylix.cursor.name + config.stylix.fonts.sansSerif.name + config.stylix.fonts.monospace.name + ( + if compositor + then "false" + else "true" + ) + ]; + }; + } + ## 3rd Party Apps Configuration + // { + # Discord Arc Theme + ".config/BetterDiscord/data/stable/custom.css" = + mkIf (exists "discord") {text = ''@import url(https://rawcdn.githack.com/orblazer/discord-nordic/f3f6833c70d0b27b1cde986233b7009d61917812/nordic.theme.css);'';}; + }; + + # Code Editor + programs.vscode = mkIf (exists "vscode") { + extensions = [pkgs.code.vscode-marketplace.alvesvaren.arc-dark]; + userSettings = { + "workbench.colorTheme" = "Arc Dark Theme"; + "terminal.external.linuxExec" = "xfce4-terminal"; + }; + }; + }; + }) + + ## Minimal XFCE Desktop Configuration + (mkIf (desktop == "xfce-minimal") { + environment = { + # Utilities + systemPackages = [pkgs.epiphany]; + + # Excluded Packages + xfce.excludePackages = with pkgs; [ + tango-icon-theme + xfce4-icon-theme + xfwm4-themes + ]; + }; + + # Disabled Services + services.tumbler.enable = mkForce false; + services.accounts-daemon.enable = mkForce false; + }) + ]); +} diff --git a/modules/gui/gtk.nix b/modules/gui/gtk.nix @@ -6,11 +6,12 @@ ... }: let inherit (lib) mkDefault mkEnableOption mkIf; + cfg = config.gui; in { options.gui.gtk.enable = mkEnableOption "Enable GTK Configuration"; ## GTK Configuration ## - config = mkIf config.gui.gtk.enable { + config = mkIf cfg.gtk.enable { # Environment Setup programs.dconf.enable = true; services.dbus.packages = [pkgs.dconf]; @@ -18,9 +19,12 @@ in { # Platform Integration programs.gnupg.agent.pinentryFlavor = "gtk2"; environment = { - variables."QT_STYLE_OVERRIDE" = mkDefault "kvantum"; systemPackages = [pkgs.libsForQt5.qtstyleplugin-kvantum]; etc."xdg/Kvantum/kvantum.kvconfig".text = "[General]"; + variables = { + "GTK_THEME" = cfg.theme.name; + "QT_STYLE_OVERRIDE" = mkDefault "kvantum"; + }; }; user = { @@ -38,11 +42,9 @@ in { # Theming gtk = { enable = true; - iconTheme = { - name = "Papirus-Dark"; - package = pkgs.papirus-icon-theme; - }; - + inherit (cfg) theme; + iconTheme = cfg.icons; + cursorTheme = cfg.cursors; gtk3.extraConfig.gtk-application-prefer-dark-theme = 1; gtk4.extraConfig.gtk-application-prefer-dark-theme = 1; }; diff --git a/modules/gui/launcher.nix b/modules/gui/launcher.nix @@ -7,13 +7,20 @@ }: let inherit (lib) mkEnableOption mkIf mkOption replaceStrings types; cfg = config.gui.launcher; - shadow = - if config.gui.compositor.enable - then "--no-window-shadow" - else ""; in { options.gui.launcher = { enable = mkEnableOption "Enable Application Launcher"; + shadow = mkOption { + description = "Control Launcher Window Shadow"; + type = types.bool; + default = true; + }; + + server = mkOption { + description = "Display Server to be used by Launcher"; + type = types.enum ["x11" "wayland"]; + default = "x11"; + }; terminal = mkOption { description = "Terminal to be used by Launcher"; @@ -71,8 +78,12 @@ in { RestartSec = 1; ExecStart = pkgs.writeShellScript "ulauncher-env-wrapper.sh" '' export PATH="''${XDG_BIN_HOME}:$HOME/.nix-profile/bin:/etc/profiles/per-user/$USER/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" - export GDK_BACKEND=x11 - exec ${pkgs.ulauncher}/bin/ulauncher --hide-window ${shadow} + export GDK_BACKEND=${cfg.server} + exec ${pkgs.ulauncher}/bin/ulauncher --hide-window ${ + if cfg.shadow + then "" + else "--no-window-shadow" + } ''; }; }; diff --git a/modules/gui/theme.nix b/modules/gui/theme.nix @@ -6,32 +6,72 @@ files, ... }: let - inherit (lib) attrNames hasSuffix mkIf mkOption optional types; + inherit (lib) attrNames hasSuffix mkIf mkOption optionals types; cfg = config.gui; enable = !(cfg.desktop == "" || hasSuffix "-minimal" cfg.desktop); exists = app: builtins.elem app config.apps.list; in { imports = [inputs.stylix.nixosModules.stylix]; - options.gui.wallpaper = mkOption { - description = "Desktop Wallpaper Choice"; - type = types.enum (attrNames files.wallpapers); - default = "Beauty"; - apply = image: files.wallpapers."${image}"; + options.gui = { + theme = { + name = mkOption { + description = "GUI Application Theme"; + type = types.str; + }; + + package = mkOption { + description = "Theme Package"; + type = types.package; + }; + }; + + icons = { + name = mkOption { + description = "Application Icons Theme"; + type = types.str; + default = "Papirus-Dark"; + }; + + package = mkOption { + description = "Icons Package"; + type = types.package; + default = pkgs.papirus-icon-theme; + }; + }; + + cursors = { + name = mkOption { + description = "GUI Cursors Theme"; + type = types.str; + default = "Bibata-Original-Classic"; + }; + + package = mkOption { + description = "Cursors Package"; + type = types.package; + default = pkgs.bibata-cursors; + }; + }; + + wallpaper = mkOption { + description = "Desktop Wallpaper Choice"; + type = types.enum (attrNames files.wallpapers); + default = "Beauty"; + apply = image: files.wallpapers."${image}"; + }; }; - ## Base16 Color Theming ## + ## Application Theming ## config = rec { - environment.systemPackages = [stylix.cursor.package] ++ optional enable pkgs.papirus-icon-theme; + environment.systemPackages = + [stylix.cursor.package] + ++ optionals enable [cfg.theme.package cfg.icons.package cfg.cursors.package]; stylix = { autoEnable = false; image = cfg.wallpaper; - cursor = { - package = pkgs.bibata-cursors; - name = "Bibata-Original-Classic"; - size = 28; - }; + cursor = cfg.cursors // {size = 28;}; } // ( if (!enable) diff --git a/modules/gui/wayland.nix b/modules/gui/wayland.nix @@ -11,9 +11,11 @@ environment.sessionVariables = { NIXOS_OZONE_WL = "1"; MOZ_ENABLE_WAYLAND = "1"; + QT_QPA_PLATFORM = "wayland"; }; # Programs Support + gui.launcher.server = "wayland"; xdg.portal.wlr.enable = true; programs.xwayland.enable = true; }; diff --git a/modules/gui/xorg.nix b/modules/gui/xorg.nix @@ -1,5 +1,15 @@ -{files, ...}: { - ## XORG Configuration ## +{ + lib, + files, + ... +}: { + options.gui.xorg.enable = lib.mkOption { + description = "Enable X11 Server Configuration"; + type = lib.types.bool; + default = true; + }; + + ## X11 Server Configuration ## config = { user.homeConfig.xresources.extraConfig = files.xorg; services.xserver = {