This commit is contained in:
Robin Appelman 2025-06-09 18:05:39 +02:00
commit d4ce62a42c
19 changed files with 2724 additions and 1988 deletions

1151
client/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -5,19 +5,20 @@ authors = ["Robin Appelman <robin@icewind.nl>"]
edition = "2021"
description = "shortcutd client library"
license = "MIT OR Apache-2.0"
repository = "https://github.com/icewind1991/shortcutd"
repository = "https://codeberg.org/icewind/shortcutd"
readme = "../README.md"
rust-version = "1.80.1"
[lib]
name = "shortcutd"
path = "src/lib.rs"
[dependencies]
futures = "0.3.28"
zbus = { version = "3.13.1", features = ["tokio"], default-features = false }
evdev-shortcut = { version = "0.1.4", default_features = false }
futures = "0.3.31"
zbus = { version = "5.7.1", features = ["tokio"], default-features = false }
zbus_macros = "5.7.1"
evdev-shortcut = { version = "0.1.5", default-features = false }
[dev-dependencies]
test-case = "3.1.0"
tokio = { version = "1.28.2", features = ["macros", "rt-multi-thread"] }
clap = { version = "4.3.4", features = ["derive"] }
tokio = { version = "1.45.1", features = ["macros", "rt-multi-thread"] }
clap = { version = "4.5.39", features = ["derive"] }

104
client/flake.lock generated Normal file
View file

@ -0,0 +1,104 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1742394900,
"narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=",
"owner": "ipetkov",
"repo": "crane",
"rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flakelight": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1749473391,
"narHash": "sha256-NkkS2d7OvXL9VJS1pae+txd43vUIMWtxlIBdsKCRtYg=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "22c8488d41c4e4678d32538f855bc05b3ba5142e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1749479717,
"narHash": "sha256-A/QfxOzt5cOLiz/Fn0xTQ3OGaJkIgq6KwnBv7AXRoG4=",
"path": "/home/robin/Projects/mill-scale",
"type": "path"
},
"original": {
"path": "/home/robin/Projects/mill-scale",
"type": "path"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1749237914,
"narHash": "sha256-N5waoqWt8aMr/MykZjSErOokYH6rOsMMXu3UOVH5kiw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "70c74b02eac46f4e4aa071e45a6189ce0f6d9265",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-25.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"flakelight": "flakelight",
"mill-scale": "mill-scale",
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs"
]
},
"locked": {
"lastModified": 1742697269,
"narHash": "sha256-Lpp0XyAtIl1oGJzNmTiTGLhTkcUjwSkEb0gOiNzYFGM=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "01973c84732f9275c50c5f075dd1f54cc04b3316",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

16
client/flake.nix Normal file
View file

@ -0,0 +1,16 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-25.05";
flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
};
mill-scale = {
# url = "git+https://codeberg.org/icewind/mill-scale";
url = "path:/home/robin/Projects/mill-scale";
inputs.flakelight.follows = "flakelight";
};
};
outputs = {mill-scale, ...}:
mill-scale ./. {};
}

View file

@ -1,20 +1,20 @@
use zbus::dbus_proxy;
use zbus::fdo;
use zbus_macros::proxy;
#[dbus_proxy(
#[proxy(
interface = "nl.icewind.shortcutd",
default_service = "nl.icewind.shortcutd",
default_path = "/register"
)]
trait Register {
pub(crate) trait Register {
async fn register(&self, shortcut: &str) -> fdo::Result<String>;
}
#[dbus_proxy(
#[proxy(
interface = "nl.icewind.shortcutd",
default_service = "nl.icewind.shortcutd"
)]
trait ShortcutSignal {
#[dbus_proxy(signal)]
pub(crate) trait ShortcutSignal {
#[zbus(signal)]
async fn triggered(&self, pressed: bool) -> fdo::Result<()>;
}