Pages

Showing posts with label theme. Show all posts
Showing posts with label theme. Show all posts

2015-01-25

Changing themes in Openbox

Skackware64 14.1, Openbox, tint2, conky, feh.
## After using three month almost only Slackware with my slightly-Steampunk theme, I got bored and recalled idea I had - to make script to start X+OB (without display manager) with visual theme I like at that moment, with choice of others.
So I made it happen. In most primitive bash (me - bash-n00b).

# There are one Chooser and four Swapper scripts (as I have currently four themes):
-- 1. Created conf-number file, like:
if [ ! -f obtheme/theme ]; then echo "1" > 'obtheme/theme' ; fi
Get the number:
theme=$(grep -o '[0-9]*' obtheme/theme)
Every time theme is chosen, new number is also written into theme-file.
Those above are for marking previously chosen theme ('if then echo') - and also to let wallpaper-randomizer script to know which one is current.
Then I set some variables;
did 'while' and 'if' between choices, 'read' those 'if'-s, and 'break'-ed with correct answer;
And final 'if-elif' then does
if ... ; then exec "ob-thx.sh"
with chosen theme-swapper script.

-- 2. Swappers
I Collected everything possible to ~/obtheme/xx folders. Like tint-stuff and wallpapers and conf files to be swapped.
For various reasons - there are either symlinks or files overwritten (respectively 'ln -sf' and 'cp').
- Two gtk confs (.gtkrc-2.0 and .config/gtk-3.0/settings.ini = gtk-theme swap);
- my wallpaper randomizer script for that theme (symlink). But - randomizer can also be modified to pick folder according to already existing theme-file number, and then there is no need to swap it | Edit - Done, see the end of the post |;
- .fehbg in ~/ (to pick up another wallpaper-folder);
- rc.xml (OB-theme swap) and autostart in ./config/openbox. Those are also symlinks which point to theme-specific files. Different tint2 and conky confs are opened from swapped auostart;
- and lastly, 'startx'. Or for debugging - as Slackware without display-manager doesn't want to log X-errors - startx 2>.xsession_errors

So, I now start my X either with alias 'sx' - no change, stright to X;
with 'sxz' - which opens up dialog of theme-change;
or, I can pass that and use aliases for swappers: sx1, sx2... .

For anyone fluent with bash - to make such scripts is totally no issue. What takes time is preparing themes - from various conf changes to actual pic-making or theme-tweaking.
But I have to say - it's most satisfactory to see my whole "desktop" instantly and totally changed.

Addon: Here is a simple script for swapping wallpapers inside the current theme wp-folder. Also, keyboard W+1 is mapped in rc.xml as 'swap desktop to first one and run randwp1.sh'.

#!/bin/bash
## very simple random wallpaper picker, through feh or nitrogen
## --------------------------

sp1="/home/user/obtheme/sp/wp"
sf2="/home/user/obtheme/sf/wp"
fan3="/home/user/obtheme/fan/wp"
nat4="/home/user/obtheme/nat/wp"

# theme number variable from theme file
theme=$(grep -o '[0-9]*' /home/user/obtheme/theme)
echo $theme
# directory containing images
DIR=$(if [ $theme -eq 1 ] ; then echo "$sp1" ; 
 elif [ $theme -eq 2 ] ; then echo "$sf2" ; 
 elif [ $theme -eq 3 ] ; then echo "$fan3" ; 
 elif [ $theme -eq 4 ] ; then echo "$nat4" ; 
 fi)
echo "$DIR"
# select a random jpg from the directory
PIC=$(ls $DIR/*.jpg | shuf -n1)
echo "$PIC"

# use nitrogen to set wallpaper
# nitrogen --set-scaled $PIC
# use feh
feh --bg-scale $PIC

exit 

2013-02-26

Themes, icons and Xfce


With every (user-friendly) distro comes some DE and some theme and icon-set. It doesn't have to be specially created or DEs' default – it might be some existing theme, tweaked, and hopefully full icon-set added to it.
Xubuntu, for example, has 'elementary xfce' icon-set – which is 'elementary' set tweaked for Xfce.
You can get themes etc in three ways:
1. Download & install as a package from repository – like 'xfwm4-themes' or 'xfce-artwork' and so on. In this case you get bunch of something, installed to root. Available for every user. But it also means – to hack them is a bit hassle.
2. Download them from xfce-look.org, Ubuntu-Art or some other (trusted) site. In this case you have to install them yourself (read install-hints).
a) To root – if you have more users in your Linux, and you want eyecandy to be available to others too. Generally, every theme-folder have to be copied to /usr/share/themes/ and icon-folders to /usr/share/icons/. Then they should automagically appear in Settings Managers.
b) To /home/your_user_name/.themes/ and to /home/ your_user_name/.icons/ - if you are only user or do not want to share, or want to tweak the stuff.
Not everything is compatible! Read notes (usually added) by author.
For example, when using Xfce and LightDM, it's silly to get themes for GDM (Gnome Display Manager). Both GTK 2 and 3 are OK. Metacity (Gnome) is not so OK, because Xfce has xfwm4 as a Window Manager. Sooner or later you happen to download something which doesn't fit and looks odd and broken.
3. You can create your own artwork. More about that later.

Themes use engines to run, that is, certain theme-families share the same engine, or theme may have several in use. Engines have to be installed for theme to work (theme-packages have engines included, separately downloaded ones – not always). When your Appearance Manager whines (hopefully it does - as opposed to simply displaying broken crap), use Synaptic and install the missing part. Just for a fun of naming some engine names: murrine, unico, pixbuf, nodova, aurora, equinox. There are more.

Xfce Window Manager uses specific xpm format, files sit in /xfwm4 folder (in themes' folder). Those files are used to build frame of every window. The process to create those files is not difficult, but it certainly takes time. Complete tutorial is here in xfce wiki. Not-Xfce themes doesn't have this xfce-specific part, unsurprasingly.
Settings Manager (xfce4-settings), includes appearance settings.
Xfce accepts both GTK 2 and GTK 3 style themes – gtk scripts create environment inside of every window. This is a bit more complicated – and I am not competent enough to give tweaking advice here. But, there are tutorials available in web, of course.
Gtk parts of theme live in gtk-2.0 and gtk-3.0 folders.
If you are adventurous and want to build your own theme, then a must is an app called thewidgetfactory (command is twf – it doesn't appear into menu, you have to create launcher yourself). Twf shows you how your buttons, sliders, check-boxes etc etc appear to look at current moment of scripting (or png-making). Gimp helps with png-s (tutorial page).
Gtk script is pure txt - use your text editor (in Xfce, Leafpad), or if you want to feel a bit more sophisticated and pro-looking: Geany or Bluefish might fit.

Icons are not part of theme, strictly speaking. Even more – they are not commonly added into theme-packs. Have to get them separately, then.
Icons are either png (standard format), or svg (scalable vector graphics, a format simply widely used) - for tweaking/creating those, use Inkscape. Icons' conf is described in index.theme file which sits in every icon-sets' folder. Icons are either fixed or scalable. There are hundreds of them, thematically grouped. Very common is to make symbolic links when the same icon is used in several places.
Changing those icons … can drive one almost insane, and it's marvelous to have more than 10 windows open at once... very business-like.
And here are some standards to muse over - when drinking evenings' Earl Grey and nibbling bisquits: Icon theme and Icon naming.

Looking back to past action ends here.