You are using an obsolete web browser, or you have the page styles (CSS) disabled. You'll be able to access this site, but only a visually simplified version.

To Plasma theme creators [Lancelot]

Just to notify you of a big recent (committed today to trunk) change in Lancelot‘s theming.

The items in the lists (ActionListView widget) now shouldn’t have a background – the standard background from Plasma (widgets/viewitem.svgz – the one you see in krunner, folder view, SAL…) is being used.

The only item that is excluded from this rule is the [Group-ActionListView-Categories] which is used for sublist headers (like ‘Recent documents’ inside the Documents section).

If you don’t remove the backgrounds, both backgrounds will be shown on mouse hover.

In order to adapt your theme to the new change, edit all sections in theme.config file that match [Group-ActionListView-*] and replace:

background.type=svg
background.svg=...something...

with:

background.type=none

That’s all.

This change will become active in KDE 4.5 so you have a lot of time to adapt. Cheerio!

ZSH: bookmarks for cd (change directory) with completion

Another zsh-related post. This one is about defining a function that will allow you to define aliases for directories so that you don’t need to type something like ‘cd /this/is/a/very/long/path/in/the/filesystem’, but only ‘cdb some-alias’ (cdb – Change Directory with Bookmarks)

You can copy the script to your .zshrc, or create a zsh module as described in my previous post

# Module: Change directory with bookmarks
# path: bin/zsh-modules-available/cdbookmarks

function cdb_edit() {
  vim ~/.cdbookmarks
}

function cdb() {
  NewDir=`egrep "^$1<TAB_KEY>" ~/.cdbookmarks \
     | sed 's/^.*<TAB_KEY>//'`;
  echo cd $NewDir
  cd $NewDir
}

function _cdb() {
  reply=(`cat ~/.cdbookmarks | sed 's/<TAB_KEY>.*$//'`);
}

compctl -K _cdb cdb

That’s it. To define the bookmarks, create a file named ~/.cdbookmarks and the bookmarks in the following format:

<alias><TAB_KEY><path>

(no spaces)

Cheerio!

ZSH: Organize your .zshrc (should work for BASH as well)

My .zshrc became is too long to maintain it easily. I’ve decided to take the idea behind apache configuration in Debian and to split the .zshrc parts into easily maintainable subscripts. I have no idea if ZSH supports this in some vim-like form of .zsh/plugins, so I did it manually.

Preparation

The first step is to create the following directories

$ mkdir -p ~/bin/zsh-modules-available
$ mkdir -p ~/bin/zsh-modules-enabled

and to make a backup of old .zshrc like this

mv ~/.zshrc ~/.zshrc.backup

Setup

Open the ~/.zshrc file with your favourite editor, and copy the following into it (replacing the old code):

# Lines configured by zsh-newuser-install
source /etc/profile

for file in ~/bin/zsh-modules-enabled/*; do
source $file
done

Splitting up

Now, open .zshrc.backup file we created earlier and split it into modules which you’ll save into ~/bin/zsh-modules-available. You can split it up any way you want. For example, one of the modules could be the following:

# Module: Aliases
# path: bin/zsh-modules-available/aliases
alias :q=exit
alias la='ls -A --color'
alias rm='rm -i'
alias f='find -name '
alias df='df -h'
alias gg='ack-grep'

Enabling modules

The last step is to choose which modules you want enabled, and to specify the order of execution by prefixing the names with a number from 00 to 99.

Go to the ~/bin/zsh-modules-enabled and do the following for the modules you want to enable:

ln -s ../zsh-modules-available/module-name ./xx_module-name

That’s all folks

So, you have a easily maintainable ZSH module system – it is easy to add a new one, to delete an old one, easy to switch them off or on… You could even create functions such as zsh_module_enable/disbable, but I’m too lazy for that. (aka, if you do, please post them in the comments section and I’ll add them to the post.

Cheerio!

Nepomuk/Plasma Activities

Unfortunately, the activities service didn’t make it into 4.4 because there wasn’t enough time for it to pass on from kdereview into kdebase. This means that it was returned to playground for further processing. :)

The service has grown a bit and now it exposes a few more methods like linking activities to other nepomuk resources (documents, places…).

KIO

Since the service is not really useful by itself (from the user’s point of view), it will need some kind of UI. The main UI will be Plasma and the ZUI replacement which will be one of the Tokamak4′s main topics.

For the time being, I made a KIO slave shown in the picture above. It lists the defined activities and the resources linked to it. At the moment, the resources are limited to Applications, Documents, Places and Contacts (I’ve just realized that those are the same sections that are in Lancelot – completely by accident).

The data shown in the picture is a garbage data I put into nepomuk for the sake of testing (no sane person would put Thumbs.db in the work-related documents. :)

Lancelot forked

I have been really lazy to write anything here for quite some time now. I enjoyed the simple life away from the blogocube (it’s actually a dodecahedron, but blogododecahedron is a mouthful) but now I’m back.

I’ve realized that I’ve made more commits to Kickoff since Tokamak 3 (mostly related to krunner integration) than to Lancelot, which is just plain wrong. So, I decided to change that and do something I was planning for quite some time now – a huge refactoring.

Puck

The first thing I noticed is that the Puck (Plasma UI compiler used in Lancelot) modules are rather outdated and reflect Lancelot widgets from the old liblancelot and not the new liblancelot2 so it got updated. It was rather cool to see that despite that, Puck still worked and didn’t break the build.

Puck will eventually (read: when Qt Declarative UI becomes stable and Plasma-integrated) be abandoned and left to rust, but ATM it seems a not so near future.

libLancelot and libLancelot-datamodels

The next step was the /fork/ from the title. The data models (aka every item list you see in Lancelot) are moved into a separate library called liblancelot-datamodels. Both libraries (liblancelot and liblancelot-datamodels) now reside in kdeplasma-addons/libs so that they can be used by any other plasmoid (or any other program for that matter).

This is a way of saying “liblancelot is now considered stable enough to be used even outside of Lancelot”.

It wasn’t only a simple move from one place in SVN to another – both libs received some beautifying, fixing, got pretty meta-includes just like all KDE libs have, so you can now do a #include <Lancelot/ExtenderButton> instead of writing the full path of the header file…

Ok, I got bored writing, so this is all for this post now, expect a couple more soon – there are two top-secret projects that need revealing. Cheerio!

Improved KDE build scripts

For quite some time now (seems like forever) I’ve used a bit modified scripts from Techbase: Increased Productivity in KDE4 with Scripts to build KDE.

I don’t know why, but I’ve never even tried kdesvn-build script, so the things I’ll write here are maybe (probably) already present in it.

So, if you don’t use kdesvn-build, and have your system set up like it is explained in the above link, keep reading.

Important: I’m using ZSH, so the scripts here maybe need changing in order to be usable in BASH.

Environment

First of all, we need to add some global, environment variables. You should put this in the script for setting KDE4 variables (for example in .my-setup)

The first variable will be used by the build logging system. You should define it near the definitions of KDE_SRC and KDE_BUILD variables.


# build and src folders
# you might want to change these!
export KDE_BUILD=$KDE4ROOT/build
export KDE_SRC=$KDE4ROOT/src
export KDE_LOG=$KDE4ROOT/log

After this, we are making a variable that holds all the dirs to be included in the automatic build system.

# all build dirs
KDE_BUILD_DIRS=""

pushd $KDE_SRC > /dev/null
	for dir in                  \
		KDE/support         \
		KDE/libs            \
		KDE/pimlibs         \
		KDE/base            \
		KDE/plasmoids       \
		KDE/pim             \
		KDE/accessibility   \
		KDE/artwork         \
		KDE/bindings        \
		KDE/graphics        \
		KDE/multimedia      \
		KDE/network         \
		KDE/sdk             \
		KDE/utils           \
                                    \
		extragear/*         \
		other/*             \
		playground/*        \
	;
	do
		KDE_BUILD_DIRS="$KDE_BUILD_DIRS $dir";
	done

popd > /dev/null

export KDE_BUILD_DIRS

SVN/GIT Updates

Now, we can create two very easy functions for fetching the updates:

function updatesource {
    if [ -n "$1" ]; then
        cd $1;
    fi
    if [ -d .svn ]; then echo "Updating directory: $PWD (svn)"; svn up; fi
    if [ -d .git ]; then echo "Updating directory: $PWD (git)"; git pull; fi
}

function kdeup {
	# clearing update logs
	rm -fr $KDE_LOG/update.log
	rm -fr $KDE_LOG/*.update

	cd $KDE_SRC
	for dir in `echo $KDE_BUILD_DIRS`; do
		updatesource $KDE_SRC/$dir || echo "$dir (see $log_file) update failed" >> $KDE_LOG/update.log
	done
}

Notice that it reports errors in $KDE_LOG/update.log file.

Building

Now we define kdemake command which will build all the directories we specified in $KDE_BUILD_DIRS. Like kdeup, it logs the process. The main log is $KDE_LOG/build.log and each built directory has its own build log (the output of cmake + make).

function kdemake {
	# clearing all logs
	rm -fr $KDE_LOG/build.log
	rm -fr $KDE_LOG/*.build

	cd $KDE_SRC
	for dir in `echo $KDE_BUILD_DIRS`; do
		cd $KDE_SRC/$dir;
		echo "Building $dir";

		log_file=`echo $dir | sed 's/\//_/g'`;
		log_file="$KDE_LOG/$log_file.build";
		echo "Building $dir > $log_file" > $log_file;

		echo "Building $dir" >> $KDE_LOG/build.log
		( ( cmakekde || echo "FAILED: see $log_file" >> $KDE_LOG/build.log ) 2> /dev/stdout | tee -a $log_file )
	done
}

Debug builds

Sometimes you want to have a certain module build with debugging symbols – just replace the default cmakekde function with this one. It checks for the .debug file and if it exists, it builds that module with dbg symbols included.

function cmakekde {
	if test -n "$1"; then
		# srcFolder is defined via command line argument
		srcFolder="$1"
	else
		# get srcFolder for current dir
		srcFolder=`pwd | sed -e s,$KDE_BUILD,$KDE_SRC,`
	fi
	# we are in the src folder, change to build directory
	# Alternatively, we could just use makeobj in the commands below...
	current=`pwd`
	if [ "$srcFolder" = "$current" ]; then
		cb
	fi
	# to enable tests, add -DKDE4_BUILD_TESTS=TRUE to the next line.
	# you can also change "debugfull" to "debug" to save disk space.
        # added "nice make..." to allow the user to work on the box while
        # compiling
        # Note: To speed up compiling, change 'make -j2' to 'make -jx',
        #   where x is your number of processors +1

	if test -e ".debug"; then
		echo "debug yes" && \
		cmake "$srcFolder" -GKDevelop3 -DCMAKE_INSTALL_PREFIX=$KDEDIR \
			-DCMAKE_BUILD_TYPE=debugfull \
			&& nice make -j3 && make install
	elif test -e ".debug-release"; then
		echo "debug yes [release-debug]" && \
		cmake "$srcFolder" -GKDevelop3 -DCMAKE_INSTALL_PREFIX=$KDEDIR \
			-DCMAKE_BUILD_TYPE=RelWithDebInfo \
			&& nice make -j3 && make install
	else
		echo "debug no" && \
		cmake "$srcFolder" -GKDevelop3 -DCMAKE_INSTALL_PREFIX=$KDEDIR \
			-DCMAKE_BUILD_TYPE=release \
			&& nice make -j3 && make install
	fi
}

Checking logs

So, updating KDE is now a matter of calling kdeup and kdemake. The next thing to do is to create a watching mechanism (to put it in the command watch plasmoid for example).

The first script is outputting what is currently being built – something like this:

/opt/kde4trunk/log/KDE_support.build : [ 49%] Built target phonon

The code for this bash script is:

#!/bin/bash
WHATFILE=`ls -t1 /opt/kde4trunk/log/*.build | head -n 1`
WHAT=`grep '%' $WHATFILE | tail -n 1`
echo $WHATFILE ":" $WHAT

That’s all for today.

Happy everything!

For all of you who celebrate anything related to the fact that we are soon to be in have entered the year 2010, have a happy New Year, even happier holidays, and ecstatic life.

This year, the /card/ is rather simplistic (especially when compared to the last year’s), and looks like crap when zoomed out – so, please, click it and open the full resolution one. :)

Cheerio!

Happy everything 2010