From 32d2e07e847038e9a19ffb2b38f303d1deb499b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Wed, 26 Oct 2022 23:41:02 -0300 Subject: [PATCH] move theme settings to global vars --- overlays/sway.nix | 19 ------------------- system/sway.nix | 12 ++++++++---- user/sway.nix | 12 +----------- user/theme.nix | 8 ++------ user/variables.nix | 4 ++++ 5 files changed, 15 insertions(+), 40 deletions(-) diff --git a/overlays/sway.nix b/overlays/sway.nix index 70117ef..ad34f82 100644 --- a/overlays/sway.nix +++ b/overlays/sway.nix @@ -15,23 +15,4 @@ systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr ''; }; - # currently, there is some friction between sway and gtk: - # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland - # the suggested way to set gtk settings is with gsettings - # for gsettings to work, we need to tell it where the schemas are - # using the XDG_DATA_DIR environment variable - # run at the end of sway config - configure-gtk = pkgs.writeTextFile { - name = "configure-gtk"; - destination = "/bin/configure-gtk"; - executable = true; - text = let - schema = pkgs.gsettings-desktop-schemas; - datadir = "${schema}/share/gsettings-schemas/${schema.name}"; - in '' - export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS - gnome_schema=org.gnome.desktop.interface - # gsettings set $gnome_schema gtk-theme 'Dracula' - ''; - }; }) diff --git a/system/sway.nix b/system/sway.nix index 6a2cc0b..c4ca282 100644 --- a/system/sway.nix +++ b/system/sway.nix @@ -9,14 +9,13 @@ enable = true; wlr.enable = true; # gtk portal needed to make gtk apps happy - # extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - # gtkUsePortal = false; + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + gtkUsePortal = true; }; services.greetd = let greetd_main_script = pkgs.writeShellScriptBin "main" '' ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment - ${pkgs.configure-gtk}/bin/configure-gtk - export XDG_CURRENT_DESKTOP=sway GTK_THEME=Orchis-Red-Dark-Compact + export XDG_CURRENT_DESKTOP=sway GTK_THEME="${pkgs.uservars.gtk_theme}" XCURSOR_THEME="${pkgs.uservars.cursor_theme}" ${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway swaymsg exit ''; @@ -56,5 +55,10 @@ wayland pkgs.xdg-desktop-portal pkgs.xdg-desktop-portal-wlr + + ## Theme + capitaine-cursors + orchis_theme_compact + papirus_red ]; } diff --git a/user/sway.nix b/user/sway.nix index 4f2e337..1c604aa 100644 --- a/user/sway.nix +++ b/user/sway.nix @@ -24,16 +24,6 @@ let systemctl --user start swayidle.service fi ''; - dbus-sway-environment = pkgs.writeTextFile { - name = "dbus-sway-environment"; - destination = "/bin/dbus-sway-environment"; - executable = true; - text = '' - dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway - systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr - systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr - ''; - }; in { config = { wayland.windowManager.sway = let @@ -297,7 +287,7 @@ in { }; extraConfig = '' for_window [title=.*] inhibit_idle fullscreen - exec ${dbus-sway-environment}/bin/dbus-sway-environment + exec ${pkgs.dbus-sway-environment}/bin/dbus-sway-environment ''; }; services.swayidle = { diff --git a/user/theme.nix b/user/theme.nix index 200c3b1..9e316cd 100644 --- a/user/theme.nix +++ b/user/theme.nix @@ -1,9 +1,5 @@ -{ config, pkgs, lib, inputs, ... }: let - font = pkgs.uservars.font; - gtk_theme = "Orchis-Red-Dark-Compact"; - icon_theme = "Papirus-Dark"; - cursor_theme = "capitaine-cursors"; -in { +{ config, pkgs, lib, inputs, ... }: +with pkgs.uservars; { home.pointerCursor = { name = cursor_theme; size = 32; diff --git a/user/variables.nix b/user/variables.nix index 36b379e..68c487f 100644 --- a/user/variables.nix +++ b/user/variables.nix @@ -57,6 +57,10 @@ in rec { color = theme.color; accent = accents.red; + gtk_theme = "Orchis-Red-Dark-Compact"; + icon_theme = "Papirus-Dark"; + cursor_theme = "capitaine-cursors"; + font = { mono = "Hack Nerd Font"; interface = "Liberation Sans";