Improve/Cleaner theme changer script.
|
@ -1,12 +1,12 @@
|
|||
general {
|
||||
lock_cmd = hyprlock & $HOME/.scripts/set-wallpaper.sh -r
|
||||
before_sleep_cmd = hyprlock & $HOME/.scripts/set-wallpaper.sh -r
|
||||
lock_cmd = hyprlock & $HOME/.scripts/theme-changer.sh album sfw
|
||||
before_sleep_cmd = hyprlock & $HOME/.scripts/theme-changer.sh album sfw
|
||||
}
|
||||
|
||||
# Lock after 5min
|
||||
listener {
|
||||
timeout = 300
|
||||
on-timeout = hyprlock & $HOME/.scripts/set-wallpaper.sh -r
|
||||
on-timeout = hyprlock & $HOME/.scripts/theme-changer.sh album sfw
|
||||
}
|
||||
|
||||
# Turn of screen after 6min
|
||||
|
|
|
@ -83,5 +83,6 @@ bindl = , XF86AudioPrev, exec, playerctl previous
|
|||
bind = CTRL, up, exec, $HOME/.scripts/foobar2000.sh -vu
|
||||
bind = CTRL, down, exec, $HOME/.scripts/foobar2000.sh -vd
|
||||
|
||||
# Weeb mode
|
||||
bind = $mainMod SHIFT, W, exec, $HOME/.scripts/toggle-weeb-mode.sh
|
||||
# Theme
|
||||
bind = $mainMod, W, exec, $HOME/.scripts/theme-changer.sh album sfw
|
||||
bind = $mainMod SHIFT, W, exec, $HOME/.scripts/theme-changer.sh album hypr
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
$foreground=rgb(e8e0e5)
|
||||
$disabled=rgb(9c1797)
|
||||
$accent1=rgb(f099ed)
|
||||
$accent2=rgb(abb5f3)
|
||||
$disabled2=rgb(16289c)
|
||||
$foreground=rgb(77e0e0)
|
||||
$disabled=rgb(167f9c)
|
||||
$accent1=rgb(1a95b8)
|
||||
$accent2=rgb(1da0cf)
|
||||
$disabled2=rgb(16799d)
|
||||
$bad=rgb(AA2222)
|
||||
$selected=rgb(9c1797)
|
||||
$urgent=rgb(9289ee)
|
||||
$background2=rgb(0d1759)
|
||||
$background1=rgb(590d56)
|
||||
$selected=rgb(167f9c)
|
||||
$urgent=rgb(18aba6)
|
||||
$background2=rgb(0d4559)
|
||||
$background1=rgb(0d4959)
|
||||
$good=rgb(00BB66)
|
||||
$hovered=rgb(6f106c)
|
||||
$hovered=rgb(105b70)
|
||||
$border_radius=4
|
||||
$gaps_in=8
|
||||
$border_size=2
|
||||
|
|
|
@ -34,15 +34,11 @@ exec-once = swayosd-server
|
|||
exec-once = syncthing --no-browser --gui-address=http://127.0.0.1:8384
|
||||
|
||||
# Theming
|
||||
exec-once = echo 1 > "$HOME/.cache/weeb-mode"
|
||||
exec-once = $HOME/.scripts/set-wallpaper.sh -r
|
||||
exec-once = $HOME/.scripts/theme-changer.sh album sfw
|
||||
|
||||
# Udiskie
|
||||
exec-once = udiskie
|
||||
|
||||
# Waybar
|
||||
exec-once = waybar
|
||||
|
||||
# XWayland
|
||||
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ cursor_beam_thickness 1
|
|||
# Mouse
|
||||
mouse_hide_wait 0
|
||||
|
||||
url_color #eca37a
|
||||
url_color #1a95b8
|
||||
url_style single
|
||||
|
||||
show_hyperlink_target yes
|
||||
|
@ -79,14 +79,14 @@ tab_powerline_style angled
|
|||
tab_activity_symbol (!)
|
||||
tab_title_template "{index}{activity_symbol}: {title.replace('proxzima@proxzima:', '')}"
|
||||
|
||||
tab_bar_background #59290d
|
||||
tab_bar_background #0d4959
|
||||
|
||||
active_tab_foreground #f0e6de
|
||||
active_tab_background #9c4716
|
||||
active_tab_foreground #77e0e0
|
||||
active_tab_background #167f9c
|
||||
active_tab_font_style bold-italic
|
||||
|
||||
inactive_tab_foreground #f0e6de
|
||||
inactive_tab_background #703310
|
||||
inactive_tab_foreground #77e0e0
|
||||
inactive_tab_background #105b70
|
||||
inactive_tab_font_style normal
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
default-timeout=5000
|
||||
text-color=#c8e0f0
|
||||
border-color=#579ce7
|
||||
background-color=#0d3259
|
||||
text-color=#77e0e0
|
||||
border-color=#1a95b8
|
||||
background-color=#0d4959
|
||||
border-radius=4
|
||||
border-size=2
|
||||
font='JetBrainsMono NF' 11
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@import url("file:///home/viyurz/.config/gtk-3.0/colors-gtk.css");
|
||||
@import url("file:///home/viyurz/.config/gtk-3.0/colors.css");
|
||||
|
||||
* {
|
||||
font-family: 'JetBrainsMono NF';
|
||||
|
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
@ -1,4 +1,4 @@
|
|||
@import url("file:///home/viyurz/.config/gtk-3.0/colors-gtk.css");
|
||||
@import url("file:///home/viyurz/.config/gtk-3.0/colors.css");
|
||||
|
||||
* {
|
||||
background-image: none;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@import url('file:///home/viyurz/.config/gtk-3.0/colors-gtk.css');
|
||||
@import url('file:///home/viyurz/.config/gtk-3.0/colors.css');
|
||||
|
||||
window {
|
||||
color: @foreground;
|
||||
|
|
|
@ -1,356 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
wp_base_dir="$HOME/Images/Wallpapers/Desktop"
|
||||
declare -A wp_dirs=([SFW]="$wp_base_dir/SFW"
|
||||
[NSFW]="$wp_base_dir/( ͡° ͜ʖ ͡°)"
|
||||
[BONK]="$wp_base_dir/Bonk")
|
||||
|
||||
|
||||
|
||||
function pick_random_wallpaper {
|
||||
if [[ ${#wp_opts[@]} -eq 0 ]]; then
|
||||
target_wp_dirs=("${wp_dirs[SFW]}")
|
||||
else
|
||||
for opt in "${!wp_opts[@]}"; do
|
||||
opt_value=${wp_opts[$opt]}
|
||||
if [[ $opt_value -eq 1 ]]; then
|
||||
target_wp_dirs+=("${wp_dirs[$opt]}")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Picking a random wallpaper from ${target_wp_dirs[@]}."
|
||||
|
||||
wallpaper="$(find "${target_wp_dirs[@]}" -type f | shuf -n 1)"
|
||||
wallpaper="$wallpaper"
|
||||
}
|
||||
|
||||
|
||||
|
||||
function help {
|
||||
cat <<- EOF
|
||||
Usage: $(basename "$0") [options...]
|
||||
|
||||
-h, --help Show this message and quit.
|
||||
-r, --random Change the theme by picking a random wallpaper.
|
||||
-w, --wallpaper <path> Change the theme using this wallpaper.
|
||||
-s, --sfw Pick a wallpaper from SFW folder (default).
|
||||
-n, --nsfw Pick a wallpaper from NSFW folder.
|
||||
-b, --bonk U horny dog ¬‿¬.
|
||||
|
||||
Options -s and -n can be used together.
|
||||
If no option is specified, reloads the current theme.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare -A wp_opts
|
||||
while getopts "hrw:snb" opt; do
|
||||
case $opt in
|
||||
h)
|
||||
help
|
||||
exit
|
||||
;;
|
||||
r)
|
||||
opt_random=1
|
||||
;;
|
||||
w)
|
||||
opt_wallpaper=1
|
||||
opt_wallpaper_arg="$OPTARG"
|
||||
;;
|
||||
s)
|
||||
wp_opts[SFW]=1
|
||||
;;
|
||||
n)
|
||||
wp_opts[NSFW]=1
|
||||
;;
|
||||
b)
|
||||
wp_opts[BONK]=1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: $opt."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
|
||||
# Set/pick wallpaper accordingly to arguments passed
|
||||
if [[ $opt_random -eq 1 && $opt_wallpaper -eq 1 ]]; then
|
||||
echo "Option -r and -w can't be used together."
|
||||
exit 1
|
||||
elif [[ $opt_random -eq 1 ]]; then
|
||||
pick_random_wallpaper
|
||||
elif [[ $opt_wallpaper -eq 1 ]]; then
|
||||
if [[ -f "$opt_wallpaper_arg" ]]; then
|
||||
wallpaper="$opt_wallpaper_arg"
|
||||
else
|
||||
echo "Error: $opt_wallpaper_arg is not a valid path."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [[ $# -gt 0 ]]; then
|
||||
echo "Warning: Neither -r or -w were specified, ignoring option(s): $*."
|
||||
fi
|
||||
# To get the current wallpaper
|
||||
source "$HOME/.cache/wal/colors.sh"
|
||||
fi
|
||||
|
||||
echo "Selected wallpaper: $wallpaper"
|
||||
|
||||
|
||||
|
||||
# Create the colors scheme
|
||||
echo "Generating color scheme using pywal."
|
||||
wal -qni "$wallpaper" --saturate 0.75
|
||||
|
||||
# Replace apostrophes around the wallpaper path with quotes
|
||||
# in case there is an apostrophe in the file name
|
||||
sed -iE "/^wallpaper=/,/#/ s/='/=\"/" "$HOME/.cache/wal/colors.sh"
|
||||
sed -iE "/^wallpaper=/,/#/ s/'$/\"/" "$HOME/.cache/wal/colors.sh"
|
||||
|
||||
|
||||
|
||||
# Source colors scheme generated
|
||||
source "$HOME/.cache/wal/colors.sh"
|
||||
|
||||
|
||||
|
||||
# Set additional colors
|
||||
accent1_dark_hsl="$(pastel darken 1 "$color5" | pastel format hsl)"
|
||||
accent2_dark_hsl="$(pastel darken 1 "$color6" | pastel format hsl)"
|
||||
declare -A colors=(
|
||||
[foreground]="$foreground"
|
||||
[good]="#00BB66"
|
||||
[bad]="#AA2222"
|
||||
[urgent]="$color4"
|
||||
[accent1]="$color5"
|
||||
[accent2]="$color6"
|
||||
[background1]="$(pastel lighten 0.2 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[background2]="$(pastel lighten 0.2 "$accent2_dark_hsl" | pastel format hex)"
|
||||
[hovered]="$(pastel lighten 0.25 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[selected]="$(pastel lighten 0.35 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[disabled]="$(pastel lighten 0.35 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[disabled2]="$(pastel lighten 0.35 "$accent2_dark_hsl" | pastel format hex)"
|
||||
)
|
||||
|
||||
declare -A params=(
|
||||
[border_radius]=4
|
||||
[border_size]=2
|
||||
[gaps_out]=15
|
||||
[gaps_in]=8
|
||||
[font]="'JetBrainsMono NF'"
|
||||
)
|
||||
|
||||
# Display accent colors
|
||||
# pastel color "${colors[accent1]}"
|
||||
# pastel color "${colors[accent2]}"
|
||||
|
||||
|
||||
|
||||
# Clear colors/params files
|
||||
echo -n '' > "$HOME/.config/gtk-3.0/colors-gtk.css"
|
||||
echo -n '' > "$HOME/.config/hypr/hyprland.d/colors.conf"
|
||||
echo "wallpaper=\"$wallpaper\"" > "$HOME/.cache/colors.sh"
|
||||
|
||||
|
||||
|
||||
# Set colors variables in files
|
||||
echo "Writing theme colors in files."
|
||||
for key in "${!colors[@]}"; do
|
||||
value="${colors[$key]}"
|
||||
# Hyprland
|
||||
echo '$'"$key=rgb(${value:1})" >> "$HOME/.config/hypr/hyprland.d/colors.conf"
|
||||
# GTK
|
||||
echo "@define-color $key $value;" >> "$HOME/.config/gtk-3.0/colors-gtk.css"
|
||||
# Shell
|
||||
echo "${key}=$value" >> "$HOME/.cache/colors.sh"
|
||||
# i3
|
||||
sed -i "s/^set \$$key.*/set \$$key $value/" "$HOME/.config/i3/config"
|
||||
done
|
||||
|
||||
# Add Hyprland/i3 params
|
||||
echo "Writing parameters to Hyprland & i3 files."
|
||||
for key in "${!params[@]}"; do
|
||||
value="${params[$key]}"
|
||||
# Hyprland
|
||||
echo '$'"$key=$value" >> "$HOME/.config/hypr/hyprland.d/colors.conf"
|
||||
# i3
|
||||
sed -i "s/^set \$$key.*/set \$$key $value/" "$HOME/.config/i3/config"
|
||||
done
|
||||
|
||||
|
||||
|
||||
# Set Kitty params
|
||||
echo "Changing colors/params in Kitty config file."
|
||||
declare -A kitty_vars=(
|
||||
[font_family]="${params[font]}"
|
||||
[url_color]="${colors[accent1]}"
|
||||
[tab_bar_background]="${colors[background1]}"
|
||||
[active_tab_background]="${colors[selected]}"
|
||||
[inactive_tab_background]="${colors[hovered]}"
|
||||
[active_tab_foreground]="${colors[foreground]}"
|
||||
[inactive_tab_foreground]="${colors[foreground]}"
|
||||
)
|
||||
for key in "${!kitty_vars[@]}"; do
|
||||
value="${kitty_vars[$key]}"
|
||||
sed -i "s/^$key.*/$key $value/" "$HOME/.config/kitty/kitty.conf"
|
||||
done
|
||||
|
||||
|
||||
|
||||
# Set Waybar params
|
||||
echo "Changing params in Waybar styling file."
|
||||
declare -A waybar_vars=(
|
||||
[font-family]="${params[font]}"
|
||||
[border-bottom]="${params[border_size]}px solid transparent"
|
||||
[margin-bottom]="${params[border_size]}px"
|
||||
)
|
||||
for key in "${!waybar_vars[@]}"; do
|
||||
value="${waybar_vars[$key]}"
|
||||
sed -i "s~$key:[^;]*~$key: $value~" "$HOME/.config/waybar/style.css"
|
||||
done
|
||||
|
||||
|
||||
|
||||
# Set Wofi params
|
||||
echo "Changing params in Wofi styling file."
|
||||
declare -A wofi_vars_window=(
|
||||
[font-family]="${params[font]}"
|
||||
[border]="${params[border_size]}px solid transparent"
|
||||
[border-radius]="${params[border_radius]}px"
|
||||
)
|
||||
for key in "${!wofi_vars_window[@]}"; do
|
||||
value="${wofi_vars_window[$key]}"
|
||||
sed -i "/^window/,/$key:/ s~$key:[^;]*~$key: $value~" "$HOME/.config/wofi/style.css"
|
||||
done
|
||||
|
||||
declare -A wofi_vars_input=(
|
||||
[margin]="${params[border_size]}px"
|
||||
[border-radius]="${params[border_radius]}px ${params[border_radius]}px 0 0"
|
||||
)
|
||||
for key in "${!wofi_vars_input[@]}"; do
|
||||
value="${wofi_vars_input[$key]}"
|
||||
sed -i "/^#input/,/$key:/ s~$key:[^;]*~$key: $value~" "$HOME/.config/wofi/style.css"
|
||||
done
|
||||
|
||||
# Set entry:selected border-radius
|
||||
sed -i "/^#entry:selected/,/border-radius:/ s/border-radius:[^;]*/border-radius: $(( params[border_radius]/2 ))px/" "$HOME/.config/wofi/style.css"
|
||||
|
||||
|
||||
|
||||
# Set Mako params
|
||||
echo "Changing colors/params in Mako config file."
|
||||
declare -A mako_vars=(
|
||||
[font]="${params[font]} 11"
|
||||
[border-radius]="${params[border_radius]}"
|
||||
[border-size]="${params[border_size]}"
|
||||
[outer-margin]="$((params[gaps_out]*2)),$((params[gaps_out]*2)),0,0"
|
||||
[text-color]="${colors[foreground]}"
|
||||
[background-color]="${colors[background1]}"
|
||||
[border-color]="${colors[accent1]}"
|
||||
)
|
||||
for key in "${!mako_vars[@]}"; do
|
||||
value="${mako_vars[$key]}"
|
||||
sed -i "s/$key=.*/$key=$value/" "$HOME/.config/mako/config"
|
||||
done
|
||||
|
||||
|
||||
|
||||
# BetterDiscord
|
||||
if [[ -x /bin/betterdiscordctl ]]; then
|
||||
echo "Executable found for betterdiscordctl."
|
||||
if [[ ! -f "$HOME/.config/BetterDiscord/data/stable/custom.css" ]]; then
|
||||
echo "Downloading ClearVision theme for BetterDiscord."
|
||||
mkdir -p "$HOME/.config/BetterDiscord/data/stable"
|
||||
wget -O "$HOME/.config/BetterDiscord/data/stable/custom.css" "https://betterdiscord.app/Download?id=23"
|
||||
fi
|
||||
|
||||
echo "Changing BetterDiscord theme colors."
|
||||
declare -A bd_vars=(
|
||||
[main-color]="${colors[accent1]}"
|
||||
[hover-color]="${colors[accent2]}"
|
||||
[text-normal]="${colors[foreground]}"
|
||||
[background-shading]='0%'
|
||||
[background-overlay]='rgba(0, 0, 0, 0)'
|
||||
[background-image]="linear-gradient(160deg, ${colors[background1]}, ${colors[background2]})"
|
||||
)
|
||||
for key in "${!bd_vars[@]}"; do
|
||||
value="${bd_vars[$key]}"
|
||||
sed -i "s~--$key:[^;]*~--$key: $value~" "$HOME/.config/BetterDiscord/data/stable/custom.css"
|
||||
done
|
||||
else
|
||||
echo "No executable found for betterdiscordctl, skipping."
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Change Wlogout icons color
|
||||
echo "Changing wlogout icons colors."
|
||||
wlogout_img=('lock' 'reboot' 'shutdown' 'logout')
|
||||
for img in "${wlogout_img[@]}"; do
|
||||
convert "$HOME/.config/wlogout/$img.png" -fill "${colors[accent1]}" -colorize 100 "$HOME/.config/wlogout/$img.png"
|
||||
convert "$HOME/.config/wlogout/$img-focus.png" -fill "${colors[accent2]}" -colorize 100 "$HOME/.config/wlogout/$img-focus.png"
|
||||
done
|
||||
|
||||
|
||||
|
||||
# Reload/restart stuff
|
||||
if [[ -z "$WAYLAND_DISPLAY" ]]; then
|
||||
echo "Reloading i3."
|
||||
i3-msg reload > /dev/null &
|
||||
|
||||
echo "Changing wallpaper using feh."
|
||||
feh --no-fehbg --bg-fill "$wallpaper" &
|
||||
else
|
||||
echo "Reloading Hyprland."
|
||||
hyprctl reload > /dev/null &
|
||||
|
||||
if grep -q 1 "$HOME/.cache/weeb-mode"; then
|
||||
echo "Changing wallpaper using swaybg."
|
||||
pkill -u "$USER" swaybg &> /dev/null
|
||||
hyprctl dispatch exec "swaybg -i \"$wallpaper\"" > /dev/null &
|
||||
fi
|
||||
|
||||
if pgrep -u "$USER" waybar > /dev/null; then
|
||||
echo "Reloading Waybar."
|
||||
killall -SIGUSR2 waybar &
|
||||
else
|
||||
echo "Starting Waybar."
|
||||
hyprctl dispatch exec waybar > /dev/null &
|
||||
fi
|
||||
|
||||
if pgrep -u "$USER" mako > /dev/null; then
|
||||
echo "Reloading Mako."
|
||||
makoctl reload &
|
||||
else
|
||||
echo "Starting mako."
|
||||
hyprctl dispatch exec mako > /dev/null &
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Reload Kitty
|
||||
echo "Reloading opened Kitty windows."
|
||||
killall -SIGUSR1 kitty &> /dev/null &
|
||||
|
||||
|
||||
# Reload pywalfox
|
||||
#if pgrep -u "$USER" firefox &> /dev/null; then
|
||||
# echo "Reloading pywalfox."
|
||||
# pywalfox update &
|
||||
#fi
|
||||
|
||||
|
||||
# OpenRGB
|
||||
if [[ -x /bin/openrgb ]]; then
|
||||
echo "Changing OpenRGB colors."
|
||||
openrgb --noautoconnect -c "${colors[accent1]:1}" > /dev/null &
|
||||
fi
|
||||
|
||||
|
||||
# Generate blurred wallpaper to use with swaylock/i3lock
|
||||
convert "$wallpaper" -blur 0x5 -resize 1920x1080 "$HOME/.cache/wallpaper-blurred.jpg" &
|
||||
[[ -f "$HOME/.cache/wallpaper-hypr-blurred.jpg" ]] || convert /usr/share/hyprland/wall_2K.png -blur 0x5 -resize 1920x1080 "$HOME/.cache/wallpaper-hypr-blurred.jpg" &
|
345
.scripts/theme-changer.sh
Executable file
|
@ -0,0 +1,345 @@
|
|||
#!/bin/sh
|
||||
|
||||
albums_dir="$HOME/Images/Wallpapers/Desktop"
|
||||
|
||||
declare -A albums=(
|
||||
[sfw]="$albums_dir/SFW"
|
||||
[nsfw]="$albums_dir/( ͡° ͜ʖ ͡°)"
|
||||
[bonk]="$albums_dir/Bonk"
|
||||
[hypr]="/usr/share/hyprland/wall0.png"
|
||||
)
|
||||
|
||||
# Declare outside of function to make them global.
|
||||
declare -A colors
|
||||
declare -A params
|
||||
|
||||
|
||||
function show_help {
|
||||
cat << EOF
|
||||
Usage: $(basename "$0") ACTION
|
||||
ACTION:
|
||||
a, album ALBUM_NAME[,ALBUM_NAME] Select a random wallpaper from one or more albums & change the theme.
|
||||
h, help Show this help.
|
||||
l, list List all defined albums.
|
||||
r, reload Reload the current theme.
|
||||
w, wallpaper WP_PATH Change the theme using a specific wallpaper.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function check_requirements {
|
||||
req_satisfied=1
|
||||
|
||||
for executable in convert hyprctl kitty mako pastel swaybg wal waybar wlogout wofi; do
|
||||
if ! which "$executable" > /dev/null; then
|
||||
echo "Executable $executable not found!"
|
||||
req_satisfied=0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $req_satisfied -eq 0 ]; then
|
||||
echo "Missing some requirements, exiting."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function list_albums {
|
||||
echo "Defined albums:"
|
||||
for album in "${!albums[@]}"; do
|
||||
echo " $album: ${albums[$album]}"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Transform comma separated $albums_arg into array ${target_albums[@]}
|
||||
function parse_albums_arg {
|
||||
IFS=', ' read -r -a target_albums <<< "$albums_arg"
|
||||
|
||||
# Check if entered album(s) are valid.
|
||||
for target_album in "${target_albums[@]}"; do
|
||||
if ! echo "${!albums[@]}" | grep -qP "\b$target_album\b"; then
|
||||
echo "Invalid album name, exiting."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Pick a random wallpaper from ${target_albums[@]}
|
||||
function pick_random_wallpaper {
|
||||
declare -a target_dirs
|
||||
|
||||
for target_album in "${target_albums[@]}"; do
|
||||
target_dirs+=("${albums[$target_album]}")
|
||||
done
|
||||
|
||||
echo "Picking a random wallpaper from ${target_dirs[*]}."
|
||||
|
||||
wallpaper="$(find "${target_dirs[@]}" -type f -regex '.*\.\(jpg\|jpeg\|png\)$' | shuf -n 1)"
|
||||
# Reassign to make variable global.
|
||||
wallpaper="$wallpaper"
|
||||
}
|
||||
|
||||
|
||||
function set_theme {
|
||||
echo "Selected wallpaper: $wallpaper"
|
||||
|
||||
# Generate the colors scheme
|
||||
echo "Generating color scheme using pywal."
|
||||
wal -qni "$wallpaper" --saturate 0.75
|
||||
|
||||
# Replace apostrophes around the wallpaper path with quotes
|
||||
# in case there is an apostrophe in the file name
|
||||
sed -iE "/^wallpaper=/,/#/ s/='/=\"/" "$HOME/.cache/wal/colors.sh"
|
||||
sed -iE "/^wallpaper=/,/#/ s/'$/\"/" "$HOME/.cache/wal/colors.sh"
|
||||
|
||||
# Source colors scheme generated
|
||||
source "$HOME/.cache/wal/colors.sh"
|
||||
|
||||
set_theme_variables
|
||||
set_gtk_css_file
|
||||
|
||||
for component in desktop_wallpaper hyprland kitty mako waybar wlogout wofi; do
|
||||
set_${component}_theme &
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function set_theme_variables {
|
||||
# Set colors
|
||||
accent1_dark_hsl="$(pastel darken 1 "$color5" | pastel format hsl)"
|
||||
accent2_dark_hsl="$(pastel darken 1 "$color6" | pastel format hsl)"
|
||||
colors=(
|
||||
[foreground]="$foreground"
|
||||
[good]="#00BB66"
|
||||
[bad]="#AA2222"
|
||||
[urgent]="$color4"
|
||||
[accent1]="$color5"
|
||||
[accent2]="$color6"
|
||||
[background1]="$(pastel lighten 0.2 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[background2]="$(pastel lighten 0.2 "$accent2_dark_hsl" | pastel format hex)"
|
||||
[hovered]="$(pastel lighten 0.25 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[selected]="$(pastel lighten 0.35 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[disabled]="$(pastel lighten 0.35 "$accent1_dark_hsl" | pastel format hex)"
|
||||
[disabled2]="$(pastel lighten 0.35 "$accent2_dark_hsl" | pastel format hex)"
|
||||
)
|
||||
|
||||
params=(
|
||||
[border_radius]=4
|
||||
[border_size]=2
|
||||
[gaps_out]=15
|
||||
[gaps_in]=8
|
||||
[font]="'JetBrainsMono NF'"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
function set_gtk_css_file {
|
||||
echo -n '' > "$HOME/.config/gtk-3.0/colors.css"
|
||||
|
||||
for key in "${!colors[@]}"; do
|
||||
value="${colors[$key]}"
|
||||
echo "@define-color $key $value;" >> "$HOME/.config/gtk-3.0/colors.css"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function set_betterdiscord_theme {
|
||||
if which betterdiscordctl > /dev/null; then
|
||||
echo "Executable found for betterdiscordctl."
|
||||
if [[ ! -f "$HOME/.config/BetterDiscord/data/stable/custom.css" ]]; then
|
||||
echo "Downloading ClearVision theme for BetterDiscord."
|
||||
mkdir -p "$HOME/.config/BetterDiscord/data/stable"
|
||||
wget -O "$HOME/.config/BetterDiscord/data/stable/custom.css" "https://betterdiscord.app/Download?id=23"
|
||||
fi
|
||||
|
||||
echo "Changing BetterDiscord theme colors."
|
||||
declare -A bd_variables=(
|
||||
[main-color]="${colors[accent1]}"
|
||||
[hover-color]="${colors[accent2]}"
|
||||
[text-normal]="${colors[foreground]}"
|
||||
[background-shading]='0%'
|
||||
[background-overlay]='rgba(0, 0, 0, 0)'
|
||||
[background-image]="linear-gradient(160deg, ${colors[background1]}, ${colors[background2]})"
|
||||
)
|
||||
|
||||
for key in "${!bd_variables[@]}"; do
|
||||
value="${bd_variables[$key]}"
|
||||
sed -i "s~--$key:[^;]*~--$key: $value~" "$HOME/.config/BetterDiscord/data/stable/custom.css"
|
||||
done
|
||||
else
|
||||
echo "No executable found for betterdiscordctl, skipping."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function set_desktop_wallpaper_theme {
|
||||
pkill -u "$USER" swaybg &> /dev/null
|
||||
hyprctl dispatch exec "swaybg -i \"$wallpaper\"" > /dev/null
|
||||
}
|
||||
|
||||
|
||||
function set_hyprland_theme {
|
||||
echo -n '' > "$HOME/.config/hypr/hyprland.d/colors.conf"
|
||||
|
||||
for key in "${!colors[@]}"; do
|
||||
value="${colors[$key]}"
|
||||
echo '$'"$key=rgb(${value:1})" >> "$HOME/.config/hypr/hyprland.d/colors.conf"
|
||||
done
|
||||
|
||||
for key in "${!params[@]}"; do
|
||||
value="${params[$key]}"
|
||||
echo '$'"$key=$value" >> "$HOME/.config/hypr/hyprland.d/colors.conf"
|
||||
done
|
||||
|
||||
hyprctl reload > /dev/null
|
||||
}
|
||||
|
||||
|
||||
function set_kitty_theme {
|
||||
declare -A kitty_variables=(
|
||||
[font_family]="${params[font]}"
|
||||
[url_color]="${colors[accent1]}"
|
||||
[tab_bar_background]="${colors[background1]}"
|
||||
[active_tab_background]="${colors[selected]}"
|
||||
[inactive_tab_background]="${colors[hovered]}"
|
||||
[active_tab_foreground]="${colors[foreground]}"
|
||||
[inactive_tab_foreground]="${colors[foreground]}"
|
||||
)
|
||||
|
||||
for key in "${!kitty_variables[@]}"; do
|
||||
value="${kitty_variables[$key]}"
|
||||
sed -i "s/^$key.*/$key $value/" "$HOME/.config/kitty/kitty.conf"
|
||||
done
|
||||
|
||||
killall -SIGUSR1 kitty &> /dev/null
|
||||
}
|
||||
|
||||
|
||||
function set_mako_theme {
|
||||
declare -A mako_variables=(
|
||||
[font]="${params[font]} 11"
|
||||
[border-radius]="${params[border_radius]}"
|
||||
[border-size]="${params[border_size]}"
|
||||
[outer-margin]="$((params[gaps_out]*2)),$((params[gaps_out]*2)),0,0"
|
||||
[text-color]="${colors[foreground]}"
|
||||
[background-color]="${colors[background1]}"
|
||||
[border-color]="${colors[accent1]}"
|
||||
)
|
||||
|
||||
for key in "${!mako_variables[@]}"; do
|
||||
value="${mako_variables[$key]}"
|
||||
sed -i "s/$key=.*/$key=$value/" "$HOME/.config/mako/config"
|
||||
done
|
||||
|
||||
if pgrep -u "$USER" mako > /dev/null; then
|
||||
makoctl reload
|
||||
else
|
||||
hyprctl dispatch exec mako > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function set_openrgb_theme {
|
||||
if which openrgb > /dev/null; then
|
||||
openrgb --noautoconnect -c "${colors[accent1]:1}" > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function set_pywalfox_theme {
|
||||
if pgrep -u "$USER" firefox &> /dev/null; then
|
||||
pywalfox update
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function set_waybar_theme {
|
||||
declare -A waybar_variables=(
|
||||
[font-family]="${params[font]}"
|
||||
[border-bottom]="${params[border_size]}px solid transparent"
|
||||
[margin-bottom]="${params[border_size]}px"
|
||||
)
|
||||
|
||||
for key in "${!waybar_variables[@]}"; do
|
||||
value="${waybar_variables[$key]}"
|
||||
sed -i "s~$key:[^;]*~$key: $value~" "$HOME/.config/waybar/style.css"
|
||||
done
|
||||
|
||||
if pgrep -u "$USER" waybar > /dev/null; then
|
||||
killall -SIGUSR2 waybar
|
||||
else
|
||||
hyprctl dispatch exec waybar > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function set_wlogout_theme {
|
||||
for img in lock reboot shutdown logout; do
|
||||
convert "$HOME/.config/wlogout/$img.png" -fill "${colors[accent1]}" -colorize 100 "$HOME/.config/wlogout/$img.png"
|
||||
convert "$HOME/.config/wlogout/$img-focus.png" -fill "${colors[accent2]}" -colorize 100 "$HOME/.config/wlogout/$img-focus.png"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function set_wofi_theme {
|
||||
declare -A wofi_variables_window=(
|
||||
[font-family]="${params[font]}"
|
||||
[border]="${params[border_size]}px solid transparent"
|
||||
[border-radius]="${params[border_radius]}px"
|
||||
)
|
||||
|
||||
for key in "${!wofi_variables_window[@]}"; do
|
||||
value="${wofi_variables_window[$key]}"
|
||||
sed -i "/^window/,/$key:/ s~$key:[^;]*~$key: $value~" "$HOME/.config/wofi/style.css"
|
||||
done
|
||||
|
||||
declare -A wofi_variables_input=(
|
||||
[margin]="${params[border_size]}px"
|
||||
[border-radius]="${params[border_radius]}px ${params[border_radius]}px 0 0"
|
||||
)
|
||||
for key in "${!wofi_variables_input[@]}"; do
|
||||
value="${wofi_variables_input[$key]}"
|
||||
sed -i "/^#input/,/$key:/ s~$key:[^;]*~$key: $value~" "$HOME/.config/wofi/style.css"
|
||||
done
|
||||
|
||||
# Set entry:selected border-radius
|
||||
sed -i "/^#entry:selected/,/border-radius:/ s/border-radius:[^;]*/border-radius: $(( params[border_radius]/2 ))px/" "$HOME/.config/wofi/style.css"
|
||||
}
|
||||
|
||||
|
||||
check_requirements
|
||||
case "$1" in
|
||||
a|album)
|
||||
albums_arg="$2"
|
||||
parse_albums_arg
|
||||
pick_random_wallpaper
|
||||
set_theme
|
||||
;;
|
||||
|
||||
h|help)
|
||||
show_help
|
||||
;;
|
||||
|
||||
l|list)
|
||||
list_albums
|
||||
;;
|
||||
|
||||
r|reload)
|
||||
# Get the current wallpaper in $wallpaper
|
||||
source "$HOME/.cache/wal/colors.sh"
|
||||
set_theme
|
||||
;;
|
||||
|
||||
w|wallpaper)
|
||||
wallpaper="$2"
|
||||
check_wallpaper_path
|
||||
set_theme
|
||||
;;
|
||||
|
||||
*)
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
source "$HOME/.cache/wal/colors.sh"
|
||||
|
||||
pkill -u "$USER" swaybg
|
||||
|
||||
if grep -q 1 "$HOME/.cache/weeb-mode"; then
|
||||
echo 0 > "$HOME/.cache/weeb-mode"
|
||||
else
|
||||
echo 1 > "$HOME/.cache/weeb-mode"
|
||||
hyprctl dispatch exec "swaybg -i \"$wallpaper\"" > /dev/null
|
||||
fi
|