LinkedIn Sourceforge Twitter

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

Tint2 rocks

Posted on 2018-03-10 21:14:00 from Vincent in Open Bsd Tint2

After having developed my own version of PyPanel, I finally prefer Tint2 which offers lot of flexibility and, in fact, match all my requirements. Let me explain you how I'm using this small peace of code.


Context

It's a long time I have not post a page on my blog; sorry for that.

The context is in fact the same since several years now: OpenBSD + Openbox.
Those 2 systems match perfectly all my needs. I've recently looked at Mate but I definitively do not find added values for me.
I should look at Lumina which ha evolve a lot the last 12 months.

But regularly Openbox flexibility amaze me. We can do a LOT with the dynamic menus. Great idea !!!.

To my eyes, the only missing element to Openbox is a panel. So let's talk about how I'm using Tint2 since now +1 year on my daily laptop.

Tint2

Let's first how to install it

To install Tint2 on an OpenBSD machine, you have 2 possibilities: pkg_add or make

For sure, and thanks to the developers of the ports, the pkg_add tint2 command rocks and do all needed actions for you.

The other option is to compile it your self. The main advantage is to have the last development snapshot.
In such case, I'm doing the following list of commands:

cd /tmp
git clone https://gitlab.com/o9000/tint2.git
cd tint2
git checkout master
mkdir build
cd build
cmake ..
make -j4
doas make install

If you want to use an official release of Tint2 (other than the one used in the package), you can replace the command "git checkout master", but "git checkout 0.14.6" for example to get the release 0.14.6.

Tint2 config files

To start Tint2, you just have to type: tint2 in you command shell.

If you want to start it at each Openbox start, you can just add the following line to your autostart.sh script locate in ~/.config/openbox. Here after my complete autostart.sh file:

compton -cfCGb -l20 -t20
~/.config/openbox/wallpaper.sh &
tint2 &

The config files of Tint2 are all located in ~/.config/tint2.

To facilitate their tuning, you can use a dedicated tool called: tint2conf. This will allow you to change colors, sizes, ... very easily.

My Tint2 configs

I'll not describe here all Tint2 parameters. I propose you to try them and to read the documentation provided with Tint2.

I'll just explain what I do with Tint2. I hope this will shows you why I find this appliction very good.

Generalities

Except the colors, buttons, ... you have a wonderful concept called: executor.

This executor allow you to execute a small script (shell, perl, python, ...) when you click on a it or at regular intervals.

To use this feature, you first have to go in the "Panel Items" of tint2conf. There, you have, on the right column, the "Executor" element. You just have to select it and click the "<-" (left arrow) to copy this element on the left column. Once you do that, you will see a new tab appearing at the bottom of your tint2conf screen. You can add as many "executor" as you want. Each of them will receive a number.

You can place your "executor" where you want on your panel by selecting the one you want to move and then on clicking on "up" or "down arrow. If you want to remove it, just select it and click on "->".

Once this disposition aspect is done, you can go to the "Executor" tab just created. All the magic is located there. Just remember well which number is for what.

Here after some explanation of what you can find in the "Executor" tab:

  • In the "Command" box, you just have to put the full path to your script. In all my cases I will explain here after, this script give a full path to an icon. This is the icon you will see on your panel.

  • The "interval" box, allow you to mention at which frequence, in seconds, the "Command" must be executed. Up to you to balance the load and the reactivity you want to have. Indeed, is several of my scripts the icons change, so a reactivity is quite important for me. In general an interval of 2 or 3 seconds is perfect.

  • Since explained, my scripts provide a path to an icon, so I have to check the value "Show icon". In most of the cases, I also check the "Cache Icon". For sure if your script generate, on the fly, the icon you cannot check this value.

  • Do not forget to adapt the "icon width" and/or "icon height" to make sure the icon will not jeopardize your panel. This is a little bit annoying that the size is defined in pixels and not in percentage of the panel size, but you have to make sure that you icon size is compatible with your panel size (lower). You do not have to put both values; if only one is defined, the other will be calculated in order to keep the original ratio of your icon.

  • Sometimes you will have to fill-in the "Left click command" or "right click command" or "wheel scroll up command" ... depending of what you want to do with you icon.

Screen shots





NFS icon

In my case, NFS is my preferred choice to access my shared folders. But the biggest problem with NFS is when it's mounted and you move away from the network environment where NFS is existing. I've tried automount with a mitigated success, so I've developed this small icon which allow me to mount my NFS folder via a simple click.

This icon also allow me to see which application is relying on NFS hanks to the command "fstat".

I'll describe this script in detail in the following days.

Network icon

This executor allow me to see if I'm connected via Wifi or via cable.

In case of Wifi, I'm able to see the strength of the signal.

By clicking on it, I can see the nwid on which I'm connected.

I'll describe this script in detail in the following days.

sound icon

This executor allow me to see if the sounds is muted or not. It allow me to see at which level the sounds is defined.

If I click on it, it toggle the mute on or off.

If I do a "wheel scroll" on it it will increase or decrease the level of sound

I'll describe this script in detail in the following days.

battery icon

My battery executor display an icon representing the battery status (nothing special). It display also when the cable is connected.

If I click on the icon, I can get some detail provided by the command "apm", like the time remaining.

I'll describe this script in detail in the following days.



1, 1
displayed: 1207



What is the first letter of the word Moon?