fix not working in systemd injection

This commit is contained in:
LeonardoTrapani
2025-10-10 19:27:52 +02:00
parent 8f94df4ad3
commit b437f575e6
4 changed files with 27 additions and 4 deletions
+10
View File
@@ -3,6 +3,7 @@ package injection
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"os/exec" "os/exec"
"strings" "strings"
"time" "time"
@@ -44,5 +45,14 @@ func checkClipboardAvailable() error {
return fmt.Errorf("wl-paste not found: %w (install wl-clipboard)", err) return fmt.Errorf("wl-paste not found: %w (install wl-clipboard)", err)
} }
// Check for Wayland environment
if os.Getenv("WAYLAND_DISPLAY") == "" {
return fmt.Errorf("WAYLAND_DISPLAY not set - clipboard operations require Wayland session")
}
if os.Getenv("XDG_RUNTIME_DIR") == "" {
return fmt.Errorf("XDG_RUNTIME_DIR not set - clipboard operations require proper session environment")
}
return nil return nil
} }
+10
View File
@@ -3,6 +3,7 @@ package injection
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"os/exec" "os/exec"
"time" "time"
) )
@@ -29,5 +30,14 @@ func checkWtypeAvailable() error {
return fmt.Errorf("wtype not found: %w (install wtype package)", err) return fmt.Errorf("wtype not found: %w (install wtype package)", err)
} }
// Check for Wayland environment
if os.Getenv("WAYLAND_DISPLAY") == "" {
return fmt.Errorf("WAYLAND_DISPLAY not set - wtype requires Wayland session")
}
if os.Getenv("XDG_RUNTIME_DIR") == "" {
return fmt.Errorf("XDG_RUNTIME_DIR not set - wtype requires proper session environment")
}
return nil return nil
} }
+3 -3
View File
@@ -1,6 +1,6 @@
# Maintainer: Leonardo Trapani <leo@trapani.sh> # Maintainer: Leonardo Trapani <leo@trapani.sh>
pkgname=hyprvoice-bin pkgname=hyprvoice-bin
pkgver=0.1.4 pkgver=0.1.5
pkgrel=1 pkgrel=1
pkgdesc="Voice-powered typing for Wayland/Hyprland" pkgdesc="Voice-powered typing for Wayland/Hyprland"
arch=('x86_64') arch=('x86_64')
@@ -25,8 +25,8 @@ source=(
"hyprvoice-${pkgver}::https://github.com/leonardotrapani/hyprvoice/releases/download/${pkgver}/hyprvoice-linux-x86_64" "hyprvoice-${pkgver}::https://github.com/leonardotrapani/hyprvoice/releases/download/${pkgver}/hyprvoice-linux-x86_64"
"hyprvoice.service" "hyprvoice.service"
) )
sha256sums=('340ef4adab613db6e7cbd7e021ec6cfc673079b94abb249c561ae14a8dfa8dbb' sha256sums=('c3b881864b126341f4b456be3422a4a76657019f750676ba4967776adc931fb8'
'8aa6e8a4895294f6645acc096dc84b69b7138dca23ff11e590eaa10c55dad391') 'bc4d17afa3a56fc50b09faae4cef9faf2a4ec7f08798b4098ba41ad78b02ab20')
install=hyprvoice.install install=hyprvoice.install
package() { package() {
+4 -1
View File
@@ -1,12 +1,15 @@
[Unit] [Unit]
Description=Hyprvoice voice-to-text daemon Description=Hyprvoice voice-to-text daemon
Documentation=https://github.com/leonardotrapani/hyprvoice Documentation=https://github.com/leonardotrapani/hyprvoice
After=pipewire.service After=pipewire.service graphical-session.target
Wants=pipewire.service Wants=pipewire.service
Requisite=graphical-session.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/hyprvoice serve ExecStart=/usr/bin/hyprvoice serve
ExecStartPre=/usr/bin/systemctl --user import-environment WAYLAND_DISPLAY XDG_RUNTIME_DIR
ExecStartPre=/bin/sh -c 'until [ -n "$WAYLAND_DISPLAY" ]; do sleep 0.1; done'
Restart=on-failure Restart=on-failure
RestartSec=5 RestartSec=5