In today’s article in the FreeBSD Desktop series we will focus on the task bar configuration. I will describe how to setup the Tint2.

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Features

The task bar role served by the Tint2 will be providing the following features.

Launcher for the most used applications.

Show opened/minimized windows on each of four virtual desktops.

Indicate current used virtual desktop.

Provide system tray area for applications that depend on it.

Maximize selected window with [Right Mouse Button] .

. Close selected window with [Middle Mouse Button] .

. Focus selected window along with switching to the virtual desktop with that window using [Left Mouse Button] .

. Pass [Left/Middle/Right Mouse Button] events to Openbox window manager when not clicked on objects.

events to Openbox window manager when not clicked on objects. Provide buttons – – to set various CPU frequencies (from left Low/Medium/High).

– to set various CPU frequencies (from left Low/Medium/High). Provide button – – to set new random wallpaper.

Here is how such Tint2 task bar would look like in action, along with previously configured Dzen2 status bar.

Tint

The Tint2 is very light solution, one of the lightest that I know while being very nice looking and effective. A rare fusion of features 🙂

Here is the apps.tar.gz tarball with ~/.apps directory and files.

To achieve described earlier features we will use following Tint2 configuration ~/.tint2rc file.

% cat ~/.tint2rc # GENERAL # ------- rounded = 0 border_width = 0 background_color = #222222 100 border_color = #000000 0 # AUTOHIDE # -------- autohide = 0 strut_policy = minimum # TOOLTIP # ------- tooltip = 0 # MOUSE # ----- mouse_middle = close mouse_right = maximize_restore # PANEL # ----- wm_menu = 1 panel_items = LTS panel_monitor = 1 panel_position = top center panel_size = 0 16 panel_margin = 0 12 panel_padding = 0 0 16 panel_layer = bottom panel_background_id = 1 font_shadow = 0 # LAUNCHER # -------- launcher_padding = 0 0 1 launcher_background_id = 1 launcher_icon_size = 14 launcher_item_app = /home/vermaden/.apps/caja.desktop launcher_item_app = /home/vermaden/.apps/thunar.desktop launcher_item_app = /home/vermaden/.apps/nfs.desktop launcher_item_app = /home/vermaden/.apps/terminal.desktop launcher_item_app = /home/vermaden/.apps/geany.desktop launcher_item_app = /home/vermaden/.apps/leafpad.desktop launcher_item_app = /home/vermaden/.apps/pidgin.desktop launcher_item_app = /home/vermaden/.apps/thunderbird.desktop launcher_item_app = /home/vermaden/.apps/firefox.desktop launcher_item_app = /home/vermaden/.apps/chromium.desktop launcher_item_app = /home/vermaden/.apps/gimp.desktop launcher_item_app = /home/vermaden/.apps/galculator.desktop launcher_item_app = /home/vermaden/.apps/deadbeef.desktop launcher_item_app = /home/vermaden/.apps/transmission.desktop launcher_item_app = /home/vermaden/.apps/cpu_L.desktop launcher_item_app = /home/vermaden/.apps/cpu_M.desktop launcher_item_app = /home/vermaden/.apps/cpu_H.desktop launcher_item_app = /home/vermaden/.apps/wallpaper.desktop # TASKBAR # ------- taskbar_mode = multi_desktop taskbar_padding = 0 0 1 taskbar_background_id = 1 taskbar_active_background_id = 1 taskbar_distribute_size = 0 taskbar_name = 1 taskbar_name_font = Ubuntu Mono 8 taskbar_name_font_color = #aaaaaa 100 taskbar_name_active_font_color = #dd0000 100 # TASKS # ----- task_icon = 1 task_text = 0 task_width = 14 task_centered = 1 task_padding = 0 0 1 task_background_id = 0 task_active_background_id = 0 task_iconified_icon_asb = 40 0 0 # SYSTRAY # ------- systray = 1 systray_padding = 0 0 1 systray_icon_size = 14

Because the *.desktop files does not support relative directories for Icon parameter such as ‘ ~ ‘ so they need to be replaced before start at the ~/.xinitrc file (or ~/.xsession file), similarly like with the Openbox files.

We already had following Openbox ‘find/replace’ in the ~/.xinitrc file (or ~/.xsession file).

# ICONS WM sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" ~/.config/openbox/menu.xml sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" ~/.config/openbox/rc.xml

We will now add the ‘rules’ needed for Tint2 and the *.desktop files from the ~/.apps directory.

# ICONS TINT2 sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" ~/.tint2rc # ICONS APPS for I in ~/.apps/*.desktop do sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" "${I}" done

Here is how the Tint2 startup is configured in the ~/.xinitrc (or ~/.xsession file).

% grep tint ~/.xinitrc ~/scripts/__openbox_restart_tint2.sh &

Remember to put ‘ & ‘ at the end of the line.

Doas

To make most scripts work Your user ( vuk in the series) needs to be in the wheel , operator and network groups and doas(1) ( sudo(8) equivalent) needs to be installed and configured in the following way.

# pkg install doas # pw groupmod wheel -m vuk # pw groupmod operator -m vuk # pw groupmod network -m vuk # cat /usr/local/etc/doas.conf permit nopass :wheel as root permit nopass :network as root cmd ifconfig permit nopass :network as root cmd dhclient permit nopass :network as root cmd umount permit nopass :network as root cmd wpa_supplicant permit nopass :network as root cmd ppp permit nopass :network as root cmd killall args -9 dhclient permit nopass :network as root cmd killall args -9 wpa_supplicant permit nopass :network as root cmd killall args -9 ppp permit nopass :network as root cmd cat args /etc/ppp/ppp.conf permit nopass :network as root cmd /etc/rc.d/netif args onerestart permit nopass :network as root cmd tee args /etc/resolv.conf permit nopass :network as root cmd tee args -a /etc/resolv.conf

Scripts

There is only one new script added – ~/scripts/nfs.sh – all others are already published in previous *.tar.gz files. Its also optional because you may not have NAS resource which you would want to mount … or maybe you prefer SSHFS or CIFS share …

I also uploaded all the scripts as individual files to the GitHub page.

Make sure they remain executable.

% chmod +x ~/scripts/*

To make them work properly add ~/scripts into the ${PATH} variable at the beginning of the ~/.xinitrc file.

# PATH TO SCRIPTS export PATH=${PATH}:~/scripts

All of my scripts have this ‘mysterious’ line at the end. Its for statistics to check which scripts are run when (or it at all to which ones to delete).

echo '1' >> ~/scripts/stats/$( basename ${0} )

Thus it is needed to create the ‘stats’ directory.

% mkdir -p ~/scripts/stats

I have implemented that about two months ago and here are the results.

% wc -l ~/scripts/stats/* | sort -n 1 /home/vermaden/scripts/stats/__openbox_edit_wallpaper_gimp.sh 1 /home/vermaden/scripts/stats/__openbox_restart_lxpanel.sh 1 /home/vermaden/scripts/stats/__openbox_show_screenshot.sh 1 /home/vermaden/scripts/stats/__openbox_stats_top_cpu_KILL.sh 1 /home/vermaden/scripts/stats/__openbox_stats_top_mem_RENICE.sh 2 /home/vermaden/scripts/stats/__openbox_fullscreen.sh 2 /home/vermaden/scripts/stats/__openbox_stats_top_cpu_RENICE.sh 3 /home/vermaden/scripts/stats/__openbox_current_wallpaper.sh 5 /home/vermaden/scripts/stats/__openbox_cpufreq.sh 5 /home/vermaden/scripts/stats/__openbox_dmenu.sh 9 /home/vermaden/scripts/stats/__openbox_virtualbox.sh 10 /home/vermaden/scripts/stats/__openbox_delete_wallpaper.sh 13 /home/vermaden/scripts/stats/__openbox_restart_conky.sh 13 /home/vermaden/scripts/stats/__openbox_restart_plank.sh 17 /home/vermaden/scripts/stats/__openbox_lock.sh 20 /home/vermaden/scripts/stats/nfs.sh 21 /home/vermaden/scripts/stats/__openbox_freebsd_sound.sh 22 /home/vermaden/scripts/stats/__openbox_lock_zzz.sh 24 /home/vermaden/scripts/stats/__openbox_edit_screenshot.sh 24 /home/vermaden/scripts/stats/__openbox_restart_dzen2.sh 24 /home/vermaden/scripts/stats/dzen2-fifo.sh 28 /home/vermaden/scripts/stats/__openbox_restart_tint2.sh 32 /home/vermaden/scripts/stats/aero-snap.sh 48 /home/vermaden/scripts/stats/shot.sh 56 /home/vermaden/scripts/stats/network.sh 447 /home/vermaden/scripts/stats/xdotool.sh 599 /home/vermaden/scripts/stats/xterm.sh 1862 /home/vermaden/scripts/stats/random_wallpaper.sh 5923 /home/vermaden/scripts/stats/__conky_if_ip.sh 5942 /home/vermaden/scripts/stats/dzen2-update.sh 5956 /home/vermaden/scripts/stats/__conky_if_dns.sh 5956 /home/vermaden/scripts/stats/__conky_if_gw.sh 5959 /home/vermaden/scripts/stats/__conky_battery.sh 5966 /home/vermaden/scripts/stats/__conky_if_ping.sh 28359 /home/vermaden/scripts/stats/desktop-kill-shit.sh 67352 total

Of course I limited the output only to scripts that are available in this article, but be patient, more to come later 🙂

Dependencies

To make these scripts work and generally to make all this setup work we will need these dependencies.

tint2

caja

chromium

deadbeef

firefox

galculator

geany

gimp

leafpad

midori

pidgin

xterm

thunar

thunderbird

transmission-gtk

feh

xkill

To install them all with pkg(8) just type this line below.

# pkg install \ tint2 caja chromium deadbeef firefox galculator midori \ geany gimp leafpad xterm thunar xkill transmission-gtk \ thunderbird feh pidgin

We have finished making the ‘top’ bars. You now have all needed information in the status bar server by Dzen2 and all applications/windows covered by the Tint2 task bar.

EOF