Choose the clipboard's programs once, instead of in every function

Which pair of tools a session uses was being asked inside copy(), read(),
copy_bytes() and press(), four times, in a conditional each. A third desktop
means a third branch in each of them, and macOS is already open as a pull
request doing exactly that in a different style.

Wayland and X11 are two entries at the top of the file now, each naming its
programs and how to build a key press from them. The functions below take
whichever entry the session gets. Adding a desktop is an entry and a line in
desktop(), and it touches nothing else.

Two things fall out of it. The key press is checked against the same table on
both: xdotool was being handed the shortcut as typed, so ctrl+f13 was refused
on Wayland and passed through on X11. And a missing tool names the package to
install again, which the shared message had dropped.

The tests say the promises once and run them against both desktops, so a third
one inherits the list rather than needing a copy of it.
This commit is contained in:
yusufipk
2026-08-01 20:32:07 +07:00
parent 3d4c29c853
commit 0e6ec3aea9
4 changed files with 256 additions and 187 deletions
+6 -14
View File
@@ -101,30 +101,22 @@ TR = {
"Unexpected error: {error}": "Beklenmeyen hata: {error}",
# --- audio / paste errors -----------------------------------------
"pw-record not found. Is pipewire-audio installed?":
"pw-record bulunamadı. pipewire-audio kurulu mu?",
"Could not start recording: {error}": "Kayıt başlatılamadı: {error}",
"No audio recorder found. Install pulseaudio-utils or pipewire-audio.":
"Ses kayıt aracı bulunamadı. pulseaudio-utils ya da pipewire-audio kur.",
"Audio recorder stopped before receiving sound: {error}":
"Ses kayıt aracı veri alamadan kapandı: {error}",
"wl-copy not found. Install wl-clipboard.":
"wl-copy bulunamadı. wl-clipboard paketini kur.",
"Could not copy to clipboard: {error}": "Panoya kopyalanamadı: {error}",
"{tool} not found; clipboard copy is unavailable.":
"{tool} bulunamadı; panoya kopyalama kullanılamıyor.",
"{tool} not found. Install {packages}.":
"{tool} bulunamadı. {packages} paketlerini kur.",
"{tool} exited with code {code}.": "{tool} {code} koduyla çıktı.",
"{tool} not found, cannot paste automatically.":
"{tool} bulunamadı, otomatik yapıştırma yapılamıyor.",
"Could not run xdotool: {error}": "xdotool çalıştırılamadı: {error}",
"xdotool failed: {error}": "xdotool hatası: {error}",
"wl-copy exited with code {code}.": "wl-copy {code} koduyla çıktı.",
"ydotool not found, cannot paste automatically.":
"ydotool bulunamadı, otomatik yapıştırma yapılamıyor.",
"Unknown key: {key}": "Bilinmeyen tuş: {key}",
"Could not run ydotool: {error}": "ydotool çalıştırılamadı: {error}",
"ydotool failed: {error}\nIs ydotoold running? (systemctl --user status ydotool)":
"ydotool hatası: {error}\nydotoold çalışıyor mu? (systemctl --user status ydotool)",
"Could not run {tool}: {error}": "{tool} çalıştırılamadı: {error}",
"{tool} failed: {error}": "{tool} hatası: {error}",
"Is ydotoold running? (systemctl --user status ydotool)":
"ydotoold çalışıyor mu? (systemctl --user status ydotool)",
# --- api errors ----------------------------------------------------
"{service} API key is empty. Add it in Settings.":