diff options
Diffstat (limited to 'modules/desktop')
| -rw-r--r-- | modules/desktop/hjem/default.nix | 1 | ||||
| -rw-r--r-- | modules/desktop/hjem/qt.nix | 31 | ||||
| -rw-r--r-- | modules/desktop/hjem/wm/tofi.nix | 2 | ||||
| -rw-r--r-- | modules/desktop/nixos/portals.nix | 48 | ||||
| -rw-r--r-- | modules/desktop/nixos/qt.nix | 51 | ||||
| -rw-r--r-- | modules/desktop/options.nix | 19 |
6 files changed, 95 insertions, 57 deletions
diff --git a/modules/desktop/hjem/default.nix b/modules/desktop/hjem/default.nix index f22fd78..113a37e 100644 --- a/modules/desktop/hjem/default.nix +++ b/modules/desktop/hjem/default.nix @@ -1,6 +1,7 @@ { imports = [ ./gtk.nix + ./qt.nix ./wm diff --git a/modules/desktop/hjem/qt.nix b/modules/desktop/hjem/qt.nix new file mode 100644 index 0000000..048108b --- /dev/null +++ b/modules/desktop/hjem/qt.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + ... +}: let + cfg = config.collinux.desktop.qt; + isCatppuccin = cfg.theme == "catppuccin"; +in + lib.mkIf cfg.enable { + xdg.config.files = + { + "kdeglobals".text = + '' + [Icons] + Theme=${cfg.iconTheme} + '' + + lib.optionalString isCatppuccin '' + [General] + ColorScheme=CatppuccinMochaBlue + + [KDE] + widgetStyle=kvantum + ''; + } + // lib.optionalAttrs isCatppuccin { + "Kvantum/kvantum.kvconfig".text = '' + [General] + theme=catppuccin-mocha-blue + ''; + }; + } diff --git a/modules/desktop/hjem/wm/tofi.nix b/modules/desktop/hjem/wm/tofi.nix index f6a0703..87dd692 100644 --- a/modules/desktop/hjem/wm/tofi.nix +++ b/modules/desktop/hjem/wm/tofi.nix @@ -4,7 +4,7 @@ config, ... }: let - cfg = config.collinux.desktop.programs.tofi; + cfg = config.collinux.desktop.wm.components.tofi; flags = { drun-launch = "true"; anchor = "bottom"; diff --git a/modules/desktop/nixos/portals.nix b/modules/desktop/nixos/portals.nix index ff65868..f69d6e0 100644 --- a/modules/desktop/nixos/portals.nix +++ b/modules/desktop/nixos/portals.nix @@ -4,47 +4,51 @@ config, ... }: let - useKdePortal = config.collinux.desktop.wm.sway.enable || config.collinux.desktop.wm.niri.enable; + wmCfg = config.collinux.desktop.wm; + useGtkPortal = wmCfg.gtkDesktopPortal.enable; + useKdePortal = wmCfg.kdeDesktopPortal.enable; + usePortal = useGtkPortal || useKdePortal; + defaultBackends = + if useKdePortal + then [ + "kde" + "gtk" + ] + else [ + "gtk" + "kde" + ]; + fileChooserBackend = if useKdePortal then ["kde"] else ["gtk"]; in - lib.mkIf useKdePortal { + lib.mkIf usePortal { xdg.portal = { enable = true; xdgOpenUsePortal = true; config = { common = { - default = [ - "kde" - "gtk" - ]; - "org.freedesktop.impl.portal.FileChooser" = ["kde"]; + default = defaultBackends; + "org.freedesktop.impl.portal.FileChooser" = fileChooserBackend; }; sway = { - default = [ - "kde" - "gtk" - ]; - "org.freedesktop.impl.portal.FileChooser" = ["kde"]; + default = defaultBackends; + "org.freedesktop.impl.portal.FileChooser" = fileChooserBackend; }; niri = { - default = [ - "kde" - "gtk" - ]; - "org.freedesktop.impl.portal.FileChooser" = ["kde"]; + default = defaultBackends; + "org.freedesktop.impl.portal.FileChooser" = fileChooserBackend; }; }; - extraPortals = with pkgs; [ - kdePackages.xdg-desktop-portal-kde - xdg-desktop-portal-gtk - ]; + extraPortals = + lib.optionals useKdePortal [pkgs.kdePackages.xdg-desktop-portal-kde] + ++ lib.optionals useGtkPortal [pkgs.xdg-desktop-portal-gtk]; }; environment.sessionVariables = { - XDG_CURRENT_DESKTOP = "KDE"; + XDG_CURRENT_DESKTOP = if useKdePortal then "KDE" else "sway"; GTK_USE_PORTAL = "1"; NIXOS_OZONE_WL = "1"; MOZ_ENABLE_WAYLAND = "1"; diff --git a/modules/desktop/nixos/qt.nix b/modules/desktop/nixos/qt.nix index f65e361..5f5c630 100644 --- a/modules/desktop/nixos/qt.nix +++ b/modules/desktop/nixos/qt.nix @@ -4,28 +4,31 @@ config, ... }: let - isCatppuccin = config.collinux.theme == "catppuccin"; - useQtDesktop = config.collinux.desktop.wm.sway.enable || config.collinux.desktop.wm.niri.enable; + cfg = config.collinux.desktop.qt; + isCatppuccin = cfg.theme == "catppuccin"; in - lib.mkIf useQtDesktop { + lib.mkIf cfg.enable { qt = { enable = true; platformTheme = "kde"; style = "kvantum"; }; - environment.systemPackages = lib.optionals isCatppuccin [ - pkgs.papirus-icon-theme - (pkgs.catppuccin-kde.override { - flavour = ["mocha"]; - accents = ["blue"]; - winDecStyles = ["modern"]; - }) - (pkgs.catppuccin-kvantum.override { - variant = "mocha"; - accent = "blue"; - }) - ]; + environment.systemPackages = + [ + pkgs.papirus-icon-theme + ] + ++ lib.optionals isCatppuccin [ + (pkgs.catppuccin-kde.override { + flavour = ["mocha"]; + accents = ["blue"]; + winDecStyles = ["modern"]; + }) + (pkgs.catppuccin-kvantum.override { + variant = "mocha"; + accent = "blue"; + }) + ]; environment.pathsToLink = lib.optionals isCatppuccin [ "/share/color-schemes" @@ -53,22 +56,4 @@ in "KDE_COLOR_SCHEME=CatppuccinMochaBlue" ]; }; - - hjem.users."${config.collinux.user.name}".xdg.config.files = lib.optionalAttrs isCatppuccin { - "Kvantum/kvantum.kvconfig".text = '' - [General] - theme=catppuccin-mocha-blue - ''; - - "kdeglobals".text = '' - [General] - ColorScheme=CatppuccinMochaBlue - - [Icons] - Theme=Papirus - - [KDE] - widgetStyle=kvantum - ''; - }; } diff --git a/modules/desktop/options.nix b/modules/desktop/options.nix index 3d6b9e3..3e20643 100644 --- a/modules/desktop/options.nix +++ b/modules/desktop/options.nix @@ -43,9 +43,13 @@ in { sway.enable = mkEnableOption "sway"; niri.enable = mkEnableOption "niri"; + gtkDesktopPortal.enable = mkEnableOption "GTK desktop portal backend"; + kdeDesktopPortal.enable = mkEnableOption "KDE desktop portal backend"; + components = { dunst = mkProgramOption "dunst"; fuzzel = mkProgramOption "fuzzel"; + tofi = mkProgramOption "tofi"; }; }; gnome.enable = mkEnableOption "gnome"; @@ -116,6 +120,16 @@ in { }; }; + qt = { + enable = mkEnableOption "qt theming"; + theme = mkThemeOption "qt"; + iconTheme = mkOption { + type = types.str; + default = "Papirus"; + description = "Icon theme to use for Qt/KDE applications"; + }; + }; + programs = { firefox = { enable = mkEnableOption "firefox"; @@ -132,7 +146,6 @@ in { }; foot = mkProgramOption "foot"; - tofi = mkProgramOption "tofi"; blackbox.enable = mkEnableOption "blackbox"; ghostty.enable = mkEnableOption "ghostty"; alacritty.enable = mkEnableOption "alacritty"; @@ -152,6 +165,10 @@ in { assertion = with config.collinux.desktop.greetd; enable -> !(autologin.enable && cosmic-greeter.enable); message = "Can't use autologin and cosmic-greeter at the same time"; } + { + assertion = with config.collinux.desktop.wm; !(gtkDesktopPortal.enable && kdeDesktopPortal.enable); + message = "Can't enable GTK and KDE desktop portal backends at the same time"; + } ]; }; } |
