Improve clipboard guidance for KDE users
Some checks failed
Release App / release-app (push) Has been cancelled
Some checks failed
Release App / release-app (push) Has been cancelled
This commit is contained in:
2
PKGBUILD
2
PKGBUILD
@@ -6,6 +6,8 @@ arch=('x86_64')
|
|||||||
url='https://git.mshq.dev/AxiFisk/shinoa'
|
url='https://git.mshq.dev/AxiFisk/shinoa'
|
||||||
license=('custom:unknown')
|
license=('custom:unknown')
|
||||||
depends=('gcc-libs' 'glibc' 'ncurses' 'openssl' 'zlib')
|
depends=('gcc-libs' 'glibc' 'ncurses' 'openssl' 'zlib')
|
||||||
|
optdepends=('wl-clipboard: clipboard image paste on Wayland/Plasma'
|
||||||
|
'xclip: clipboard image paste on X11')
|
||||||
options=(!debug)
|
options=(!debug)
|
||||||
provides=('shinoa')
|
provides=('shinoa')
|
||||||
conflicts=('shinoa')
|
conflicts=('shinoa')
|
||||||
|
|||||||
@@ -50,6 +50,12 @@ Or start the app without env vars and enter them interactively when prompted.
|
|||||||
When entered in the TUI, the app now stores `api_id` and `api_hash` in
|
When entered in the TUI, the app now stores `api_id` and `api_hash` in
|
||||||
`~/.local/share/telegram-tui/config.json` and reuses them on later launches.
|
`~/.local/share/telegram-tui/config.json` and reuses them on later launches.
|
||||||
|
|
||||||
|
Clipboard image sending via `>paste` or `>clip` requires an external clipboard tool:
|
||||||
|
- `wl-clipboard` on Wayland or KDE Plasma Wayland
|
||||||
|
- `xclip` on X11
|
||||||
|
|
||||||
|
Klipper by itself is not a supported image backend for this feature.
|
||||||
|
|
||||||
To use Telegram test servers instead of production:
|
To use Telegram test servers instead of production:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -65,6 +65,36 @@ bool command_exists(const char *command) {
|
|||||||
return !trim_copy(resolved).empty();
|
return !trim_copy(resolved).empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_wayland_session() {
|
||||||
|
return get_env("XDG_SESSION_TYPE") == "wayland";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_kde_session() {
|
||||||
|
const std::string current_desktop = get_env("XDG_CURRENT_DESKTOP");
|
||||||
|
const std::string session_desktop = get_env("XDG_SESSION_DESKTOP");
|
||||||
|
return current_desktop.find("KDE") != std::string::npos ||
|
||||||
|
current_desktop.find("PLASMA") != std::string::npos ||
|
||||||
|
session_desktop.find("kde") != std::string::npos ||
|
||||||
|
session_desktop.find("plasma") != std::string::npos;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string missing_clipboard_tool_hint() {
|
||||||
|
if (command_exists("wl-paste") || command_exists("xclip") || command_exists("pngpaste")) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_wayland_session()) {
|
||||||
|
if (is_kde_session()) {
|
||||||
|
return " Install wl-clipboard. Klipper alone is not enough.";
|
||||||
|
}
|
||||||
|
return " Install wl-clipboard.";
|
||||||
|
}
|
||||||
|
if (is_kde_session()) {
|
||||||
|
return " Install xclip or wl-clipboard. Klipper alone is not enough.";
|
||||||
|
}
|
||||||
|
return " Install wl-clipboard or xclip.";
|
||||||
|
}
|
||||||
|
|
||||||
std::string clipboard_capture_command(const std::string &mime_type,
|
std::string clipboard_capture_command(const std::string &mime_type,
|
||||||
const std::string &destination_path) {
|
const std::string &destination_path) {
|
||||||
if (command_exists("wl-paste")) {
|
if (command_exists("wl-paste")) {
|
||||||
@@ -580,8 +610,8 @@ bool App::preview_clipboard_photo_message(std::int64_t chat_id, const std::strin
|
|||||||
std::optional<std::int64_t> reply_to_message_id) {
|
std::optional<std::int64_t> reply_to_message_id) {
|
||||||
const auto clipboard_type = detect_clipboard_image_type();
|
const auto clipboard_type = detect_clipboard_image_type();
|
||||||
if (!clipboard_type.has_value()) {
|
if (!clipboard_type.has_value()) {
|
||||||
status_line_ =
|
status_line_ = "Clipboard doesn't contain an image, or no clipboard tool is available." +
|
||||||
"Clipboard doesn't contain an image, or no clipboard tool is available.";
|
missing_clipboard_tool_hint();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user