Resolve mix() for Flatpak GTK4 apps and add explicit widget rules
Browse files at this commit3ed98ccf19179e6b31b86126e5f4137f7dd2646fParent: 15bab3f- fix
- resolve mix() for Flatpak GTK4 apps and add explicit widget rules
4 changed files +80 -4
- .config/hypr/hyprpaper.conf +1 -1
- .config/scripts/shared/qt_colors.sh → .config/scripts/shared/theme_colors.sh +26 -1
- .config/wallust/templates/gtk4.css +51 -0
- .config/wallust/wallust.toml +2 -2
.config/hypr/hyprpaper.confmodified+1 -1
| @@ -2,6 +2,6 @@ splash = false | |||
| 2 | 2 | ||
| 3 | wallpaper { | 3 | wallpaper { |
| 4 | monitor = | 4 | monitor = |
| 5 | - path = /home/tahinli/Pictures/Wallpapers/nikhil-kumar-JdPHvI7VF0o-unsplash.jpg | 5 | + path = /home/tahinli/Pictures/Wallpapers/franck-ridel-VXZy1mljRfk-unsplash.jpg |
| 6 | fit_mode = cover | 6 | fit_mode = cover |
| 7 | } | 7 | } |
.config/scripts/shared/qt_colors.sh → .config/scripts/shared/theme_colors.shrenamed+26 -1
| @@ -1,5 +1,30 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | -# Compute mixed surface colors for QT to match GTK mix(background, color1, ratio) | 2 | +# Post-process wallust-generated theme files: |
| 3 | +# - GTK 3/4: resolve mix(#hex, #hex, ratio) to pre-computed hex values | ||
| 4 | +# - QT 5/6: convert colors and compute mixed surface colors | ||
| 5 | + | ||
| 6 | +# Resolve mix() in GTK CSS files | ||
| 7 | +for css in ~/.config/gtk-4.0/gtk.css ~/.config/gtk-4.0/gtk-dark.css ~/.config/gtk-3.0/gtk.css; do | ||
| 8 | + [ -f "$css" ] || continue | ||
| 9 | + python3 -c " | ||
| 10 | +import re | ||
| 11 | +def mix(c1, c2, f): | ||
| 12 | + r = int(int(c1[1:3],16)*(1-f) + int(c2[1:3],16)*f) | ||
| 13 | + g = int(int(c1[3:5],16)*(1-f) + int(c2[3:5],16)*f) | ||
| 14 | + b = int(int(c1[5:7],16)*(1-f) + int(c2[5:7],16)*f) | ||
| 15 | + return f'#{r:02x}{g:02x}{b:02x}' | ||
| 16 | + | ||
| 17 | +with open('$css') as f: | ||
| 18 | + content = f.read() | ||
| 19 | +content = re.sub( | ||
| 20 | + r'mix\(\s*(#[0-9A-Fa-f]{6})\s*,\s*(#[0-9A-Fa-f]{6})\s*,\s*([0-9.]+)\s*\)', | ||
| 21 | + lambda m: mix(m.group(1), m.group(2), float(m.group(3))), | ||
| 22 | + content | ||
| 23 | +) | ||
| 24 | +with open('$css', 'w') as f: | ||
| 25 | + f.write(content) | ||
| 26 | +" | ||
| 27 | +done | ||
| 3 | 28 | ||
| 4 | for conf in ~/.config/qt5ct/colors/wallust.conf ~/.config/qt6ct/colors/wallust.conf; do | 29 | for conf in ~/.config/qt5ct/colors/wallust.conf ~/.config/qt6ct/colors/wallust.conf; do |
| 5 | [ -f "$conf" ] || continue | 30 | [ -f "$conf" ] || continue |
.config/wallust/templates/gtk4.cssmodified+51 -0
| @@ -44,3 +44,54 @@ | |||
| 44 | 44 | ||
| 45 | @define-color shade_color rgba(0, 0, 0, 0.36); | 45 | @define-color shade_color rgba(0, 0, 0, 0.36); |
| 46 | @define-color scrollbar_outline_color rgba(0, 0, 0, 0.5); | 46 | @define-color scrollbar_outline_color rgba(0, 0, 0, 0.5); |
| 47 | + | ||
| 48 | +window.background { | ||
| 49 | + background-color: mix({{background}}, {{color1}}, 0.35); | ||
| 50 | + color: {{foreground}}; | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +headerbar { | ||
| 54 | + background-color: mix({{background}}, {{color1}}, 0.4); | ||
| 55 | + background-image: none; | ||
| 56 | + color: {{foreground}}; | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +.view, list, row, treeview { | ||
| 60 | + background-color: mix({{background}}, {{color1}}, 0.3); | ||
| 61 | + color: {{foreground}}; | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +.card { | ||
| 65 | + background-color: mix({{background}}, {{color1}}, 0.45); | ||
| 66 | + color: {{foreground}}; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +.navigation-sidebar { | ||
| 70 | + background-color: mix({{background}}, {{color1}}, 0.32); | ||
| 71 | + color: {{foreground}}; | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +popover contents { | ||
| 75 | + background-color: mix({{background}}, {{color1}}, 0.4); | ||
| 76 | + color: {{foreground}}; | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +row:selected { | ||
| 80 | + background-color: {{color4}}; | ||
| 81 | + color: {{color15}}; | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +button.suggested-action { | ||
| 85 | + background-color: {{color4}}; | ||
| 86 | + color: {{color15}}; | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +button.destructive-action { | ||
| 90 | + background-color: {{color1}}; | ||
| 91 | + color: {{color15}}; | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +entry { | ||
| 95 | + background-color: mix({{background}}, {{color1}}, 0.3); | ||
| 96 | + color: {{foreground}}; | ||
| 97 | +} | ||
.config/wallust/wallust.tomlmodified+2 -2
| @@ -55,5 +55,5 @@ gtk3 = { template = 'gtk3.css', target = '~/.config/gtk-3.0/gtk.css' } | |||
| 55 | qt5ct = { template = 'qt5ct-wallust.conf', target = '~/.config/qt5ct/colors/wallust.conf' } | 55 | qt5ct = { template = 'qt5ct-wallust.conf', target = '~/.config/qt5ct/colors/wallust.conf' } |
| 56 | qt6ct = { template = 'qt6ct-wallust.conf', target = '~/.config/qt6ct/colors/wallust.conf' } | 56 | qt6ct = { template = 'qt6ct-wallust.conf', target = '~/.config/qt6ct/colors/wallust.conf' } |
| 57 | [hooks] | 57 | [hooks] |
| 58 | -# Convert colors and compute mixed surface colors for QT | 58 | +# Resolve mix() and compute surface colors for GTK and QT |
| 59 | -qt_colors = """~/.config/scripts/shared/qt_colors.sh""" | 59 | +theme_colors = """~/.config/scripts/shared/theme_colors.sh""" |