Fixing Yakuake Shift+Tab


I upgraded my Ubuntu recently from 19.04 (Disco) to 19.10 (Eoan Ermine). At some point, I noticed that Shift+Tab stopped working in vim. I use nvim and have Tab configured to move to the next tab and Shift+Tab configured to move to the previous tab. Tab worked, Shift+Tab didn’t.

It’s two lines in my .vimrc:

nmap <Tab> :tabnext<enter>
nmap <S-Tab> :tabprev<enter>

Maybe it’s nvim?

At first, I suspected it’s a problem with nvim since I upgraded it as well and there is some old article mentioning how to get Shift+Tab to work. While old it provided some nice way of checking if vim has received the keys. If in insert mode you press Ctrl+V it tries to write the literal character of what you pressed into the file instead of interpreting it in some way. Again, for Tab it worked, and for Shift+Tab it didn’t.

Tmux?

Okay, so maybe the problem wasn’t with nvim. I run every shell session in tmux, so that’s another layer of the onion that could have broken this. But running nvim outside tmux also didn’t work.

I wanted to check if any console app gets Shift+Tab, I googled a bit and it turns out that mpv has a mode that shows if it received keys. I run mpv --idle --input-test --force-window and when in console it doesn’t get Shift+Tab, but when I do it in the app window it does.

Yakuake?

Another layer of the onion is Yakuake. Maybe the problem is that some app set Shift+Tab as a shortcut for something and that’s why it’s not delivered to the shell. I checked the Yakuake shortcuts and nothing used Shift+Tab. To test further I assigned Shift+Tab to some action in Yakuake and tried to trigger it. I got a popup saying:

Ambiguous shortcut detected - Yakuake

The key sequence 'Shift+Tab' is ambiguous. Use 'Configure Shortcuts' from the 'Settings' menu to solve the ambiguity. No action will be triggered.

I found this reddit post, but it didn’t say how to find the conflict. If it was a Yakuake shortcut, it should have asked me if I want to reassign when I was setting it up. It also can’t be a global shortcut, because then it wouldn’t have worked in the mpv app window.

Does it work in Konsole?

Yakuake is related to Konsole, so I checked if it worked there. It didn’t. But trying to define a Shift+Tab shortcut for some action in Konsole, Konsole told me that it’s already used for Next View Container. That was helpful, I removed the Shift+Tab shortcut for Next View Container and nvim finally received Shift+Tab in Konsole.

Unfortunately, it didn’t fix Yakuake. After some googling, I’ve found a bug report about Konsole ignoring Shift+Tab. It confirmed what I found through previous experimentation. More importantly, it linked to bug 402161 which was about Yakuake.

The fix

At the end of the bug report, someone commented that it’s fixed in the 19.08.0 release of Konsole. I had Konsole 19.04, so I needed to google for a way to upgrade.

It turns out that there’s a kubuntu-ppa/backports repository with newer versions of packages and it has the versions I need. Using it is as simple as:

sudo add-apt-repository ppa:kubuntu-ppa/backports 
sudo apt update
sudo apt install <package name>

After doing sudo apt update it told me that a lot of KDE packages are upgradeable, so I opted for a full KDE upgrade with:

sudo apt upgrade

I restarted the system and it Shift+Tab worked again in Yakuake.

The code

I was curious how this got fixed, so with a bit of git grep I finally found D17643. The fix is a bit of a coincidence, the whole containers thing got reworked and the shortcut was no longer needed. If you’re interested look for the deleted line with:

    collection->setDefaultShortcut(nextContainerAction, Qt::SHIFT + Qt::Key_Tab);

in src/ViewManager.cpp.