Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-11-03 17:57:42

Mr.Bum
Member
Registered: 2020-01-05
Posts: 4

[SOLVED] Can we prevent an application of stealing the focus?

Hi all!

First, this is not a bug, and second the question is not exactly XFCE related. But I think XFCE might be the most straightforward way to solve it.

I often use audacity to split big files (5 hours an more) into small files. This process can take up 15 minutes, in which I would like to do some other stuff on my second screen. But each time Audacity has saved one of the small files (that's like every 30 to 60 secs), the corresponding dialogue "steals" the focus", which is especially annoying if you hit a key in that moment, that is recognized by audacity as a hotkey and that influences your saving process.

Now, can we configure XCFE in a way that a windows cannot get the focus unless by the user? I know there's an "always on top" option, so I thought having a "never get the focus unless permitted manually" option might not be completely out of reach.

And yes, I could have posted this in the Audacity forum. But when I searched there for "focus" I had the impression that there are already many (partially competing) requests regarding the general topic "focus", and I somehow had the feeling, that mine would not really make things easier.

Cheers,
Bum

Last edited by Mr.Bum (2020-11-09 18:27:05)

Offline

#2 2020-11-03 19:18:21

Signy
Member
Registered: 2020-10-20
Posts: 52

Re: [SOLVED] Can we prevent an application of stealing the focus?

It seems that there is more people interested in this topic.
I have troubles with focus stealing application as well. For example with Avidemux, when my script opens a lot of Avidemux windows an its small "progress windows" (like the window "Indexing..." etc.) are always stealing focus.
My settings are (on=checked):

  • Window manager > Focus

    • Focus follows mouse: on

    • New window focus: off

    • Raise on focus: off (I would guess that this should not affect focus stealing)

    • Raise on click: on (I would guess that this should not affect focus stealing)

  • Window Manager Tweaks > Focus

    • Activate focus stealing prevention: on

    • Honor standard ICCCM focus hint: off (although I did not found explanation of this, people usually suggest to disable this option)

    • When a window raises itself: Do nothing

  • Window Manager Tweaks > Placement

    • Minimum size of windows to trigger smart placement: Large

    • By default, place windows: At the center of the screen (choice "Under the mouse pointer" together with "Focus follows mouse: on" would probably steal focus by design).

And despite all these settings my focus is still stolen by some applications. Not by all of them - starting a Thunar window or a Mousepad window (by keyboard shortcut) does not steal focus).

For me optional behaviour would be:

  • If an application already has focus, its newly opened window should get focus.

  • If an application does not have focus, its newly opened window should raise above the application but without getting focus.

I am wondering if someone could improve the "Focus stealing prevention" so no window of an inactive application can steal focus.

BTW: there is a discussion How to forbid windows from stealing focus in XFce4? at https://unix.stackexchange.com - nothing from their advice helped me.

Offline

#3 2020-11-03 19:44:44

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: [SOLVED] Can we prevent an application of stealing the focus?

Hello and welcome Mr.B!

Can you post the output of this command?

xfconf-query -c xfwm4 -l -v | grep focus

Offline

#4 2020-11-05 09:41:22

Mr.Bum
Member
Registered: 2020-01-05
Posts: 4

Re: [SOLVED] Can we prevent an application of stealing the focus?

Hi, alcornoqui!

The command returns as follows:

xfconf-query -c xfwm4 -l -v | grep focus
/general/click_to_focus                  true
/general/focus_delay                     695
/general/focus_hint                      true
/general/focus_new                       true
/general/prevent_focus_stealing          false
/general/raise_on_focus                  true

I should note, that I am quite a Linux newbie (this of course includes XFCE), so I didn't know that command or how to alter these settings. Although Signy's post implies different, the prevent_focus_stealing option sounds promising. How can I set this to true?

Offline

#5 2020-11-05 10:43:34

Signy
Member
Registered: 2020-10-20
Posts: 52

Re: [SOLVED] Can we prevent an application of stealing the focus?

Mr.Bum wrote:

Although Signy's post implies different, the prevent_focus_stealing option sounds promising. How can I set this to true?

There is a Settings Manager (at least on Xubuntu),  "Window Manager Tweaks" inside it and  on "Focus" card is the setting "Activate focus stealing prevention".

BTW: I realized that it is not simple for the system to recognize, which focus overtaking is correct and which not.
In my case, when some Application opens just a simple status window it is clearly useless to take focus over.  And it is probably the applications fault.
But in case of settings I posted last time it turned out that sometimes is practical when newly opened window raises and takes focus - for example when I double click on a file in Thunar it is useful when its associated application (for example Mousepad) opens, raises and takes focus...

Offline

#6 2020-11-05 12:14:52

Mr.Bum
Member
Registered: 2020-01-05
Posts: 4

Re: [SOLVED] Can we prevent an application of stealing the focus?

Signy wrote:

There is a Settings Manager (at least on Xubuntu),  "Window Manager Tweaks" inside it and  on "Focus" card is the setting "Activate focus stealing prevention".

That would have been my guess as well, but either that feature is missing at my side, or the translation is somewhat misleading. But even when I look in the English documentation, I do not see any option that reads "prevent.....", or am I mistaken something?
xfwm4-settings-focus.png

Anyway I see I should give some additional info:

  • Ubuntu Studio 18.04

  • GNOME 3.28.2

  • 4.15.0-122-lowlatency

  • system language = German

If I forgot something essential, just let me know....

Last edited by Mr.Bum (2020-11-05 12:15:35)

Offline

#7 2020-11-05 12:19:11

Signy
Member
Registered: 2020-10-20
Posts: 52

Re: [SOLVED] Can we prevent an application of stealing the focus?

You are in the "Window Manager". What I mean is  "Window Manager Tweaks". If it is on your system, you can run it from command line as well:

xfwm4-tweaks-settings &

Offline

#8 2020-11-05 15:44:33

Mr.Bum
Member
Registered: 2020-01-05
Posts: 4

Re: [SOLVED] Can we prevent an application of stealing the focus?

Signy, you made my day!

Soooo, when looking at the correct location the prevent_focus_stealing option is there. Not only that, regarding my described Audacity problem it seems to work like a charm. I just made a very quick test, and found myself happily hacking away on my right screen while on the left the windows kept popping up but without stealing my focus smile

I should say that I set both options

  • activate focus stealing prevention

  • when a window raises itself --> do nothing

as the second simply sounded logical to me. All other options and settings I left at their defaults.

Thanks a lot, both of you!

Last edited by Mr.Bum (2020-11-05 15:49:04)

Offline

#9 2020-11-05 18:42:44

Signy
Member
Registered: 2020-10-20
Posts: 52

Re: [SOLVED] Can we prevent an application of stealing the focus?

You are welcome, Mr.Bum :-)
Good for you that this work for you. I am affraid that some application (Avidemux in my case) still avoid these settings.

Offline

#10 2020-11-06 16:01:12

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: [SOLVED] Can we prevent an application of stealing the focus?

Signy wrote:

I am afraid that some application (Avidemux in my case) still avoid these settings.

A bit off-topic, but I just found a thread related to Avidemux focus troubles, perhaps it helps...

Offline

#11 2020-11-07 07:47:42

Signy
Member
Registered: 2020-10-20
Posts: 52

Re: [SOLVED] Can we prevent an application of stealing the focus?

alcornoqui wrote:

A bit off-topic, but I just found a thread related to Avidemux focus troubles, perhaps it helps...

Thank you, I have not noticed this forum. Fortunately I do not experience that issue - my Avidemux behaves in that way only if I click inside the audio shift field (that with ms) to set audio shift.
But you have actually brought me an idea how to get focus back to the timeline after I had edited a time shift: just pressing Tab key moves focus from the audio shift field back to timeline. Thank you :-)

Offline

#12 2020-11-07 12:34:37

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: [SOLVED] Can we prevent an application of stealing the focus?

@Signy: That's great, glad to have helped!

@MrBum: Could you edit the post title and prepend [SOLVED] to it?

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.013 seconds, 7 queries executed - Memory usage: 587.71 KiB (Peak: 604.55 KiB) ]