forked from Shinonome/dots-hyprland
allow turning gradience off
This commit is contained in:
@@ -31,7 +31,7 @@ export function launchCustomCommand(command) {
|
||||
else if (args[0] == '>color') { // Generate colorscheme from color picker
|
||||
if (!args[1])
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh --pick`, `&`]).catch(print);
|
||||
else if(args[1][0] === '#')
|
||||
else if (args[1][0] === '#')
|
||||
execAsync([`bash`, `-c`, `${App.configDir}/scripts/color_generation/switchcolor.sh "${args[1]}"`, `&`]).catch(print);
|
||||
}
|
||||
else if (args[0] == '>light') { // Light mode
|
||||
@@ -45,6 +45,19 @@ 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))
|
||||
|
||||
@@ -122,8 +122,22 @@ apply_hyprlock() {
|
||||
cp "$CACHE_DIR"/user/generated/hypr/hyprlock.conf "$XDG_CONFIG_HOME"/hypr/hyprlock.conf
|
||||
}
|
||||
|
||||
apply_gtk() { # Using gradience-cli
|
||||
apply_lightdark() {
|
||||
lightdark=$(get_light_dark)
|
||||
if [ "$lightdark" = "light" ]; then
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
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"
|
||||
return
|
||||
fi
|
||||
|
||||
# Copy template
|
||||
mkdir -p "$CACHE_DIR"/user/generated/gradience
|
||||
@@ -137,15 +151,13 @@ apply_gtk() { # Using gradience-cli
|
||||
mkdir -p "$XDG_CONFIG_HOME/presets" # create gradience presets folder
|
||||
gradience-cli apply -p "$CACHE_DIR"/user/generated/gradience/preset.json --gtk both
|
||||
|
||||
# Set light/dark preference
|
||||
# And set GTK theme manually as Gradience defaults to light adw-gtk3
|
||||
# (which is unreadable when broken when you use dark mode)
|
||||
lightdark=$(get_light_dark)
|
||||
if [ "$lightdark" = "light" ]; then
|
||||
gsettings set org.gnome.desktop.interface gtk-theme 'adw-gtk3'
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
||||
else
|
||||
gsettings set org.gnome.desktop.interface gtk-theme adw-gtk3-dark
|
||||
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -154,25 +166,17 @@ apply_ags() {
|
||||
ags run-js 'openColorScheme.value = true; Utils.timeout(2000, () => openColorScheme.value = false);'
|
||||
}
|
||||
|
||||
if [[ "$1" = "--bad-apple" ]]; then
|
||||
lightdark=$(get_light_dark)
|
||||
cp scripts/color_generation/specials/_material_badapple"${lightdark}".scss $STATE_DIR/scss/_material.scss
|
||||
colornames=$(cat scripts/color_generation/specials/_material_badapple"${lightdark}".scss | cut -d: -f1)
|
||||
colorstrings=$(cat scripts/color_generation/specials/_material_badapple"${lightdark}".scss | cut -d: -f2 | cut -d ' ' -f2 | cut -d ";" -f1)
|
||||
IFS=$'\n'
|
||||
colorlist=( $colornames ) # Array of color names
|
||||
colorvalues=( $colorstrings ) # Array of color values
|
||||
else
|
||||
colornames=$(cat $STATE_DIR/scss/_material.scss | cut -d: -f1)
|
||||
colorstrings=$(cat $STATE_DIR/scss/_material.scss | cut -d: -f2 | cut -d ' ' -f2 | cut -d ";" -f1)
|
||||
IFS=$'\n'
|
||||
colorlist=( $colornames ) # Array of color names
|
||||
colorvalues=( $colorstrings ) # Array of color values
|
||||
fi
|
||||
|
||||
colornames=$(cat $STATE_DIR/scss/_material.scss | cut -d: -f1)
|
||||
colorstrings=$(cat $STATE_DIR/scss/_material.scss | cut -d: -f2 | cut -d ' ' -f2 | cut -d ";" -f1)
|
||||
IFS=$'\n'
|
||||
colorlist=( $colornames ) # Array of color names
|
||||
colorvalues=( $colorstrings ) # Array of color values
|
||||
|
||||
apply_ags &
|
||||
apply_hyprland &
|
||||
apply_hyprlock &
|
||||
apply_lightdark &
|
||||
apply_gtk &
|
||||
apply_fuzzel &
|
||||
apply_term &
|
||||
|
||||
@@ -24,10 +24,11 @@ if [ ! -f $colormodefile ]; then
|
||||
echo "dark" > $colormodefile
|
||||
echo "opaque" >> $colormodefile
|
||||
echo "vibrant" >> $colormodefile
|
||||
elif [[ $(wc -l < $colormodefile) -ne 3 || $(wc -w < $colormodefile) -ne 3 ]]; then
|
||||
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)
|
||||
|
||||
@@ -7,6 +7,8 @@ CONFIG_DIR="$XDG_CONFIG_HOME/ags"
|
||||
CACHE_DIR="$XDG_CACHE_HOME/ags"
|
||||
STATE_DIR="$XDG_STATE_HOME/ags"
|
||||
|
||||
COLORMODE_FILE_DIR="$STATE_DIR/user/colormode.txt"
|
||||
|
||||
if [ "$1" == "--pick" ]; then
|
||||
color=$(hyprpicker --no-fancy)
|
||||
elif [[ "$1" = "#"* ]]; then # this is a color
|
||||
@@ -15,5 +17,25 @@ else
|
||||
color=$(cut -f1 "$STATE_DIR/user/color.txt")
|
||||
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
|
||||
echo 'AAAAAAAAAAAAAAAAA' "$colormodelines"
|
||||
if [ "$colormodelines" == "3" ]; then
|
||||
echo "$COLORMODE_FILE_DIR"
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user