Implement GnomeClient primarily for Wayland

pull/39/head
Takashi Kokubun 2 years ago
parent 6547b4883d
commit 4b0e3ceb36
No known key found for this signature in database
GPG Key ID: 6FFC433B12EE23DD

444
Cargo.lock generated

@ -2,6 +2,25 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "async-io"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b"
dependencies = [
"concurrent-queue",
"futures-lite",
"libc",
"log",
"once_cell",
"parking",
"polling",
"slab",
"socket2",
"waker-fn",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.0.1"
@ -10,9 +29,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bitflags"
version = "1.3.2"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "bitvec"
@ -26,6 +45,18 @@ dependencies = [
"wyz",
]
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cache-padded"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]]
name = "cc"
version = "1.0.72"
@ -38,6 +69,47 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "concurrent-queue"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
dependencies = [
"cache-padded",
]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "enumflags2"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "evdev"
version = "0.11.3"
@ -46,7 +118,16 @@ checksum = "5fd975dc56c85a845d56e5dce9a8eb0b058e7a22441b3fb15fad324e0476e7c4"
dependencies = [
"bitvec",
"libc",
"nix",
"nix 0.23.1",
]
[[package]]
name = "fastrand"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2"
dependencies = [
"instant",
]
[[package]]
@ -55,6 +136,110 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e"
[[package]]
name = "futures"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-core"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7"
[[package]]
name = "futures-executor"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-io"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2"
[[package]]
name = "futures-lite"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"memchr",
"parking",
"pin-project-lite",
"waker-fn",
]
[[package]]
name = "futures-macro"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "futures-sink"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508"
[[package]]
name = "futures-task"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72"
[[package]]
name = "futures-util"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
"pin-utils",
"slab",
]
[[package]]
name = "getopts"
version = "0.2.21"
@ -80,6 +265,15 @@ dependencies = [
"hashbrown",
]
[[package]]
name = "instant"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
dependencies = [
"cfg-if",
]
[[package]]
name = "itoa"
version = "1.0.1"
@ -104,6 +298,21 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "memoffset"
version = "0.6.5"
@ -113,6 +322,29 @@ dependencies = [
"autocfg",
]
[[package]]
name = "nb-connect"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1bb540dc6ef51cfe1916ec038ce7a620daf3a111e2502d745197cd53d6bca15"
dependencies = [
"libc",
"socket2",
]
[[package]]
name = "nix"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.23.1"
@ -126,12 +358,68 @@ dependencies = [
"memoffset",
]
[[package]]
name = "once_cell"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]]
name = "parking"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
[[package]]
name = "pin-project-lite"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
[[package]]
name = "polling"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"
dependencies = [
"cfg-if",
"libc",
"log",
"wepoll-ffi",
"winapi",
]
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]]
name = "proc-macro-crate"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83"
dependencies = [
"thiserror",
"toml",
]
[[package]]
name = "proc-macro2"
version = "1.0.34"
@ -162,6 +450,12 @@ version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "serde"
version = "1.0.132"
@ -193,6 +487,17 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_repr"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_yaml"
version = "0.8.23"
@ -205,6 +510,28 @@ dependencies = [
"yaml-rust",
]
[[package]]
name = "slab"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
[[package]]
name = "socket2"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "swayipc"
version = "3.0.0-alpha.3"
@ -262,6 +589,15 @@ dependencies = [
"syn",
]
[[package]]
name = "toml"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
[[package]]
name = "unicode-width"
version = "0.1.9"
@ -274,6 +610,43 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "waker-fn"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
[[package]]
name = "wepoll-ffi"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
dependencies = [
"cc",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wyz"
version = "0.4.0"
@ -300,11 +673,13 @@ dependencies = [
"evdev",
"getopts",
"lazy_static",
"nix",
"nix 0.23.1",
"serde",
"serde_json",
"serde_yaml",
"swayipc",
"x11",
"zbus",
]
[[package]]
@ -315,3 +690,64 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]
[[package]]
name = "zbus"
version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5983c3d035549ab80db67c844ec83ed271f7c1f2546fd9577c594d34c1b6c85"
dependencies = [
"async-io",
"byteorder",
"derivative",
"enumflags2",
"fastrand",
"futures",
"nb-connect",
"nix 0.20.2",
"once_cell",
"polling",
"scoped-tls",
"serde",
"serde_repr",
"zbus_macros",
"zvariant",
]
[[package]]
name = "zbus_macros"
version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bce54ac7b2150a2fa21ad5842a7470ce2288158d7da1f9bfda8ad455a1c59a97"
dependencies = [
"proc-macro-crate 0.1.5",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "zvariant"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a68c7b55f2074489b7e8e07d2d0a6ee6b4f233867a653c664d8020ba53692525"
dependencies = [
"byteorder",
"enumflags2",
"libc",
"serde",
"static_assertions",
"zvariant_derive",
]
[[package]]
name = "zvariant_derive"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ca5e22593eb4212382d60d26350065bf2a02c34b85bc850474a74b589a3de9"
dependencies = [
"proc-macro-crate 1.1.0",
"proc-macro2",
"quote",
"syn",
]

@ -12,9 +12,12 @@ swayipc = { git = "https://github.com/k0kubun/swayipc-rs" }
lazy_static = "1.4.0"
nix = "0.23.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.8"
x11_rs = { package = "x11", version = "2.19.1", features = ["xlib"] }
zbus = "1.9.2"
[features]
gnome = []
sway = []
x11 = []

@ -0,0 +1,57 @@
use zbus::Connection;
use crate::client::Client;
pub struct GnomeClient {
connection: Option<Connection>,
}
impl GnomeClient {
pub fn new() -> GnomeClient {
GnomeClient {
connection: None,
}
}
fn connect(&mut self) {
let uid = 1000; // Assume a first nornal Linux user. TODO: Make it configurable
let address = format!("unix:path=/run/user/{}/bus", uid);
match Connection::new_for_address(&address, true) {
Ok(connection) => self.connection = Some(connection),
Err(e) => println!("GnomeClient#connect() failed: {}", e),
}
}
}
impl Client for GnomeClient {
fn supported(&mut self) -> bool {
self.connect();
self.connection.is_some()
}
fn current_application(&mut self) -> Option<String> {
self.connect();
let connection = match &mut self.connection {
Some(connection) => connection,
None => return None,
};
let code = "
const actor = global.get_window_actors().find(a=>a.meta_window.has_focus()===true)
actor && actor.get_meta_window().get_wm_class()
";
if let Ok(message) = connection.call_method(
Some("org.gnome.Shell"),
"/org/gnome/Shell",
Some("org.gnome.Shell"),
"Eval",
&(code),
) {
if let Ok((_actor, json)) = message.body::<(bool, String)>() {
if let Ok(wm_class) = serde_json::from_str::<String>(&json) {
return Some(wm_class)
}
}
}
None
}
}

@ -1,12 +1,3 @@
#[cfg(feature = "sway")]
mod sway_client;
#[cfg(feature = "x11")]
mod x11_client;
#[cfg(not(any(feature = "sway", feature = "x11")))]
mod null_client;
trait Client {
fn supported(&mut self) -> bool;
fn current_application(&mut self) -> Option<String>;
@ -15,7 +6,7 @@ trait Client {
pub struct WMClient {
name: String,
client: Box<dyn Client>,
called: bool,
supported: Option<bool>,
last_application: String,
}
@ -24,16 +15,25 @@ impl WMClient {
WMClient {
name: name.to_string(),
client,
called: false,
supported: None,
last_application: String::new(),
}
}
pub fn current_application(&mut self) -> Option<String> {
if !self.called {
self.called = true;
println!("application-client: {} (supported: {})", self.name, self.client.supported());
if let None = self.supported {
let supported = self.client.supported();
self.supported = Some(supported);
println!(
"application-client: {} (supported: {})",
self.name,
supported
);
}
if !self.supported.unwrap() {
return None
}
let result = self.client.current_application();
if let Some(application) = &result {
if &self.last_application != application {
@ -45,17 +45,30 @@ impl WMClient {
}
}
#[cfg(feature = "gnome")]
mod gnome_client;
#[cfg(feature = "gnome")]
pub fn build_client() -> WMClient {
WMClient::new("GNOME", Box::new(gnome_client::GnomeClient::new()))
}
#[cfg(feature = "sway")]
mod sway_client;
#[cfg(feature = "sway")]
pub fn build_client() -> WMClient {
WMClient::new("Sway", Box::new(sway_client::SwayClient::new()))
}
#[cfg(feature = "x11")]
mod x11_client;
#[cfg(feature = "x11")]
pub fn build_client() -> WMClient {
WMClient::new("X11", Box::new(x11_client::X11Client::new()))
}
#[cfg(not(any(feature = "sway", feature = "x11")))]
#[cfg(not(any(feature = "gnome", feature = "sway", feature = "x11")))]
mod null_client;
#[cfg(not(any(feature = "gnome", feature = "sway", feature = "x11")))]
pub fn build_client() -> WMClient {
WMClient::new("none", Box::new(null_client::NullClient))
}

@ -6,41 +6,34 @@ use swayipc::Connection;
pub struct SwayClient {
connection: Option<Connection>,
supported: Option<bool>,
}
impl SwayClient {
pub fn new() -> SwayClient {
SwayClient {
connection: None,
supported: None,
}
}
}
impl Client for SwayClient {
fn supported(&mut self) -> bool {
match self.supported {
Some(supported) => supported,
None => {
let mut supported = false;
if let Some(socket) = find_socket() {
if let Ok(unix_stream) = UnixStream::connect(socket) {
self.connection = Some(Connection(unix_stream));
supported = true;
}
fn connect(&mut self) {
if let None = self.connection {
if let Some(socket) = find_socket() {
if let Ok(unix_stream) = UnixStream::connect(socket) {
self.connection = Some(Connection(unix_stream));
}
self.supported = Some(supported);
supported
}
}
}
}
fn current_application(&mut self) -> Option<String> {
if !self.supported() {
return None;
}
impl Client for SwayClient {
fn supported(&mut self) -> bool {
self.connect();
self.connection.is_some()
}
fn current_application(&mut self) -> Option<String> {
self.connect();
let connection = match &mut self.connection {
Some(connection) => connection,
None => return None,
@ -57,7 +50,7 @@ impl Client for SwayClient {
// e.g. "/run/user/1000/sway-ipc.1000.2575.sock"
fn find_socket() -> Option<String> {
let uid = 1000; // Assume a first nornal Linux user
let uid = 1000; // Assume a first nornal Linux user. TODO: Make it configurable
if let Some(run_user) = read_dir(format!("/run/user/{}", uid)).as_mut().ok() {
while let Some(entry) = run_user.next() {
let path = entry.ok()?.path();

@ -2,20 +2,17 @@ use crate::client::Client;
use x11_rs::xlib;
pub struct X11Client {
// Both of them are lazily initialized
display: Option<*mut xlib::Display>,
supported: Option<bool>,
}
impl X11Client {
pub fn new() -> X11Client {
X11Client {
display: None,
supported: None,
}
}
fn display(&mut self) -> *mut xlib::Display {
fn connect(&mut self) -> *mut xlib::Display {
match self.display {
Some(display) => display,
None => {
@ -29,21 +26,14 @@ impl X11Client {
impl Client for X11Client {
fn supported(&mut self) -> bool {
match self.supported {
Some(supported) => supported,
None => {
let display = self.display();
let supported = if display.is_null() {
false
} else {
let mut focused_window = 0;
let mut focus_state = 0;
unsafe { xlib::XGetInputFocus(display, &mut focused_window, &mut focus_state) };
focused_window > 0
};
self.supported = Some(supported);
supported
}
let display = self.connect();
if display.is_null() {
false
} else {
let mut focused_window = 0;
let mut focus_state = 0;
unsafe { xlib::XGetInputFocus(display, &mut focused_window, &mut focus_state) };
focused_window > 0
}
}
@ -52,7 +42,7 @@ impl Client for X11Client {
return None;
}
let display = self.display();
let display = self.connect();
let mut focused_window = 0;
let mut focus_state = 0;
unsafe { xlib::XGetInputFocus(display, &mut focused_window, &mut focus_state) };

@ -1,7 +1,7 @@
use crate::config::action::Action;
use crate::config::actions::Actions;
use crate::config::key_press::KeyPress;
use crate::config::application::Application;
use crate::config::key_press::KeyPress;
use serde::de::{MapAccess, Visitor};
use serde::{Deserialize, Deserializer};
use std::collections::HashMap;

@ -1,10 +1,10 @@
pub mod action;
mod actions;
pub mod application;
mod key;
pub mod key_press;
mod keymap;
mod modmap;
pub mod application;
extern crate serde_yaml;

@ -1,5 +1,5 @@
use crate::config::key::parse_key;
use crate::config::application::Application;
use crate::config::key::parse_key;
use evdev::Key;
use serde::de::{value, Error, MapAccess, Visitor};
use serde::{Deserialize, Deserializer};

@ -1,7 +1,7 @@
use crate::client::{build_client, WMClient};
use crate::config::action::Action;
use crate::config::key_press::{KeyPress, Modifier};
use crate::config::application::Application;
use crate::config::key_press::{KeyPress, Modifier};
use crate::Config;
use evdev::uinput::VirtualDevice;
use evdev::{EventType, InputEvent, Key};

Loading…
Cancel
Save