How To - Latest Tint2 Code and New Tint2 Additions

VastOne

Note : Everything included in this is now a part of the tint2 package maintained by Sebastian making this How To obsolete

This is a How To to build the latest version of Tint2 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 cmake

Note - 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-dev

Note - If you do not have svn installed you will need it.  Install it this way from terminal:

sudo apt-get install subversion-tools

Now for the build process:

From Terminal run this:

svn checkout http://tint2.googlecode.com/svn/trunk/ tint2-read-only

Download this file:

Tint2 Patch Files

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 install


Once 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/.tint2launchers

Then 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=true


You will note the use of this

Exec=launch pithos

launch 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 wmctrl
sudo apt-get install xdotool
Now create the launch file

gksudo gedit /usr/local/bin/launch

and 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 0


Save the file

next make the file executable

sudo chmod +x /usr/local/bin/launch


Freespace 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 = LFBSC

This 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.

Launchers

Freespace

Task Alignment

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

___________

My tint2 panel layout with Launchers

This is a link to my .tintlaunchers .desktop files that can be used as reference

This is a link to the icons I use for my tint2 layouts



tint2rctwo


#---------------------------------------------
# TINT2 CONFIG FILE
#---------------------------------------------

#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------

# Background definitions
# ID 1 for Panel
rounded = 0
border_width = 0
background_color = #ffffff 0
#border_color = #000000 70

# ID 2
rounded = 1
border_width = 1
background_color = #ffffff 0
#border_color = #D8D8D8 29

# ID 3
rounded = 1
border_width = 1
background_color = #ffffff 0
#border_color = #121212 89

# ID 4
rounded = 1
border_width = 1
background_color = #ffffff 0
#border_color = #ED2323 60

# ID 5
rounded = 0
border_width = 1
background_color = #ffffff 0
#border_color = #000000 0

# ID 6
rounded = 6
border_width = 0
background_color = #ffffff 0
#border_color = #D8D8D8 0

# ID 7
rounded = 3
border_width = 0
background_color = #ffffff 0
#border_color = #222222 89

# ID 8
rounded = 1
border_width = 1
background_color = #ffffff 0
#border_color = #888888 200

# ID 9
rounded = 6
border_width = 0
background_color = #ffffff 0
#border_color = #888888 20

# ID 10
rounded = 0
border_width = 0
background_color = #ffffff 0
#border_color = #888888 20


#---------------------------------------------
# PANEL
#---------------------------------------------
# wm_menu = 1
panel_items = L
panel_monitor = all
panel_position = bottom left
panel_size = 530 70
panel_margin = 0 0
panel_padding = 10 0
font_shadow = 0
panel_background_id = 0
panel_layer = top

#---------------------------------------------
# TASKBAR
#---------------------------------------------
taskbar_mode = single_desktop
taskbar_padding = 0 0 0
taskbar_background_id = 1

#---------------------------------------------
# TASKS
#---------------------------------------------
#task_icon = 1
#task_text = 0
#task_width = 40
#task_centered = 1
#task_padding = 2 2
#task_font = sans 7
#task_font_color = #ffffff 70
#task_active_font_color = #ffffff 85
#task_background_id = 3
#task_active_background_id = 2

#---------------------------------------------
# SYSTRAYBAR
#---------------------------------------------
#systray_padding = 4 2 3
#systray_background_id = 1

#---------------------------------------------
# CLOCK
#---------------------------------------------
#time1_format = %H:%M
#time1_font = sans 8
#time2_format = %A %d %B
#time2_font = sans 6
#clock_font_color = #ffffff 76
#clock_padding = 4 4
#clock_background_id = 1

#---------------------------------------------
# BATTERY
#---------------------------------------------
#battery = 0
#battery_low_status = 7
#battery_low_cmd = notify-send "battery low"
#bat1_font = sans 8
#bat2_font = sans 6
#battery_font_color = #ffffff 76
#battery_padding = 1 0
#battery_background_id = 0

# Launchers
launcher_icon_theme = LinuxLex-8
launcher_padding = 5 0 10
launcher_background_id = 9
launcher_icon_size = 70
launcher_apps_dir = /home/vastone/.tint2launchers/


#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = none
mouse_scroll_up = toggle
mouse_scroll_down = iconify


# Panel Autohide
autohide = 1
autohide_show_timeout = 0.0
autohide_hide_timeout = 0.0
autohide_height = 30
strut_policy = none


My Tint2 panel for Tasks



tint2rctasks

#---------------------------------------------
# TINT2 CONFIG FILE
#---------------------------------------------

#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------

rounded = 0
border_width = 1
background_color = #1A1A1A 0
# border_color = #000000 100

rounded = 0
border_width = 0
background_color = #ffffff 20
# border_color = #ffffff 20

rounded = 0
border_width = 0
background_color = #ffffff 0
# border_color = #ffffff 0

#---------------------------------------------
# PANEL
#---------------------------------------------
# wm_menu = 1
panel_items = T
panel_monitor = all
panel_position = bottom center
panel_size = 700 75
panel_margin = 0 0
panel_padding = 20 0
font_shadow = 0
panel_background_id = 0
panel_layer = top

#---------------------------------------------
# TASKBAR
#---------------------------------------------
taskbar_mode = single_desktop
taskbar_padding = 0 0 8
taskbar_background_id = 1

#---------------------------------------------
# TASKS
#---------------------------------------------
urgent_nb_of_blink = 8
task_icon = 1
task_text = 0
task_width = 75
task_align = center
task_centered = 1
task_padding = 0 0
task_font = sans 9
task_font_color = #ffffff 70
task_active_font_color = #ffffff 85
task_background_id = 3
# task_icon_asb = 100
task_active_background_id = 3

#---------------------------------------------
# SYSTRAYBAR
#---------------------------------------------
systray = 1
systray_padding = 18 0 0
systray_sort = ascending
systray_background_id = 0
systray_icon_size = 45

# Launchers
launcher_icon_theme = LinuxLex-8
launcher_padding = 0 0 0
launcher_background_id = 9
launcher_icon_size = 65
launcher_apps_dir = /home/vastone/.tint2launchers/
# launcher_item_app = /home/vastone/bin/iceweasel.desktop
# launcher_item_app = /home/vastone/bin/term.desktop
# launcher_item_app = /home/vastone/bin/pcmanfm.desktop
# launcher_item_app = /home/vastone/bin/xfce4-menu.desktop
# launcher_item_app = /home/vastone/bin/gmusicbrowser.desktop
# launcher_item_app = /home/vastone/bin/pithos.desktop
# launcher_item_app = /home/vastone/bin/xchat.desktop

#---------------------------------------------
# CLOCK
#---------------------------------------------
#time1_format = %H:%M
#time1_font = sans 8
#time2_format = %A %d %B
#time2_font = sans 6
#clock_font_color = #ffffff 76
#clock_padding = 4 4
#clock_background_id = 1

#---------------------------------------------
# BATTERY
#---------------------------------------------
#battery = 0
#battery_low_status = 7
#battery_low_cmd = notify-send "battery low"
#bat1_font = sans 8
#bat2_font = sans 6
#battery_font_color = #ffffff 76
#battery_padding = 1 0
#battery_background_id = 0


#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = none
mouse_scroll_up = toggle
mouse_scroll_down = iconify


# Panel Autohide
autohide = 1
autohide_show_timeout = 0.0
autohide_hide_timeout = 0.0
autohide_height = 30
strut_policy = none


My tint2 panel

tint2rc


#---------------------------------------------
# TINT2 CONFIG FILE
#---------------------------------------------

#---------------------------------------------
# BACKGROUND AND BORDER
#---------------------------------------------

rounded = 0
border_width = 1
background_color = #1A1A1A 0
# border_color = #000000 100

rounded = 0
border_width = 0
background_color = #ffffff 20
# border_color = #ffffff 20

rounded = 0
border_width = 0
background_color = #ffffff 0
# border_color = #ffffff 0

#---------------------------------------------
# PANEL
#---------------------------------------------
# wm_menu = 1
panel_items = TSL
panel_monitor = all
panel_position = top right
panel_size = 375 36
panel_margin = 0 0
panel_padding = 0 0
font_shadow = 0
panel_background_id = 0
panel_layer = top

#---------------------------------------------
# TASKBAR
#---------------------------------------------
taskbar_mode = single_desktop
taskbar_padding = 0 0 0
taskbar_background_id = 1

#---------------------------------------------
# TASKS
#---------------------------------------------
urgent_nb_of_blink = 8
task_icon = 1
task_text = 0
task_width = 35
task_centered = 1
task_padding = 2 2
task_font = sans 9
task_font_color = #ffffff 70
task_active_font_color = #ffffff 85
task_background_id = 3
# task_icon_asb = 100
task_active_background_id = 3

#---------------------------------------------
# SYSTRAYBAR
#---------------------------------------------
systray = 1
systray_padding = 18 2 3
systray_sort = ascending
systray_background_id = 0
systray_icon_size = 0

# Launchers
launcher_icon_theme = LinuxLex-8
launcher_padding = 2 2 2
launcher_background_id = 9
# launcher_icon_size = 32
# launcher_item_app = /home/vastone/bin/menu.desktop
# launcher_item_app = /home/vastone/bin/adesk-menu2.desktop
launcher_item_app = /home/vastone/bin/xfce4-menu.desktop
launcher_item_app = /home/vastone/bin/xfce4-session-logout.desktop
#---------------------------------------------
# CLOCK
#---------------------------------------------
#time1_format = %H:%M
#time1_font = sans 8
#time2_format = %A %d %B
#time2_font = sans 6
#clock_font_color = #ffffff 76
#clock_padding = 4 4
#clock_background_id = 1

#---------------------------------------------
# BATTERY
#---------------------------------------------
#battery = 0
#battery_low_status = 7
#battery_low_cmd = notify-send "battery low"
#bat1_font = sans 8
#bat2_font = sans 6
#battery_font_color = #ffffff 76
#battery_padding = 1 0
#battery_background_id = 0


#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = none
mouse_scroll_up = toggle
mouse_scroll_down = iconify


# Panel Autohide
autohide = 0
autohide_show_timeout = 0.0
autohide_hide_timeout = 0.0
autohide_height = 3
strut_policy = none


The debs for both x32 and x64 platforms are also attached to this message. Simply download your architect version and install it
VSIDO      VSIDO Change Blog    

    I dev VSIDO