"Bring to front" command line option

Have a suggestion for "Everything"? Please post it here.
Post Reply
ten
Posts: 4
Joined: Mon Jun 01, 2020 3:53 pm

"Bring to front" command line option

Post by ten »

I'm using Everything from context menus and other applications (Total Commander) with command line option "-focus-results". When a new window is opened it is only focused, but not on top of other windows, so I always have to click the icon in the task bar to bring it to front. Can you please add a command line option ("-bring-to-front") so the window is opened on top of all other windows? (like "-ontop", but only initially, not "always on top")

Thanks in advance
therube
Posts: 4979
Joined: Thu Sep 03, 2009 6:48 pm

Re: "Bring to front" command line option

Post by therube »

with command line option "-focus-results"
If you remove that, does focus work as expected?

(Selecting text in my browser window, & sending that "search" to Everything, using es: "protocol" handler, does bring the Everything window to focus, front, as expected.)
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: "Bring to front" command line option

Post by horst.epp »

I use Everything in many ways from Total Commander and context menus.
It always gets the focus and is on top without any special setting.
ten
Posts: 4
Joined: Mon Jun 01, 2020 3:53 pm

Re: "Bring to front" command line option

Post by ten »

therube wrote: Thu Sep 30, 2021 4:11 pm
with command line option "-focus-results"
If you remove that, does focus work as expected?
no, does not change anything, I tried all combinations of command line options, only way it works is with "-ontop", but then it stays on top.
ten
Posts: 4
Joined: Mon Jun 01, 2020 3:53 pm

Re: "Bring to front" command line option

Post by ten »

horst.epp wrote: Thu Sep 30, 2021 4:20 pm I use Everything in many ways from Total Commander and context menus.
It always gets the focus and is on top without any special setting.
are you working with multiple windows or re-use the window? When I re-use the window, it works as expected, but not if I open a new window for each new search and/or some Everything windows are already opened - then, depending on what was focused before it either opens on top or just opens in the background and only highlights the icon in the task bar.
horst.epp
Posts: 1447
Joined: Fri Apr 04, 2014 3:24 pm

Re: "Bring to front" command line option

Post by horst.epp »

ten wrote: Thu Sep 30, 2021 4:38 pm
horst.epp wrote: Thu Sep 30, 2021 4:20 pm I use Everything in many ways from Total Commander and context menus.
It always gets the focus and is on top without any special setting.
are you working with multiple windows or re-use the window? When I re-use the window, it works as expected, but not if I open a new window for each new search and/or some Everything windows are already opened - then, depending on what was focused before it either opens on top or just opens in the background and only highlights the icon in the task bar.
I'm working with multiple windows.
I get a new Everything windows from each TC context menu "Search this file name with Everything".
Eveything comes up with a new window and is on top without special settings.
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: "Bring to front" command line option

Post by void »

It sounds like Everything is failing to be set as the foreground window.
Does the Everything taskbar button flash when Everything should be in the foreground?

Please try enabling set_foreground_window_attach_thread_input:
  • In Everything, type in the following search and press ENTER:
    /set_foreground_window_attach_thread_input=1
  • If successful, set_foreground_window_attach_thread_input=1 is shown in the status bar for a few seconds.
This will force Everything to attach itself to the thread input of the current foreground window, which in turn will allow Everything to be set as the foreground window when it would otherwise fail.

Does the issue persist?
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: "Bring to front" command line option

Post by raccoon »

I want to suggest that Total Commander may be Always-On-Top, and that's why Everything can't get on top of it unless it too is Always-On-top.

Alternately, Microsoft implements a number of safeguards to prevent one application from stealing focus and z-order from another application. Depending on so many different factors (too many). Maybe it's this?
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: "Bring to front" command line option

Post by void »

Alternately, Microsoft implements a number of safeguards to prevent one application from stealing focus and z-order from another application. Depending on so many different factors (too many). Maybe it's this?
Yes, it sounds like this.
Enabling the set_foreground_window_attach_thread_input hack should bypass this safeguard.

It's odd Everything is not allowed to set itself as the foreground after Everything.exe is launched.
There is information available in the debug output which might help solve the issue.
It might be a user account boundary issue.

Please make sure Everything is installed correctly:
  • In Everything, from the Tools menu, click Options.
  • Click the General tab on the left.
  • Check Store settings and data in %APPDATA%\Everything
  • Uncheck Run as administrator.
  • Check Everything Service. (Please make sure this is tick-checked and not square-checked)
  • Click OK.
  • Exit Everything (right click the Everything tray icon and click Exit).
  • Restart Everything.
Please make sure the program that launches Everything.exe is also running as a standard user.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: "Bring to front" command line option

Post by raccoon »

Everything could always set itself to Always-On-Top for 1 second and remove it, especially if it's an Administrator or Service. If we want to get aggressive about it.
ten
Posts: 4
Joined: Mon Jun 01, 2020 3:53 pm

Re: "Bring to front" command line option

Post by ten »

void wrote: Thu Sep 30, 2021 11:00 pm Does the Everything taskbar button flash when Everything should be in the foreground?
no, it just sets the highlight background on the icon and unhides my auto-hidden taskbar
void wrote: Thu Sep 30, 2021 11:00 pm Please try enabling set_foreground_window_attach_thread_input:
  • In Everything, type in the following search and press ENTER:
    /set_foreground_window_attach_thread_input=1
  • If successful, set_foreground_window_attach_thread_input=1 is shown in the status bar for a few seconds.
This worked, great! Thanks!
void wrote: Fri Oct 01, 2021 1:14 am Please make sure Everything is installed correctly: ...
all was set correctly, I checked that before.

Thanks for the workaround. I looked a bit deeper into it, a reason for this might also be the current Logitech mouse drivers (G Hub 2021.9.7463), there is a focus bug when switching profiles, and I use different profiles for various applications. When auto-switching a profile, the two apps (previous and newly focused) both lose focus and after a short delay the activated window receives it. I have no idea what is focused in between, but this looks like a source for errors like that. I also tested with deactivated profiles and it seems the issue is still there, but only happens occasionally, with activated profiles all the time.
Post Reply