You can sign up to get a daily email of our articles, see the Mailing List page!
Software that fixes a glaring problem with my Linux experience
Smilex commented on 21 June 2018 at 1:47 pm UTC

Hey! I'm curious if anyone else has this problem, and would benefit from this solution. I've switched DEs and terminals trying to get away from it. Most recently I switched from XFCE to DWM, but I moved back because it turns out DWM doesn't suffice for me anymore, and so I was reminded about this issue again. The solution I made was a real eureka moment for me, and I'm happier about it than I should be.
This is a cross post from

I've been using Linux for over a decade now, and I find myself always with several terminals open, each with something running in them that I cycle through.
A problem with desktop environments that have a window bar and support alt+tab, is that each terminal has the same icon, and so I have to cycle through all of them, until I get to the correct one.
I've tried solving this by using some terminal software that supports custom background colors, but XFCE changes the window screenshot, in the Alt+Tab window, to grayscale. Also this doesn't help with the XFCE panel.
I had the idea that these should all have distinct icons, with different silhouettes, so that they are easy and quick to recognise. But I figured this would be a good feature for a desktop environment, and that meant a lot of work.
That was until I came across a tool made by Paul Evans ( ), called xseticon ( ). The X protocol allows you to change the icon of other X windows, and that is what xseticon does. So all I had to do, was write a program that spawns a new terminal, then looks up the X window that was created for it. This was done by checking the PID of the window, which I got from the _NET_WM_PID atom, with the PID I got from the fork() call. Once I had the window ID, I found the PNG icon I wanted to use for this window, and then I called execv to xseticon, with the window ID and the PNG path. The way I select PNGs, is simply with a global array in the code, and then I create a file in $HOME/.icongiver that stores the previous iterator value. This way it simply iterates through the array, in modulus of the array size.
One weird issue that I never figured out, is that when the program was launched from the XFCE Application Finder, it wouldn't give the terminal an icon. I solved this by creating a script, with a /bin/bash bang that only calls my program. I then copied this script into /usr/local/bin.

I made these icons for myself to use. I'm not trained at this stuff, but it is an enjoyable activity. Mostly I just used the circle select tool in The Gimp, and the bucket tool to fill in color.
This is how it looks on the XFCE panel. The top most icon is what the default is. It's for a terminal that's been running since before I started this project.
And here it is in the Alt+Tab window,
This does not solve the problem entirely, but it does help. And for 2 hours of programming, I expect the effort to have been worth it.
It is only one file of C code, with system dependent variables being #define'd at the top.

Now I want to write about licensing. Of course this program is so simple that any license I put on it is merely symbolic; but I decided to go with GPLv3. And I'm worried where the community is going with MIT licenses, and the like. Worried, but not certain, that it is a very bad thing to do, which only propels the giants and furthers consolidation.
It is weird to think that the GPL wasn't a big part of why the FOSS community exists today. And most tech companies who have adopted open source, have done so because they have had to. This implies that open source has beaten proprietary, in at least some fields. What does it then mean to MIT license your software? To my mind, it means that corporations can freely kick and scream about change, and delay it as much as possible, but then do not have to pay anything when they lose. Because the software was MIT licensed, when the corporation makes the decision that they've lost, they just jump over at no cost and fight again.
I also recognise that the MIT license, and licenses similar to it, can benefit small business because the GPL gets in the way. But if my worry is founded on something, then I don't think the solution is to move to a MIT license. The solution might instead be to have multiple licenses, for different team sizes. However I also see that it isn't that simple, because a large corporation can create a smaller team that gets the MIT licensed version of a FOSS project, but then gives that back to the large corporation.
I realize that I'm hardly adding much to the conversion, but I like to use writing to learn what I think. And I do not have the answer, but I'm also not content with what is currently happening, and so I'd like to link to an article I read that touches on the subject -

The source code and the icon PNGs can be downloaded here -

nox commented on 21 June 2018 at 5:13 pm UTC

This is a neat solution to your problem!

Personally I've taken to assigning certain terminals to certain named workspaces. To me that's a cleaner way of resolving, in my eyes, the same issue.

prachi53 commented on 26 March 2019 at 9:26 am UTC

Great Post, Many thanks for sharing such nice and helpful info.

Xpander commented on 26 March 2019 at 9:40 am UTC

I used workspaces also, but recently i made a script to try a bit different approach since i always don't need maximized terminals.

it looks like this:

and script which is binded to my roccat keyboard easyshift+T:

mate-terminal --title=T1 --hide-menubar &
mate-terminal --title=T2 --hide-menubar &
mate-terminal --title=T3 --hide-menubar &
mate-terminal --title=T4 --hide-menubar
sleep 1
wmctrl -r "T1" -e 0,3,20,1277,695
wmctrl -r "T2" -e 0,1282,20,1277,695
wmctrl -r "T3" -e 0,3,771,1277,695
wmctrl -r "T4" -e 0,1282,771,1277,695

wmctrl is a wonderful thing

wvstolzing commented on 26 March 2019 at 11:17 am UTC

Looks great. I've got a few scripts that launch special purpose urxvt windows with predefined attributes and icon file, but it's all entered by hand. Though I've eventually settled on tmux title strings for telling apart terminal windows.

Xpanderwmctrl is a wonderful thing

Does anyone know whether something equivalent is in the works for pure Wayland? (wmctrl does work on XWayland IIRC).

slaapliedje commented on 26 March 2019 at 3:19 pm UTC

Use Tilix and set the title of the terminal so it's the program you're using

You just go into Preferences -> Appearance -> Default Session name, and you can customize it however you want.

Shmerl commented on 26 March 2019 at 8:16 pm UTC

For Wayland such thing would be very compositor specific.

The_Aquabat commented on 28 March 2019 at 8:22 am UTC

i get segmentation fault, does it work with konsole?? should I define the full path to my home directory?

Smilex commented on 14 July 2019 at 7:02 pm UTC

chancho_zombiei get segmentation fault, does it work with konsole?? should I define the full path to my home directory?

Sorry for the late reply, I never noticed the activity in this thread!
Anyway, the script is written to require knowledge of programming from the user. You'll have to look at the code and alter it to what works for you

You need to Register and Login to comment, submit articles and more.

Or login with...

Livestreams & Videos
Community Livestreams
  • Friday Livestream with Samsai
Popular this week
View by Category
Latest Comments
Latest Forum Posts