Topic: How To - Latest Tint2 Code and New Tint2 Additions
This is a How To to build the latest version of Tint2 (r646) and to add 3 patches that do:
launcher_apps_dir-v2.patch
Allows for a single directory instance to pull the .desktop Launchers that Tint2 uses, instead of having multiple launchers in the tint2 config.
freespace.patch
Adds new element called "FreeSpace" and the Function F. This element has no configuration can be enabled only via panel_items by letter "F" as in panel_items = TLFSB. It expands the next item in the panel across any free space helping especially with full length panels.
src-task-align.patch
Add task_align[ment] option with possible values: left, center, right. Allows you to align the tasks on the panel.
To get the latest Tint2 code and these patches, follow this:
Note - If you do not have CMake, the cross-platform open-source build system already, you will need to install it:
sudo apt-get install cmakeNote - You will also need to install the Tint2 dependencies. Install them from terminal this way:
sudo apt-get install libcairo2-dev libpango1.0-dev libglib2.0-dev libimlib2-dev libxinerama-dev libx11-dev libxdamage-dev libxcomposite-dev libxrender-dev libxrandr-dev libgtk2.0-devNote - If you do not have svn installed you will need it. Install it this way from terminal:
sudo apt-get install subversion-toolsNow for the build process:
From Terminal run this:
svn checkout http://tint2.googlecode.com/svn/trunk/ tint2-read-onlyDownload this file:
and extract the three files to ~/tint2-read-only
Next, run each of these in this order from terminal
cd tint2-read-only
patch -p0 < src-task-align.patch
patch -p0 < freespace.patch
patch -p0 < launcher_apps_dir-v2.patch
cmake -DCMAKE_INSTALL_PREFIX=/usr ./
make
sudo make installOnce completed, you will have the latest Tint2 code and the 3 patches installed.
Explanation of each new Component
For the Launchers, you will want to create a directory called .tint2launchers in your home directory and add this to your tint2 config:
launcher_apps_dir = /home/yourusername/.tint2launchersThen add any launchers you want to use to that directory.
To sort, you can name the .desktop files:
10-iceweasel.desktop
20-geany.desktop
30-thunar.desktop
40-xchat.desktop
etc etc etc
I would advise grabbing any launchers you want to use from /usr/share/applications and copying them to the .tint2launchers directory. This way you have easy access to edit or rename them without worrying about root.
You can also build your own .desktop file, here is a sample of one I have created.
05-pithos.desktop
[Desktop Entry]
Type=Application
Name=Pithos
Exec=launch pithos
Icon=/home/vastone/images/music.png
Categories=Audio;AudioVideo;
StartupNotify=trueYou will note the use of this
Exec=launch pithoslaunch is a bash script file that was created from one of my other How To's. It's purpose is so when you click on a launcher it iconifies what is already open and will not open multiple instances of the launched application.
Here is how to create and use launch
You will first need to install wmctrl and xdotool, the tools that are used to manage windows (opened apps)
sudo apt-get install wmctrlsudo apt-get install xdotoolNow create the launch file
gksudo gedit /usr/local/bin/launchand put the following code in:
#!/bin/bash
# This script acts as a launcher for apps that observes the following rules:
# 1. If the app is not running, then start it up
# 2. If the app is running, don't start a second instance, instead:
# 2a. If the app does not have focus, give it focus
# 2b. If the app has focus, minimize it
# Reference link: http://forum.xfce.org/viewtopic.php?id=6168&p=1
# there has to be at least one parameter, the name of the file to execute
if [ $# -lt 1 ]
then
echo "Usage: `basename $0` {executable_name parameters}"
exit 1
fi
BNAME=`basename $1`
# test to see if program is already running
if [ "`wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME`" ]; then
# means it must already be running
ACTIV_WIN=$(xdotool getactivewindow getwindowpid)
LAUNCH_WIN=$(ps -ef | grep "$BNAME" | grep -v grep | tr -s ' ' | cut -d' ' -f2 | head -n 1)
if [ "$ACTIV_WIN" == "$LAUNCH_WIN" ]; then
# launched app is currently in focus, so minimize
xdotool getactivewindow windowminimize
else
# launched app is not in focus, so raise and bring to focus
for win in `wmctrl -lx | tr -s ' ' | cut -d' ' -f1-3 | grep -i $BNAME | cut -d' ' -f1`
do
wmctrl -i -a $win
done
fi
exit
else
# start it up
$*&
fi
exit 0Save the file
next make the file executable
sudo chmod +x /usr/local/bin/launchFreespace is self explanatory and will need the F variable added to panel_items and play with it. A good example is having a full length tint2 config and using this:
panel_items = LFBSCThis would place the launchers on the left and the Systray, Battery and Clock all to the right.
Sort Tasks on a panel is the final patch. I happen to use a panel just for tasks and this works great to center them the way that I want them.
It adds
task_align = center, left or right (any ONE of these options will work)in the Tasks section of your tint2 config
The Source for all of these are at the Tint2 Google Code sites. I do not know the names of the individuals to give them credit, but you can go there and see their code and explanations about the setups.
Pictures and sample layouts are in the next post.
Contact me with any questions.
Good Luck!
UPDATE - 08 February 2012
Using the launchers the same as tasks is now doable now thanks to my friend ToZ. The launch file on the this page and instructions has been updated and now uses wmctrl and xdotool and:
This script acts as a launcher for apps that observes the following rules:
1. If the app is not running, then start it up
2. If the app is running, don't start a second instance, instead:
2a. If the app does not have focus, give it focus
2b. If the app has focus, minimize it
Last edited by VastOne (2012-01-17 00:45:12)