#!/bin/bash # Run like this # wally /path/to/wallpaper/or/directory # examples: wally ~/Pictures/Wallpapers # wally ~/Pictures/Wallpapers/pape.jpg # Arguments checking if [ $# == 0 ]; then echo "No path to wallpaper or directory specified :(" exit 0; fi # Grabbing current Xresources colors XCOLOR0_OLD="$(cat ~/.Xresources | grep -m 1 color0 | awk '{print $2}')" XCOLOR1_OLD="$(cat ~/.Xresources | grep -m 1 color1 | awk '{print $2}')" XCOLOR2_OLD="$(cat ~/.Xresources | grep -m 1 color2 | awk '{print $2}')" XCOLOR3_OLD="$(cat ~/.Xresources | grep -m 1 color3 | awk '{print $2}')" XCOLOR4_OLD="$(cat ~/.Xresources | grep -m 1 color4 | awk '{print $2}')" XCOLOR5_OLD="$(cat ~/.Xresources | grep -m 1 color5 | awk '{print $2}')" XCOLOR6_OLD="$(cat ~/.Xresources | grep -m 1 color6 | awk '{print $2}')" XCOLOR7_OLD="$(cat ~/.Xresources | grep -m 1 color7 | awk '{print $2}')" # Calling wal to generate new colors ARG=$1 echo "Calling wal at $ARG... toot toot..." wal -i $ARG echo "> New colorscheme generated!" # Apply new colors to Xresources echo "Setting .Xresources..." cp ~/.wally/Xresources-clean ~/.wally/Xresources-new cat ~/.cache/wal/colors.xresources >> ~/.wally/Xresources-new cp ~/.wally/Xresources-new ~/.Xresources reloadXr echo "> New .Xresources set!" # Grabbing new Xresources colors # Grabbing current Xresources colors XCOLOR0_NEW="$(cat ~/.Xresources | grep -m 1 color0 | awk '{print $2}')" XCOLOR1_NEW="$(cat ~/.Xresources | grep -m 1 color1 | awk '{print $2}')" XCOLOR2_NEW="$(cat ~/.Xresources | grep -m 1 color2 | awk '{print $2}')" XCOLOR3_NEW="$(cat ~/.Xresources | grep -m 1 color3 | awk '{print $2}')" XCOLOR4_NEW="$(cat ~/.Xresources | grep -m 1 color4 | awk '{print $2}')" XCOLOR5_NEW="$(cat ~/.Xresources | grep -m 1 color5 | awk '{print $2}')" XCOLOR6_NEW="$(cat ~/.Xresources | grep -m 1 color6 | awk '{print $2}')" XCOLOR7_NEW="$(cat ~/.Xresources | grep -m 1 color7 | awk '{print $2}')" # Replace colors to all linked files in wally's folder sed -i --follow-symlinks "s@$XCOLOR0_OLD@$XCOLOR0_NEW@gI" ~/.wally/links/* sed -i --follow-symlinks "s@$XCOLOR1_OLD@$XCOLOR1_NEW@gI" ~/.wally/links/* sed -i --follow-symlinks "s@$XCOLOR2_OLD@$XCOLOR2_NEW@gI" ~/.wally/links/* sed -i --follow-symlinks "s@$XCOLOR3_OLD@$XCOLOR3_NEW@gI" ~/.wally/links/* sed -i --follow-symlinks "s@$XCOLOR4_OLD@$XCOLOR4_NEW@gI" ~/.wally/links/* sed -i --follow-symlinks "s@$XCOLOR5_OLD@$XCOLOR5_NEW@gI" ~/.wally/links/* sed -i --follow-symlinks "s@$XCOLOR6_OLD@$XCOLOR6_NEW@gI" ~/.wally/links/* sed -i --follow-symlinks "s@$XCOLOR7_OLD@$XCOLOR7_NEW@gI" ~/.wally/links/* # Restart tint2 to reload config file # The grep is to supress tint2 output (doesn't work very well though) tint2restart | grep shutup! & echo "> tint2 has restarted!" # Reconfigure openbox to reload theme # Template: ~/.local/share/themes/thebox/openbox-3/themerc openbox --reconfigure echo "> Openbox is reconfigured!" # Uncomment to enable gtk and icon coloring # Warning: this is very slow due to the large number of files! # echo "Customizing gtk theme and icons... This might take a while!" # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR0_OLD@$XCOLOR0_NEW@gI" {} \; # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR1_OLD@$XCOLOR1_NEW@gI" {} \; # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR2_OLD@$XCOLOR2_NEW@gI" {} \; # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR3_OLD@$XCOLOR3_NEW@gI" {} \; # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR4_OLD@$XCOLOR4_NEW@gI" {} \; # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR5_OLD@$XCOLOR5_NEW@gI" {} \; # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR6_OLD@$XCOLOR6_NEW@gI" {} \; # echo -n ". " # find -L ~/.wally/gtk ~/.wally/icons -type f -exec sed -i -e "s@$XCOLOR7_OLD@$XCOLOR7_NEW@gI" {} \; # echo "!" # echo "> New gtk theme and icons set!" # Customize login screen: TODO! sos needs sudo sadly # Copy new wallpaper path to wally's directory cp ~/.cache/wal/wal ~/.wally/path_to_wallpaper WALLPAPER="$(cat ~/.wally/path_to_wallpaper)" # Display new colors with a color script # (other good scripts: spectrum, colortest) ~/Scripts/Color/colortest echo "> Current wallpaper: $WALLPAPER" echo "> All done :)"