no no

i will not shy away from the complexities





DONT PUT YOURSELF IN A BOX THEY ARE SO HARD TO GET OUT OF
Code: Select all
MYTEMP=$(echo -E $bgcolor | sed 's/[\/&]/\\&/g')
sed "s/\_\@bg_color/$MYTEMP/g" -i "$f"
i'm trying to figure out what the first sed is doing. so far i can't. is that a variable inside the [] ? or is it actually literally looking for [/&]7bit wrote:Code: Select all
MYTEMP=$(echo -E $bgcolor | sed 's/[\/&]/\\&/g') sed "s/\_\@bg_color/$MYTEMP/g" -i "$f"
Code: Select all
#!/bin/bash
# vaire.sh, ya freak!
# requirements: gnu sed
# generates openbox/gtk2/3/xresources basics/dmenu_run colors
# easy as heck to add new skeleton files
# what the heck! try it out for a laff.
clear
# This is the theme generator script's attempt at small talk
echo "Welcome to the vaire workspace theme generator."
echo "This utility generates theme/colorschemes for GTK2/3, openbox, xresources, dmenu_run and more."
echo "Just enter the colors and other information requested and this script will do the rest, ya bum."
workingdir=`pwd`
# make sure all the stuff is here - not important for now
#if [ -d "$workingdir" ]; then
# shitty for now
#echo "dude this ain't gonna work but i'm too lazy to fail properly
#right now so you're just gonna have to chill and set some variables."
#fi
# Just in case you forget a value or you just want to generate a skeleton theme, I'll set some defaults.
# These are later forcibly applied in the event your input does not match an acceptable pattern.
# No broken themes allowed.
# Haven't tested 'em. gonna make a nice 'ne and update this.
# Brand integrity!
themename="vaire_generic"
fgcolor="#121412"
bgcolor="#DEDEDE"
linkcolor="#AF092F"
disabledcolor="#AF092F"
# Okay, let's have a conversation. Whare are your favorite colors? I'll write them down.
# TODO: regex for error checking.
# No broken themes allowed.
# themename
echo 1>&2 "Enter your theme's name (default: wrkst_generic)"
read themename
if [ -z "$themename" ]; then
themename="wkst_generic"
fi
echo "You entered "$themename". What a perfectly awful name. Shame on you."
# fgcolor
echo 1>&2 "Enter foreground color (default: #121412)"
read fgcolor
if [ -z "$fgcolor" ]; then
fgcolor="#121412"
fi
echo "You entered "$fgcolor". Disgusting."
# bgcolor
echo 1>&2 "Enter background color (default: #DEDEDE)"
read bgcolor
if [ -z "$bgcolor" ]; then
bgcolor="#DEDEDE"
fi
echo "You entered "$bgcolor". That'll stain."
# linkcolor
echo 1>&2 "Enter link color (default: #AF092F)"
read linkcolor
if [ -z "$linkcolor" ]; then
linkcolor="#AF092F"
fi
echo "You entered "$linkcolor", you nasty li'l freak"
# disabledcolor
echo 1>&2 "Enter disabled-items color (default: #C3C3C3"
read disabledcolor
if [ -z "$disabledcolor" ]; then
disabledcolor="#C3C3C3"
fi
echo "You entered "$disabledcolor". Whoopdefrickin-doo-dad."
# Thanks, ants. Thants.
echo "Thanks, ants..."
sleep 1
echo "Thants."
echo "Ensue calamity..."
sleep 1
# Okay let's do some stuuuuuff.
# HEY!!!
# so here's the deal. at some point, we'll work this out with the config file setup AND a menu system to determine which themes/config files/strings to generate.
# for now you get 'em all by default but if you want to save precious time, you can comment out which ones you don't want from the list below.
# Create the duh-rectory and copy ALL that dang stuff. It's gonna be nice.
cp -r "$workingdir"/skel/ "$workingdir"/"$themename"
# Let's make more variables. Well, one more.
themedir="$workingdir"/"$themename"
# get in there
cd "$themedir"
# create config file. More on that in a sec.
touch $themedir/"$themename"_rc
# Here's that list I was talking about. The top one is going to be that config file I mentioned.
# Everytime you run the script to generate a new theme, you'll get a config with it.
# The Future is important. But it doesn't do anything now.
# Sorry.
echo "Calamity ensues..."
# let's make another variable. Hey, check this out: it's a list. So it keeps going for a while.
THEMES="$themedir/$themename_rc $themedir/openbox-3/themerc $themedir/gtk-2.0/gtkrc $themedir/gtk-3.0/gtk.css"
# start looking for files and run some sed. for every one of the specified files above, replace the placeholders with the contents of our theme variables.
for f in $THEMES
do
sed -i "s/\_\@\(fg\)_color/$fgcolor/g" "$f"
sed -i "s/\_\@\(bg\)_color/$bgcolor/g" "$f"
sed -i "s/\_\@\(link\)_color/$linkcolor/g" "$f"
sed -i "s/\_\@\(disabled\)_color/$disabledcolor/g" "$f"
done
echo "Okay I'm done."
# sleep 1
# echo "Buzz..." ; sleep .5 ; echo "your theme..." ; sleep 1.5; echo "Woof."
that is the plan! eventually. i think the way i'm doing this should be pretty portable (as in, it's just variables). like i said, the config file way is the goal (so you can define the variables yourself) or maybe give it some runtime options.7bit wrote: The first line ensures that everything that is interpreted by sed is escaped, so the content of the variable is not interpreted by sed (things like \1 etc.).
BTW: Interactive bash sripts are not a good idea.
Why not write a GUI interface for that purpose and make the script read command line parameters?
![]()
yes the plan is to regex filter for hex values preceded by a crunch only. part of No broken themes allowed philosophy
disorder implies lack of order in a dichotomy that is boring!
The Keyboard Oracle has decided: One can nev'r climb in vain on the mountains of truth: eith'r thou will reacheth a pointeth high'r up today, or will be training thy pow'rs and be able to climb high'r tom'rrow.sth wrote: we must be able to adapt to the constant change in our universe! just as one may hold grains of sand in their hand we may also hold many titles, specifications and identities!![]()
the trick is seeing the handful of sand as a unique construction of individual grains of sand and accepting the existence of multiple, occasionally (on the surface) incompatible aspects of our lives.
i support this attitude 100%!!!The Keyboard Oracle wrote:The Keyboard Oracle has decided: One can nev'r climb in vain on the mountains of truth: eith'r thou will reacheth a pointeth high'r up today, or will be training thy pow'rs and be able to climb high'r tom'rrow.sth wrote: we must be able to adapt to the constant change in our universe! just as one may hold grains of sand in their hand we may also hold many titles, specifications and identities!![]()
the trick is seeing the handful of sand as a unique construction of individual grains of sand and accepting the existence of multiple, occasionally (on the surface) incompatible aspects of our lives.
https://en.wikipedia.org/wiki/David_IckeThe Venerable Wikipedia wrote:Icke combines discussion about the universe and consciousness with conspiracy theories about public figures being satanic paedophiles, and how apparently unconnected events are really attempts to control humanity. He argued in The Biggest Secret that human beings originated in a breeding program run by a race of reptilians called Anunnaki from the Draco constellation, and that what we call reality is just a holographic experience; the only reality is the realm of the Absolute. He believes in a collective consciousness that has intentionality, in reincarnation, in other possible worlds that exist alongside ours on other frequencies, and in acquired characteristics, arguing that our experiences change our DNA by downloading new information and overwriting the software. We are also able to attract experiences to ourselves by means of good and bad thoughts.