bump penrose to 0.3.1, change key bindings

This commit is contained in:
Łukasz Pankowski 2023-02-14 21:31:42 +01:00
parent 6caecdb766
commit 45d9be425b
3 changed files with 502 additions and 316 deletions

513
lupan-wm/Cargo.lock generated
View File

@ -4,9 +4,15 @@ version = 3
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.52" version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
[[package]]
name = "anymap"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33954243bd79057c2de7338850b85983a44588021f8a5fee574a8888c6de4344"
[[package]] [[package]]
name = "atty" name = "atty"
@ -21,9 +27,9 @@ dependencies = [
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@ -33,24 +39,22 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "cairo-rs" name = "cairo-rs"
version = "0.9.1" version = "0.15.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5c0f2e047e8ca53d0ff249c54ae047931d7a6ebe05d00af73e0ffeb6e34bdb8" checksum = "c76ee391b03d35510d9fa917357c7f1855bd9a6659c95a1b392e33f49b3369bc"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cairo-sys-rs", "cairo-sys-rs",
"glib", "glib",
"glib-sys",
"gobject-sys",
"libc", "libc",
"thiserror", "thiserror",
] ]
[[package]] [[package]]
name = "cairo-sys-rs" name = "cairo-sys-rs"
version = "0.10.0" version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ed2639b9ad5f1d6efa76de95558e11339e7318426d84ac4890b86c03e828ca7" checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
dependencies = [ dependencies = [
"glib-sys", "glib-sys",
"libc", "libc",
@ -58,10 +62,13 @@ dependencies = [
] ]
[[package]] [[package]]
name = "cc" name = "cfg-expr"
version = "1.0.72" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" checksum = "b0357a6402b295ca3a86bc148e84df46c02e41f41fef186bda662557ef6328aa"
dependencies = [
"smallvec",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@ -112,63 +119,45 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.19" version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
dependencies = [ dependencies = [
"futures-core", "futures-core",
] ]
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.19" version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.19" version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
"futures-util", "futures-util",
] ]
[[package]]
name = "futures-macro"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.19" version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.19" version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-macro",
"futures-task", "futures-task",
"pin-project-lite", "pin-project-lite",
"pin-utils", "pin-utils",
@ -176,33 +165,43 @@ dependencies = [
] ]
[[package]] [[package]]
name = "glib" name = "gethostname"
version = "0.10.3" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c685013b7515e668f1b57a165b009d4d28cb139a8a989bbd699c10dad29d0c5" checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "glib"
version = "0.15.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edb0306fbad0ab5428b0ca674a23893db909a98582969c9b537be4ced78c505d"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-executor", "futures-executor",
"futures-task", "futures-task",
"futures-util",
"glib-macros", "glib-macros",
"glib-sys", "glib-sys",
"gobject-sys", "gobject-sys",
"libc", "libc",
"once_cell", "once_cell",
"smallvec",
"thiserror",
] ]
[[package]] [[package]]
name = "glib-macros" name = "glib-macros"
version = "0.10.1" version = "0.15.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41486a26d1366a8032b160b59065a59fb528530a46a49f627e7048fb8c064039" checksum = "25a68131a662b04931e71891fb14aaf65ee4b44d08e8abc10f49e77418c86c64"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"heck 0.3.3", "heck 0.4.0",
"itertools",
"proc-macro-crate", "proc-macro-crate",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
@ -212,9 +211,9 @@ dependencies = [
[[package]] [[package]]
name = "glib-sys" name = "glib-sys"
version = "0.10.1" version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1" checksum = "ef4b192f8e65e9cf76cbf4ea71fa8e3be4a0e18ffe3d68b8da6836974cc5bad4"
dependencies = [ dependencies = [
"libc", "libc",
"system-deps", "system-deps",
@ -222,9 +221,9 @@ dependencies = [
[[package]] [[package]]
name = "gobject-sys" name = "gobject-sys"
version = "0.10.0" version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c" checksum = "0d57ce44246becd17153bd035ab4d32cfee096a657fc01f2231c9278378d1e0a"
dependencies = [ dependencies = [
"glib-sys", "glib-sys",
"libc", "libc",
@ -233,9 +232,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.11.2" version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]] [[package]]
name = "heck" name = "heck"
@ -263,23 +262,14 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.8.0" version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
] ]
[[package]]
name = "itertools"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
dependencies = [
"either",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -288,26 +278,38 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.112" version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.14" version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]] [[package]]
name = "lupan-wm" name = "lupan-wm"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"clap", "clap",
"penrose", "penrose",
"penrose_ui",
"simplelog", "simplelog",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "matchers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
dependencies = [
"regex-automata",
] ]
[[package]] [[package]]
@ -317,15 +319,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]] [[package]]
name = "nix" name = "memoffset"
version = "0.20.0" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
[[package]]
name = "nix"
version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cc",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset",
]
[[package]]
name = "nix"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
dependencies = [
"autocfg",
"bitflags",
"cfg-if",
"libc",
"memoffset",
"pin-utils",
]
[[package]]
name = "nom8"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8"
dependencies = [
"memchr",
]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
"winapi",
] ]
[[package]] [[package]]
@ -349,9 +393,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.9.0" version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
@ -363,15 +407,19 @@ dependencies = [
] ]
[[package]] [[package]]
name = "pango" name = "overload"
version = "0.9.1" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9937068580bebd8ced19975938573803273ccbcbd598c58d4906efd4ac87c438" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "pango"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e4045548659aee5313bde6c582b0d83a627b7904dd20dc2d9ef0895d414e4f"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"glib", "glib",
"glib-sys",
"gobject-sys",
"libc", "libc",
"once_cell", "once_cell",
"pango-sys", "pango-sys",
@ -379,9 +427,9 @@ dependencies = [
[[package]] [[package]]
name = "pango-sys" name = "pango-sys"
version = "0.10.0" version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d2650c8b62d116c020abd0cea26a4ed96526afda89b1c4ea567131fdefc890" checksum = "d2a00081cde4661982ed91d80ef437c20eacaf6aa1a5962c0279ae194662c3aa"
dependencies = [ dependencies = [
"glib-sys", "glib-sys",
"gobject-sys", "gobject-sys",
@ -391,27 +439,23 @@ dependencies = [
[[package]] [[package]]
name = "pangocairo" name = "pangocairo"
version = "0.10.0" version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00f5ae67a05a5e023f09f64e9a71c845274d4b82dedee237b70425811885e883" checksum = "7876a45c1f1d1a75a2601dc6d9ef2cb5a8be0e3d76f909d82450759929035366"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cairo-rs", "cairo-rs",
"cairo-sys-rs",
"glib", "glib",
"glib-sys",
"gobject-sys",
"libc", "libc",
"pango", "pango",
"pango-sys",
"pangocairo-sys", "pangocairo-sys",
] ]
[[package]] [[package]]
name = "pangocairo-sys" name = "pangocairo-sys"
version = "0.11.0" version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94ccc97f698c2f0233b84e5ca676893a1e676785b60eec700b9c0e6dcd0feb98" checksum = "78cf746594916c81d5f739af9335c5f55a1f4606d80b3e1d821f18cf95a29494"
dependencies = [ dependencies = [
"cairo-sys-rs", "cairo-sys-rs",
"glib-sys", "glib-sys",
@ -422,23 +466,19 @@ dependencies = [
[[package]] [[package]]
name = "penrose" name = "penrose"
version = "0.2.1" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c99eba539000844e97310340f43654453286c81da95639436d9a41f738fdab06" checksum = "1e93c99e05bb9926a036cd391570dd142dc8d6522edc7b290c9e86beacf7e799"
dependencies = [ dependencies = [
"anymap",
"bitflags", "bitflags",
"cairo-rs", "nix 0.25.1",
"cairo-sys-rs",
"nix",
"pango",
"pangocairo",
"penrose_keysyms", "penrose_keysyms",
"penrose_proc", "strum 0.24.1",
"strum 0.20.0", "strum_macros 0.24.3",
"strum_macros 0.20.1",
"thiserror", "thiserror",
"tracing", "tracing",
"xcb", "x11rb",
] ]
[[package]] [[package]]
@ -452,24 +492,25 @@ dependencies = [
] ]
[[package]] [[package]]
name = "penrose_proc" name = "penrose_ui"
version = "0.1.3" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a4e9438e0d3ed63bbd08fd0838bb35d94ef298f6705144b27608a5a22f1ebb9" checksum = "540c877ce9894a5c23a4aa9a21f2a061c22de530e47bbc4ac548e7a2acb30b7d"
dependencies = [ dependencies = [
"penrose_keysyms", "cairo-rs",
"proc-macro2", "pango",
"quote", "pangocairo",
"rustversion", "penrose",
"strum 0.20.0", "thiserror",
"syn", "tracing",
"x11rb",
] ]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.7" version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -479,17 +520,18 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.24" version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "0.1.5" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34"
dependencies = [ dependencies = [
"toml", "once_cell",
"toml_edit",
] ]
[[package]] [[package]]
@ -518,11 +560,11 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.35" version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "392a54546fda6b7cc663379d0e6ce8b324cf88aecc5a499838e1be9781bdce2e" checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [ dependencies = [
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
@ -534,6 +576,30 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "regex"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.6" version = "1.0.6"
@ -542,9 +608,18 @@ checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.132" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
[[package]]
name = "sharded-slab"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "simplelog" name = "simplelog"
@ -559,9 +634,18 @@ dependencies = [
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.5" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef"
dependencies = [
"autocfg",
]
[[package]]
name = "smallvec"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]] [[package]]
name = "strsim" name = "strsim"
@ -569,12 +653,6 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "strum"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.20.0" version = "0.20.0"
@ -585,15 +663,12 @@ dependencies = [
] ]
[[package]] [[package]]
name = "strum_macros" name = "strum"
version = "0.18.0" version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
dependencies = [ dependencies = [
"heck 0.3.3", "strum_macros 0.24.3",
"proc-macro2",
"quote",
"syn",
] ]
[[package]] [[package]]
@ -609,27 +684,38 @@ dependencies = [
] ]
[[package]] [[package]]
name = "syn" name = "strum_macros"
version = "1.0.84" version = "0.24.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
dependencies = [
"heck 0.4.0",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
[[package]]
name = "syn"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"unicode-xid", "unicode-ident",
] ]
[[package]] [[package]]
name = "system-deps" name = "system-deps"
version = "1.3.2" version = "6.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f3ecc17269a19353b3558b313bba738b25d82993e30d62a18406a24aba4649b" checksum = "2955b1fe31e1fa2fbd1976b71cc69a606d7d4da16f6de3333d0c92d51419aeff"
dependencies = [ dependencies = [
"heck 0.3.3", "cfg-expr",
"heck 0.4.0",
"pkg-config", "pkg-config",
"strum 0.18.0",
"strum_macros 0.18.0",
"thiserror",
"toml", "toml",
"version-compare", "version-compare",
] ]
@ -651,24 +737,34 @@ checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.30" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.30" version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "thread_local"
version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [
"cfg-if",
"once_cell",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.44" version = "0.1.44"
@ -682,18 +778,35 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.8" version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "tracing" name = "toml_datetime"
version = "0.1.29" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5"
[[package]]
name = "toml_edit"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b"
dependencies = [
"indexmap",
"nom8",
"toml_datetime",
]
[[package]]
name = "tracing"
version = "0.1.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"log", "log",
@ -704,9 +817,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-attributes" name = "tracing-attributes"
version = "0.1.18" version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -715,13 +828,49 @@ dependencies = [
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.21" version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
dependencies = [
"once_cell",
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"log",
"tracing-core",
] ]
[[package]]
name = "tracing-subscriber"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
dependencies = [
"matchers",
"nu-ansi-term",
"once_cell",
"regex",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
]
[[package]]
name = "unicode-ident"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.8.0" version = "1.8.0"
@ -729,16 +878,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]] [[package]]
name = "unicode-xid" name = "valuable"
version = "0.2.2" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.0.10" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
[[package]] [[package]]
name = "version_check" name = "version_check"
@ -777,6 +926,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "winapi-wsapoll"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
@ -784,11 +942,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "xcb" name = "x11rb"
version = "0.9.0" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6" checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507"
dependencies = [ dependencies = [
"gethostname",
"libc", "libc",
"log", "nix 0.24.3",
"winapi",
"winapi-wsapoll",
"x11rb-protocol",
]
[[package]]
name = "x11rb-protocol"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67"
dependencies = [
"nix 0.24.3",
] ]

View File

@ -1,9 +1,12 @@
[package] [package]
name = "lupan-wm" name = "lupan-wm"
version = "0.1.0" version = "0.1.1"
edition = "2018" edition = "2021"
[dependencies] [dependencies]
clap = { version = "3.0.5", features = ["derive"] } clap = { version = "3.0.5", features = ["derive"] }
penrose = "0.2.1" penrose = "0.3.1"
penrose_ui = "0.1.1"
simplelog = "0.8" simplelog = "0.8"
tracing = { version = "0.1.37", features = ["attributes", "log"] }
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }

View File

@ -1,41 +1,138 @@
#[macro_use]
extern crate penrose;
use clap::Parser; use clap::Parser;
use penrose::{ use penrose::{
contrib::{hooks::ManageExistingClients}, builtin::{
core::{ actions::{exit, log_current_state, modify_with, send_layout_message, spawn, key_handler},
bindings::{KeyEventHandler, MouseEvent}, config::Config, helpers::index_selectors, manager::WindowManager, layout::{
hooks::Hooks, messages::{ExpandMain, IncMain, ShrinkMain},
layout::{bottom_stack, side_stack, Layout, LayoutConf}, transformers::{Gaps, ReserveTop},
MainAndStack, Monocle,
},
}, },
draw::{bar::dwm_bar, Color, TextStyle}, core::{
logging_error_handler, bindings::{parse_keybindings_with_xmodmap, KeyEventHandler},
xcb::{new_xcb_backed_window_manager, XcbDraw, XcbConnection}, layout::LayoutStack,
Backward, Forward, Less, More, Result, Selector Config, WindowManager,
},
extensions::{hooks::add_ewmh_hooks, actions::focus_or_spawn},
extensions::actions::toggle_fullscreen,
map, stack,
x11rb::RustConn,
Result,
util
}; };
use penrose_ui::{bar::Position, core::TextStyle, status_bar};
use std::convert::{TryFrom, TryInto}; use std::collections::HashMap;
use tracing_subscriber::{self, prelude::*};
pub type Conn = XcbConnection;
const TERMINAL: &str = "st tmux";
const TERMINAL2: &str = "st";
const EDITOR: &str = "emacsclient -c -n";
const MIXER: &str = "pavucontrol";
const SUSPEND: &str = "systemctl suspend";
const LOCK: &str = "slock";
const SET_THEME: &str = "lupan-set-theme";
const FONT: &str = "Iosevka Slab Light"; const FONT: &str = "Iosevka Slab Light";
const FONT_SIZE: i32 = 20; const FONT_SIZE: i32 = 20;
const BAR_BG: &str = "#0c4a6e"; const BLACK: u32 = 0x282828ff;
const BAR_FG: &str = "#7dd3fc"; const WHITE: u32 = 0x7dd3fcff;
const BAR_HIGHLIGHT: &str = "#0369a1"; const GREY: u32 = 0x94a3b8ff;
const BAR_EMPTY: &str = "#94a3b8"; const BLUE: u32 = 0x0c4a6eff;
const FOCUSED_BORDER: &str = "#d97706"; const FOCUSED_BORDER: u32 = 0xd97706ff;
const UNFOCUSED_BORDER: &str = "#64748b"; const NORMAL_BORDER: u32 = 0x64748ff;
const MAX_MAIN: u32 = 1;
const RATIO: f32 = 0.6;
const RATIO_STEP: f32 = 0.05;
const OUTER_PX: u32 = 5;
const INNER_PX: u32 = 5;
const TERMINAL: &str = "alacritty";
const EDITOR: &str = "emacsclient -c -n";
const SUSPEND: &str = "systemctl suspend";
const LOCK: &str = "slock";
const SET_THEME: &str = "lupan-set-theme";
const DMENU_ARGS: &[&str] = &["-fn", "Iosevka Slab Light"];
fn raw_key_bindings() -> HashMap<String, Box<dyn KeyEventHandler<RustConn>>> {
let mut theme = "dark";
let mut raw_bindings = map! {
map_keys: |k: &str| k.to_owned();
"M-j" => modify_with(|cs| cs.focus_down()),
"M-k" => modify_with(|cs| cs.focus_up()),
"M-S-j" => modify_with(|cs| cs.swap_down()),
"M-S-k" => modify_with(|cs| cs.swap_up()),
"M-S-c" => modify_with(|cs| cs.kill_focused()),
"M-a" => modify_with(|cs| cs.toggle_tag()),
"M-f" => toggle_fullscreen(),
"M-Return" => modify_with(|cs| cs.swap_focus_and_head()),
"M-m" => modify_with(|cs| cs.focus_head()),
"M-bracketright" => modify_with(|cs| cs.next_screen()),
"M-bracketleft" => modify_with(|cs| cs.previous_screen()),
"M-S-bracketright" => modify_with(|cs| {
let current_tag = cs.current_tag().to_string();
cs.next_screen();
cs.pull_tag_to_screen(current_tag);
}),
"M-S-bracketleft" => modify_with(|cs| {
let current_tag = cs.current_tag().to_string();
cs.previous_screen();
cs.pull_tag_to_screen(current_tag);
}),
"M-grave" => modify_with(|cs| cs.next_layout()),
"M-S-grave" => modify_with(|cs| cs.previous_layout()),
"M-comma" => send_layout_message(|| IncMain(1)),
"M-period" => send_layout_message(|| IncMain(-1)),
"M-l" => send_layout_message(|| ExpandMain),
"M-h" => send_layout_message(|| ShrinkMain),
"M-p" => key_handler(move |_, _| util::spawn_with_args("dmenu_run", DMENU_ARGS)),
"M-S-p" => spawn("rofi -theme Arc-Dark -show combi"),
"M-S-e" => spawn(EDITOR),
"M-S-s" => log_current_state(),
"M-S-Return" => spawn(TERMINAL),
"C-M-f" => focus_or_spawn("firefox", "firefox"),
"C-M-l" => spawn(LOCK),
"C-M-s" => spawn(SUSPEND),
"C-M-t" => focus_or_spawn("thunderbird", "thunderbird"),
"M-S-q" => exit(),
"M-i" => modify_with(|cs| cs.current_tag().parse::<i32>().map_or((), |i| cs.focus_tag((i - 1).to_string()))),
"M-o" => modify_with(|cs| cs.current_tag().parse::<i32>().map_or((), |i| cs.focus_tag((i + 1).to_string()))),
"M-S-i" => modify_with(|cs| cs.current_tag().parse::<i32>().map_or((), |i| cs.move_focused_to_tag((i - 1).to_string()))),
"M-S-o" => modify_with(|cs| cs.current_tag().parse::<i32>().map_or((), |i| cs.move_focused_to_tag((i + 1).to_string()))),
"M-C-i" => modify_with(|cs| cs.current_tag().parse::<i32>().map_or((), |i| cs.pull_tag_to_screen((i - 1).to_string()))),
"M-C-o" => modify_with(|cs| cs.current_tag().parse::<i32>().map_or((), |i| cs.pull_tag_to_screen((i + 1).to_string()))),
// Switch theme
"M-S-F6" => key_handler(move |_, _| {
theme = if theme == "dark" { "light" } else { "dark" };
util::spawn(format!("{} {}", SET_THEME, theme))
}),
};
for tag in &["1", "2", "3", "4", "5", "6", "7", "8", "9"] {
raw_bindings.extend([
(
format!("M-{tag}"),
modify_with(move |client_set| client_set.focus_tag(tag)),
),
(
format!("M-S-{tag}"),
modify_with(move |client_set| client_set.move_focused_to_tag(tag)),
),
(
format!("M-C-{tag}"),
modify_with(move |client_set| client_set.pull_tag_to_screen(tag)),
),
]);
}
raw_bindings
}
fn layouts(bar_height_px: u32) -> LayoutStack {
stack!(
MainAndStack::side(MAX_MAIN, RATIO, RATIO_STEP),
MainAndStack::side_mirrored(MAX_MAIN, RATIO, RATIO_STEP),
MainAndStack::bottom(MAX_MAIN, RATIO, RATIO_STEP),
Monocle::boxed()
)
.map(|layout| ReserveTop::wrap(Gaps::wrap(layout, OUTER_PX, INNER_PX), bar_height_px))
}
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[clap(about, version, author)] #[clap(about, version, author)]
@ -49,124 +146,39 @@ struct Args {
font_size: i32, font_size: i32,
} }
macro_rules! rofi {
($theme_str:tt, $show:tt) => {
Box::new(move |_: &mut WindowManager<_>| {
spawn!("rofi", "-theme", "Pop-Dark", "-theme-str", $theme_str,
"-kb-row-select", "Tab", "-kb-row-tab", "Alt-Tab", "-show", $show)
}) as KeyEventHandler<_>
}
}
#[allow(unused_parens)]
fn main() -> Result<()> { fn main() -> Result<()> {
let n_main = 1;
let ratio = 0.6;
let args = Args::parse(); let args = Args::parse();
let rofi_theme_str = format!("* {{ text-color: {}; background-color: {}; blue: {}; font: \"{} {}\"; }}", tracing_subscriber::fmt()
BAR_FG, BAR_BG, BAR_HIGHLIGHT, args.font, args.font_size); .with_env_filter("debug")
let mut theme = "dark"; .finish()
let config = Config::default() .init();
.builder() let bar_height_px = 2 * args.font_size as u32;
.workspaces(vec!["1", "2", "3", "4", "5", "6", "7", "8", "9"])
.bar_height((2 * args.font_size).try_into().unwrap())
.border_px(4)
.focused_border(FOCUSED_BORDER)?
.unfocused_border(UNFOCUSED_BORDER)?
.layouts(vec![
Layout::new("[side]", LayoutConf::default(), side_stack, n_main, ratio),
Layout::new("[botm]", LayoutConf::default(), bottom_stack, n_main, ratio),
])
.build()
.unwrap();
let key_bindings = gen_keybindings! { let config = add_ewmh_hooks(Config {
// Program launchers default_layouts: layouts(bar_height_px),
"M-Return" => run_external!(TERMINAL); normal_border: NORMAL_BORDER.into(),
"M-S-Return" => run_external!(TERMINAL2); focused_border: FOCUSED_BORDER.into(),
"M-space" => { let s = rofi_theme_str.clone(); rofi!((&s), "run") }; ..Config::default()
"M-S-space" => { let s = rofi_theme_str.clone(); rofi!((&s), "window") }; });
"M-C-space" => { let s = rofi_theme_str.clone(); rofi!((&s), "ssh") };
"M-e" => run_external!(EDITOR);
"M-p" => run_external!(MIXER);
"M-S-s" => run_external!(SUSPEND);
"M-C-s" => run_external!(LOCK);
// Switch theme let conn = RustConn::new()?;
"M-S-F6" => Box::new(move |_: &mut WindowManager<_>| { let key_bindings = parse_keybindings_with_xmodmap(raw_key_bindings())?;
theme = if theme == "dark" { "light" } else { "dark" }; let style = TextStyle {
spawn!(SET_THEME, theme) font: FONT.to_string(),
}); point_size: args.font_size,
fg: WHITE.into(),
// Exit Penrose (important to remember this one!) bg: Some(BLACK.into()),
"M-A-C-Escape" => run_internal!(exit); padding: (2.0, 2.0),
// Client management
"M-j" => run_internal!(cycle_client, Forward);
"M-k" => run_internal!(cycle_client, Backward);
"M-S-j" => run_internal!(drag_client, Forward);
"M-A-j" => run_internal!(rotate_clients, Forward);
"M-A-k" => run_internal!(rotate_clients, Backward);
"M-S-k" => run_internal!(drag_client, Backward);
"M-S-f" => run_internal!(toggle_client_fullscreen, &Selector::Focused);
"M-S-q" => run_internal!(kill_client);
// Workspace management
"M-Tab" => run_internal!(toggle_workspace);
"M-period" => run_internal!(cycle_screen, Forward);
"M-comma" => run_internal!(cycle_screen, Backward);
"M-S-period" => run_internal!(drag_workspace, Forward);
"M-S-comma" => run_internal!(drag_workspace, Backward);
"M-A-period" => run_internal!(cycle_workspace, Forward);
"M-A-comma" => run_internal!(cycle_workspace, Backward);
// Layout management
"M-m" => run_internal!(cycle_layout, Forward);
"M-S-m" => run_internal!(cycle_layout, Backward);
"M-A-Up" => run_internal!(update_max_main, More);
"M-A-Down" => run_internal!(update_max_main, Less);
"M-A-Right" => run_internal!(update_main_ratio, More);
"M-A-Left" => run_internal!(update_main_ratio, Less);
"M-S-h" => run_internal!(update_max_main, More);
"M-S-l" => run_internal!(update_max_main, Less);
"M-l" => run_internal!(update_main_ratio, More);
"M-h" => run_internal!(update_main_ratio, Less);
map: { "1", "2", "3", "4", "5", "6", "7", "8", "9" } to index_selectors(9) => {
"M-{}" => focus_workspace (REF);
"M-S-{}" => client_to_workspace (REF);
};
}; };
let mouse_bindings = gen_mousebindings! { let bar = status_bar(bar_height_px, &style, BLUE, GREY, Position::Top).unwrap();
Press Right + [Meta] => |wm: &mut WindowManager<_>, _: &MouseEvent| wm.cycle_workspace(Forward),
Press Left + [Meta] => |wm: &mut WindowManager<_>, _: &MouseEvent| wm.cycle_workspace(Backward),
Press Middle + [Meta] => |wm: &mut WindowManager<_>, _: &MouseEvent| wm.toggle_workspace(),
Press Left + [Alt] => |_wm: &mut WindowManager<_>, _: &MouseEvent| penrose::core::helpers::spawn(TERMINAL)
};
let bar = dwm_bar( let wm = bar.add_to(WindowManager::new(
XcbDraw::new()?, config,
(2 * args.font_size).try_into().unwrap(), key_bindings,
&TextStyle { HashMap::new(),
font: args.font, conn,
point_size: args.font_size, )?);
fg: Color::try_from(BAR_FG)?,
bg: Some(Color::try_from(BAR_BG)?),
padding: (12.0, 12.0),
},
Color::try_from(BAR_HIGHLIGHT)?, // highlight
Color::try_from(BAR_EMPTY)?, // empty_ws
config.workspaces().clone(),
)?;
let hooks: Hooks<Conn> = vec![ wm.run()
ManageExistingClients::new(),
Box::new(bar),
];
let mut wm = new_xcb_backed_window_manager(config, hooks, logging_error_handler())?;
wm.grab_keys_and_run(key_bindings, mouse_bindings)?;
Ok(())
} }