Have Window Rule Only Apply to First Instance of Program

Hi! Migrating from Windows to Linux/KDE and enjoying the productivity boost!

In continuing with this I’m experimenting with Window Rules, but can’t seem to figure out how to do something that might be obvious.

Basically, I only want my Rule to apply to the first instance of Konsole that I run; I don’t’ want any subsequent New Konsole Windows that I open to be affected by this rule. I know I can have Window Rules apply differently for child windows, but I’m not sure if opening a new instance of Konsole (for example, by right clicking on the icon and clicking Open a New Window) applies here.

I apologize if the answer is blatantly obvious, but I’m new here and need a clue!

Thank you!

1 Like

Hey bink,

Did you ever find a solution to this issue you posted? I’ve run into exactly the same issue and I can’t find a solution.

-jbodamer

1 Like

Unfortunately not. If you wind up with a solution, I’d love to hear about it.

If I find a way to make it work I’ll post back for sure. I’m retired now so I have plenty of cycles to spend on this. lol.

-jbodamer

1 Like

How about explicitly setting the title of the first instance with an escape sequence (“\033]0;your title\007“) when starting that session? Just make an alias or an icon for it with the proper instructions so they get run when firing up the first instance. All other instances can be started as usual. Don’t forget that konsole by default will ignore the shell’s title request, so you need to adjust this in konsole’s settings (set title format to %w). Once you get that set up you can define a window rule associated with the title you created. If I understand what you want correctly, this should achieve what you wish for.

1 Like

HdV,

You do understand what I’m trying to do and I ran across your suggestion doing research. This approach should work for most applications but will can be broken as applications change the way they handle window titles (not that this should happen very often). I believe there are other properties on the window that can be set to identify that window at startup/logon and I’m going to work on that for a bit longer.

Unfortunately Wayland is explicitly more secure than X11. Wayland 6.5 will largely focus on bug fixes and will not address window placement on specific virtual desktops at startup/logon.

I’ve not proven this personally, but everything I read say all of this will work on X11 using tools like wmctrl, qdbus and xdotool. I don’t really want to switch back to X so I’ll look at using your suggestion and see how it works.

Thanks for assisting.

Well, the OP specifically referred to Konsole and shells have been honouring escape sequences for decades now, so I made my suggestion going from that.

The fact that Wayland will not do many of the things I need for my setup is the reason I am still on X11. Too much of my workflow would be negatively impacted by switching over to Wayland as it is right now.

I have a solution that is working for me, on my Dell Inspiron 16, with the applications I wanted to start on system boot. It is hackish for sure as Wayland doesn’t provide necessary support to make this easy.

I can provide access to the code, setup instructions, etc. through a Github repo if anyone is interested. I worked with the Windsurf IDE (Cascade AI I believe) and went through revision after revision before arriving here.

I have been using this for over two months now and, aside from the occassional hicup, it is working on system startup and when run from a terminal window.

Let me know of any interest in this.

-jbodamer