mirror of
https://github.com/house-of-vanity/swkb.git
synced 2025-07-06 02:54:06 +00:00
save lock file in XDG_CONFIG_DIR
This commit is contained in:
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -187,6 +187,7 @@ version = "0.2.4"
|
||||
dependencies = [
|
||||
"single-instance",
|
||||
"swayipc",
|
||||
"xdg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -245,3 +246,9 @@ 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 = "xdg"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
|
||||
|
@ -9,6 +9,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
swayipc = {version = "2.7.0", features = [ "event_stream"]}
|
||||
single-instance = "0.1.2"
|
||||
xdg = "*"
|
||||
|
||||
[packaging]
|
||||
depends = ["sway"]
|
||||
|
@ -16,7 +16,9 @@ fn get_input_id(c: &mut Connection) -> Vec<String> {
|
||||
}
|
||||
|
||||
fn main() -> Fallible<()> {
|
||||
let instance_a = single_instance::SingleInstance::new("swkb").unwrap();
|
||||
let xdg_dirs = xdg::BaseDirectories::new().unwrap();
|
||||
let file = xdg_dirs.place_config_file("swkb.lock").unwrap();
|
||||
let instance_a = single_instance::SingleInstance::new(file.to_str().unwrap()).unwrap();
|
||||
if !instance_a.is_single() {
|
||||
println!("only one instance of swkb at a time is allowed");
|
||||
std::process::exit(1);
|
||||
|
Reference in New Issue
Block a user