Fix keyboard input on Wayland: use ydotool instead of wtype

- Replace wtype with ydotool as primary keyboard input tool on Wayland
  (wtype had a bug sending ESC instead of correct keys to GUI apps)
- Use 'ydotool type' command for better Wine/game compatibility
- Automatically start ydotoold daemon on startup if available
- Keep wtype as fallback for backward compatibility
- Improve keyboard action support for games running in Wine
This commit is contained in:
Maksim Totmin
2026-06-17 22:19:54 +07:00
parent 2a23a038e3
commit d171c26755
2 changed files with 26 additions and 2 deletions
+13
View File
@@ -232,6 +232,9 @@ func deckBuiltinAction(action string, deck *Deck) error {
func keyboardTool() string {
if os.Getenv("WAYLAND_DISPLAY") != "" {
if _, err := exec.LookPath("ydotool"); err == nil {
return "ydotool"
}
if _, err := exec.LookPath("wtype"); err == nil {
return "wtype"
}
@@ -264,6 +267,8 @@ func execKeyboard(a *config.Action) error {
}
switch tool {
case "ydotool":
return execYDOTool(keys)
case "wtype":
return execWType(parts)
case "xdotool":
@@ -300,6 +305,14 @@ func execXDoTool(keys string) error {
return cmd.Run()
}
func execYDOTool(keys string) error {
// Use 'type' command instead of 'key' for better compatibility with Wine/games on Wayland
cmd := exec.Command("ydotool", "type", keys)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
func (pm *PageManager) PageNames() []string {
pm.mu.RLock()
defer pm.mu.RUnlock()