mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
Replace Gradience with a simpler solution (#1273)
This commit is contained in:
@@ -145,7 +145,6 @@
|
||||
"Options": "Options",
|
||||
"Dark Mode": "Dark Mode",
|
||||
"Ya should go to sleep!": "Ya should go to sleep!",
|
||||
"Use Gradience": "Use Gradience",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)",
|
||||
"Scheme styles": "Scheme styles",
|
||||
"Vibrant": "Vibrant",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "گزینهها",
|
||||
"Dark Mode": "حالت تاریک",
|
||||
"Ya should go to sleep!": "پاشو برو بخواب!",
|
||||
"Use Gradience": "بکارگیری رنگ شیب دار(Gradience)",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "برنامههای GTK را با بکارگیری رنگ تأکید پوسته گذاری کنید\n(معایب: تغییر حالت تاریک/روشن نیاز به باز راهاندازی دارد)",
|
||||
"Scheme styles": "سبکهای طرح",
|
||||
"Vibrant": "زنده",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "Options",
|
||||
"Dark Mode": "Mode sombre",
|
||||
"Ya should go to sleep!": "Tu devrais aller dormir !",
|
||||
"Use Gradience": "Utiliser Gradience",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "Thématiser les applications GTK avec la couleur d'accent\n(inconvénient : le changement de mode sombre/clair nécessite un redémarrage)",
|
||||
"Scheme styles": "Styles de schéma",
|
||||
"Vibrant": "Vibrant",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "Opzioni",
|
||||
"Dark Mode": "Modalità scura",
|
||||
"Ya should go to sleep!": "Dovresti andare a dormire!",
|
||||
"Use Gradience": "Usa Gradience",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "Tema le app GTK usando il colore di accento\n(svantaggio: il passaggio tra modalità scura/chiara richiede un riavvio)",
|
||||
"Scheme styles": "Stili dello schema",
|
||||
"Vibrant": "Vivace",
|
||||
|
||||
@@ -134,7 +134,6 @@
|
||||
"Options": "选项",
|
||||
"Dark Mode": "深色模式",
|
||||
"Ya should go to sleep!": "你应该去睡觉!",
|
||||
"Use Gradience": "GTK 主题",
|
||||
"Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)": "使用强调色对 GTK 应用程序进行主题化\n(缺点:深色/浅色模式切换需要重启)",
|
||||
"Scheme styles": "样式方案",
|
||||
"Vibrant": "鲜艳",
|
||||
|
||||
@@ -142,34 +142,6 @@ const ColorSchemeSettings = () => Widget.Box({
|
||||
.catch(print);
|
||||
},
|
||||
}),
|
||||
Widget.Box({
|
||||
tooltipText: getString('Theme GTK apps using accent color\n(drawback: dark/light mode switching requires restart)'),
|
||||
className: 'txt spacing-h-5 configtoggle-box',
|
||||
children: [
|
||||
MaterialIcon('imagesearch_roller', 'norm'),
|
||||
Widget.Label({
|
||||
className: 'txt txt-small',
|
||||
label: getString('Use Gradience'),
|
||||
}),
|
||||
Widget.Box({ hexpand: true }),
|
||||
ConfigMulipleSelection({
|
||||
hpack: 'center',
|
||||
vpack: 'center',
|
||||
optionsArr: [
|
||||
[{ name: 'Off', value: 0 }, { name: 'On', value: 1 }],
|
||||
],
|
||||
initIndex: [-1, -1],
|
||||
onChange: (value, name) => {
|
||||
const ADWAITA_BLUE = "#3584E4";
|
||||
if (value) execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh - --yes-gradience`, `&`])
|
||||
.catch(print);
|
||||
else execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh "${ADWAITA_BLUE}" --no-gradience`, `&`])
|
||||
.catch(print);
|
||||
|
||||
},
|
||||
}),
|
||||
]
|
||||
}),
|
||||
]
|
||||
}),
|
||||
Widget.Box({
|
||||
|
||||
@@ -44,19 +44,6 @@ export function launchCustomCommand(command) {
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchcolor.sh`]))
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>adw' || args[0] == '>adwaita') {
|
||||
const ADWAITA_BLUE = "#3584E4";
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh "${ADWAITA_BLUE}" --no-gradience`, `&`])
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>grad' || args[0] == '>gradience') {
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh - --yes-gradience`, `&`])
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>nograd' || args[0] == '>nogradience') {
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh - --no-gradience`, `&`])
|
||||
.catch(print);
|
||||
}
|
||||
else if (args[0] == '>material') { // Use material colors
|
||||
execAsync([`bash`, `-c`, `mkdir -p ${GLib.get_user_state_dir()}/ags/user && echo "material" > ${GLib.get_user_state_dir()}/ags/user/colorbackend.txt`]).catch(print)
|
||||
.then(execAsync(['bash', '-c', `${App.configDir}/scripts/color_generation/switchwall.sh --noswitch`]).catch(print))
|
||||
|
||||
@@ -151,30 +151,25 @@ apply_lightdark() {
|
||||
fi
|
||||
}
|
||||
|
||||
apply_gtk() { # Using gradience-cli
|
||||
usegradience=$(sed -n '4p' "$STATE_DIR/user/colormode.txt")
|
||||
if [[ "$usegradience" = "nogradience" ]]; then
|
||||
rm "$XDG_CONFIG_HOME/gtk-3.0/gtk.css"
|
||||
rm "$XDG_CONFIG_HOME/gtk-4.0/gtk.css"
|
||||
apply_gtk() {
|
||||
# Check if template exists
|
||||
if [ ! -f "scripts/templates/gtk/gtk-colors.css" ]; then
|
||||
echo "Template file not found for gtk colors. Skipping that."
|
||||
return
|
||||
fi
|
||||
|
||||
# Copy template
|
||||
mkdir -p "$CACHE_DIR"/user/generated/gradience
|
||||
cp "scripts/templates/gradience/preset.json" "$CACHE_DIR"/user/generated/gradience/preset.json
|
||||
|
||||
mkdir -p "$CACHE_DIR"/user/generated/gtk/
|
||||
cp "scripts/templates/gtk/gtk-colors.css" "$CACHE_DIR"/user/generated/gtk/gtk-colors.css
|
||||
# Apply colors
|
||||
for i in "${!colorlist[@]}"; do
|
||||
sed -i "s/{{ ${colorlist[$i]} }}/${colorvalues[$i]}/g" "$CACHE_DIR"/user/generated/gradience/preset.json
|
||||
sed -i "s/{{ ${colorlist[$i]} }}/#${colorvalues[$i]#\#}/g" "$CACHE_DIR"/user/generated/gtk/gtk-colors.css
|
||||
done
|
||||
|
||||
mkdir -p "$XDG_CONFIG_HOME/presets" # create gradience presets folder
|
||||
source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate
|
||||
gradience-cli apply -p "$CACHE_DIR"/user/generated/gradience/preset.json --gtk both
|
||||
deactivate
|
||||
# Apply to both gtk3 and gtk4
|
||||
cp "$CACHE_DIR"/user/generated/gtk/gtk-colors.css "$XDG_CONFIG_HOME"/gtk-3.0/gtk.css
|
||||
cp "$CACHE_DIR"/user/generated/gtk/gtk-colors.css "$XDG_CONFIG_HOME"/gtk-4.0/gtk.css
|
||||
|
||||
# And set GTK theme manually as Gradience defaults to light adw-gtk3
|
||||
# (which is unreadable when broken when you use dark mode)
|
||||
# And set the right variant of adw gtk3
|
||||
lightdark=$(get_light_dark)
|
||||
if [ "$lightdark" = "light" ]; then
|
||||
gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'
|
||||
|
||||
@@ -24,11 +24,6 @@ if [ ! -f $colormodefile ]; then
|
||||
echo "dark" > $colormodefile
|
||||
echo "opaque" >> $colormodefile
|
||||
echo "vibrant" >> $colormodefile
|
||||
elif [[ $(wc -l < $colormodefile) -ne 4 || $(wc -w < $colormodefile) -ne 4 ]]; then
|
||||
echo "dark" > $colormodefile
|
||||
echo "opaque" >> $colormodefile
|
||||
echo "vibrant" >> $colormodefile
|
||||
echo "yesgradience" >> $colormodefile
|
||||
else
|
||||
lightdark=$(sed -n '1p' $colormodefile)
|
||||
transparency=$(sed -n '2p' $colormodefile)
|
||||
|
||||
@@ -19,21 +19,5 @@ fi
|
||||
|
||||
sed -i "1s/.*/$color/" "$STATE_DIR/user/color.txt"
|
||||
|
||||
# Use Gradience?
|
||||
colormodelines=$(wc -l "$COLORMODE_FILE_DIR" | awk '{print $1}' )
|
||||
if [ "$2" == "--no-gradience" ]; then
|
||||
if [ "$colormodelines" == "3" ]; then
|
||||
echo 'nogradience' >> "$COLORMODE_FILE_DIR"
|
||||
else
|
||||
sed -i "4s/.*/nogradience/" "$COLORMODE_FILE_DIR"
|
||||
fi
|
||||
elif [ "$2" == "--yes-gradience" ]; then
|
||||
if [ "$colormodelines" == "3" ]; then
|
||||
echo 'yesgradience' >> "$COLORMODE_FILE_DIR"
|
||||
else
|
||||
sed -i "4s/.*/yesgradience/" "$COLORMODE_FILE_DIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate colors for ags n stuff
|
||||
"$CONFIG_DIR"/scripts/color_generation/colorgen.sh "${color}" --apply
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* GTK Colors
|
||||
*/
|
||||
|
||||
@define-color accent_color {{ $primary }};
|
||||
@define-color accent_fg_color {{ $onPrimary }};
|
||||
@define-color accent_bg_color {{ $primary }};
|
||||
@define-color window_bg_color {{ $background }};
|
||||
@define-color window_fg_color {{ $onBackground }};
|
||||
@define-color headerbar_bg_color {{ $surfaceDim }};
|
||||
@define-color headerbar_fg_color {{ $onSurface }};
|
||||
@define-color popover_bg_color {{ $surfaceDim }};
|
||||
@define-color popover_fg_color {{ $onSurface }};
|
||||
@define-color view_bg_color {{ $surface }};
|
||||
@define-color view_fg_color {{ $onSurface }};
|
||||
@define-color card_bg_color {{ $surface }};
|
||||
@define-color card_fg_color {{ $onSurface }};
|
||||
@define-color sidebar_bg_color @window_bg_color;
|
||||
@define-color sidebar_fg_color @window_fg_color;
|
||||
@define-color sidebar_border_color @window_bg_color;
|
||||
@define-color sidebar_backdrop_color @window_bg_color;
|
||||
@@ -35,7 +35,7 @@ ii_check_distro() {
|
||||
}
|
||||
ii_check_venv() {
|
||||
source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate
|
||||
which gradience-cli
|
||||
which python
|
||||
deactivate
|
||||
}
|
||||
ii_check_ags() {
|
||||
@@ -66,9 +66,6 @@ x declare -p ILLOGICAL_IMPULSE_VIRTUAL_ENV # $XDG_STATE_HOME/ags/.venv
|
||||
|
||||
e "Checking directories/files"
|
||||
x ls -l ~/.local/state/ags/.venv
|
||||
x ls -l $ILLOGICAL_IMPULSE_VIRTUAL_ENV/bin/gradience-cli
|
||||
x ls $XDG_DATA_HOME/glib-2.0/schemas
|
||||
x ls $XDG_DATA_HOME/gradience
|
||||
#x cat ~/.config/ags/
|
||||
|
||||
#e "Checking command existence"
|
||||
|
||||
@@ -129,30 +129,7 @@ install-python-packages (){
|
||||
x uv venv --prompt .venv $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV) -p 3.12
|
||||
x source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate
|
||||
x uv pip install -r scriptdata/requirements.txt
|
||||
|
||||
x mkdir -p $base/cache/blueprint-compiler && cd $base/cache/blueprint-compiler
|
||||
try git init -b main
|
||||
try git remote add origin https://github.com/end-4/ii-blueprint-compiler.git
|
||||
x git pull origin main && git submodule update --init --recursive
|
||||
x meson setup build --prefix=$VIRTUAL_ENV
|
||||
x meson compile -C build
|
||||
x meson install -C build
|
||||
x cd -
|
||||
|
||||
x mkdir -p $base/cache/gradience && cd $base/cache/gradience
|
||||
try git init -b main
|
||||
try git remote add origin https://github.com/end-4/ii-gradience.git
|
||||
x git pull origin main && git submodule update --init --recursive
|
||||
x uv pip install -r requirements.txt
|
||||
x meson setup build --prefix=$VIRTUAL_ENV
|
||||
x meson compile -C build
|
||||
x meson install -C build
|
||||
x cd -
|
||||
|
||||
x deactivate # We don't need the virtual environment anymore
|
||||
for i in "glib-2.0" "gradience"; do
|
||||
x rsync -av "$ILLOGICAL_IMPULSE_VIRTUAL_ENV"/share/$i/ "$XDG_DATA_HOME"/$i/
|
||||
done
|
||||
}
|
||||
|
||||
# Only for Arch(based) distro.
|
||||
|
||||
Reference in New Issue
Block a user