move theme settings to global vars

This commit is contained in:
Leonardo Eugênio 2022-10-26 23:41:02 -03:00
parent e07ec45d45
commit 32d2e07e84
5 changed files with 15 additions and 40 deletions

View file

@ -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'
'';
};
})

View file

@ -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
];
}

View file

@ -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 = {

View file

@ -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;

View file

@ -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";