Merge pull request #14 from olivierroy/support_older_ydotool
Support ydotool versions below v1.0.0
This commit is contained in:
@@ -361,7 +361,7 @@ clipboard_timeout = "3s"
|
|||||||
|
|
||||||
**Injection Backends:**
|
**Injection Backends:**
|
||||||
|
|
||||||
- **`ydotool`**: Uses ydotool (requires `ydotoold` daemon). Most compatible with Chromium/Electron apps.
|
- **`ydotool`**: Uses ydotool (requires `ydotoold` daemon for ydotool v1.0.0+). Most compatible with Chromium/Electron apps.
|
||||||
- **`wtype`**: Uses wtype for Wayland. May have issues with some Chromium-based apps (known upstream bug).
|
- **`wtype`**: Uses wtype for Wayland. May have issues with some Chromium-based apps (known upstream bug).
|
||||||
- **`clipboard`**: Copies text to clipboard only. Most reliable, but requires manual paste.
|
- **`clipboard`**: Copies text to clipboard only. Most reliable, but requires manual paste.
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ backends = ["ydotool"]
|
|||||||
|
|
||||||
**ydotool Setup:**
|
**ydotool Setup:**
|
||||||
|
|
||||||
ydotool requires the `ydotoold` daemon running and access to `/dev/uinput`:
|
ydotool requires the `ydotoold` daemon running (for ydotool v1.0.0+) and access to `/dev/uinput`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Start ydotool daemon (systemd)
|
# Start ydotool daemon (systemd)
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ func runInteractiveConfig() error {
|
|||||||
fmt.Println("⌨️ Text Injection Configuration")
|
fmt.Println("⌨️ Text Injection Configuration")
|
||||||
fmt.Println("--------------------------------")
|
fmt.Println("--------------------------------")
|
||||||
fmt.Println("Backends are tried in order until one succeeds (fallback chain):")
|
fmt.Println("Backends are tried in order until one succeeds (fallback chain):")
|
||||||
fmt.Println(" - ydotool: Best for Chromium/Electron apps (requires ydotoold daemon)")
|
fmt.Println(" - ydotool: Best for Chromium/Electron apps (requires ydotoold daemon for ydotool v1.0.0+)")
|
||||||
fmt.Println(" - wtype: Native Wayland typing (may fail on some Chromium apps)")
|
fmt.Println(" - wtype: Native Wayland typing (may fail on some Chromium apps)")
|
||||||
fmt.Println(" - clipboard: Copies to clipboard only (most reliable, needs manual paste)")
|
fmt.Println(" - clipboard: Copies to clipboard only (most reliable, needs manual paste)")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
@@ -665,7 +665,7 @@ func saveConfig(cfg *config.Config) error {
|
|||||||
clipboard_timeout = "%s" # Timeout for clipboard operations
|
clipboard_timeout = "%s" # Timeout for clipboard operations
|
||||||
|
|
||||||
# Backend explanations:
|
# Backend explanations:
|
||||||
# - "ydotool": Uses ydotool (requires ydotoold daemon running). Most compatible with Chromium/Electron apps.
|
# - "ydotool": Uses ydotool (requires ydotoold daemon running for ydotool v1.0.0+). Most compatible with Chromium/Electron apps.
|
||||||
# - "wtype": Uses wtype for Wayland. May have issues with some Chromium-based apps.
|
# - "wtype": Uses wtype for Wayland. May have issues with some Chromium-based apps.
|
||||||
# - "clipboard": Copies text to clipboard only (most reliable, but requires manual paste).
|
# - "clipboard": Copies text to clipboard only (most reliable, but requires manual paste).
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ func SaveDefaultConfig() error {
|
|||||||
# body = "🔧"
|
# body = "🔧"
|
||||||
|
|
||||||
# Backend explanations:
|
# Backend explanations:
|
||||||
# - "ydotool": Uses ydotool (requires ydotoold daemon running). Most compatible with Chromium/Electron apps.
|
# - "ydotool": Uses ydotool (requires ydotoold daemon running for ydotool v1.0.0+). Most compatible with Chromium/Electron apps.
|
||||||
# - "wtype": Uses wtype for Wayland. May have issues with some Chromium-based apps.
|
# - "wtype": Uses wtype for Wayland. May have issues with some Chromium-based apps.
|
||||||
# - "clipboard": Copies text to clipboard only (most reliable, but requires manual paste).
|
# - "clipboard": Copies text to clipboard only (most reliable, but requires manual paste).
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -25,18 +25,19 @@ func (y *ydotoolBackend) Available() error {
|
|||||||
return fmt.Errorf("ydotool not found: %w (install ydotool package)", err)
|
return fmt.Errorf("ydotool not found: %w (install ydotool package)", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if ydotoold is running by checking socket
|
// Only check socket if ydotoold exists
|
||||||
|
if _, err := exec.LookPath("ydotoold"); err == nil {
|
||||||
socketPath := y.getSocketPath()
|
socketPath := y.getSocketPath()
|
||||||
if socketPath == "" {
|
if socketPath == "" {
|
||||||
return fmt.Errorf("ydotoold socket not found - ensure ydotoold is running")
|
return fmt.Errorf("ydotoold socket not found - ensure ydotoold is running")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to connect to verify daemon is responsive
|
|
||||||
conn, err := net.DialTimeout("unix", socketPath, 500*time.Millisecond)
|
conn, err := net.DialTimeout("unix", socketPath, 500*time.Millisecond)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("ydotoold not responding at %s: %w", socketPath, err)
|
return fmt.Errorf("ydotoold not responding at %s: %w", socketPath, err)
|
||||||
}
|
}
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user