10 Commits

Author SHA1 Message Date
4bc061eb8f Update README.md 2021-06-15 22:27:30 -07:00
90c18381ea Update and rename README to README.md 2021-06-15 22:26:39 -07:00
829b0ffab5 Delete tmp_builder.py 2021-05-29 15:40:33 -07:00
94050d06f0 Merge pull request #1 from treeshateorcs/master
Updates
2021-02-17 10:00:46 +03:00
tho
c901d00e36 save lock file in XDG_CONFIG_DIR 2020-11-15 05:34:34 -08:00
tho
73c12cdcba rename instance 2020-11-15 00:47:40 -08:00
tho
313ba1170f only allow one instance 2020-11-15 00:22:04 -08:00
tho
5f90e39a62 restore deleted unwrap_or_else 2020-11-14 10:34:01 -08:00
tho
b4c31e005b fix working with qt programs 2020-11-14 10:29:15 -08:00
ab127dc580 Fix IPC window tree processing. 2020-08-21 15:42:58 +10:00
6 changed files with 58 additions and 579 deletions

View File

@ -1,7 +1,7 @@
# Maintainer: Alexandr Bogomyakov (ultradesu) <ab@hexor.ru> # Maintainer: Alexandr Bogomyakov (ultradesu) <ab@hexor.ru>
pkgname=swkb pkgname=swkb
pkgver=0.2.3 pkgver=0.2.4
pkgrel=1 pkgrel=1
pkgdesc="swkb" pkgdesc="swkb"
url="https://github.com/house-of-vanity/swkb.git" url="https://github.com/house-of-vanity/swkb.git"

469
Cargo.lock generated
View File

@ -15,70 +15,6 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
[[package]]
name = "async-attributes"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd3d156917d94862e779f356c5acae312b08fd3121e792c857d7928c8088423"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "async-channel"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee81ba99bee79f3c8ae114ae4baa7eaa326f63447cf2ec65e4393618b63f8770"
dependencies = [
"concurrent-queue",
"event-listener",
"futures-core",
]
[[package]]
name = "async-std"
version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00d68a33ebc8b57800847d00787307f84a562224a14db069b0acefe4c2abbf5d"
dependencies = [
"async-attributes",
"async-task",
"crossbeam-utils",
"futures-channel",
"futures-core",
"futures-io",
"futures-timer",
"kv-log-macro",
"log",
"memchr",
"num_cpus",
"once_cell",
"pin-project-lite",
"pin-utils",
"slab",
"smol",
"wasm-bindgen-futures",
]
[[package]]
name = "async-task"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3"
[[package]]
name = "atomic-waker"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
[[package]]
name = "autocfg"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
[[package]] [[package]]
name = "backtrace" name = "backtrace"
version = "0.3.50" version = "0.3.50"
@ -93,70 +29,12 @@ dependencies = [
"rustc-demangle", "rustc-demangle",
] ]
[[package]]
name = "blocking"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2468ff7bf85066b4a3678fede6fe66db31846d753ff0adfbfab2c6a6e81612b"
dependencies = [
"async-channel",
"atomic-waker",
"futures-lite",
"once_cell",
"parking",
"waker-fn",
]
[[package]]
name = "bumpalo"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "cache-padded"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
[[package]]
name = "cc"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "0.1.10" version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "concurrent-queue"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83c06aff61f2d899eb87c379df3cbf7876f14471dcab474e0b6dc90ab96c080"
dependencies = [
"cache-padded",
]
[[package]]
name = "crossbeam-utils"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
"autocfg",
"cfg-if",
"lazy_static",
]
[[package]]
name = "event-listener"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "699d84875f1b72b4da017e6b0f77dfa88c0137f089958a88974d15938cbc2976"
[[package]] [[package]]
name = "failure" name = "failure"
version = "0.1.8" version = "0.1.8"
@ -179,161 +57,30 @@ dependencies = [
"synstructure", "synstructure",
] ]
[[package]]
name = "fastrand"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36a9cb09840f81cd211e435d00a4e487edd263dc3c8ff815c32dd76ad668ebed"
[[package]]
name = "futures-channel"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"
dependencies = [
"futures-core",
]
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.5" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
[[package]]
name = "futures-io"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
[[package]]
name = "futures-lite"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180d8fc9819eb48a0c976672fbeea13a73e10999e812bdc9e14644c25ad51d60"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"memchr",
"parking",
"pin-project-lite",
"waker-fn",
]
[[package]]
name = "futures-task"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
dependencies = [
"once_cell",
]
[[package]]
name = "futures-timer"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
dependencies = [
"gloo-timers",
"send_wrapper",
]
[[package]]
name = "futures-util"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
dependencies = [
"futures-core",
"futures-io",
"futures-task",
"memchr",
"pin-project",
"pin-utils",
"slab",
]
[[package]] [[package]]
name = "gimli" name = "gimli"
version = "0.22.0" version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
[[package]]
name = "gloo-timers"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47204a46aaff920a1ea58b11d03dec6f704287d27561724a4631e450654a891f"
dependencies = [
"futures-channel",
"futures-core",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "hermit-abi"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.4.6" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]]
name = "js-sys"
version = "0.3.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "kv-log-macro"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
dependencies = [
"log",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.73" version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
[[package]]
name = "log"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.4.0" version = "0.4.0"
@ -343,66 +90,12 @@ dependencies = [
"adler", "adler",
] ]
[[package]]
name = "num_cpus"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [
"hermit-abi",
"libc",
]
[[package]] [[package]]
name = "object" name = "object"
version = "0.20.0" version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
[[package]]
name = "once_cell"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d"
[[package]]
name = "parking"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d4a6da31f8144a32532fe38fe8fb439a6842e0ec633f0037f0144c14e7f907"
[[package]]
name = "pin-project"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.19" version = "1.0.19"
@ -421,12 +114,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.16" version = "0.1.16"
@ -439,18 +126,6 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "send_wrapper"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.114" version = "1.0.114"
@ -483,41 +158,14 @@ dependencies = [
] ]
[[package]] [[package]]
name = "slab" name = "single-instance"
version = "0.4.2" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" checksum = "e5cf81b17aaa439345566aff22f4e0c11a50c265f6d5589ab693e40913326385"
[[package]]
name = "smol"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "620cbb3c6e34da57d3a248cda0cd01cd5848164dc062e764e65d06fe3ea7aed5"
dependencies = [ dependencies = [
"async-task", "failure",
"blocking",
"concurrent-queue",
"fastrand",
"futures-io",
"futures-util",
"libc", "libc",
"once_cell", "widestring",
"scoped-tls",
"slab",
"socket2",
"wepoll-sys-stjepang",
"winapi",
]
[[package]]
name = "socket2"
version = "0.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"winapi", "winapi",
] ]
@ -527,7 +175,6 @@ version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1011da319de2a758a3898558f595fa282ec1de82a089e90b288a09ff4ebfaea8" checksum = "1011da319de2a758a3898558f595fa282ec1de82a089e90b288a09ff4ebfaea8"
dependencies = [ dependencies = [
"async-std",
"failure", "failure",
"futures-core", "futures-core",
"serde", "serde",
@ -536,14 +183,11 @@ dependencies = [
[[package]] [[package]]
name = "swkb" name = "swkb"
version = "0.2.3" version = "0.2.4"
dependencies = [ dependencies = [
"async-std", "single-instance",
"failure",
"futures-core",
"serde",
"serde_json",
"swayipc", "swayipc",
"xdg",
] ]
[[package]] [[package]]
@ -576,95 +220,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]] [[package]]
name = "waker-fn" name = "widestring"
version = "1.0.0" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9571542c2ce85ce642e6b58b3364da2fb53526360dfb7c211add4f5c23105ff7" checksum = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb"
[[package]]
name = "wasm-bindgen"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ad6e4e8b2b7f8c90b6e09a9b590ea15cb0d1dbe28502b5a405cd95d1981671"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87"
[[package]]
name = "web-sys"
version = "0.3.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "wepoll-sys-stjepang"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fd319e971980166b53e17b1026812ad66c6b54063be879eb182342b55284694"
dependencies = [
"cc",
]
[[package]] [[package]]
name = "winapi" name = "winapi"
@ -687,3 +246,9 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "xdg"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"

View File

@ -1,26 +1,15 @@
[package] [package]
name = "swkb" name = "swkb"
version = "0.2.3" version = "0.2.4"
authors = ["Alexandr Bogomyakov <abogomyakov@iponweb.net>"] authors = ["Alexandr Bogomyakov <abogomyakov@iponweb.net>"]
edition = "2018" edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
serde = { version = "1.0", features = ["derive"] } swayipc = {version = "2.7.0", features = [ "event_stream"]}
serde_json = "1.0" single-instance = "0.1.2"
failure = "0.1" xdg = "*"
futures-core = { version = "0.3", optional = true }
async-std = { version = "1.6", features = ["attributes", "unstable"], optional = true }
swayipc = {version = "2.7.0", features = ["async", "event_stream"]}
[features]
async = ["async-std"]
event_stream = ["futures-core"]
unstable = []
#[dependencies.swayipc]
#features = ["async", "event_stream"]
[packaging] [packaging]
depends = ["sway"] depends = ["sway"]

View File

@ -1,3 +1,5 @@
swkb - simple per-window keyboard layout switching daemon for Sway WM. swkb - simple per-window keyboard layout switching daemon for Sway WM.
![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhouse-of-vanity%2Fswkb.svg?type=large)
prebuild ArchLinux packages here - https://repo.hexor.ru/ prebuild ArchLinux packages here - https://repo.hexor.ru/

View File

@ -1,100 +1,67 @@
use async_std::stream::StreamExt;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Mutex;
use swayipc::reply::Event; use swayipc::reply::Event;
use swayipc::{Connection, EventType, Fallible}; use swayipc::{Connection, EventType, Fallible};
fn get_input_id(c: &mut Connection) -> Vec<String> {
async fn get_input_id() -> Vec<String> {
let mut connection = Connection::new().await.unwrap();
let mut ids: Vec<String> = Vec::new(); let mut ids: Vec<String> = Vec::new();
match connection.get_inputs().await { match c.get_inputs() {
Ok(inputs) => { Ok(inputs) => {
for i in inputs { for i in inputs {
ids.push(i.identifier); ids.push(i.identifier);
}
} }
} _ => {}
_ => {}
} }
ids ids
} }
async fn get_focus_id() -> i64 { fn main() -> Fallible<()> {
let mut connection = Connection::new().await.unwrap(); let xdg_dirs = xdg::BaseDirectories::new().unwrap();
let tree = connection.get_tree().await.unwrap(); let file = xdg_dirs.place_config_file("swkb.lock").unwrap();
let mut focused: i64 = 0; let instance_a = single_instance::SingleInstance::new(file.to_str().unwrap()).unwrap();
for i in tree.nodes { if !instance_a.is_single() {
for z in i.nodes { println!("only one instance of swkb at a time is allowed");
for x in z.nodes { std::process::exit(1);
if x.focused == true {
focused = x.id;
/*
println!(
"Focused window [id {:?}] {:?}",
x.id,
x.name.unwrap_or("unnamed".to_string())
);
*/
}
}
}
} }
focused let mut connection = Connection::new()?;
} let inputs = get_input_id(&mut connection);
let mut layouts: HashMap<i64, i64> = HashMap::new();
#[async_std::main]
async fn main() -> Fallible<()> {
let inputs = get_input_id().await;
let connection = Connection::new().await?;
let layouts: Mutex<HashMap<i64, i64>> = Mutex::new(HashMap::new());
let subs = [EventType::Input, EventType::Window]; let subs = [EventType::Input, EventType::Window];
let mut events = connection.subscribe(&subs).await?; let mut events = connection.subscribe(&subs)?;
while let Some(event) = events.next().await { let mut current_window: i64 = 0;
while let Some(event) = events.next() {
match event { match event {
Ok(Event::Input(event)) => { Ok(Event::Input(event)) => {
println!("Input: {:?}", event);
let layouts_list = event.input.xkb_layout_names; let layouts_list = event.input.xkb_layout_names;
let layout_name = event.input.xkb_active_layout_name.unwrap_or("none".to_string()); let layout_name = event
.input
.xkb_active_layout_name
.unwrap_or("none".to_string());
if layout_name == "none" { if layout_name == "none" {
continue continue;
} }
let index = layouts_list.iter().position(|r| *r == layout_name).unwrap_or(0) as i64; let index = layouts_list
let mut layouts = layouts.lock().unwrap(); .iter()
let current_window = get_focus_id().await; .position(|r| *r == layout_name)
//println!("Layout saved [{:?}] for {:?}", layout_name, current_window); .unwrap_or(0) as i64;
layouts.insert(current_window, index); layouts.insert(current_window, index);
} }
Ok(Event::Window(event)) => { Ok(Event::Window(event)) => match event.change {
println!("Window: {:?}", event);
match event.change {
swayipc::reply::WindowChange::Focus => { swayipc::reply::WindowChange::Focus => {
let layouts = layouts.lock().unwrap(); let mut connection = Connection::new()?;
let mut connection = Connection::new().await?;
/*
println!(
"Restoring layout [{:?}] for {:?}",
layouts
.get_key_value(&event.container.id)
.unwrap_or((&0, &0))
.1,
event.container.id
);
*/
for input in &inputs { for input in &inputs {
connection connection.run_command(format!(
.run_command(format!(
"input {} xkb_switch_layout {}", "input {} xkb_switch_layout {}",
input, input,
layouts layouts
.get_key_value(&event.container.id) .get_key_value(&event.container.id)
.unwrap_or((&0, &0)) .unwrap_or((&0, &0))
.1 .1
)) ))?;
.await?;
} }
current_window = event.container.id;
} }
_ => (), _ => (),
}
}, },
_ => (), _ => (),
} }

View File

@ -1,44 +0,0 @@
from jinja2 import Environment, PackageLoader, FileSystemLoader
cargo = dict()
# async-std = { version = "1.6", features = ["attributes", "unstable"], optional = true }
def parse_line(val):
result = dict()
attr, value = line.split("=", maxsplit=1)
result[value] = dict()
return result
def parse(filename='Cargo.toml'):
with open(filename) as cargo_file:
level = ''
for line in cargo_file.readlines():
if line[0] == '#' or line[0] == '\n':
continue
print("line is ", (line, len(line)))
if line[0] == '[':
attr = line.replace('[', '').replace(']', '').strip()
cargo[attr] = dict()
level = attr
continue
value = parse_line(line)
print(value)
cargo[level] += value
print(cargo)
config = {}
with open("PKGBUILD", "w") as rcfile_obj:
file_loader = Environment(loader=FileSystemLoader('assets'))
template = file_loader.get_template('PKGBUILD.jinja')
output = template.render(config=config)
rcfile_obj.write(output+ "\n")