nixos config

This commit is contained in:
Nexoniarz 2026-08-30 01:26:52 +02:00
commit 5dc9fb020e
46 changed files with 6194 additions and 0 deletions

View file

@ -0,0 +1,119 @@
#!/usr/bin/env bash
# Regenerates GTK3/4 CSS + settings.ini to match the current Quickshell
# theme (accent color + dark/light mode). These used to be static,
# Nix-rebuild-only files (symlinked straight into the store) — this makes
# them live-editable instead, the same way cursor.conf/display.conf work,
# so the Theme picker can actually reach GTK apps like Thunar.
set -euo pipefail
accent="${1:?usage: gtk-theme-set <accent> <bg> <bgAlt> <fg> <fgDim> <border> <dark:1|0>}"
bg="${2:?bg required}"
bg_alt="${3:?bgAlt required}"
fg="${4:?fg required}"
fg_dim="${5:?fgDim required}"
border="${6:?border required}"
dark="${7:?dark required}"
dir3="$HOME/.config/gtk-3.0"
dir4="$HOME/.config/gtk-4.0"
mkdir -p "$dir3" "$dir4"
css_file=$(mktemp)
cat > "$css_file" <<EOF
/* Squared corners + accent colors, generated by gtk-theme-set from the
Quickshell Theme picker — GTK's CSS is a subset of real CSS: no
!important, and zero still needs a unit.
The @define-color block matters more than it looks: plain selector
overrides (window, .background, .view, ...) only get you so far —
Thunar's icon-view content area and sidebar tree view turned out to
pull their actual fill color from these named theme variables
internally, not from the generic background-color cascade. Verified
live: without redefining theme_base_color specifically, the sidebar
and file grid stayed white no matter how broad the selector list got. */
@define-color theme_bg_color $bg;
@define-color theme_base_color $bg;
@define-color theme_fg_color $fg;
@define-color theme_text_color $fg;
@define-color theme_selected_bg_color $accent;
@define-color theme_selected_fg_color $bg;
@define-color borders $border;
* {
border-radius: 0px;
-gtk-outline-radius: 0px;
}
window, .background, .view, iconview, treeview, treeview.view, list, row,
notebook, notebook > stack, scrolledwindow, viewport {
background-color: $bg;
color: $fg;
}
iconview.cell, iconview text {
background-color: $bg;
color: $fg;
}
treeview.view:selected, row:selected, iconview:selected {
background-color: $accent;
color: $bg;
}
headerbar, .titlebar {
background-color: $bg_alt;
color: $fg;
border-color: $border;
box-shadow: none;
}
button {
border-color: $border;
}
button:hover {
background-color: $bg_alt;
}
selection, *:selected {
background-color: $accent;
color: $bg;
}
EOF
cp "$css_file" "$dir3/gtk.css"
cp "$css_file" "$dir4/gtk.css"
rm -f "$css_file"
prefer_dark="false"
theme_name="Adwaita"
icon_theme="Gruvbox-Plus-Light"
if [ "$dark" = "1" ]; then
prefer_dark="true"
theme_name="Adwaita-dark"
icon_theme="Gruvbox-Plus-Dark"
fi
ini_file=$(mktemp)
cat > "$ini_file" <<EOF
[Settings]
gtk-application-prefer-dark-theme=$prefer_dark
gtk-theme-name=$theme_name
gtk-icon-theme-name=$icon_theme
gtk-font-name=Noto Sans, 10
gtk-enable-animations=true
EOF
cp "$ini_file" "$dir3/settings.ini"
cp "$ini_file" "$dir4/settings.ini"
rm -f "$ini_file"
# settings.ini alone isn't enough: GTK3 binds gtk-theme-name/icon-theme-name
# to org.gnome.desktop.interface via GSettings whenever that schema and a
# dconf backend are present (they are here — dconf-service was already
# running), and that binding wins over settings.ini unconditionally. This
# machine's dconf database had hard values left over (gtk-theme='Breeze',
# icon-theme='breeze') that silently overrode every settings.ini edit —
# which is why neither accent/dark-mode nor the Gruvbox icon switch ever
# reached Thunar. Writing the same values to dconf keeps both sources in
# sync so it doesn't matter which one GTK actually reads from.
if command -v dconf >/dev/null 2>&1; then
color_scheme="default"
[ "$dark" = "1" ] && color_scheme="prefer-dark"
dconf write /org/gnome/desktop/interface/gtk-theme "'$theme_name'"
dconf write /org/gnome/desktop/interface/icon-theme "'$icon_theme'"
dconf write /org/gnome/desktop/interface/color-scheme "'$color_scheme'"
fi