Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make german-postfix work #63

Open
spiderbit opened this issue Feb 25, 2019 · 4 comments
Open

make german-postfix work #63

spiderbit opened this issue Feb 25, 2019 · 4 comments

Comments

@spiderbit
Copy link

With my Truly Ergonomic Keyboard and my Thinkpad with japanese thumbkeys I ditched using a o and u (dvorak) in command mode.

Mostly by binding "end" to insert mode and having a menu key mapped as prefix key. the Problem with german-postfix that if you press a o and u it does not immidiatly register that charakter but waits if you press e afterwards to create the corrospondend german umlauts: ä ö and ü.

also it creates with the sz -> ß. (hard s)

Now I bought a old netbook with a qwertz keyboard which I will use with the normal dvorak keymap not the german variant, because I am used to that.

So I still have the same problem that I don't have a seperate key for this german umlauts.

One alternative solution is german-prefix but it's pretty unreasonable to type "u for ü because it involves a keychord also its more natural to type in ue ae oe because that is what you would write if you would sit on a pc that could not create the german umlauts and germans would understand it.

Now the solution to have this functionality is to have input method german-postfix for insert-mode but not set it as default-input-mode.

So that you get in command mode the functionality you expect on that key without waiting for a second charakter.

This is less of a Bug but more a documentation I guess, but I think it's related and maybe some german fly-keys users apreciate it.

I add the solution as answer to this.

@spiderbit
Copy link
Author

That should do the trick:

(add-hook 'xah-fly-insert-mode-activate-hook
	  (lambda () (set-input-method "german-postfix")))

(add-hook 'xah-fly-command-mode-activate-hook 'deactivate-input-method)

hmm wonder why I never thought about that, I guess because I never relied on this keys for starting as M-x replacement or to activate insert mode. But could have used those for other commands.

@spiderbit
Copy link
Author

The next problems is still mixing that with exwm, I can't deny the X buffers the a or space keys because they have no insert / command mode technically.

Not sure there is a good solution for that I have a menu key on the right of the space key. I have to look into that later but maybe that's a missing exwm feature / bug.

@spiderbit
Copy link
Author

ok that seems to work:

(add-hook 'xah-fly-insert-mode-activate-hook
	  (lambda ()
	    (set-input-method "german-postfix")
	    (setq exwm-input-prefix-keys (remove ?a exwm-input-prefix-keys))
	    (setq exwm-input-prefix-keys (remove ?u exwm-input-prefix-keys))
	    (setq exwm-input-prefix-keys (remove ?\s exwm-input-prefix-keys))))

(add-hook 'xah-fly-command-mode-activate-hook
	  (lambda () (deactivate-input-method) 
	    (push ?\s exwm-input-prefix-keys)
	    (push ?u exwm-input-prefix-keys)
	    (push ?a exwm-input-prefix-keys)))

the only problem I see is that there is no different curser that indicates that you are in command mode, so you must be careful to mistakenly doing commands when you want to write some text in a X app.

@spiderbit
Copy link
Author

spiderbit commented Oct 3, 2020

(setq default-input-method nil)
(defun sb/setup-fly-keys-command-mode ()
  (deactivate-input-method)
  (push ?w exwm-input-prefix-keys)
  (push ?u exwm-input-prefix-keys)
  (push ?a exwm-input-prefix-keys)
  (push ?\s exwm-input-prefix-keys)
  (setq exwm-input-prefix-keys (remove 'home exwm-input-prefix-keys))
  (setq exwm-input-prefix-keys (remove 'end exwm-input-prefix-keys)))

(defun sb/setup-fly-keys-insert-mode ()
  (set-input-method "german-postfix")
  (setq exwm-input-prefix-keys (remove ?a exwm-input-prefix-keys))
  (setq exwm-input-prefix-keys (remove ?u exwm-input-prefix-keys))
  (setq exwm-input-prefix-keys (remove ?w exwm-input-prefix-keys))
  (setq exwm-input-prefix-keys (remove ?\s exwm-input-prefix-keys))
  (push 'home exwm-input-prefix-keys)
  (push 'end exwm-input-prefix-keys))

(add-hook 'change-major-mode-hook 'sb/setup-fly-keys-command-mode t)
(add-hook 'xah-fly-command-mode-activate-hook 'sb/setup-fly-keys-command-mode)
(add-hook 'xah-fly-insert-mode-activate-hook 'sb/setup-fly-keys-insert-mode)

That is a bit more sophisticated code for the problem, not sure if I need the "w" key in there or why I need it, what is more strange is that I have to add a change-major-mode-hook because the xah-fly-command-mode-activate-hook don't get triggered it seems if you change to a buffer and it starts in command mode.

I wonder if that is a bug or if that makes sense, but with change-major-mode-hook you can catch that, the point is again that I don't need german umlauts in command mode, and that a and u don't works because it waits if you press e afterwards for the german umlauts.

This would be btw probably applicable to the other 19 -prefix input-methods and maybe other asian input systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant