Score:0

How to fix Ubuntu out of focus (dialog) windows for VSCode, (Chrome based) browsers, and Typora app and other apps?

tk flag

Apps like Visual Studio Code and Typora have the open and save dialog windows opened behind the programs. And in the Brave and Chrome browsers I use the save as dialog window is out off focus, so I have to use the mouse to click and focus the mouse before I can edit the filename for example.

This has been annoying me for quite some time.

If the workaround below works for you, please reply for what other programs it fixes this.

Score:0
tk flag

This is a Two step workaround for an annoying problem for the programs listed in the title and maybe for your app. Let me know if it worked and for which programs.

Note 1: When a app window is not full screen and small enough that that the open or save dialog window can fit in the empty space of my screen the dialog window will open next to the main window with the focus on the main window. The workaround works for me as long as the main window is maximized or large enough that the dialog window is forced to be displayed above it.

Step 1: Install gnome extension "Grand Theft Focus" to focus dialog windows for Visual Studio Code and ...:

https://extensions.gnome.org/extension/5410/grand-theft-focus/

Step 2: Use devilspie2 to focus dialog windows for (Chrome based) browsers and ... :

I'm using Brave browser.

Credits

From a terminal install devilspie2:

sudo apt install devilspie2

Create a rule by making the following file:

nano ~/.config/devilspie2/devilspie2.lua

Insert the following code:

if ( get_application_name() == 'xdg-desktop-portal-gnome' and get_window_type() == 'WINDOW_TYPE_DIALOG' )
then
    focus_window();
end

Save and exit the file.

If you get an error that the file of folder does not exist, just run devilspie2 once. It will create the config directory and exits because there are no rules and try to create the rule again.

Run devilspie from Alt+F2 to test if it works by opening (a) Chrome (based) Browser and pressing Ctrl + s. The dialog window should be in focus.

If all works add devilspie2 to your Startup Applications and it should work the next login.

Step 3: Remore %U from the desktop launcher of Typora:

Funny enough just removing %U from Typora's desktop launcher fixes the issues, probably in combination with one of the above steps. The desktop launcher now reads:

[Desktop Entry]
Version=1.1
Type=Application
Name=Typora
GenericName=Markdown Editor
Comment=a minimal Markdown reading & writing app. Change Log: (https://>
Icon=typora
Exec=typora
Actions=
MimeType=text/markdown;text/x-markdown;
Categories=Office;WordProcessor;
StartupNotify=true

These are the work around steps that fixed this annoying issue until the devs get around to the problem.

I hope it helps some of you.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.