From 43264a0be783d326e01d43e5320369850608d577 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Mon, 24 Aug 2026 18:59:56 +0530 Subject: desktop: added gnome portal - added gnome portal to use with niri --- modules/desktop/niri/default.nix | 3 ++- modules/desktop/xdg/default.nix | 41 ++++++++++++++++++++++++++++++++++ modules/desktop/xdg/style.mustache.css | 32 ++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 modules/desktop/xdg/style.mustache.css (limited to 'modules/desktop') diff --git a/modules/desktop/niri/default.nix b/modules/desktop/niri/default.nix index f1e0fa7..7fbb5fb 100644 --- a/modules/desktop/niri/default.nix +++ b/modules/desktop/niri/default.nix @@ -21,7 +21,6 @@ CLUTTER_BACKEND = "wayland"; GDK_SCALE = "1"; QT_SCALE_FACTOR = "1"; - GTK_THEME = "Adwaita:dark"; } (lib.mkIf config.desktop.hardware.gpu.nvidia.enable { @@ -41,6 +40,8 @@ wayland.windowManager.niri = { enable = true; systemd.enable = true; + # Portals are declared centrally in ../xdg. + portalPackage = null; }; # Niri does not paint wallpapers itself, so start swaybg with the existing wallpaper. diff --git a/modules/desktop/xdg/default.nix b/modules/desktop/xdg/default.nix index 852b36c..3803502 100644 --- a/modules/desktop/xdg/default.nix +++ b/modules/desktop/xdg/default.nix @@ -5,13 +5,25 @@ pkgs, ... }: +let + gtkCss = builtins.readFile ( + config.scheme { + template = builtins.readFile ./style.mustache.css; + extension = ".css"; + } + ); +in { config = lib.mkIf config.desktop.enable { + dconf.enable = true; + xdg.portal = { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-termfilechooser + xdg-desktop-portal-gnome ]; + configPackages = [ pkgs.niri ]; config.common = { "org.freedesktop.impl.portal.FileChooser" = [ "termfilechooser" ]; default = [ @@ -21,5 +33,34 @@ }; xdgOpenUsePortal = true; }; + + gtk = { + enable = true; + font = { + name = config.fonts.normal; + size = config.fonts.size; + }; + theme = { + name = "Adwaita-dark"; + package = pkgs.gnome-themes-extra; + }; + iconTheme = { + name = "Adwaita"; + package = pkgs.adwaita-icon-theme; + }; + cursorTheme = { + name = "Adwaita"; + package = pkgs.adwaita-icon-theme; + size = 20; + }; + colorScheme = "dark"; + gtk3.extraCss = gtkCss; + gtk4 = { + # GTK 4/libadwaita does not support loading GTK 3 themes; use the + # Base16 CSS above without Home Manager's compatibility workaround. + theme = null; + extraCss = gtkCss; + }; + }; }; } diff --git a/modules/desktop/xdg/style.mustache.css b/modules/desktop/xdg/style.mustache.css new file mode 100644 index 0000000..d7a5420 --- /dev/null +++ b/modules/desktop/xdg/style.mustache.css @@ -0,0 +1,32 @@ +@define-color theme_bg_color #{{base00}}; +@define-color theme_fg_color #{{base05}}; +@define-color theme_base_color #{{base00}}; +@define-color theme_text_color #{{base05}}; +@define-color theme_selected_bg_color #{{base0D}}; +@define-color theme_selected_fg_color #{{base00}}; +@define-color borders #{{base03}}; +@define-color accent_color #{{base0D}}; +@define-color warning_color #{{base0A}}; +@define-color error_color #{{base08}}; + +window, dialog, .background { + background-color: @theme_bg_color; + color: @theme_fg_color; +} + +button, entry, textview, .view, list, row { + background-color: @theme_base_color; + color: @theme_text_color; + border-color: @borders; + border-radius: 0; + box-shadow: none; +} + +button:hover, entry:focus { + border-color: @accent_color; +} + +selection, row:selected, flowboxchild:selected { + background-color: @theme_selected_bg_color; + color: @theme_selected_fg_color; +} -- cgit v1.2.3