mirror of
https://github.com/italicsjenga/muda.git
synced 2025-01-11 04:11:32 +11:00
feat: add libxdo
feature flag (#67)
* feat: add `libxdo` feature flag * Update .changes/linux-libxdo-feature-flag.md
This commit is contained in:
parent
6e59ec71f6
commit
7af4477896
5
.changes/linux-libxdo-feature-flag.md
Normal file
5
.changes/linux-libxdo-feature-flag.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"muda": "minor"
|
||||
---
|
||||
|
||||
Add `libxdo` feature flag, enabled by default, to control whether to link `libxdo` on Linux or not.
|
|
@ -10,6 +10,10 @@ repository = "https://github.com/amrbashir/muda"
|
|||
documentation = "https://docs.rs/muda"
|
||||
categories = [ "gui" ]
|
||||
|
||||
[features]
|
||||
default = [ "libxdo" ]
|
||||
libxdo = [ "dep:libxdo" ]
|
||||
|
||||
[dependencies]
|
||||
crossbeam-channel = "0.5"
|
||||
keyboard-types = "0.6"
|
||||
|
@ -32,7 +36,7 @@ features = [
|
|||
gtk = "0.16"
|
||||
gdk = "0.16"
|
||||
gdk-pixbuf = "0.16"
|
||||
libxdo = "0.6.0"
|
||||
libxdo = { version = "0.6.0", optional = true }
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
cocoa = "0.24"
|
||||
|
|
|
@ -12,6 +12,10 @@ muda is a Menu Utilities library for Desktop Applications.
|
|||
[`TranslateAcceleratorW`](https://docs.rs/windows-sys/latest/windows_sys/Win32/UI/WindowsAndMessaging/fn.TranslateAcceleratorW.html).
|
||||
See [`Menu::init_for_hwnd`](https://docs.rs/muda/latest/muda/struct.Menu.html#method.init_for_hwnd) for more details
|
||||
|
||||
### Cargo Features
|
||||
|
||||
- `libxdo` (enabled by default): Enables linking to `libxdo` which is used for the predfined `Copy`, `Cut`, `Paste` and `SelectAll` menu item.
|
||||
|
||||
## Dependencies (Linux Only)
|
||||
|
||||
`gtk` is used for menus and `libxdo` is used to make the predfined `Copy`, `Cut`, `Paste` and `SelectAll` menu items work. Be sure to install following packages before building:
|
||||
|
|
|
@ -946,6 +946,7 @@ impl PredefinedMenuItem {
|
|||
.set_accel(key, mods);
|
||||
item.connect_activate(move |_| {
|
||||
// TODO: wayland
|
||||
#[cfg(feature = "libxdo")]
|
||||
if let Ok(xdo) = libxdo::XDo::new(None) {
|
||||
let _ = xdo.send_keysequence(predefined_item_type.xdo_keys(), 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue