Bug 174948 - Add setting to set/force a specific layout for specific programs
Summary: Add setting to set/force a specific layout for specific programs
Status: RESOLVED INTENTIONAL
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keyboard_layout (show other bugs)
Version: 4.1
Platform: Compiled Sources Unspecified
: NOR wishlist
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-12 13:45 UTC by Bernd Steinhauser
Modified: 2011-04-17 22:39 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernd Steinhauser 2008-11-12 13:45:44 UTC
Version:            (using Devel)
Installed from:    Compiled sources

First, this is sort of possible, when one sets, that the keyboard layout should be changed on a per-application basis.

But that is not exactly what I want.

The problem is, that I'm using a custom keyboard layout ( www.neo-layout.org for completeness ) which changes a lot of keys on the keyboard.
Since some applications are made explicitly for a specific keyboard layout (examples include mplayer or games like cannonball), or won't work with specific custom layouts (for example VirtualBox), I need to change the layout for these applications.
In my opinion, it would be best to introduce a setting for the keyboard layout in the "Specific settings for this window/program" menu, where one can also set, force a specific size or other properties.

This way it would be possible to set the layout for a program, even if one uses doesn't want to use the per-application switching rule for the keyboard layout.
Comment 1 Marcus Harrison 2008-11-13 14:29:12 UTC
MPlayer, VirtualBox and (I think) Cannonball aren't actually KDE applications. If you experience no problems with KDE applications while the keyboard is set to your layout, then you should post bug reports to these individual applications separately or use per-application switching: this probably isn't a KDE problem.
Comment 2 Bernd Steinhauser 2008-11-13 15:25:07 UTC
(In reply to comment #1)
> MPlayer, VirtualBox and (I think) Cannonball aren't actually KDE applications.
> If you experience no problems with KDE applications while the keyboard is set
> to your layout, then you should post bug reports to these individual
> applications separately or use per-application switching: this probably isn't a
> KDE problem.
> 
No, it's a KDE feature request. (Filed with Severity wishlist)
I've already submitted a bug to VirtualBox upstream, but that doesn't mean that this feature wouldn't be very useful for programs that have to be started with a specific layout.
Comment 3 Bernd Steinhauser 2008-11-16 12:38:22 UTC
Let me just add, that the VBox upstream bug has been closed with wontfix, since it can't be fixed, due to technical issues.
This leaves only the possibility to force VirtualBox to be started with a specific layout.
(Note: Changing the layout during runtime won't work, it has to be started with the layout it works with.)
Comment 4 Wolf Behrenhoff 2011-02-14 10:02:34 UTC
I support the wish. Let me add another usecase with KDE apps only. I am using German and US English layouts.

German layout because I write lots of mails in German, so in KMail I have German layout to be able to access umlauts. However for programming German layout is bad because {, }, [, ], \, ', and ; are not easy to access. So my Konsole and KDevelop always use US English layout. That is, if I type "ΓΌ", I get a "[". Very convenient.

However, I always have to switch to the specific layout. Would be a lot easier if one could switch the layout just once and let the application run under this layout until one decides otherwise.

And for other apps, especially media or game apps, they sometimes assume z is left of x (which isn't the case in German layout), thus the Stop, Pause, Play, ... keys which should lay in a row of keys next to each other (z,x,c,v, ...) are suddenly distributed all over the keyboard. For these apps switching to US layout usually cures this problem.
Comment 5 Andriy Rysin 2011-04-17 20:14:31 UTC
I think that most of this wish will be covered with using "By Application" switching mode. I am planning to push the fix for 52095 (No session management in kxkb - it doesn't remembers the last layout) so that all modes except "by window" will store the layout maps when exiting KDE (and restore session option is ON in System Settings/Startup & Shutdown).

Thus in By Application mode when the application is active you will switch the layout once and it'll be remembered unless you change the layout settings or unselect "restore previous session".

Unfortunately I won't have time any time soon to add "hardcoded layout per application". I will review the patch if somebody sends me one but from what I can tell this feature is quite intrusive both UI- and code-wise so I would be cautious about merging something like that. The codebase and feature count for the layout switcher grown quite a bit these days so the more and more I am thinking if the switcher does too much already (breaking the Unix-way) :)

As to the VirtualBox problem: I hate to put workarounds for bugs in other programs into the code (I must say there's quite a bit of ugliness in xkb to deal with already). But if it was a small tweak to fix some big annoyance I could consider it. The problem is - you mentioned that the VB should be *started* with predefined layout. And keyboard daemon has no control of application start - it only gets notified when the window gets active (which is too late) so in this case I don't think I could help here much. Seems like to address this problem you'll need to add a notification to keyboard daemon that some program is starting and then implement the whole feature I was talking about. And it does not look like it's worth it. 
I'd say for bugs in other programs like this you'd want a two-liner script instead, e.g.:
#/bin/bash
set_active_layout "ee"
VirtualBox

set_active_layout can be just a dbus call, e.g:
qdbus org.kde.keyboard /Layouts setLayout 'ee'

I would close this bug as fixed when 52095 is done but if you want to keep it open please let me know.
Comment 6 Bernd Steinhauser 2011-04-17 22:27:23 UTC
The problem with virtualbox has been fixed upstream, so my main motivation for this bug report is gone.

I still think, that it is a good idea to add a way to force a specific layout for a certain application, but if that is hard to achieve I won't mind if doesn't get implemented.
Comment 7 Andriy Rysin 2011-04-17 22:39:26 UTC
As restore layouts from session is implemented in 52095 and for special cases like VirtualBox above there's two-line fix provided in comment #5 (which is way better than hundreds lines of code and more UI options in keyboard daemon) I am closing this one as won't fix.