mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 13:51:19 +01:00
feat(wm): initial commit
This commit is contained in:
commit
2b99a68ed8
25 files changed
+2597
No files matched your search
@@ -0,0 +1,4 @@
|
||||
/target
|
||||
/result
|
||||
/.idea
|
||||
/.direnv
|
||||
Generated
+695
@@ -0,0 +1,695 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.24.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.75"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
|
||||
|
||||
[[package]]
|
||||
name = "block2"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "340d2f0bdb2a43c1d3cd40513185b2bd7def0aa1052f956455114bc98f82dcf2"
|
||||
dependencies = [
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "color-eyre"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"color-spantrace",
|
||||
"eyre",
|
||||
"indenter",
|
||||
"once_cell",
|
||||
"owo-colors",
|
||||
"tracing-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "color-spantrace"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"owo-colors",
|
||||
"tracing-core",
|
||||
"tracing-error",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
version = "3.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "881c5d0a13b2f1498e2306e82cbada78390e152d4b1378fb28a84f4dcd0dc4f3"
|
||||
dependencies = [
|
||||
"dispatch",
|
||||
"nix",
|
||||
"windows-sys 0.61.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dispatch"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
||||
|
||||
[[package]]
|
||||
name = "dispatch2"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "eyre"
|
||||
version = "0.6.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
|
||||
dependencies = [
|
||||
"indenter",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
||||
|
||||
[[package]]
|
||||
name = "indenter"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
|
||||
|
||||
[[package]]
|
||||
name = "komorebi"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"color-eyre",
|
||||
"ctrlc",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-application-services",
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-graphics",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.175"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
|
||||
dependencies = [
|
||||
"regex-automata",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.50.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "561f357ba7f3a2a61563a186a163d0a3a5247e1089524a3981d49adb775078bc"
|
||||
dependencies = [
|
||||
"objc2-encode",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-app-kit"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6f29f568bec459b0ddff777cec4fe3fd8666d82d5a40ebd0ff7e66134f89bcc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block2",
|
||||
"libc",
|
||||
"objc2",
|
||||
"objc2-cloud-kit",
|
||||
"objc2-core-data",
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-graphics",
|
||||
"objc2-core-image",
|
||||
"objc2-foundation",
|
||||
"objc2-quartz-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-application-services"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9abc05b1f757ebfbd72f4f3f9a515662c67dfe66b26e71b37d818f56a1c2f17"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-graphics",
|
||||
"objc2-core-services",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-cloud-kit"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17614fdcd9b411e6ff1117dfb1d0150f908ba83a7df81b1f118005fe0a8ea15d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-data"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "291fbbf7d29287518e8686417cf7239c74700fd4b607623140a7d4a3c834329d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-foundation"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block2",
|
||||
"dispatch2",
|
||||
"libc",
|
||||
"objc2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-graphics"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "989c6c68c13021b5c2d6b71456ebb0f9dc78d752e86a98da7c716f4f9470f5a4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block2",
|
||||
"dispatch2",
|
||||
"libc",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
"objc2-io-surface",
|
||||
"objc2-metal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-image"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79b3dc0cc4386b6ccf21c157591b34a7f44c8e75b064f85502901ab2188c007e"
|
||||
dependencies = [
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-core-services"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "159be6e4cd366c7d236d798daa2aa71855230e5691cde045a0670ce01a06d664"
|
||||
dependencies = [
|
||||
"dispatch2",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
"objc2-security",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-encode"
|
||||
version = "4.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
|
||||
|
||||
[[package]]
|
||||
name = "objc2-foundation"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-io-surface"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7282e9ac92529fa3457ce90ebb15f4ecbc383e8338060960760fa2cf75420c3c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-metal"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f246c183239540aab1782457b35ab2040d4259175bd1d0c58e46ada7b47a874"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-quartz-core"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90ffb6a0cd5f182dc964334388560b12a57f7b74b3e2dec5e2722aa2dfb2ccd5"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-security"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1f8e0ef3ab66b08c42644dcb34dba6ec0a574bbd8adbb8bdbdc7a2779731a44"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"objc2",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
version = "4.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.106"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
|
||||
dependencies = [
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-error"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db"
|
||||
dependencies = [
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
|
||||
dependencies = [
|
||||
"matchers",
|
||||
"nu-ansi-term",
|
||||
"once_cell",
|
||||
"regex-automata",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
@@ -0,0 +1,6 @@
|
||||
[workspace]
|
||||
|
||||
resolver = "2"
|
||||
members = [
|
||||
"komorebi",
|
||||
]
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
# Komorebi License
|
||||
|
||||
Version 2.0.0
|
||||
|
||||
## Acceptance
|
||||
|
||||
In order to get any license under these terms, you must agree
|
||||
to them as both strict obligations and conditions to all
|
||||
your licenses.
|
||||
|
||||
## Copyright License
|
||||
|
||||
The licensor grants you a copyright license for the software
|
||||
to do everything you might do with the software that would
|
||||
otherwise infringe the licensor's copyright in it for any
|
||||
permitted purpose. However, you may only distribute the source
|
||||
code of the software according to the [Distribution License](
|
||||
#distribution-license), you may only make changes according
|
||||
to the [Changes License](#changes-license), and you may not
|
||||
otherwise distribute the software or new works based on the
|
||||
software.
|
||||
|
||||
## Distribution License
|
||||
|
||||
The licensor grants you an additional copyright license to
|
||||
distribute copies of the source code of the software. Your
|
||||
license to distribute covers distributing the source code of
|
||||
the software with changes permitted by the [Changes License](
|
||||
#changes-license).
|
||||
|
||||
## Changes License
|
||||
|
||||
The licensor grants you an additional copyright license to
|
||||
make changes for any permitted purpose.
|
||||
|
||||
## Patent License
|
||||
|
||||
The licensor grants you a patent license for the software that
|
||||
covers patent claims the licensor can license, or becomes able
|
||||
to license, that you would infringe by using the software.
|
||||
|
||||
## Personal Uses
|
||||
|
||||
Personal use for research, experiment, and testing for
|
||||
the benefit of public knowledge, personal study, private
|
||||
entertainment, hobby projects, amateur pursuits, or religious
|
||||
observance, without any anticipated commercial application,
|
||||
is use for a permitted purpose.
|
||||
|
||||
## Fair Use
|
||||
|
||||
You may have "fair use" rights for the software under the
|
||||
law. These terms do not limit them.
|
||||
|
||||
## No Other Rights
|
||||
|
||||
These terms do not allow you to sublicense or transfer any of
|
||||
your licenses to anyone else, or prevent the licensor from
|
||||
granting licenses to anyone else. These terms do not imply
|
||||
any other licenses.
|
||||
|
||||
## Patent Defense
|
||||
|
||||
If you make any written claim that the software infringes or
|
||||
contributes to infringement of any patent, your patent license
|
||||
for the software granted under these terms ends immediately. If
|
||||
your company makes such a claim, your patent license ends
|
||||
immediately for work on behalf of your company.
|
||||
|
||||
## Violations
|
||||
|
||||
The first time you are notified in writing that you have
|
||||
violated any of these terms, or done anything with the software
|
||||
not covered by your licenses, your licenses can nonetheless
|
||||
continue if you come into full compliance with these terms,
|
||||
and take practical steps to correct past violations, within
|
||||
32 days of receiving notice. Otherwise, all your licenses
|
||||
end immediately.
|
||||
|
||||
## No Liability
|
||||
|
||||
***As far as the law allows, the software comes as is, without
|
||||
any warranty or condition, and the licensor will not be liable
|
||||
to you for any damages arising out of these terms or the use
|
||||
or nature of the software, under any kind of legal claim.***
|
||||
|
||||
## Definitions
|
||||
|
||||
The **licensor** is the individual or entity offering these
|
||||
terms, and the **software** is the software the licensor makes
|
||||
available under these terms.
|
||||
|
||||
**You** refers to the individual or entity agreeing to these
|
||||
terms.
|
||||
|
||||
**Your company** is any legal entity, sole proprietorship,
|
||||
or other kind of organization that you work for, plus all
|
||||
organizations that have control over, are under the control of,
|
||||
or are under common control with that organization. **Control**
|
||||
means ownership of substantially all the assets of an entity,
|
||||
or the power to direct its management and policies by vote,
|
||||
contract, or otherwise. Control can be direct or indirect.
|
||||
|
||||
**Your licenses** are all the licenses granted to you for the
|
||||
software under these terms.
|
||||
|
||||
**Use** means anything you do with the software requiring one
|
||||
of your licenses.
|
||||
@@ -0,0 +1,111 @@
|
||||
# komorebi for Mac
|
||||
|
||||
Tiling Window Management for macOS.
|
||||
|
||||
<p>
|
||||
<a href="https://techforpalestine.org/learn-more">
|
||||
<img alt="Tech for Palestine" src="https://badge.techforpalestine.org/default">
|
||||
</a>
|
||||
|
||||
[//]: # ' <img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/LGUG2Z/komorebi-for-mac/.github/workflows/windows.yaml">'
|
||||
[//]: # ' <img alt="GitHub all releases" src="https://img.shields.io/github/downloads/LGUG2Z/komorebi-for-mac/total">'
|
||||
[//]: # ' <img alt="GitHub commits since latest release (by date) for a branch" src="https://img.shields.io/github/commits-since/LGUG2Z/komorebi-for-mac/latest">'
|
||||
|
||||
<img alt="Active Individual Commercial Use Licenses" src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Flgug2z-ecstaticmagentacheetah.web.val.run&query=%24.&label=active%20individual%20commercial%20use%20licenses&cacheSeconds=3600&link=https%3A%2F%2Flgug2z.com%2Fsoftware%2Fkomorebi">
|
||||
|
||||
<a href="https://discord.gg/mGkn66PHkx">
|
||||
<img alt="Discord" src="https://img.shields.io/discord/898554690126630914">
|
||||
</a>
|
||||
<a href="https://github.com/sponsors/LGUG2Z">
|
||||
<img alt="GitHub Sponsors" src="https://img.shields.io/github/sponsors/LGUG2Z">
|
||||
</a>
|
||||
<a href="https://ko-fi.com/lgug2z">
|
||||
<img alt="Ko-fi" src="https://img.shields.io/badge/kofi-tip-green">
|
||||
</a>
|
||||
<a href="https://notado.app/feeds/jado/software-development">
|
||||
<img alt="Notado Feed" src="https://img.shields.io/badge/Notado-Subscribe-informational">
|
||||
</a>
|
||||
<a href="https://www.youtube.com/channel/UCeai3-do-9O4MNy9_xjO6mg?sub_confirmation=1">
|
||||
<img alt="YouTube" src="https://img.shields.io/youtube/channel/subscribers/UCeai3-do-9O4MNy9_xjO6mg">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Overview
|
||||
|
||||
_komorebi for Mac_ is a tiling window manager that works as an extension to the
|
||||
standard macOS desktop environment.
|
||||
|
||||
_komorebi for Mac_ aims to make _as few modifications as possible_ to the
|
||||
operating system and desktop environment by default.
|
||||
|
||||
_komorebi for Mac_ is currently under development, and this repository is
|
||||
currently restricted to sponsors.
|
||||
|
||||
## Community
|
||||
|
||||
There is a [Discord server](https://discord.gg/mGkn66PHkx) available for
|
||||
_komorebi_-related discussion, help, troubleshooting etc. If you have any
|
||||
specific feature requests or bugs to report, please create an issue in this
|
||||
repository.
|
||||
|
||||
There is
|
||||
a [YouTube channel](https://www.youtube.com/channel/UCeai3-do-9O4MNy9_xjO6mg)
|
||||
where I post _komorebi_ development videos, feature previews and release
|
||||
overviews. Subscribing to the channel (which is monetized as part of the YouTube
|
||||
Partner Program) and watching videos is a really simple and passive way to
|
||||
contribute financially to the development and maintenance of _komorebi_.
|
||||
|
||||
There is an [Awesome List](https://github.com/LGUG2Z/awesome-komorebi) which
|
||||
showcases the many awesome projects that exist in the _komorebi_ ecosystem.
|
||||
|
||||
## Licensing for Personal Use
|
||||
|
||||
`komorebi`
|
||||
is [educational source software](https://lgug2z.com/articles/educational-source-software/).
|
||||
|
||||
`komorebi` is licensed under
|
||||
the [Komorebi 2.0.0 license](https://github.com/LGUG2Z/komorebi-license), which
|
||||
is a fork of
|
||||
the [PolyForm Strict 1.0.0 license](https://polyformproject.org/licenses/strict/1.0.0).
|
||||
On a high level this means that you are free to do whatever you want with
|
||||
`komorebi` for personal use other than redistribution, or distribution of new
|
||||
works (i.e. hard-forks) based on the software.
|
||||
|
||||
Anyone is free to make their own fork of `komorebi` with changes intended either
|
||||
for personal use or for integration back upstream via pull requests.
|
||||
|
||||
The [Komorebi 2.0.0 License](https://github.com/LGUG2Z/komorebi-license) does
|
||||
not permit any kind of commercial use ( i.e. using `komorebi` at work).
|
||||
|
||||
## Sponsorship for Personal Use
|
||||
|
||||
_komorebi for Mac_ is a free and educational source project, and one that
|
||||
encourages you to make charitable donations if you find the software to be
|
||||
useful and have the financial means.
|
||||
|
||||
I encourage you to make a charitable donation to
|
||||
the [Palestine Children's Relief Fund](https://pcrf1.app.neoncrm.com/forms/gaza-recovery)
|
||||
or to contribute to a [Gaza Funds campaign](https://gazafunds.com) before you
|
||||
consider sponsoring me on GitHub.
|
||||
|
||||
[GitHub Sponsors is enabled for this project](https://github.com/sponsors/LGUG2Z).
|
||||
Sponsors can claim custom roles on the Discord server, get shout outs at the end
|
||||
of _komorebi_-related videos on YouTube, gain the ability to submit feature
|
||||
requests on the issue tracker, and receive releases of komorebi with "easter
|
||||
eggs" on physical media.
|
||||
|
||||
If you would like to tip or sponsor the project but are unable to use GitHub
|
||||
Sponsors, you may also sponsor through [Ko-fi](https://ko-fi.com/lgug2z), or
|
||||
make an anonymous Bitcoin donation to
|
||||
`bc1qv73wzspc77k46uty4vp85x8sdp24mphvm58f6q`.
|
||||
|
||||
## Licensing for Commercial Use
|
||||
|
||||
A dedicated Individual Commercial Use License will eventually be made available
|
||||
for those who want to use `komorebi` at work.
|
||||
|
||||
The Individual Commerical Use License will add “Commercial Use” as a “Permitted
|
||||
Use” for the licensed individual only, for the duration of a valid paid license
|
||||
subscription only. All provisions and restrictions enumerated in
|
||||
the [Komorebi License](https://github.com/LGUG2Z/komorebi-license) will continue
|
||||
to apply.
|
||||
@@ -0,0 +1,56 @@
|
||||
[graph]
|
||||
targets = [
|
||||
"aarch64-apple-darwin",
|
||||
]
|
||||
all-features = false
|
||||
no-default-features = false
|
||||
|
||||
[output]
|
||||
feature-depth = 1
|
||||
|
||||
[advisories]
|
||||
ignore = []
|
||||
|
||||
[licenses]
|
||||
allow = [
|
||||
"0BSD",
|
||||
"Apache-2.0",
|
||||
"MIT",
|
||||
"Unicode-3.0",
|
||||
"Zlib",
|
||||
"LicenseRef-Komorebi-2.0"
|
||||
|
||||
# these are also ok, but not yet used
|
||||
|
||||
# "Artistic-2.0",
|
||||
# "BSD-2-Clause",
|
||||
# "BSD-3-Clause",
|
||||
# "BSL-1.0",
|
||||
# "CC0-1.0",
|
||||
# "ISC",
|
||||
# "MIT-0",
|
||||
# "MPL-2.0",
|
||||
# "OFL-1.1",
|
||||
# "Ubuntu-font-1.0",
|
||||
]
|
||||
confidence-threshold = 0.8
|
||||
|
||||
[[licenses.clarify]]
|
||||
crate = "komorebi"
|
||||
expression = "LicenseRef-Komorebi-2.0"
|
||||
license-files = []
|
||||
|
||||
[bans]
|
||||
multiple-versions = "allow"
|
||||
wildcards = "allow"
|
||||
highlight = "all"
|
||||
workspace-default-features = "allow"
|
||||
external-default-features = "allow"
|
||||
|
||||
[sources]
|
||||
unknown-registry = "deny"
|
||||
unknown-git = "deny"
|
||||
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
|
||||
allow-git = [
|
||||
# "https://github.com/LGUG2Z/komorebi-for-mac",
|
||||
]
|
||||
@@ -0,0 +1,147 @@
|
||||
{
|
||||
"licenses": [
|
||||
[
|
||||
"0BSD",
|
||||
[
|
||||
"adler2 2.0.1 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
],
|
||||
[
|
||||
"Apache-2.0",
|
||||
[
|
||||
"addr2line 0.24.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"adler2 2.0.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"backtrace 0.3.75 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 2.9.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg-if 1.0.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-eyre 0.6.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-spantrace 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ctrlc 3.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"dispatch2 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"eyre 0.6.12 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"gimli 0.31.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"indenter 0.3.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"lazy_static 1.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libc 0.2.175 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"log 0.4.28 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"miniz_oxide 0.8.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-app-kit 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-application-services 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-cloud-kit 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-data 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-foundation 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-graphics 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-image 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-services 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-metal 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-quartz-core 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"object 0.36.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"once_cell 1.21.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"pin-project-lite 0.2.16 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"proc-macro2 1.0.101 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"quote 1.0.40 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"regex-automata 0.4.10 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"regex-syntax 0.8.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"rustc-demangle 0.1.26 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"smallvec 1.15.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 2.0.106 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thiserror 1.0.69 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thiserror-impl 1.0.69 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thread_local 1.1.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.19 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
],
|
||||
[
|
||||
"MIT",
|
||||
[
|
||||
"addr2line 0.24.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"adler2 2.0.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"backtrace 0.3.75 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"bitflags 2.9.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"block2 0.6.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg-if 1.0.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"cfg_aliases 0.2.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-eyre 0.6.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"color-spantrace 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"ctrlc 3.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"dispatch 0.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"dispatch2 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"eyre 0.6.12 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"gimli 0.31.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"indenter 0.3.4 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"lazy_static 1.5.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"libc 0.2.175 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"log 0.4.28 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"matchers 0.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"memchr 2.7.5 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"miniz_oxide 0.8.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"nix 0.30.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"nu-ansi-term 0.50.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2 0.6.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-app-kit 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-application-services 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-cloud-kit 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-data 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-foundation 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-graphics 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-image 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-services 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-encode 4.1.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-foundation 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-metal 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-quartz-core 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"object 0.36.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"once_cell 1.21.3 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"owo-colors 4.2.2 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"pin-project-lite 0.2.16 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"proc-macro2 1.0.101 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"quote 1.0.40 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"regex-automata 0.4.10 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"regex-syntax 0.8.6 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"rustc-demangle 0.1.26 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"sharded-slab 0.1.7 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"smallvec 1.15.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"syn 2.0.106 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thiserror 1.0.69 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thiserror-impl 1.0.69 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"thread_local 1.1.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tracing 0.1.41 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tracing-attributes 0.1.30 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tracing-core 0.1.34 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tracing-error 0.2.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tracing-log 0.2.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"tracing-subscriber 0.3.20 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"unicode-ident 1.0.19 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
],
|
||||
[
|
||||
"Unicode-3.0",
|
||||
[
|
||||
"unicode-ident 1.0.19 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
],
|
||||
[
|
||||
"Unlicense",
|
||||
[
|
||||
"memchr 2.7.5 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
],
|
||||
[
|
||||
"Zlib",
|
||||
[
|
||||
"dispatch2 0.3.0 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"miniz_oxide 0.8.9 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-app-kit 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-application-services 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-cloud-kit 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-data 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-foundation 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-graphics 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-image 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-core-services 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-metal 0.3.1 registry+https://github.com/rust-lang/crates.io-index",
|
||||
"objc2-quartz-core 0.3.1 registry+https://github.com/rust-lang/crates.io-index"
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
Generated
+112
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1757183466,
|
||||
"narHash": "sha256-kTdCCMuRE+/HNHES5JYsbRHmgtr+l9mOtf5dpcMppVc=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "d599ae4847e7f87603e7082d73ca673aa93c916d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1757745802,
|
||||
"narHash": "sha256-hLEO2TPj55KcUFUU1vgtHE9UEIOjRcH/4QbmfHNF820=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c23193b943c6c689d70ee98ce3128239ed9e32d1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1744536153,
|
||||
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1757930296,
|
||||
"narHash": "sha256-Z9u5VszKs8rfEvg2AsFucWEjl7wMtAln9l1b78cfBh4=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "09442765a05c2ca617c20ed68d9613da92a2d96b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
crane.url = "github:ipetkov/crane";
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
with inputs;
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
overlays = [
|
||||
(import rust-overlay)
|
||||
];
|
||||
pkgs = (import nixpkgs) {
|
||||
inherit system overlays;
|
||||
};
|
||||
|
||||
inherit (pkgs) lib;
|
||||
|
||||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
|
||||
|
||||
pname = "komorebi";
|
||||
version = "0.1.0";
|
||||
|
||||
commonArgs = {
|
||||
inherit pname version;
|
||||
nativeBuildInputs = with pkgs; [
|
||||
# pkg-config
|
||||
];
|
||||
doCheck = false;
|
||||
buildInputs = with pkgs; [
|
||||
gcc
|
||||
libiconv
|
||||
];
|
||||
};
|
||||
|
||||
cargoArtifacts = craneLib.buildDepsOnly (commonArgs
|
||||
// {
|
||||
src = craneLib.cleanCargoSource (craneLib.path ./.);
|
||||
});
|
||||
|
||||
komorebi = craneLib.buildPackage (commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
src = ./.;
|
||||
});
|
||||
in {
|
||||
devShells = flake-utils.lib.flattenTree {
|
||||
default = import ./shell.nix {inherit pkgs;};
|
||||
};
|
||||
|
||||
packages = flake-utils.lib.flattenTree rec {
|
||||
inherit komorebi;
|
||||
default = komorebi;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
export RUST_BACKTRACE := "full"
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
fmt:
|
||||
cargo +nightly fmt
|
||||
cargo +stable clippy
|
||||
prettier --write README.md
|
||||
|
||||
install target:
|
||||
cargo +stable install --path {{ target }} --locked
|
||||
|
||||
build target:
|
||||
cargo +stable build --package {{ target }} --locked --release
|
||||
|
||||
run target:
|
||||
cargo +stable run --bin {{ target }} --locked
|
||||
|
||||
warn target $RUST_LOG="warn":
|
||||
just run {{ target }}
|
||||
|
||||
info target $RUST_LOG="info":
|
||||
just run {{ target }}
|
||||
|
||||
debug target $RUST_LOG="debug":
|
||||
just run {{ target }}
|
||||
|
||||
trace target $RUST_LOG="trace":
|
||||
just run {{ target }}
|
||||
|
||||
depgen:
|
||||
cargo deny check
|
||||
cargo deny list --format json | jq 'del(.unlicensed)' > dependencies.json
|
||||
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "komorebi"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
color-eyre = { version = "0.6" }
|
||||
ctrlc = { version = "3", features = ["termination"] }
|
||||
objc2 = "0.6"
|
||||
objc2-app-kit = "0.3"
|
||||
objc2-application-services = "0.3"
|
||||
objc2-core-foundation = { version = "0.3", features = ["CFDictionary", "CFString"] }
|
||||
objc2-core-graphics = { version = "0.3", features = ["CGWindow", "alloc"] }
|
||||
thiserror = "1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
@@ -0,0 +1,162 @@
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
pub const kAXRoleAttribute: &str = "AXRole";
|
||||
pub const kAXSubroleAttribute: &str = "AXSubrole";
|
||||
pub const kAXRoleDescriptionAttribute: &str = "AXRoleDescription";
|
||||
pub const kAXHelpAttribute: &str = "AXHelp";
|
||||
pub const kAXTitleAttribute: &str = "AXTitle";
|
||||
pub const kAXValueAttribute: &str = "AXValue";
|
||||
pub const kAXValueDescriptionAttribute: &str = "AXValueDescription";
|
||||
pub const kAXMinValueAttribute: &str = "AXMinValue";
|
||||
pub const kAXMaxValueAttribute: &str = "AXMaxValue";
|
||||
pub const kAXValueIncrementAttribute: &str = "AXValueIncrement";
|
||||
pub const kAXAllowedValuesAttribute: &str = "AXAllowedValues";
|
||||
pub const kAXPlaceholderValueAttribute: &str = "AXPlaceholderValue";
|
||||
pub const kAXEnabledAttribute: &str = "AXEnabled";
|
||||
pub const kAXElementBusyAttribute: &str = "AXElementBusy";
|
||||
pub const kAXFocusedAttribute: &str = "AXFocused";
|
||||
pub const kAXParentAttribute: &str = "AXParent";
|
||||
pub const kAXChildrenAttribute: &str = "AXChildren";
|
||||
pub const kAXSelectedChildrenAttribute: &str = "AXSelectedChildren";
|
||||
pub const kAXVisibleChildrenAttribute: &str = "AXVisibleChildren";
|
||||
pub const kAXWindowAttribute: &str = "AXWindow";
|
||||
pub const kAXTopLevelUIElementAttribute: &str = "AXTopLevelUIElement";
|
||||
pub const kAXPositionAttribute: &str = "AXPosition";
|
||||
pub const kAXSizeAttribute: &str = "AXSize";
|
||||
pub const kAXOrientationAttribute: &str = "AXOrientation";
|
||||
pub const kAXDescriptionAttribute: &str = "AXDescription";
|
||||
pub const kAXDescription: &str = "AXDescription"; // old name
|
||||
pub const kAXSelectedTextAttribute: &str = "AXSelectedText";
|
||||
pub const kAXSelectedTextRangeAttribute: &str = "AXSelectedTextRange";
|
||||
pub const kAXSelectedTextRangesAttribute: &str = "AXSelectedTextRanges";
|
||||
pub const kAXVisibleCharacterRangeAttribute: &str = "AXVisibleCharacterRange";
|
||||
pub const kAXNumberOfCharactersAttribute: &str = "AXNumberOfCharacters";
|
||||
pub const kAXSharedTextUIElementsAttribute: &str = "AXSharedTextUIElements";
|
||||
pub const kAXSharedCharacterRangeAttribute: &str = "AXSharedCharacterRange";
|
||||
pub const kAXSharedFocusElementsAttribute: &str = "AXSharedFocusElements";
|
||||
pub const kAXInsertionPointLineNumberAttribute: &str = "AXInsertionPointLineNumber";
|
||||
pub const kAXMainAttribute: &str = "AXMain";
|
||||
pub const kAXMinimizedAttribute: &str = "AXMinimized";
|
||||
pub const kAXCloseButtonAttribute: &str = "AXCloseButton";
|
||||
pub const kAXZoomButtonAttribute: &str = "AXZoomButton";
|
||||
pub const kAXMinimizeButtonAttribute: &str = "AXMinimizeButton";
|
||||
pub const kAXToolbarButtonAttribute: &str = "AXToolbarButton";
|
||||
pub const kAXFullScreenButtonAttribute: &str = "AXFullScreenButton";
|
||||
pub const kAXProxyAttribute: &str = "AXProxy";
|
||||
pub const kAXGrowAreaAttribute: &str = "AXGrowArea";
|
||||
pub const kAXModalAttribute: &str = "AXModal";
|
||||
pub const kAXDefaultButtonAttribute: &str = "AXDefaultButton";
|
||||
pub const kAXCancelButtonAttribute: &str = "AXCancelButton";
|
||||
pub const kAXMenuItemCmdCharAttribute: &str = "AXMenuItemCmdChar";
|
||||
pub const kAXMenuItemCmdVirtualKeyAttribute: &str = "AXMenuItemCmdVirtualKey";
|
||||
pub const kAXMenuItemCmdGlyphAttribute: &str = "AXMenuItemCmdGlyph";
|
||||
pub const kAXMenuItemCmdModifiersAttribute: &str = "AXMenuItemCmdModifiers";
|
||||
pub const kAXMenuItemMarkCharAttribute: &str = "AXMenuItemMarkChar";
|
||||
pub const kAXMenuItemPrimaryUIElementAttribute: &str = "AXMenuItemPrimaryUIElement";
|
||||
|
||||
pub const kAXMenuItemModifierNone: u32 = 0;
|
||||
pub const kAXMenuItemModifierShift: u32 = 1 << 0;
|
||||
pub const kAXMenuItemModifierOption: u32 = 1 << 1;
|
||||
pub const kAXMenuItemModifierControl: u32 = 1 << 2;
|
||||
pub const kAXMenuItemModifierNoCommand: u32 = 1 << 3;
|
||||
|
||||
pub const kAXMenuBarAttribute: &str = "AXMenuBar";
|
||||
pub const kAXWindowsAttribute: &str = "AXWindows";
|
||||
pub const kAXFrontmostAttribute: &str = "AXFrontmost";
|
||||
pub const kAXHiddenAttribute: &str = "AXHidden";
|
||||
pub const kAXMainWindowAttribute: &str = "AXMainWindow";
|
||||
pub const kAXFocusedWindowAttribute: &str = "AXFocusedWindow";
|
||||
pub const kAXFocusedUIElementAttribute: &str = "AXFocusedUIElement";
|
||||
pub const kAXExtrasMenuBarAttribute: &str = "AXExtrasMenuBar";
|
||||
pub const kAXHeaderAttribute: &str = "AXHeader";
|
||||
pub const kAXEditedAttribute: &str = "AXEdited";
|
||||
pub const kAXValueWrapsAttribute: &str = "AXValueWraps";
|
||||
pub const kAXTabsAttribute: &str = "AXTabs";
|
||||
pub const kAXTitleUIElementAttribute: &str = "AXTitleUIElement";
|
||||
pub const kAXHorizontalScrollBarAttribute: &str = "AXHorizontalScrollBar";
|
||||
pub const kAXVerticalScrollBarAttribute: &str = "AXVerticalScrollBar";
|
||||
pub const kAXOverflowButtonAttribute: &str = "AXOverflowButton";
|
||||
pub const kAXFilenameAttribute: &str = "AXFilename";
|
||||
pub const kAXExpandedAttribute: &str = "AXExpanded";
|
||||
pub const kAXSelectedAttribute: &str = "AXSelected";
|
||||
pub const kAXSplittersAttribute: &str = "AXSplitters";
|
||||
pub const kAXNextContentsAttribute: &str = "AXNextContents";
|
||||
pub const kAXDocumentAttribute: &str = "AXDocument";
|
||||
pub const kAXDecrementButtonAttribute: &str = "AXDecrementButton";
|
||||
pub const kAXIncrementButtonAttribute: &str = "AXIncrementButton";
|
||||
pub const kAXPreviousContentsAttribute: &str = "AXPreviousContents";
|
||||
pub const kAXContentsAttribute: &str = "AXContents";
|
||||
pub const kAXIncrementorAttribute: &str = "AXIncrementor";
|
||||
pub const kAXHourFieldAttribute: &str = "AXHourField";
|
||||
pub const kAXMinuteFieldAttribute: &str = "AXMinuteField";
|
||||
pub const kAXSecondFieldAttribute: &str = "AXSecondField";
|
||||
pub const kAXAMPMFieldAttribute: &str = "AXAMPMField";
|
||||
pub const kAXDayFieldAttribute: &str = "AXDayField";
|
||||
pub const kAXMonthFieldAttribute: &str = "AXMonthField";
|
||||
pub const kAXYearFieldAttribute: &str = "AXYearField";
|
||||
pub const kAXColumnTitleAttribute: &str = "AXColumnTitles";
|
||||
pub const kAXURLAttribute: &str = "AXURL";
|
||||
pub const kAXLabelUIElementsAttribute: &str = "AXLabelUIElements";
|
||||
pub const kAXLabelValueAttribute: &str = "AXLabelValue";
|
||||
pub const kAXShownMenuUIElementAttribute: &str = "AXShownMenuUIElement";
|
||||
pub const kAXServesAsTitleForUIElementsAttribute: &str = "AXServesAsTitleForUIElements";
|
||||
pub const kAXLinkedUIElementsAttribute: &str = "AXLinkedUIElements";
|
||||
pub const kAXRowsAttribute: &str = "AXRows";
|
||||
pub const kAXVisibleRowsAttribute: &str = "AXVisibleRows";
|
||||
pub const kAXSelectedRowsAttribute: &str = "AXSelectedRows";
|
||||
pub const kAXColumnsAttribute: &str = "AXColumns";
|
||||
pub const kAXVisibleColumnsAttribute: &str = "AXVisibleColumns";
|
||||
pub const kAXSelectedColumnsAttribute: &str = "AXSelectedColumns";
|
||||
pub const kAXSortDirectionAttribute: &str = "AXSortDirection";
|
||||
pub const kAXIndexAttribute: &str = "AXIndex";
|
||||
pub const kAXDisclosingAttribute: &str = "AXDisclosing";
|
||||
pub const kAXDisclosedRowsAttribute: &str = "AXDisclosedRows";
|
||||
pub const kAXDisclosedByRowAttribute: &str = "AXDisclosedByRow";
|
||||
pub const kAXDisclosureLevelAttribute: &str = "AXDisclosureLevel";
|
||||
pub const kAXMatteHoleAttribute: &str = "AXMatteHole";
|
||||
pub const kAXMatteContentUIElementAttribute: &str = "AXMatteContentUIElement";
|
||||
pub const kAXMarkerUIElementsAttribute: &str = "AXMarkerUIElements";
|
||||
pub const kAXUnitsAttribute: &str = "AXUnits";
|
||||
pub const kAXUnitDescriptionAttribute: &str = "AXUnitDescription";
|
||||
pub const kAXMarkerTypeAttribute: &str = "AXMarkerType";
|
||||
pub const kAXMarkerTypeDescriptionAttribute: &str = "AXMarkerTypeDescription";
|
||||
pub const kAXIsApplicationRunningAttribute: &str = "AXIsApplicationRunning";
|
||||
pub const kAXSearchButtonAttribute: &str = "AXSearchButton";
|
||||
pub const kAXClearButtonAttribute: &str = "AXClearButton";
|
||||
pub const kAXFocusedApplicationAttribute: &str = "AXFocusedApplication";
|
||||
pub const kAXRowCountAttribute: &str = "AXRowCount";
|
||||
pub const kAXColumnCountAttribute: &str = "AXColumnCount";
|
||||
pub const kAXOrderedByRowAttribute: &str = "AXOrderedByRow";
|
||||
pub const kAXWarningValueAttribute: &str = "AXWarningValue";
|
||||
pub const kAXCriticalValueAttribute: &str = "AXCriticalValue";
|
||||
pub const kAXSelectedCellsAttribute: &str = "AXSelectedCells";
|
||||
pub const kAXVisibleCellsAttribute: &str = "AXVisibleCells";
|
||||
pub const kAXRowHeaderUIElementsAttribute: &str = "AXRowHeaderUIElements";
|
||||
pub const kAXColumnHeaderUIElementsAttribute: &str = "AXColumnHeaderUIElements";
|
||||
pub const kAXRowIndexRangeAttribute: &str = "AXRowIndexRange";
|
||||
pub const kAXColumnIndexRangeAttribute: &str = "AXColumnIndexRange";
|
||||
pub const kAXHorizontalUnitsAttribute: &str = "AXHorizontalUnits";
|
||||
pub const kAXVerticalUnitsAttribute: &str = "AXVerticalUnits";
|
||||
pub const kAXHorizontalUnitDescriptionAttribute: &str = "AXHorizontalUnitDescription";
|
||||
pub const kAXVerticalUnitDescriptionAttribute: &str = "AXVerticalUnitDescription";
|
||||
pub const kAXHandlesAttribute: &str = "AXHandles";
|
||||
pub const kAXTextAttribute: &str = "AXText";
|
||||
pub const kAXVisibleTextAttribute: &str = "AXVisibleText";
|
||||
pub const kAXIsEditableAttribute: &str = "AXIsEditable";
|
||||
pub const kAXColumnTitlesAttribute: &str = "AXColumnTitles";
|
||||
pub const kAXIdentifierAttribute: &str = "AXIdentifier";
|
||||
pub const kAXAlternateUIVisibleAttribute: &str = "AXAlternateUIVisible";
|
||||
pub const kAXLineForIndexParameterizedAttribute: &str = "AXLineForIndex";
|
||||
pub const kAXRangeForLineParameterizedAttribute: &str = "AXRangeForLine";
|
||||
pub const kAXStringForRangeParameterizedAttribute: &str = "AXStringForRange";
|
||||
pub const kAXRangeForPositionParameterizedAttribute: &str = "AXRangeForPosition";
|
||||
pub const kAXRangeForIndexParameterizedAttribute: &str = "AXRangeForIndex";
|
||||
pub const kAXBoundsForRangeParameterizedAttribute: &str = "AXBoundsForRange";
|
||||
pub const kAXRTFForRangeParameterizedAttribute: &str = "AXRTFForRange";
|
||||
pub const kAXAttributedStringForRangeParameterizedAttribute: &str = "AXAttributedStringForRange";
|
||||
pub const kAXStyleRangeForIndexParameterizedAttribute: &str = "AXStyleRangeForIndex";
|
||||
pub const kAXCellForColumnAndRowParameterizedAttribute: &str = "AXCellForColumnAndRow";
|
||||
pub const kAXLayoutPointForScreenPointParameterizedAttribute: &str = "AXLayoutPointForScreenPoint";
|
||||
pub const kAXLayoutSizeForScreenSizeParameterizedAttribute: &str = "AXLayoutSizeForScreenSize";
|
||||
pub const kAXScreenPointForLayoutPointParameterizedAttribute: &str = "AXScreenPointForLayoutPoint";
|
||||
pub const kAXScreenSizeForLayoutSizeParameterizedAttribute: &str = "AXScreenSizeForLayoutSize";
|
||||
@@ -0,0 +1,85 @@
|
||||
use objc2_application_services::AXError;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum AccessibilityError {
|
||||
#[error(transparent)]
|
||||
Api(AccessibilityApiError),
|
||||
#[error(transparent)]
|
||||
Custom(AccessibilityCustomError),
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum AccessibilityApiError {
|
||||
#[error("AXError::Success")]
|
||||
Success,
|
||||
#[error("AXError::Failure")]
|
||||
Failure,
|
||||
#[error("AXError::IllegalArgument")]
|
||||
IllegalArgument,
|
||||
#[error("AXError::InvalidUIElement")]
|
||||
InvalidUIElement,
|
||||
#[error("AXError::InvalidUIElementObserver")]
|
||||
InvalidUIElementObserver,
|
||||
#[error("AXError::CannotComplete")]
|
||||
CannotComplete,
|
||||
#[error("AXError::AttributeUnsupported")]
|
||||
AttributeUnsupported,
|
||||
#[error("AXError::ActionUnsupported")]
|
||||
ActionUnsupported,
|
||||
#[error("AXError::NotificationUnsupported")]
|
||||
NotificationUnsupported,
|
||||
#[error("AXError::NotImplemented")]
|
||||
NotImplemented,
|
||||
#[error("AXError::NotificationAlreadyRegistered")]
|
||||
NotificationAlreadyRegistered,
|
||||
#[error("AXError::NotificationNotRegistered")]
|
||||
NotificationNotRegistered,
|
||||
#[error("AXError::APIDisabled")]
|
||||
APIDisabled,
|
||||
#[error("AXError::NoValue")]
|
||||
NoValue,
|
||||
#[error("AXError::ParameterizedAttributeUnsupported")]
|
||||
ParameterizedAttributeUnsupported,
|
||||
#[error("AXError::NotEnoughPrecision")]
|
||||
NotEnoughPrecision,
|
||||
#[error("AXError::Unknown {0}")]
|
||||
Unknown(i32),
|
||||
}
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum AccessibilityCustomError {
|
||||
#[error("AXValue::create returned None")]
|
||||
AxValueCreate,
|
||||
#[error("NSRunningApplication could not be created for process {0}")]
|
||||
NSRunningApplication(i32),
|
||||
}
|
||||
|
||||
impl From<AXError> for AccessibilityApiError {
|
||||
fn from(value: AXError) -> Self {
|
||||
match value {
|
||||
AXError::Success => Self::Success,
|
||||
AXError::Failure => Self::Failure,
|
||||
AXError::IllegalArgument => Self::IllegalArgument,
|
||||
AXError::InvalidUIElement => Self::InvalidUIElement,
|
||||
AXError::InvalidUIElementObserver => Self::InvalidUIElementObserver,
|
||||
AXError::CannotComplete => Self::CannotComplete,
|
||||
AXError::AttributeUnsupported => Self::AttributeUnsupported,
|
||||
AXError::ActionUnsupported => Self::ActionUnsupported,
|
||||
AXError::NotificationUnsupported => Self::NotificationUnsupported,
|
||||
AXError::NotImplemented => Self::NotImplemented,
|
||||
AXError::NotificationAlreadyRegistered => Self::NotificationAlreadyRegistered,
|
||||
AXError::NotificationNotRegistered => Self::NotificationNotRegistered,
|
||||
AXError::APIDisabled => Self::APIDisabled,
|
||||
AXError::NoValue => Self::NoValue,
|
||||
AXError::ParameterizedAttributeUnsupported => Self::ParameterizedAttributeUnsupported,
|
||||
AXError::NotEnoughPrecision => Self::NotEnoughPrecision,
|
||||
error => Self::Unknown(error.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AXError> for AccessibilityError {
|
||||
fn from(value: AXError) -> Self {
|
||||
Self::Api(AccessibilityApiError::from(value))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
use error::AccessibilityApiError;
|
||||
use error::AccessibilityCustomError;
|
||||
use error::AccessibilityError;
|
||||
use objc2_application_services::AXObserver;
|
||||
use objc2_application_services::AXObserverCallback;
|
||||
use objc2_application_services::AXUIElement;
|
||||
use objc2_application_services::AXValue;
|
||||
use objc2_application_services::AXValueType;
|
||||
use objc2_core_foundation::CFRetained;
|
||||
use objc2_core_foundation::CFRunLoop;
|
||||
use objc2_core_foundation::CFRunLoopSource;
|
||||
use objc2_core_foundation::CFString;
|
||||
use objc2_core_foundation::CFType;
|
||||
use objc2_core_foundation::kCFRunLoopDefaultMode;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
pub mod attribute_constants;
|
||||
pub mod error;
|
||||
pub mod notification_constants;
|
||||
|
||||
pub struct AccessibilityApi;
|
||||
|
||||
impl AccessibilityApi {
|
||||
pub fn copy_attribute_value<T: objc2_core_foundation::Type>(
|
||||
element: &AXUIElement,
|
||||
attribute: &'static str,
|
||||
) -> Option<CFRetained<T>> {
|
||||
let mut receiver = std::ptr::null();
|
||||
|
||||
unsafe {
|
||||
element.copy_attribute_value(
|
||||
&CFString::from_static_str(attribute),
|
||||
NonNull::from(&mut receiver),
|
||||
);
|
||||
|
||||
NonNull::new(receiver.cast::<T>().cast_mut())
|
||||
.map(|cf_type| CFRetained::from_raw(cf_type))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_attribute_ax_value<T>(
|
||||
element: &AXUIElement,
|
||||
attribute: &'static str,
|
||||
value_type: AXValueType,
|
||||
mut value: T,
|
||||
) -> Result<(), AccessibilityError> {
|
||||
let pointer = NonNull::from_mut(&mut value).cast::<std::ffi::c_void>();
|
||||
|
||||
unsafe {
|
||||
let value = AXValue::new(value_type, pointer).ok_or(AccessibilityError::Custom(
|
||||
AccessibilityCustomError::AxValueCreate,
|
||||
))?;
|
||||
|
||||
match AccessibilityError::from(
|
||||
element.set_attribute_value(&CFString::from_static_str(attribute), &value),
|
||||
) {
|
||||
AccessibilityError::Api(AccessibilityApiError::Success) => Ok(()),
|
||||
error => Err(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_attribute_cf_value(
|
||||
element: &AXUIElement,
|
||||
attribute: &'static str,
|
||||
value: &CFType,
|
||||
) -> Result<(), AccessibilityError> {
|
||||
unsafe {
|
||||
match AccessibilityError::from(
|
||||
element.set_attribute_value(&CFString::from_static_str(attribute), value),
|
||||
) {
|
||||
AccessibilityError::Api(AccessibilityApiError::Success) => Ok(()),
|
||||
error => Err(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_application(process_id: i32) -> CFRetained<AXUIElement> {
|
||||
unsafe { AXUIElement::new_application(process_id) }
|
||||
}
|
||||
|
||||
pub fn create_observer(
|
||||
process_id: i32,
|
||||
callback: AXObserverCallback,
|
||||
) -> Result<CFRetained<AXObserver>, AccessibilityError> {
|
||||
let mut observer_ref = std::ptr::null_mut();
|
||||
|
||||
match AccessibilityError::from(unsafe {
|
||||
AXObserver::create(process_id, callback, NonNull::from_mut(&mut observer_ref))
|
||||
}) {
|
||||
AccessibilityError::Api(AccessibilityApiError::Success) => unsafe {
|
||||
Ok(CFRetained::from_raw(
|
||||
NonNull::new(observer_ref.cast::<AXObserver>()).unwrap(),
|
||||
))
|
||||
},
|
||||
error => Err(error),
|
||||
}
|
||||
}
|
||||
|
||||
fn add_notifications_to_observer(
|
||||
observer: &AXObserver,
|
||||
element: &AXUIElement,
|
||||
notifications: &[&'static str],
|
||||
) -> Result<(), AccessibilityError> {
|
||||
for notification in notifications {
|
||||
unsafe {
|
||||
match AccessibilityError::from(AXObserver::add_notification(
|
||||
observer,
|
||||
element,
|
||||
&CFString::from_str(notification),
|
||||
std::ptr::null_mut(),
|
||||
)) {
|
||||
// we don't want to return until all the notifications have been added
|
||||
AccessibilityError::Api(AccessibilityApiError::Success) => {}
|
||||
// if the notification is already registered then we don't treat that as a true error
|
||||
AccessibilityError::Api(
|
||||
AccessibilityApiError::NotificationAlreadyRegistered,
|
||||
) => {
|
||||
let mut pid = 0;
|
||||
element.pid(NonNull::from_mut(&mut pid));
|
||||
tracing::info!(
|
||||
"{notification} already exists on observer for process id {pid}"
|
||||
);
|
||||
}
|
||||
error => return Err(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn add_observer_to_run_loop(
|
||||
observer: &AXObserver,
|
||||
element: &AXUIElement,
|
||||
notifications: &[&'static str],
|
||||
run_loop: &CFRetained<CFRunLoop>,
|
||||
) -> Result<(), AccessibilityError> {
|
||||
AccessibilityApi::add_notifications_to_observer(observer, element, notifications)?;
|
||||
|
||||
unsafe {
|
||||
CFRunLoop::add_source(
|
||||
run_loop,
|
||||
Some(&observer.run_loop_source()),
|
||||
kCFRunLoopDefaultMode,
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn invalidate_observer(observer: &AXObserver) {
|
||||
unsafe {
|
||||
// invalidate means that this will get removed from all run loops by the system
|
||||
CFRunLoopSource::invalidate(&observer.run_loop_source());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#![allow(non_upper_case_globals, unused)]
|
||||
|
||||
pub const kAXMainWindowChangedNotification: &str = "AXMainWindowChanged";
|
||||
pub const kAXFocusedWindowChangedNotification: &str = "AXFocusedWindowChanged";
|
||||
pub const kAXFocusedUIElementChangedNotification: &str = "AXFocusedUIElementChanged";
|
||||
pub const kAXApplicationActivatedNotification: &str = "AXApplicationActivated";
|
||||
pub const kAXApplicationDeactivatedNotification: &str = "AXApplicationDeactivated";
|
||||
pub const kAXApplicationHiddenNotification: &str = "AXApplicationHidden";
|
||||
pub const kAXApplicationShownNotification: &str = "AXApplicationShown";
|
||||
pub const kAXWindowCreatedNotification: &str = "AXWindowCreated";
|
||||
pub const kAXWindowMovedNotification: &str = "AXWindowMoved";
|
||||
pub const kAXWindowResizedNotification: &str = "AXWindowResized";
|
||||
pub const kAXWindowMiniaturizedNotification: &str = "AXWindowMiniaturized";
|
||||
pub const kAXWindowDeminiaturizedNotification: &str = "AXWindowDeminiaturized";
|
||||
pub const kAXDrawerCreatedNotification: &str = "AXDrawerCreated";
|
||||
pub const kAXSheetCreatedNotification: &str = "AXSheetCreated";
|
||||
pub const kAXHelpTagCreatedNotification: &str = "AXHelpTagCreated";
|
||||
pub const kAXValueChangedNotification: &str = "AXValueChanged";
|
||||
pub const kAXUIElementDestroyedNotification: &str = "AXUIElementDestroyed";
|
||||
pub const kAXElementBusyChangedNotification: &str = "AXElementBusyChanged";
|
||||
pub const kAXMenuOpenedNotification: &str = "AXMenuOpened";
|
||||
pub const kAXMenuClosedNotification: &str = "AXMenuClosed";
|
||||
pub const kAXMenuItemSelectedNotification: &str = "AXMenuItemSelected";
|
||||
pub const kAXRowCountChangedNotification: &str = "AXRowCountChanged";
|
||||
pub const kAXRowExpandedNotification: &str = "AXRowExpanded";
|
||||
pub const kAXRowCollapsedNotification: &str = "AXRowCollapsed";
|
||||
pub const kAXSelectedCellsChangedNotification: &str = "AXSelectedCellsChanged";
|
||||
pub const kAXUnitsChangedNotification: &str = "AXUnitsChanged";
|
||||
pub const kAXSelectedChildrenMovedNotification: &str = "AXSelectedChildrenMoved";
|
||||
pub const kAXSelectedChildrenChangedNotification: &str = "AXSelectedChildrenChanged";
|
||||
pub const kAXResizedNotification: &str = "AXResized";
|
||||
pub const kAXMovedNotification: &str = "AXMoved";
|
||||
pub const kAXCreatedNotification: &str = "AXCreated";
|
||||
pub const kAXSelectedRowsChangedNotification: &str = "AXSelectedRowsChanged";
|
||||
pub const kAXSelectedColumnsChangedNotification: &str = "AXSelectedColumnsChanged";
|
||||
pub const kAXSelectedTextChangedNotification: &str = "AXSelectedTextChanged";
|
||||
pub const kAXTitleChangedNotification: &str = "AXTitleChanged";
|
||||
pub const kAXLayoutChangedNotification: &str = "AXLayoutChanged";
|
||||
pub const kAXAnnouncementRequestedNotification: &str = "AXAnnouncementRequested";
|
||||
pub const kAXUIElementsKey: &str = "AXUIElementsKey";
|
||||
pub const kAXPriorityKey: &str = "AXPriorityKey";
|
||||
pub const kAXAnnouncementKey: &str = "AXAnnouncementKey";
|
||||
pub const kAXUIElementTitleKey: &str = "AXUIElementTitleKey";
|
||||
@@ -0,0 +1,140 @@
|
||||
use crate::accessibility::AccessibilityApi;
|
||||
use crate::accessibility::attribute_constants::kAXTitleAttribute;
|
||||
use crate::accessibility::attribute_constants::kAXWindowsAttribute;
|
||||
use crate::accessibility::error::AccessibilityError;
|
||||
use crate::accessibility::notification_constants::kAXApplicationActivatedNotification;
|
||||
use crate::accessibility::notification_constants::kAXApplicationDeactivatedNotification;
|
||||
use crate::accessibility::notification_constants::kAXApplicationHiddenNotification;
|
||||
use crate::accessibility::notification_constants::kAXApplicationShownNotification;
|
||||
use crate::accessibility::notification_constants::kAXMainWindowChangedNotification;
|
||||
use crate::accessibility::notification_constants::kAXUIElementDestroyedNotification;
|
||||
use crate::accessibility::notification_constants::kAXWindowCreatedNotification;
|
||||
use crate::window::Window;
|
||||
use objc2_application_services::AXObserver;
|
||||
use objc2_application_services::AXUIElement;
|
||||
use objc2_core_foundation::CFArray;
|
||||
use objc2_core_foundation::CFRetained;
|
||||
use objc2_core_foundation::CFRunLoop;
|
||||
use objc2_core_foundation::CFString;
|
||||
use std::ffi::c_void;
|
||||
use std::ptr::NonNull;
|
||||
use tracing::instrument;
|
||||
|
||||
const NOTIFICATIONS: &[&str] = &[
|
||||
kAXApplicationActivatedNotification,
|
||||
kAXApplicationDeactivatedNotification,
|
||||
kAXApplicationHiddenNotification,
|
||||
kAXApplicationShownNotification,
|
||||
// this is when we change focus between two windows of the same app
|
||||
kAXMainWindowChangedNotification,
|
||||
// this is when the same app has a new window opened
|
||||
kAXWindowCreatedNotification,
|
||||
// this is when a window of an application is destroyed / closed
|
||||
// when this fires, the app owner name won't be found, but the can be matched via PID
|
||||
kAXUIElementDestroyedNotification,
|
||||
];
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Application {
|
||||
element: CFRetained<AXUIElement>,
|
||||
pub process_id: i32,
|
||||
pub observer: CFRetained<AXObserver>,
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
unsafe extern "C-unwind" fn application_observer_callback(
|
||||
_observer: NonNull<AXObserver>,
|
||||
element: NonNull<AXUIElement>,
|
||||
notification: NonNull<CFString>,
|
||||
_context: *mut c_void,
|
||||
) {
|
||||
unsafe {
|
||||
let name =
|
||||
AccessibilityApi::copy_attribute_value::<CFString>(element.as_ref(), kAXTitleAttribute)
|
||||
.map(|s| s.to_string());
|
||||
|
||||
let mut pid = 0;
|
||||
|
||||
element.as_ref().pid(NonNull::from_mut(&mut pid));
|
||||
|
||||
if let Some(name) = name
|
||||
&& !name.is_empty()
|
||||
{
|
||||
tracing::info!(
|
||||
"notification: {}, process: {pid}, name: \"{name}\"",
|
||||
notification.as_ref()
|
||||
);
|
||||
} else {
|
||||
tracing::info!("notification: {}, process: {pid}", notification.as_ref());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Application {
|
||||
fn drop(&mut self) {
|
||||
tracing::info!(
|
||||
"invalidating application observer for process id {}",
|
||||
self.process_id
|
||||
);
|
||||
// make sure the observer gets removed from any run loops
|
||||
AccessibilityApi::invalidate_observer(&self.observer);
|
||||
}
|
||||
}
|
||||
|
||||
impl Application {
|
||||
pub fn new(process_id: i32) -> Result<Self, AccessibilityError> {
|
||||
Ok(Self {
|
||||
element: AccessibilityApi::create_application(process_id),
|
||||
process_id,
|
||||
observer: AccessibilityApi::create_observer(
|
||||
process_id,
|
||||
Some(application_observer_callback),
|
||||
)?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Option<String> {
|
||||
AccessibilityApi::copy_attribute_value::<CFString>(&self.element, kAXTitleAttribute)
|
||||
.map(|s| s.to_string())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn observe(&self, run_loop: &CFRetained<CFRunLoop>) -> Result<(), AccessibilityError> {
|
||||
tracing::info!(
|
||||
"registering observer for process: {}, name: {}",
|
||||
self.process_id,
|
||||
self.name()
|
||||
.unwrap_or_else(|| String::from("<NO NAME FOUND>"))
|
||||
);
|
||||
|
||||
AccessibilityApi::add_observer_to_run_loop(
|
||||
&self.observer,
|
||||
&self.element,
|
||||
NOTIFICATIONS,
|
||||
run_loop,
|
||||
)
|
||||
}
|
||||
|
||||
fn window_elements(&self) -> Option<CFRetained<CFArray<AXUIElement>>> {
|
||||
AccessibilityApi::copy_attribute_value::<CFArray<AXUIElement>>(
|
||||
&self.element,
|
||||
kAXWindowsAttribute,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn window_by_title(&self, title: &str) -> Option<Window> {
|
||||
let mut target = None;
|
||||
|
||||
for element in self.window_elements()? {
|
||||
let window = Window::new(element, self.clone()).ok()?;
|
||||
|
||||
if let Some(window_title) = window.title()
|
||||
&& window_title.eq(title)
|
||||
{
|
||||
target = Some(window);
|
||||
}
|
||||
}
|
||||
|
||||
target
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
use crate::rect::Rect;
|
||||
|
||||
pub fn recursive_fibonacci(
|
||||
idx: usize,
|
||||
count: usize,
|
||||
area: &Rect,
|
||||
resize_adjustments: Vec<Option<Rect>>,
|
||||
) -> Vec<Rect> {
|
||||
let mut a = *area;
|
||||
|
||||
let resized = if let Some(Some(r)) = resize_adjustments.get(idx) {
|
||||
a.left += r.left;
|
||||
a.top += r.top;
|
||||
a.right += r.right;
|
||||
a.bottom += r.bottom;
|
||||
a
|
||||
} else {
|
||||
*area
|
||||
};
|
||||
|
||||
// let half_width = area.right / 2.0;
|
||||
// let half_height = area.bottom / 2.0;
|
||||
let half_resized_width = resized.right / 2.0;
|
||||
let half_resized_height = resized.bottom / 2.0;
|
||||
|
||||
let (main_x, alt_x, alt_y, main_y);
|
||||
|
||||
main_x = resized.left;
|
||||
alt_x = resized.left + half_resized_width;
|
||||
main_y = resized.top;
|
||||
alt_y = resized.top + half_resized_height;
|
||||
|
||||
#[allow(clippy::if_not_else)]
|
||||
if count == 0 {
|
||||
vec![]
|
||||
} else if count == 1 {
|
||||
vec![Rect {
|
||||
left: resized.left,
|
||||
top: resized.top,
|
||||
right: resized.right,
|
||||
bottom: resized.bottom,
|
||||
}]
|
||||
} else if idx % 2 != 0 {
|
||||
let mut res = vec![Rect {
|
||||
left: resized.left,
|
||||
top: main_y,
|
||||
right: resized.right,
|
||||
bottom: half_resized_height,
|
||||
}];
|
||||
res.append(&mut recursive_fibonacci(
|
||||
idx + 1,
|
||||
count - 1,
|
||||
&Rect {
|
||||
left: area.left,
|
||||
top: alt_y,
|
||||
right: area.right,
|
||||
bottom: area.bottom - half_resized_height,
|
||||
},
|
||||
resize_adjustments,
|
||||
));
|
||||
res
|
||||
} else {
|
||||
let mut res = vec![Rect {
|
||||
left: main_x,
|
||||
top: resized.top,
|
||||
right: half_resized_width,
|
||||
bottom: resized.bottom,
|
||||
}];
|
||||
res.append(&mut recursive_fibonacci(
|
||||
idx + 1,
|
||||
count - 1,
|
||||
&Rect {
|
||||
left: alt_x,
|
||||
top: area.top,
|
||||
right: area.right - half_resized_width,
|
||||
bottom: area.bottom,
|
||||
},
|
||||
resize_adjustments,
|
||||
));
|
||||
res
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#![warn(clippy::all)]
|
||||
|
||||
use objc2_core_foundation::CFArray;
|
||||
use objc2_core_foundation::CFDictionary;
|
||||
use objc2_core_foundation::CFString;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
pub mod accessibility;
|
||||
pub mod application;
|
||||
pub mod layout;
|
||||
pub mod rect;
|
||||
pub mod window;
|
||||
|
||||
pub fn cf_array_as<T>(array: &CFArray) -> impl Iterator<Item = NonNull<T>> + use<'_, T> {
|
||||
let count = CFArray::count(array);
|
||||
(0..count).flat_map(move |idx| {
|
||||
NonNull::new(unsafe { CFArray::value_at_index(array, idx).cast_mut() })
|
||||
.map(|ptr| ptr.cast::<T>())
|
||||
})
|
||||
}
|
||||
|
||||
pub fn cf_dictionary_value<T>(dict: &CFDictionary, key: &CFString) -> Option<NonNull<T>> {
|
||||
let ptr = unsafe { CFDictionary::value(dict, NonNull::from(key).as_ptr().cast()) };
|
||||
NonNull::new(ptr.cast_mut()).map(|ptr| ptr.cast::<T>())
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
#![warn(clippy::all)]
|
||||
|
||||
use color_eyre::eyre;
|
||||
use color_eyre::eyre::eyre;
|
||||
use komorebi::application::Application;
|
||||
use komorebi::cf_array_as;
|
||||
use komorebi::layout;
|
||||
use komorebi::rect::Rect;
|
||||
use komorebi::window::WindowInfo;
|
||||
use objc2::rc::autoreleasepool;
|
||||
use objc2_application_services::AXIsProcessTrusted;
|
||||
use objc2_core_foundation::CFArray;
|
||||
use objc2_core_foundation::CFDictionary;
|
||||
use objc2_core_foundation::CFRetained;
|
||||
use objc2_core_foundation::CFRunLoop;
|
||||
use objc2_core_foundation::kCFRunLoopDefaultMode;
|
||||
use objc2_core_graphics::CGDisplayBounds;
|
||||
use objc2_core_graphics::CGMainDisplayID;
|
||||
use objc2_core_graphics::CGPreflightScreenCaptureAccess;
|
||||
use objc2_core_graphics::CGRequestScreenCaptureAccess;
|
||||
use objc2_core_graphics::CGWindowListCopyWindowInfo;
|
||||
use objc2_core_graphics::CGWindowListOption;
|
||||
use objc2_core_graphics::kCGNullWindowID;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::mpsc;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
fn check_permissions() -> eyre::Result<()> {
|
||||
unsafe {
|
||||
// check for screen capture access - this is needed to read window titles
|
||||
if !CGPreflightScreenCaptureAccess() {
|
||||
// if providing the dialog box failed, exit
|
||||
if !CGRequestScreenCaptureAccess() {
|
||||
eyre::bail!("failed to request screen capability");
|
||||
}
|
||||
}
|
||||
|
||||
if !AXIsProcessTrusted() {
|
||||
eyre::bail!("komorebi needs to be added as a trusted accessibility process");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn setup() -> eyre::Result<()> {
|
||||
if std::env::var("RUST_LIB_BACKTRACE").is_err() {
|
||||
unsafe {
|
||||
std::env::set_var("RUST_LIB_BACKTRACE", "1");
|
||||
}
|
||||
}
|
||||
|
||||
color_eyre::install()?;
|
||||
|
||||
if std::env::var("RUST_LOG").is_err() {
|
||||
unsafe {
|
||||
std::env::set_var("RUST_LOG", "info");
|
||||
}
|
||||
}
|
||||
tracing::subscriber::set_global_default(
|
||||
tracing_subscriber::fmt::Subscriber::builder()
|
||||
.with_env_filter(EnvFilter::from_default_env())
|
||||
.finish(),
|
||||
)?;
|
||||
|
||||
// https://github.com/tokio-rs/tracing/blob/master/examples/examples/panic_hook.rs
|
||||
// Set a panic hook that records the panic as a `tracing` event at the
|
||||
// `ERROR` verbosity level.
|
||||
//
|
||||
// If we are currently in a span when the panic occurred, the logged event
|
||||
// will include the current span, allowing the context in which the panic
|
||||
// occurred to be recorded.
|
||||
std::panic::set_hook(Box::new(|panic| {
|
||||
// If the panic has a source location, record it as structured fields.
|
||||
panic.location().map_or_else(
|
||||
|| {
|
||||
tracing::error!(message = %panic);
|
||||
},
|
||||
|location| {
|
||||
// On nightly Rust, where the `PanicInfo` type also exposes a
|
||||
// `message()` method returning just the message, we could record
|
||||
// just the message instead of the entire `fmt::Display`
|
||||
// implementation, avoiding the duplciated location
|
||||
tracing::error!(
|
||||
message = %panic,
|
||||
panic.file = location.file(),
|
||||
panic.line = location.line(),
|
||||
panic.column = location.column(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() -> eyre::Result<()> {
|
||||
setup()?;
|
||||
check_permissions()?;
|
||||
|
||||
let display_size = unsafe { CGDisplayBounds(CGMainDisplayID()) };
|
||||
tracing::info!("display size for main display is: {:?}", display_size);
|
||||
|
||||
let run_loop = CFRunLoop::current().ok_or(eyre!("couldn't get CFRunLoop::current"))?;
|
||||
|
||||
if let Some(window_info_list) = list_window_info() {
|
||||
tracing::info!("{} windows found", window_info_list.len());
|
||||
|
||||
let mut windows = vec![];
|
||||
let mut applications = HashMap::new();
|
||||
|
||||
for entry in cf_array_as::<CFDictionary>(window_info_list.as_ref()) {
|
||||
if let Some(info) = WindowInfo::new(entry).validated() {
|
||||
let application = applications.entry(info.owner_pid).or_insert_with(|| {
|
||||
let application = Application::new(info.owner_pid).unwrap_or_else(|_| {
|
||||
panic!("failed to create application from pid {}", info.owner_pid)
|
||||
});
|
||||
application
|
||||
.observe(&run_loop)
|
||||
.expect("application must be observable");
|
||||
application
|
||||
});
|
||||
|
||||
if let Some(window) = application.window_by_title(&info.name) {
|
||||
window.observe(&run_loop)?;
|
||||
windows.push(window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tracing::info!("{} valid windows identified", windows.len());
|
||||
|
||||
let layouts =
|
||||
layout::recursive_fibonacci(0, windows.len(), &Rect::from(display_size), vec![]);
|
||||
|
||||
windows.iter().zip(layouts).for_each(|(window, layout)| {
|
||||
if let Err(error) = window.set_position(&layout) {
|
||||
tracing::error!(
|
||||
"failed to position window: {} ({error})",
|
||||
window
|
||||
.title()
|
||||
.unwrap_or_else(|| String::from("<NO TITLE FOUND>"))
|
||||
);
|
||||
}
|
||||
|
||||
// initial example to ensure that window focusing works
|
||||
// if let Some(window_title) = window.title()
|
||||
// && window_title.contains("Komorebi Community Server")
|
||||
// {
|
||||
// match window.focus() {
|
||||
// Err(error) => {
|
||||
// tracing::error!(
|
||||
// "failed to focus window: {} ({error})",
|
||||
// window
|
||||
// .title()
|
||||
// .unwrap_or_else(|| String::from("<NO TITLE FOUND>"))
|
||||
// );
|
||||
// }
|
||||
// Ok(()) => {
|
||||
// tracing::info!(
|
||||
// "focused window: {}",
|
||||
// window
|
||||
// .title()
|
||||
// .unwrap_or_else(|| String::from("<NO TITLE FOUND>"))
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
let quit_ctrlc = Arc::new(AtomicBool::new(false));
|
||||
let quit_thread = quit_ctrlc.clone();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let (ctrlc_sender, ctrlc_receiver) = mpsc::channel();
|
||||
ctrlc::set_handler(move || {
|
||||
ctrlc_sender
|
||||
.send(())
|
||||
.expect("could not send signal on ctrl-c channel");
|
||||
})
|
||||
.expect("could not set ctrl-c handler");
|
||||
|
||||
ctrlc_receiver
|
||||
.recv()
|
||||
.expect("could not receive signal on ctrl-c channel");
|
||||
|
||||
tracing::info!("ctrl-c signal received");
|
||||
quit_ctrlc.store(true, Ordering::Relaxed);
|
||||
});
|
||||
|
||||
tracing::info!("starting CFRunLoop to receive observer notifications");
|
||||
|
||||
loop {
|
||||
if quit_thread.load(Ordering::Relaxed) {
|
||||
tracing::info!("stopping CFRunLoop");
|
||||
break;
|
||||
}
|
||||
|
||||
// this gets our observer notification callbacks firing
|
||||
autoreleasepool(|_| unsafe {
|
||||
CFRunLoop::run_in_mode(kCFRunLoopDefaultMode, 2.0, false)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn list_window_info() -> Option<CFRetained<CFArray>> {
|
||||
unsafe {
|
||||
CGWindowListCopyWindowInfo(
|
||||
// this is still way too many bogus windows
|
||||
CGWindowListOption::OptionOnScreenOnly | CGWindowListOption::ExcludeDesktopElements,
|
||||
// required when using OnScreenOnly
|
||||
kCGNullWindowID,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
use objc2_core_foundation::CGRect;
|
||||
use objc2_core_foundation::CGSize;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Rect {
|
||||
pub left: f32,
|
||||
pub top: f32,
|
||||
pub right: f32,
|
||||
pub bottom: f32,
|
||||
}
|
||||
|
||||
impl From<CGSize> for Rect {
|
||||
fn from(value: CGSize) -> Self {
|
||||
Self {
|
||||
left: 0.0,
|
||||
top: 0.0,
|
||||
right: value.width as f32,
|
||||
bottom: value.height as f32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<CGRect> for Rect {
|
||||
fn from(value: CGRect) -> Self {
|
||||
Self {
|
||||
left: value.origin.x as f32,
|
||||
top: value.origin.y as f32,
|
||||
right: value.size.width as f32,
|
||||
bottom: value.size.height as f32,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
use crate::accessibility::AccessibilityApi;
|
||||
use crate::accessibility::attribute_constants::kAXMainAttribute;
|
||||
use crate::accessibility::attribute_constants::kAXPositionAttribute;
|
||||
use crate::accessibility::attribute_constants::kAXSizeAttribute;
|
||||
use crate::accessibility::attribute_constants::kAXTitleAttribute;
|
||||
use crate::accessibility::error::AccessibilityCustomError;
|
||||
use crate::accessibility::error::AccessibilityError;
|
||||
use crate::accessibility::notification_constants::kAXTitleChangedNotification;
|
||||
use crate::accessibility::notification_constants::kAXWindowDeminiaturizedNotification;
|
||||
use crate::accessibility::notification_constants::kAXWindowMiniaturizedNotification;
|
||||
use crate::accessibility::notification_constants::kAXWindowMovedNotification;
|
||||
use crate::accessibility::notification_constants::kAXWindowResizedNotification;
|
||||
use crate::application::Application;
|
||||
use crate::cf_dictionary_value;
|
||||
use crate::rect::Rect;
|
||||
use objc2_app_kit::NSApplicationActivationOptions;
|
||||
use objc2_app_kit::NSRunningApplication;
|
||||
use objc2_application_services::AXObserver;
|
||||
use objc2_application_services::AXUIElement;
|
||||
use objc2_application_services::AXValueType;
|
||||
use objc2_core_foundation::CFBoolean;
|
||||
use objc2_core_foundation::CFDictionary;
|
||||
use objc2_core_foundation::CFNumber;
|
||||
use objc2_core_foundation::CFRetained;
|
||||
use objc2_core_foundation::CFRunLoop;
|
||||
use objc2_core_foundation::CFString;
|
||||
use objc2_core_foundation::CGFloat;
|
||||
use objc2_core_foundation::CGPoint;
|
||||
use objc2_core_foundation::CGSize;
|
||||
use objc2_core_graphics::kCGWindowAlpha;
|
||||
use objc2_core_graphics::kCGWindowBounds;
|
||||
use objc2_core_graphics::kCGWindowName;
|
||||
use objc2_core_graphics::kCGWindowOwnerName;
|
||||
use objc2_core_graphics::kCGWindowOwnerPID;
|
||||
use std::ffi::c_void;
|
||||
use std::ptr::NonNull;
|
||||
use tracing::instrument;
|
||||
|
||||
const NOTIFICATIONS: &[&str] = &[
|
||||
kAXWindowMiniaturizedNotification,
|
||||
kAXWindowDeminiaturizedNotification,
|
||||
kAXWindowMovedNotification,
|
||||
kAXWindowResizedNotification,
|
||||
kAXTitleChangedNotification,
|
||||
];
|
||||
|
||||
#[instrument(skip_all)]
|
||||
unsafe extern "C-unwind" fn window_observer_callback(
|
||||
_observer: NonNull<AXObserver>,
|
||||
element: NonNull<AXUIElement>,
|
||||
notification: NonNull<CFString>,
|
||||
_context: *mut c_void,
|
||||
) {
|
||||
unsafe {
|
||||
let title =
|
||||
AccessibilityApi::copy_attribute_value::<CFString>(element.as_ref(), kAXTitleAttribute)
|
||||
.map(|s| s.to_string());
|
||||
|
||||
let mut pid = 0;
|
||||
|
||||
element.as_ref().pid(NonNull::from_mut(&mut pid));
|
||||
|
||||
if let Some(title) = title
|
||||
&& !title.is_empty()
|
||||
{
|
||||
tracing::info!(
|
||||
"notification: {}, process: {pid}, title: \"{title}\"",
|
||||
notification.as_ref()
|
||||
);
|
||||
} else {
|
||||
tracing::info!("notification: {}, process: {pid}", notification.as_ref());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct WindowInfo {
|
||||
name: Option<String>,
|
||||
owner_pid: i32,
|
||||
owner_name: String,
|
||||
alpha: f32,
|
||||
bounds: WindowBounds,
|
||||
}
|
||||
|
||||
impl WindowInfo {
|
||||
pub fn new(entry: NonNull<CFDictionary>) -> Self {
|
||||
WindowInfo::from(unsafe { entry.as_ref() })
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[allow(unused)]
|
||||
pub struct ValidWindowInfo {
|
||||
pub name: String,
|
||||
pub owner_pid: i32,
|
||||
owner_name: String,
|
||||
alpha: f32,
|
||||
bounds: WindowBounds,
|
||||
}
|
||||
|
||||
impl WindowInfo {
|
||||
pub fn validated(self) -> Option<ValidWindowInfo> {
|
||||
if let Some(name) = self.name
|
||||
&& self.alpha != 0.0
|
||||
&& self.bounds.y != 0.0
|
||||
&& self.bounds.height != 0.0
|
||||
&& !name.is_empty()
|
||||
{
|
||||
return Some(ValidWindowInfo {
|
||||
name,
|
||||
owner_pid: self.owner_pid,
|
||||
owner_name: self.owner_name,
|
||||
alpha: self.alpha,
|
||||
bounds: self.bounds,
|
||||
});
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(unused)]
|
||||
pub struct Window {
|
||||
element: CFRetained<AXUIElement>,
|
||||
application: Application,
|
||||
observer: CFRetained<AXObserver>,
|
||||
}
|
||||
|
||||
impl Drop for Window {
|
||||
fn drop(&mut self) {
|
||||
// make sure the observer gets removed from any run loops
|
||||
tracing::info!(
|
||||
"invalidating window observer for {}",
|
||||
self.title()
|
||||
.unwrap_or_else(|| String::from("<NO TITLE FOUND>"))
|
||||
);
|
||||
AccessibilityApi::invalidate_observer(&self.observer);
|
||||
}
|
||||
}
|
||||
|
||||
impl Window {
|
||||
pub fn new(
|
||||
element: CFRetained<AXUIElement>,
|
||||
application: Application,
|
||||
) -> Result<Self, AccessibilityError> {
|
||||
let observer = AccessibilityApi::create_observer(
|
||||
application.process_id,
|
||||
Some(window_observer_callback),
|
||||
)?;
|
||||
|
||||
Ok(Self {
|
||||
element,
|
||||
application,
|
||||
observer,
|
||||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub fn observe(&self, run_loop: &CFRetained<CFRunLoop>) -> Result<(), AccessibilityError> {
|
||||
tracing::info!(
|
||||
"registering observer for process: {}, title: {}",
|
||||
self.application.process_id,
|
||||
self.title()
|
||||
.unwrap_or_else(|| String::from("<NO TITLE FOUND>"))
|
||||
);
|
||||
|
||||
AccessibilityApi::add_observer_to_run_loop(
|
||||
&self.observer,
|
||||
&self.element,
|
||||
NOTIFICATIONS,
|
||||
run_loop,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn title(&self) -> Option<String> {
|
||||
AccessibilityApi::copy_attribute_value::<CFString>(&self.element, kAXTitleAttribute)
|
||||
.map(|s| s.to_string())
|
||||
}
|
||||
|
||||
pub fn set_position(&self, rect: &Rect) -> Result<(), AccessibilityError> {
|
||||
self.set_point(CGPoint::new(rect.left as CGFloat, rect.top as CGFloat))?;
|
||||
self.set_size(CGSize::new(rect.right as CGFloat, rect.bottom as CGFloat))
|
||||
}
|
||||
|
||||
pub fn focus(&self) -> Result<(), AccessibilityError> {
|
||||
unsafe {
|
||||
NSRunningApplication::runningApplicationWithProcessIdentifier(
|
||||
self.application.process_id,
|
||||
)
|
||||
.ok_or(AccessibilityError::Custom(
|
||||
AccessibilityCustomError::NSRunningApplication(self.application.process_id),
|
||||
))?
|
||||
.activateWithOptions(NSApplicationActivationOptions::empty());
|
||||
|
||||
let cf_boolean = CFBoolean::new(true);
|
||||
let value = &**cf_boolean;
|
||||
AccessibilityApi::set_attribute_cf_value(&self.element, kAXMainAttribute, value)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_point(&self, point: CGPoint) -> Result<(), AccessibilityError> {
|
||||
AccessibilityApi::set_attribute_ax_value(
|
||||
&self.element,
|
||||
kAXPositionAttribute,
|
||||
AXValueType::CGPoint,
|
||||
point,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn set_size(&self, size: CGSize) -> Result<(), AccessibilityError> {
|
||||
AccessibilityApi::set_attribute_ax_value(
|
||||
&self.element,
|
||||
kAXSizeAttribute,
|
||||
AXValueType::CGSize,
|
||||
size,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&CFDictionary> for WindowInfo {
|
||||
fn from(value: &CFDictionary) -> Self {
|
||||
unsafe {
|
||||
Self {
|
||||
name: cf_dictionary_value::<CFString>(value, kCGWindowName)
|
||||
.map(|s| s.as_ref().to_string())
|
||||
.and_then(|s| if s.is_empty() { None } else { Some(s) }),
|
||||
owner_pid: cf_dictionary_value::<CFNumber>(value, kCGWindowOwnerPID)
|
||||
.and_then(|s| s.as_ref().as_i32())
|
||||
.expect("window must have an owner process id"),
|
||||
owner_name: cf_dictionary_value::<CFString>(value, kCGWindowOwnerName)
|
||||
.map(|s| s.as_ref().to_string())
|
||||
.expect("window must have an owner name"),
|
||||
alpha: cf_dictionary_value::<CFNumber>(value, kCGWindowAlpha)
|
||||
.and_then(|s| s.as_ref().as_f32())
|
||||
.expect("window must have an alpha value"),
|
||||
|
||||
bounds: if let Some(dict) =
|
||||
cf_dictionary_value::<CFDictionary>(value, kCGWindowBounds).as_ref()
|
||||
{
|
||||
WindowBounds::from(dict.as_ref())
|
||||
} else {
|
||||
Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
#[allow(unused)]
|
||||
struct WindowBounds {
|
||||
height: f32,
|
||||
width: f32,
|
||||
x: f32,
|
||||
y: f32,
|
||||
}
|
||||
|
||||
impl From<&CFDictionary> for WindowBounds {
|
||||
fn from(value: &CFDictionary) -> Self {
|
||||
unsafe {
|
||||
Self {
|
||||
height: cf_dictionary_value::<CFNumber>(
|
||||
value,
|
||||
&CFString::from_static_str("Height"),
|
||||
)
|
||||
.and_then(|val| val.as_ref().as_f32())
|
||||
.unwrap_or_default(),
|
||||
width: cf_dictionary_value::<CFNumber>(value, &CFString::from_static_str("Width"))
|
||||
.and_then(|val| val.as_ref().as_f32())
|
||||
.unwrap_or_default(),
|
||||
x: cf_dictionary_value::<CFNumber>(value, &CFString::from_static_str("X"))
|
||||
.and_then(|val| val.as_ref().as_f32())
|
||||
.unwrap_or_default(),
|
||||
y: cf_dictionary_value::<CFNumber>(value, &CFString::from_static_str("Y"))
|
||||
.and_then(|val| val.as_ref().as_f32())
|
||||
.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "stable"
|
||||
@@ -0,0 +1 @@
|
||||
imports_granularity = "Item"
|
||||
Reference in new issue
Block a user