Pages

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 

2015-01-18

Slackware64 14.1 + new kernel

Yeah, compiled a new 3.14.28 kernel - in a bit leaner way than slackware generic is.
So here comes concisely how I did it.

# First, open up this page and read it - my description here is almost the same, with occasional addons. And - I did everything on desktop terminal until Nvidia drivers' reinstall (logout, console, init 3).

1. Download the source (and pgp .sign) from kernel.org, copy to /usr/src, unxz the source file (tar needed afterwards), then unpack source to folder. To be nice and orderly, do: rm linux && ln -s /usr/src/linux-3.14.28 linux
cd linux
zcat /proc/config.gz > /usr/src/linux/.config  # or use some other handy config...
make oldconfig  # to insert kernel changes into old config file.
make menuconfig # Which probably takes two hours at least. But it's worth to be alert and click everything - for not to miss, for example, your network drivers.
make bzImage modules
make modules_install
cp arch/x86/boot/bzImage /boot/vmlinuz-custom-3.14.28
cp System.map /boot/System.map-custom-3.14.28 
cp .config /boot/config-custom-3.14.28
  # instead of 'custom' comes of course your special name you gave to your kernel (when menuconfiging).
/usr/share/mkinitrd/mkinitrd_command_generator.sh -k 3.14.28
This nicy script gives you exact command for creating initrd. Do it.
cd /boot
There should be three links to: kernel, system.map and config. Change those to point to your new files (ln -sf filename link).
Done with the kernel.

2. There is link /etc/rc.d/rc.modules which points to old rc.modules-3.10.17; copy this old modules file, rename it according to new kernel modules folder name (or 'uname -r' - which you can't use as kernel is not yet installed :) and change rc.modules link to point to this new file.

3. Grub or Lilo - has to be rerun for introducing new kernel. I have Grub2 in Wheezy (which I still keep only for hosting my multiboot) - I mounted Wheezys' partition and simply edited /boot/grub/grub.conf file. And that was that.

4. GPG-check. (Additionally to AlienBobs' tutorial there is also nice explanation in kernel.org.)
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.14.28.tar.sign
Put it into the same folder where you have linux-3.14.28.tar
gpg --verify linux-3.14.28.tar.sign linux-3.14.28.tar
What results 'no key', but there is id=6092693E , use this and import:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 6092693E
gpg --verify linux-3.14.28.tar.sign linux-3.14.28.tar
"This key is not certified with a trusted signature" - let it be like that, done.

5. NVIDIA
Kernel 3.14 and nvidia 319, seems, are not friends - no compile, BUT newer 331.86 did the trick. Before run, delete /etc/X11/xorg.conf - and then let installer make a new one. Sometimes there is a difference - as X starting or not starting (missing screens). No, I do not know why it sometimes matters.
Last part in following is for compiling for not yet installed kernel.
sh NVIDIA-Linux-x86_64-331.89.run --kernel-name='3.14.28'
It compiled, but whined over wrong arch in  /usr/lib64/libEGL.la
Anyway - X started up. I checked aforementioned .la - and it appeared that Nvidia removed it totally. Found it in /var/log/nvidia/103, copied back and also deleted in it one dependency that was obviously 32bit... We'll see what happens next time when compiling.
According to web, reinstalling mesa also fixes .la issue.

But never mind.
I have my new kernel running and everything seems to function OK.

Slackware + apps and stuff

I happened to look around for some new apps and so on... Found some and installed.
So it seems to be a good opportunity to flash MY list of apps, and blab a bit of some of them. This list, of course, is not a template for greater awareness and being godlike, but it might give some app-ideas... Like I found when peeking into other people choices ...
And here, some bollocks then:

## The patient: Slackware64 14.1, Nvidia 331.86 binary, Openbox. My Slack-install was not the 'full' one, but rather castrated - I left out everything possible... Including vim&family - which means that dotnew didn't want to compare anything (missing vimdiff). But never mind - new config files are for promptly deleting anyway.
Not-full install means that I might mention some things as 'new' that normally get installed automagically.
- Usage of my Linux(es): Educational playing-around, no serious work done, strictly desktop. No plan to use vi or emacs, no apache et al, not even ssh and ntp; no social bullshit and fraternizing (skype, chats and so on).
So - rather simple setup with net, writing and graphic tools, and occasionally test-stuff (for example, see my silly tour with linux games)

## Beginnings of apps:
-- I always use stright Nvidia binary (sh NVIDIA....run). It blacklists nouveau, reboot, run it again, let it make conf for X. For n00bs: for every kernel or x-server upgrade - nvidia driver has to be recompiled!

-- nano is installed from ISO - so console is survivable without various vi-s;

-- slackpkg+ and sbotools - get package for the first one, and SlackBuild for the second beforehand, makes a little less fussing now.
Slackpkg+ is a wrapper for official slackpkg. It has the same tools, but it provides multi-repo capability. Ie, various ready-made packages can be retrieved from several repos (see slakfinder.org). As a bonus - playing around with slackpkg+ conf keeps you occupied for an hour, or more.
Sbotools is freebsd-like ports-script. It installs, removes and keeps account of your sbo packages. It also checks dependencies (provided those are notified in .info file). Means, makes life easier - a lot easier if install is of 8-10 depending sbo packages ...
Sbotools has .SlackBuild in slackbuilds.org and compiles easily, no deps.
Run sudo sboconf (all sbotools are sudo / su) first, change something - and you get /etc/sbotools/sbotools.conf file created. Now fill it according to wishes and documentation (man sbotools).
I find it smart to keep sbo tree (and distfiles) on different partition (not in default /usr/sbo) - the same goes for made packages.
sbosnap fetch, and off we go - sboinstall, sboupdate etc etc.
As a rule I check .SlackBuild file for compile flags - before I commit. I tend to change them flags occasionally. Means that in serious cases I also unpack source and check for all possible flags, run: ./configure --help .
NB! If using other partition - better mount it already in fstab with 'defaults' - to avoid that file manager (maybe) mounts it "safely" with 'noexec, nosuid' etc.

-- xdotool, wmctrl are helpers for certain things one can do in openbox menus.

-- xarchiver, xfce4-terminal, medit, spacefm+udevil, openbox (I want icons - dep: imlib2 and --enable-imlib2 \ in .SlackBuild too), obconf, tint2 (svn version, with launchers), conky (same with imlib2, but check .SlackBuild also for things you do not need - and '--disable'), compton, feh, gtk-nodoka-engine, various fonts, gksu.
There is no display manager and I startx (alias sx) from init 3.
As I copied all confs already earlier, my desktop is essentially finished.

## Second group, installs are already from terminal:
-- New kernel - if one feels like compiling one. The point - Slackwares' generic is really quite big and has very probably some useless stuff there. But, let's be honest - it doesn't matter - and whole compile-thing can be considered just a merry exercise of showing who is the boss.
Also do: lsmod and see if you have some pointless modules loaded (for example, I take down parallel-port, printer and some other things - either by blacklisting or in kernel).

-- firejail+firefox. "Firejail is a SUID security sandbox program..." - but take a look yourself, there is quite a lot of explaining available.

-- dotnew+meld+diffuse. No vim = no vimdiff. So I installed diffuse (sbo), and swapped every gvimdiff in /usr/bin/dotnew-gtk script to diffuse. Strange enough, it works.

-- mplayer+smplayer+volumeicon. The last one has to be ver .46 if staying with gtk-2, the later versions demand gtk-3.

-- qpdfviewer, FBReader, Geany. To mention - FBReader is nice lightweight epub and mobi reader. It remembers your last read page too.

## And, third - those things which come when really needed:
-- gparted, unetbootin, bleachbit, fslint, libreoffice, qbittorrent, galculator, gcolor2, calibre, convertlit, inkscape (gimp is in official ISO), sigil, clementine.

-- If slightly paranoid: rkhunter from sbo, and for quite nice simple tutorial looka here.
And others...