Initial commit: Moonarch reproduzierbares Arch-Linux-Setup
Niri-basierter Wayland-Desktop mit greetd/regreet, Catppuccin Mocha Theming, Rofi-Menus, Waybar und vollstaendiger Post-Install-Automatisierung. Archinstall-Config klont das Repo automatisch via custom-commands, danach genuegt ein einzelner Befehl fuer die komplette Einrichtung.
This commit is contained in:
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env python3
|
||||
# ABOUTME: Converts GTK theme colors to rofi-compatible CSS color values.
|
||||
# ABOUTME: Reads a template file and replaces {@theme_*_color} placeholders with hex values.
|
||||
|
||||
# https://github.com/Git-Fal7/gtk-rofi/
|
||||
# Taken from MATE-HUD github.com/ubuntu-mate/mate-hud
|
||||
# Used for rofi css
|
||||
|
||||
# Usage
|
||||
# ./moonarch-gtk-style [input file] > [output file]
|
||||
|
||||
# examples
|
||||
# background-color: {@theme_bg_color}
|
||||
|
||||
# see the array below for list of style context to use
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv)<2:
|
||||
sys.exit(1)
|
||||
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gio, GLib, Gtk
|
||||
|
||||
#Converts from rgba <GTK R, G, B> to hex #RRGGBB
|
||||
def rgba_to_hex(color):
|
||||
return "#{0:02x}{1:02x}{2:02x}".format( int(color.red * 255), int(color.green * 255), int(color.blue * 255))
|
||||
|
||||
window = Gtk.Window()
|
||||
style_context = window.get_style_context()
|
||||
|
||||
#List of style contexts
|
||||
lists = [
|
||||
#Foreground
|
||||
'theme_fg_color', 'theme_selected_fg_color', 'theme_fg_color',
|
||||
'warning_fg_color', 'info_fg_color',
|
||||
#Background
|
||||
'theme_bg_color', 'theme_selected_bg_color', 'error_bg_color',
|
||||
'warning_bg_color', 'info_bg_color',
|
||||
#Others
|
||||
'theme_unfocused_fg_color', 'theme_text_color',
|
||||
'theme_unfocused_text_color',
|
||||
'theme_base_color',
|
||||
'theme_unfocused_fg_color',
|
||||
'theme_unfocused_text_color',
|
||||
'theme_unfocused_bg_color',
|
||||
'theme_unfocused_base_color',
|
||||
'theme_unfocused_selected_bg_color',
|
||||
'theme_unfocused_selected_fg_color',
|
||||
'unfocused_insensitive_color',
|
||||
'borders',
|
||||
'unfocused_borders',
|
||||
'warning_color',
|
||||
'error_color',
|
||||
'success_color'
|
||||
]
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
file=f.read()
|
||||
for style in lists:
|
||||
file=file.replace("{@" + style + "}", rgba_to_hex(style_context.lookup_color(style)[1]))
|
||||
print(file)
|
||||
Reference in New Issue
Block a user