Monday, July 16, 2012

KDE Focus Stealing Prevention

I spent a little time last night trying to devise keystrokes which I could use in ebe to switch the current window rapidly.  Ebe has a total of 6 windows and finding the right one from a task bar can be a little tedious.

I first considered using the Windows key (Mod4 for Tkinter) along with a letter to switch.  I am already using Windows + S to start synaptic, so that may be a problem.  Then I considered briefly Alt.  I am already using Alt + D to bring up the Data menu which is a slight conflict.  I may eliminate the Data menu and use Alt, but for now I am using Shift+Control.

It took a little while before I learned that I needed to bind 'Shift-Control-C' instead of 'Shift-Control-c'.  I don't know why you have to tell Tkinter you want a capital letter when you have already specified Shift.  Perhaps I could specify 'Control-C' just as well.

These issues are fairly easy to cope with - the major problem was figuring out how to get the desired window to be on top of all the other windows.  I rapidly found the "lift" function and tried console.lift() to bring the ebe console window to the front.  It failed over and over.  I read quite a bit before I became suspicious that my window manager, KDE, was not allowing me to make the window be the top window.  That was indeed the case.

KDE uses an interesting "feature" called "focus stealing prevention".  Apparently some people are annoyed by applications which suddenly jump to the top.  I've used multiple window managers and I assume most of them do not have this KDE feature, but I haven't been plagued with applications popping up.  (Well a long time ago I used the MacOX, before X, to implement multitasking and had to bring processes to the front to receive messages.  That was a bit flashy, but off-track.)

I did discover a solution in KDE.  Using the KDE main menu follow "Settings" and select "System Settings".  This will bring up a settings window.  Using the "Window Behavior" option on the left you get a choice for "Focus stealing prevention level".  Setting this to "None" eliminates the problem.

Eliminating Focus Stealing Prevention

No comments: