19

I use Ubuntu 21.04 and bumped exactly in the issue that seem to be solved long ago... under 14.04 version. But now it's back. I use Chrome 94.0.4606.61(Official Build)and when open "Save as..." dialog, I'd rather prefer to just hit Enter button to confirm my choice. Instead it's not on focus, so I have to move my cursor to the Save button and press it, since no hotkeys let me focus this dialogue.

Would appreciate is anybody could advice me how to fix it under Ubuntu 21.04.

username
  • 353
  • I see the same, in Google Chrome, Chromium flatpak and Firefox flatpak – vanadium Sep 30 '21 at 19:29
  • 1
    I see the same on my Ubuntu 18.04.6 LTS with MATE and deb-packaged Chromium. Reported a bug. Offered a bounty here to get a fix. – N0rbert Nov 01 '21 at 08:46
  • 6
    I'm not going to add this as an answer, because it's not - it's a workaround at best. That said, if you want to keep your hands on the keyboard and not grab the mouse, you can alt-tab to whatever that selects and then alt-tab to come back and you'll be in the save dialog. Hacky, but it keeps your hands down until they fix this – Feasoron Dec 08 '21 at 17:26
  • 2
    Another way of focusing the popup is to use the Alt+~ (tilde) window switch instead of the Alt+Tab app switch as suggested above. Of course that works best if you have a single Chrome window opened cause otherwise you will be switching between the actual Chrome windows instead. – simo Apr 24 '22 at 15:17
  • Also file upload dialog is out of focus and it always defaults to home folder. – Collector Apr 26 '22 at 10:28

4 Answers4

7

This unfortunately is a bug, probably with xdg-desktop-portal. It affects some applications in any containerized format, not only snap, but also flatpak and appimage. Mouse users will not quickly see it, but it is an enormous annoyance for keyboard oriented users. Firefox and Thunderbird (containerized) are affected too.

The bug is around for some time already, and is still not solved in the forthcoming Ubuntu 22.04. In the current Ubuntu LTS, 20.04,it works fine though.

Xorg users can use devilspie or devilspie2 to work around this bug (with credit here). A devilspie2 rule that will automatically focus xdg-desktop-portal dialogs is:

if ( get_application_name() == 'xdg-desktop-portal-gnome' and get_window_type() == 'WINDOW_TYPE_DIALOG' )
then
    focus_window();
end
vanadium
  • 88,010
1

Just to expand on @vanadium's answer, here are all the steps for the Ubuntu:

  1. Install devilspie2 with: sudo apt install devilspie2

  2. Add it to startup programs:

    • Open "Startup Applications" in Ubuntu
    • Press Add
    • As a Name enter Devilspie2
    • As a Command enter devilspie2 for it to to start at startup
    • Finish by clicking Add
  3. Create a script for devilspie2 to execute

    • vim ~/.config/devilspie2/devilspie2.lua

    • Paste in the following script:

       if ( get_application_name() == 'xdg-desktop-portal-gnome' and get_window_type() == 'WINDOW_TYPE_DIALOG' )
       then
           focus_window();
       end
      
  4. Log out and log in again for devilspie2 to start working


Works on Xorg, doesn't work on Wayland, credits to original answer on ubuntuforums

zx485
  • 2,426
J Asgarov
  • 111
0

Not a fix but a workaround: you can make it focus by holding alt+tab without releasing it, then you switch back with alt+shift+tab.

At least on Ubuntu 22.04.3

-3

"... anybody could advice me how to fix it under Ubuntu 21.04."

My apologies if this sounds trivial, but I think it is the only way:

  1. File a bug, and wait for someone to fix it.
  2. Fix it yourself.
  3. Try updating chrome.

Note: I don't see that behaviour with either of the following systems

  1. System 1: Ubuntu 20.04.3

    1.1. Chrome Version 94.0.4606.54 (Official Build) (64-bit)

    1.2. Chromium Version 95.0.4638.69 (Official Build) snap (64-bit)

  2. System 2: Lubuntu 20.04.3

    2.1. Chrome Version 95.0.4638.69 (Official Build) (64-bit)

I know this Ubuntu version was not quoted, but it is in-between 18.04.6 Mate and 21.04, which were quoted... it is quite strange.

  • 3
    Very useful answer. Bug is filed. It is reproducible even in 21.10. Not a way to get a bounty. – N0rbert Nov 01 '21 at 21:30
  • @N0rbert - That is my minimal contribution... evidence towards the fact that the bug is not that reproducible, I guess. Unless 21.04 / 21.10 / Mate 18.04.6 have something specifically different from 20.04.3. Others may give their experiences. – sancho.s ReinstateMonicaCellio Nov 02 '21 at 02:39
  • 2
    I'm still facing this issue. Is there any update on the bug? Or a link I can follow? – Sahil Dhoked Mar 15 '22 at 21:16