mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ffe25f5cc4 | |||
| 43e2cf14d2 | |||
| 2c59131f7f | |||
| 64c41fa2c8 | |||
| 4e0aa39113 | |||
| dcb80efc88 |
Generated
+47
-37
@@ -161,7 +161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c"
|
checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"event-listener 4.0.2",
|
"event-listener 4.0.3",
|
||||||
"event-listener-strategy",
|
"event-listener-strategy",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
@@ -177,7 +177,7 @@ dependencies = [
|
|||||||
"async-task",
|
"async-task",
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
"futures-lite 2.1.0",
|
"futures-lite 2.2.0",
|
||||||
"slab",
|
"slab",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
"futures-lite 2.1.0",
|
"futures-lite 2.2.0",
|
||||||
"parking",
|
"parking",
|
||||||
"polling 3.3.1",
|
"polling 3.3.1",
|
||||||
"rustix 0.38.28",
|
"rustix 0.38.28",
|
||||||
@@ -247,7 +247,7 @@ version = "3.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c"
|
checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"event-listener 4.0.2",
|
"event-listener 4.0.3",
|
||||||
"event-listener-strategy",
|
"event-listener-strategy",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
@@ -397,9 +397,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-sys"
|
name = "block-sys"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92"
|
checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"objc-sys",
|
"objc-sys",
|
||||||
]
|
]
|
||||||
@@ -425,7 +425,7 @@ dependencies = [
|
|||||||
"async-task",
|
"async-task",
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
"futures-lite 2.1.0",
|
"futures-lite 2.2.0",
|
||||||
"piper",
|
"piper",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
@@ -928,9 +928,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "event-listener"
|
name = "event-listener"
|
||||||
version = "4.0.2"
|
version = "4.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "218a870470cce1469024e9fb66b901aa983929d81304a1cdb299f28118e550d5"
|
checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
"parking",
|
"parking",
|
||||||
@@ -943,7 +943,7 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
|
checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"event-listener 4.0.2",
|
"event-listener 4.0.3",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1052,9 +1052,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-lite"
|
name = "futures-lite"
|
||||||
version = "2.1.0"
|
version = "2.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143"
|
checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fastrand 2.0.1",
|
"fastrand 2.0.1",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -1693,7 +1693,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "niri"
|
name = "niri"
|
||||||
version = "0.1.0-alpha.2"
|
version = "0.1.0-alpha.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
@@ -1704,11 +1704,10 @@ dependencies = [
|
|||||||
"directories",
|
"directories",
|
||||||
"git-version",
|
"git-version",
|
||||||
"keyframe",
|
"keyframe",
|
||||||
"knuffel",
|
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"logind-zbus",
|
"logind-zbus",
|
||||||
"miette",
|
"niri-config",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
"pipewire",
|
"pipewire",
|
||||||
"png",
|
"png",
|
||||||
@@ -1728,6 +1727,18 @@ dependencies = [
|
|||||||
"zbus",
|
"zbus",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "niri-config"
|
||||||
|
version = "0.1.0-alpha.3"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.4.1",
|
||||||
|
"directories",
|
||||||
|
"knuffel",
|
||||||
|
"miette",
|
||||||
|
"smithay",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.26.4"
|
version = "0.26.4"
|
||||||
@@ -1786,20 +1797,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_enum"
|
name = "num_enum"
|
||||||
version = "0.7.1"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0"
|
checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num_enum_derive",
|
"num_enum_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_enum_derive"
|
name = "num_enum_derive"
|
||||||
version = "0.7.1"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e"
|
checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate 2.0.1",
|
"proc-macro-crate 3.0.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.48",
|
"syn 2.0.48",
|
||||||
@@ -2041,12 +2052,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-crate"
|
name = "proc-macro-crate"
|
||||||
version = "2.0.1"
|
version = "3.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a"
|
checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"toml_datetime",
|
"toml_edit 0.21.0",
|
||||||
"toml_edit 0.20.2",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2452,7 +2462,7 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay"
|
name = "smithay"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/Smithay/smithay.git#f6a33e4c45a3c7fd42d201130ada50b026ff06c7"
|
source = "git+https://github.com/Smithay/smithay.git#77686d70991d6aa86de2ed787a335ef1643132d8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"appendlist",
|
"appendlist",
|
||||||
"bitflags 2.4.1",
|
"bitflags 2.4.1",
|
||||||
@@ -2523,7 +2533,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay-drm-extras"
|
name = "smithay-drm-extras"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Smithay/smithay.git#f6a33e4c45a3c7fd42d201130ada50b026ff06c7"
|
source = "git+https://github.com/Smithay/smithay.git#77686d70991d6aa86de2ed787a335ef1643132d8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"drm",
|
"drm",
|
||||||
"edid-rs",
|
"edid-rs",
|
||||||
@@ -2556,9 +2566,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.10.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 = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
checksum = "ccbca6f34534eb78dbee83f6b2c9442fea7113f43d9e80ea320f0972ae5dc08d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
@@ -2689,21 +2699,21 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.8.2"
|
version = "0.8.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
|
checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"toml_edit 0.20.2",
|
"toml_edit 0.21.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.3"
|
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 = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
|
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@@ -2721,9 +2731,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.20.2"
|
version = "0.21.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
|
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -3500,9 +3510,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.5.32"
|
version = "0.5.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8434aeec7b290e8da5c3f0d628cb0eac6cabcb31d14bb74f779a08109a5914d6"
|
checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|||||||
+35
-15
@@ -1,13 +1,35 @@
|
|||||||
[package]
|
[workspace.package]
|
||||||
name = "niri"
|
version = "0.1.0-alpha.3"
|
||||||
version = "0.1.0-alpha.2"
|
|
||||||
description = "A scrollable-tiling Wayland compositor"
|
description = "A scrollable-tiling Wayland compositor"
|
||||||
authors = ["Ivan Molodetskikh <yalterz@gmail.com>"]
|
authors = ["Ivan Molodetskikh <yalterz@gmail.com>"]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
repository = "https://github.com/YaLTeR/niri"
|
||||||
|
|
||||||
|
[workspace.dependencies]
|
||||||
|
bitflags = "2.4.1"
|
||||||
|
directories = "5.0.1"
|
||||||
|
tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] }
|
||||||
|
|
||||||
|
[workspace.dependencies.smithay]
|
||||||
|
git = "https://github.com/Smithay/smithay.git"
|
||||||
|
# path = "../smithay"
|
||||||
|
default-features = false
|
||||||
|
|
||||||
|
[workspace.dependencies.smithay-drm-extras]
|
||||||
|
git = "https://github.com/Smithay/smithay.git"
|
||||||
|
# path = "../smithay/smithay-drm-extras"
|
||||||
|
|
||||||
|
[package]
|
||||||
|
name = "niri"
|
||||||
|
version.workspace = true
|
||||||
|
description.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/YaLTeR/niri"
|
|
||||||
keywords = ["wayland", "compositor", "tiling", "smithay", "wm"]
|
keywords = ["wayland", "compositor", "tiling", "smithay", "wm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -20,29 +42,27 @@ clap = { version = "4.4.13", features = ["derive"] }
|
|||||||
directories = "5.0.1"
|
directories = "5.0.1"
|
||||||
git-version = "0.3.9"
|
git-version = "0.3.9"
|
||||||
keyframe = { version = "1.1.1", default-features = false }
|
keyframe = { version = "1.1.1", default-features = false }
|
||||||
knuffel = "3.2.0"
|
|
||||||
libc = "0.2.151"
|
libc = "0.2.151"
|
||||||
logind-zbus = { version = "3.1.2", optional = true }
|
logind-zbus = { version = "3.1.2", optional = true }
|
||||||
log = { version = "0.4.20", features = ["max_level_trace", "release_max_level_debug"] }
|
log = { version = "0.4.20", features = ["max_level_trace", "release_max_level_debug"] }
|
||||||
miette = "5.10.0"
|
niri-config = { version = "0.1.0-alpha.3", path = "niri-config" }
|
||||||
notify-rust = { version = "4.10.0", optional = true }
|
notify-rust = { version = "4.10.0", optional = true }
|
||||||
pipewire = { version = "0.7.2", optional = true }
|
pipewire = { version = "0.7.2", optional = true }
|
||||||
png = "0.17.10"
|
png = "0.17.10"
|
||||||
portable-atomic = { version = "1.6.0", default-features = false, features = ["float"] }
|
portable-atomic = { version = "1.6.0", default-features = false, features = ["float"] }
|
||||||
profiling = "1.0.13"
|
profiling = "1.0.13"
|
||||||
sd-notify = "0.4.1"
|
sd-notify = "0.4.1"
|
||||||
|
smithay-drm-extras.workspace = true
|
||||||
serde = { version = "1.0.195", features = ["derive"] }
|
serde = { version = "1.0.195", features = ["derive"] }
|
||||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||||
tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] }
|
tracing.workspace = true
|
||||||
tracy-client = { version = "0.16.5", default-features = false }
|
tracy-client = { version = "0.16.5", default-features = false }
|
||||||
url = { version = "2.5.0", optional = true }
|
url = { version = "2.5.0", optional = true }
|
||||||
xcursor = "0.3.5"
|
xcursor = "0.3.5"
|
||||||
zbus = { version = "3.14.1", optional = true }
|
zbus = { version = "3.14.1", optional = true }
|
||||||
|
|
||||||
[dependencies.smithay]
|
[dependencies.smithay]
|
||||||
git = "https://github.com/Smithay/smithay.git"
|
workspace = true
|
||||||
# path = "../smithay"
|
|
||||||
default-features = false
|
|
||||||
features = [
|
features = [
|
||||||
"backend_drm",
|
"backend_drm",
|
||||||
"backend_egl",
|
"backend_egl",
|
||||||
@@ -58,10 +78,6 @@ features = [
|
|||||||
"wayland_frontend",
|
"wayland_frontend",
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies.smithay-drm-extras]
|
|
||||||
git = "https://github.com/Smithay/smithay.git"
|
|
||||||
# path = "../smithay/smithay-drm-extras"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
proptest = "1.4.0"
|
proptest = "1.4.0"
|
||||||
proptest-derive = "0.4.0"
|
proptest-derive = "0.4.0"
|
||||||
@@ -80,8 +96,12 @@ debug = "line-tables-only"
|
|||||||
overflow-checks = true
|
overflow-checks = true
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
|
|
||||||
|
[profile.release.package.niri-config]
|
||||||
|
# knuffel with chomsky generates a metric ton of debuginfo.
|
||||||
|
debug = false
|
||||||
|
|
||||||
[package.metadata.generate-rpm]
|
[package.metadata.generate-rpm]
|
||||||
version = "0.1.0~alpha.2"
|
version = "0.1.0~alpha.3"
|
||||||
assets = [
|
assets = [
|
||||||
{ source = "target/release/niri", dest = "/usr/bin/", mode = "755" },
|
{ source = "target/release/niri", dest = "/usr/bin/", mode = "755" },
|
||||||
{ source = "resources/niri-session", dest = "/usr/bin/", mode = "755" },
|
{ source = "resources/niri-session", dest = "/usr/bin/", mode = "755" },
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
name = "niri-config"
|
||||||
|
version.workspace = true
|
||||||
|
description.workspace = true
|
||||||
|
authors.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
bitflags.workspace = true
|
||||||
|
directories.workspace = true
|
||||||
|
knuffel = "3.2.0"
|
||||||
|
miette = "5.10.0"
|
||||||
|
smithay.workspace = true
|
||||||
|
tracing.workspace = true
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
|
#[macro_use]
|
||||||
|
extern crate tracing;
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use bitflags::bitflags;
|
use bitflags::bitflags;
|
||||||
use directories::ProjectDirs;
|
use directories::ProjectDirs;
|
||||||
use miette::{miette, Context, IntoDiagnostic};
|
use miette::{miette, Context, IntoDiagnostic, NarratableReportHandler};
|
||||||
use smithay::input::keyboard::keysyms::KEY_NoSymbol;
|
use smithay::input::keyboard::keysyms::KEY_NoSymbol;
|
||||||
use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE};
|
use smithay::input::keyboard::xkb::{keysym_from_name, KEYSYM_CASE_INSENSITIVE};
|
||||||
use smithay::input::keyboard::{Keysym, XkbConfig};
|
use smithay::input::keyboard::{Keysym, XkbConfig};
|
||||||
@@ -17,21 +20,11 @@ pub struct Config {
|
|||||||
#[knuffel(children(name = "spawn-at-startup"))]
|
#[knuffel(children(name = "spawn-at-startup"))]
|
||||||
pub spawn_at_startup: Vec<SpawnAtStartup>,
|
pub spawn_at_startup: Vec<SpawnAtStartup>,
|
||||||
#[knuffel(child, default)]
|
#[knuffel(child, default)]
|
||||||
pub focus_ring: FocusRing,
|
pub layout: Layout,
|
||||||
#[knuffel(child, default = default_border())]
|
|
||||||
pub border: FocusRing,
|
|
||||||
#[knuffel(child, default)]
|
#[knuffel(child, default)]
|
||||||
pub prefer_no_csd: bool,
|
pub prefer_no_csd: bool,
|
||||||
#[knuffel(child, default)]
|
#[knuffel(child, default)]
|
||||||
pub cursor: Cursor,
|
pub cursor: Cursor,
|
||||||
#[knuffel(child, unwrap(children), default)]
|
|
||||||
pub preset_column_widths: Vec<PresetWidth>,
|
|
||||||
#[knuffel(child)]
|
|
||||||
pub default_column_width: Option<DefaultColumnWidth>,
|
|
||||||
#[knuffel(child, unwrap(argument), default = 16)]
|
|
||||||
pub gaps: u16,
|
|
||||||
#[knuffel(child, default)]
|
|
||||||
pub struts: Struts,
|
|
||||||
#[knuffel(
|
#[knuffel(
|
||||||
child,
|
child,
|
||||||
unwrap(argument),
|
unwrap(argument),
|
||||||
@@ -165,6 +158,22 @@ pub struct Mode {
|
|||||||
pub refresh: Option<f64>,
|
pub refresh: Option<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(knuffel::Decode, Debug, Default, Clone, PartialEq)]
|
||||||
|
pub struct Layout {
|
||||||
|
#[knuffel(child, default)]
|
||||||
|
pub focus_ring: FocusRing,
|
||||||
|
#[knuffel(child, default = default_border())]
|
||||||
|
pub border: FocusRing,
|
||||||
|
#[knuffel(child, unwrap(children), default)]
|
||||||
|
pub preset_column_widths: Vec<PresetWidth>,
|
||||||
|
#[knuffel(child)]
|
||||||
|
pub default_column_width: Option<DefaultColumnWidth>,
|
||||||
|
#[knuffel(child, unwrap(argument), default = 16)]
|
||||||
|
pub gaps: u16,
|
||||||
|
#[knuffel(child, default)]
|
||||||
|
pub struts: Struts,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(knuffel::Decode, Debug, Clone, PartialEq, Eq)]
|
#[derive(knuffel::Decode, Debug, Clone, PartialEq, Eq)]
|
||||||
pub struct SpawnAtStartup {
|
pub struct SpawnAtStartup {
|
||||||
#[knuffel(arguments)]
|
#[knuffel(arguments)]
|
||||||
@@ -401,6 +410,10 @@ impl Default for DebugConfig {
|
|||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn load(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
|
pub fn load(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
|
||||||
|
Self::load_internal(path).context("error loading config")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn load_internal(path: Option<PathBuf>) -> miette::Result<(Self, PathBuf)> {
|
||||||
let path = if let Some(path) = path {
|
let path = if let Some(path) = path {
|
||||||
path
|
path
|
||||||
} else {
|
} else {
|
||||||
@@ -430,7 +443,7 @@ impl Default for Config {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Config::parse(
|
Config::parse(
|
||||||
"default-config.kdl",
|
"default-config.kdl",
|
||||||
include_str!("../resources/default-config.kdl"),
|
include_str!("../../resources/default-config.kdl"),
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
@@ -558,6 +571,10 @@ impl FromStr for SizeChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_miette_hook() -> Result<(), miette::InstallError> {
|
||||||
|
miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new())))
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use miette::NarratableReportHandler;
|
use miette::NarratableReportHandler;
|
||||||
@@ -607,8 +624,7 @@ mod tests {
|
|||||||
mode "1920x1080@144"
|
mode "1920x1080@144"
|
||||||
}
|
}
|
||||||
|
|
||||||
spawn-at-startup "alacritty" "-e" "fish"
|
layout {
|
||||||
|
|
||||||
focus-ring {
|
focus-ring {
|
||||||
width 5
|
width 5
|
||||||
active-color 0 100 200 255
|
active-color 0 100 200 255
|
||||||
@@ -621,13 +637,6 @@ mod tests {
|
|||||||
inactive-color 255 200 100 0
|
inactive-color 255 200 100 0
|
||||||
}
|
}
|
||||||
|
|
||||||
prefer-no-csd
|
|
||||||
|
|
||||||
cursor {
|
|
||||||
xcursor-theme "breeze_cursors"
|
|
||||||
xcursor-size 16
|
|
||||||
}
|
|
||||||
|
|
||||||
preset-column-widths {
|
preset-column-widths {
|
||||||
proportion 0.25
|
proportion 0.25
|
||||||
proportion 0.5
|
proportion 0.5
|
||||||
@@ -644,6 +653,16 @@ mod tests {
|
|||||||
right 2
|
right 2
|
||||||
top 3
|
top 3
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spawn-at-startup "alacritty" "-e" "fish"
|
||||||
|
|
||||||
|
prefer-no-csd
|
||||||
|
|
||||||
|
cursor {
|
||||||
|
xcursor-theme "breeze_cursors"
|
||||||
|
xcursor-size 16
|
||||||
|
}
|
||||||
|
|
||||||
screenshot-path "~/Screenshots/screenshot.png"
|
screenshot-path "~/Screenshots/screenshot.png"
|
||||||
|
|
||||||
@@ -694,9 +713,7 @@ mod tests {
|
|||||||
refresh: Some(144.),
|
refresh: Some(144.),
|
||||||
}),
|
}),
|
||||||
}],
|
}],
|
||||||
spawn_at_startup: vec![SpawnAtStartup {
|
layout: Layout {
|
||||||
command: vec!["alacritty".to_owned(), "-e".to_owned(), "fish".to_owned()],
|
|
||||||
}],
|
|
||||||
focus_ring: FocusRing {
|
focus_ring: FocusRing {
|
||||||
off: false,
|
off: false,
|
||||||
width: 5,
|
width: 5,
|
||||||
@@ -729,18 +746,15 @@ mod tests {
|
|||||||
a: 0,
|
a: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
prefer_no_csd: true,
|
|
||||||
cursor: Cursor {
|
|
||||||
xcursor_theme: String::from("breeze_cursors"),
|
|
||||||
xcursor_size: 16,
|
|
||||||
},
|
|
||||||
preset_column_widths: vec![
|
preset_column_widths: vec![
|
||||||
PresetWidth::Proportion(0.25),
|
PresetWidth::Proportion(0.25),
|
||||||
PresetWidth::Proportion(0.5),
|
PresetWidth::Proportion(0.5),
|
||||||
PresetWidth::Fixed(960),
|
PresetWidth::Fixed(960),
|
||||||
PresetWidth::Fixed(1280),
|
PresetWidth::Fixed(1280),
|
||||||
],
|
],
|
||||||
default_column_width: Some(DefaultColumnWidth(vec![PresetWidth::Proportion(0.25)])),
|
default_column_width: Some(DefaultColumnWidth(vec![PresetWidth::Proportion(
|
||||||
|
0.25,
|
||||||
|
)])),
|
||||||
gaps: 8,
|
gaps: 8,
|
||||||
struts: Struts {
|
struts: Struts {
|
||||||
left: 1,
|
left: 1,
|
||||||
@@ -748,6 +762,15 @@ mod tests {
|
|||||||
top: 3,
|
top: 3,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
spawn_at_startup: vec![SpawnAtStartup {
|
||||||
|
command: vec!["alacritty".to_owned(), "-e".to_owned(), "fish".to_owned()],
|
||||||
|
}],
|
||||||
|
prefer_no_csd: true,
|
||||||
|
cursor: Cursor {
|
||||||
|
xcursor_theme: String::from("breeze_cursors"),
|
||||||
|
xcursor_size: 16,
|
||||||
|
},
|
||||||
screenshot_path: Some(String::from("~/Screenshots/screenshot.png")),
|
screenshot_path: Some(String::from("~/Screenshots/screenshot.png")),
|
||||||
binds: Binds(vec![
|
binds: Binds(vec![
|
||||||
Bind {
|
Bind {
|
||||||
@@ -75,11 +75,7 @@ input {
|
|||||||
position x=1280 y=0
|
position x=1280 y=0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add lines like this to spawn processes at startup.
|
layout {
|
||||||
// Note that running niri as a session supports xdg-desktop-autostart,
|
|
||||||
// which may be more convenient to use.
|
|
||||||
// spawn-at-startup "alacritty" "-e" "fish"
|
|
||||||
|
|
||||||
// You can change how the focus ring looks.
|
// You can change how the focus ring looks.
|
||||||
focus-ring {
|
focus-ring {
|
||||||
// Uncomment this line to disable the focus ring.
|
// Uncomment this line to disable the focus ring.
|
||||||
@@ -106,18 +102,6 @@ border {
|
|||||||
inactive-color 80 80 80 255
|
inactive-color 80 80 80 255
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor {
|
|
||||||
// Change the theme and size of the cursor as well as set the
|
|
||||||
// `XCURSOR_THEME` and `XCURSOR_SIZE` env variables.
|
|
||||||
// xcursor-theme "default"
|
|
||||||
// xcursor-size 24
|
|
||||||
}
|
|
||||||
|
|
||||||
// Uncomment this line to ask the clients to omit their client-side decorations if possible.
|
|
||||||
// If the client will specifically ask for CSD, the request will be honored.
|
|
||||||
// Additionally, clients will be informed that they are tiled, removing some rounded corners.
|
|
||||||
// prefer-no-csd
|
|
||||||
|
|
||||||
// You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
|
// You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
|
||||||
preset-column-widths {
|
preset-column-widths {
|
||||||
// Proportion sets the width as a fraction of the output width, taking gaps into account.
|
// Proportion sets the width as a fraction of the output width, taking gaps into account.
|
||||||
@@ -150,6 +134,24 @@ struts {
|
|||||||
// top 64
|
// top 64
|
||||||
// bottom 64
|
// bottom 64
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add lines like this to spawn processes at startup.
|
||||||
|
// Note that running niri as a session supports xdg-desktop-autostart,
|
||||||
|
// which may be more convenient to use.
|
||||||
|
// spawn-at-startup "alacritty" "-e" "fish"
|
||||||
|
|
||||||
|
cursor {
|
||||||
|
// Change the theme and size of the cursor as well as set the
|
||||||
|
// `XCURSOR_THEME` and `XCURSOR_SIZE` env variables.
|
||||||
|
// xcursor-theme "default"
|
||||||
|
// xcursor-size 24
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uncomment this line to ask the clients to omit their client-side decorations if possible.
|
||||||
|
// If the client will specifically ask for CSD, the request will be honored.
|
||||||
|
// Additionally, clients will be informed that they are tiled, removing some rounded corners.
|
||||||
|
// prefer-no-csd
|
||||||
|
|
||||||
// You can change the path where screenshots are saved.
|
// You can change the path where screenshots are saved.
|
||||||
// A ~ at the front will be expanded to the home directory.
|
// A ~ at the front will be expanded to the home directory.
|
||||||
|
|||||||
+1
-1
@@ -9,6 +9,7 @@ use std::{io, mem};
|
|||||||
|
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use libc::dev_t;
|
use libc::dev_t;
|
||||||
|
use niri_config::Config;
|
||||||
use smithay::backend::allocator::dmabuf::{Dmabuf, DmabufAllocator};
|
use smithay::backend::allocator::dmabuf::{Dmabuf, DmabufAllocator};
|
||||||
use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};
|
use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice};
|
||||||
use smithay::backend::allocator::{Format, Fourcc};
|
use smithay::backend::allocator::{Format, Fourcc};
|
||||||
@@ -46,7 +47,6 @@ use wayland_protocols::wp::linux_dmabuf::zv1::server::zwp_linux_dmabuf_feedback_
|
|||||||
use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
|
use wayland_protocols::wp::presentation_time::server::wp_presentation_feedback;
|
||||||
|
|
||||||
use super::RenderResult;
|
use super::RenderResult;
|
||||||
use crate::config::Config;
|
|
||||||
use crate::niri::{RedrawState, State};
|
use crate::niri::{RedrawState, State};
|
||||||
use crate::render_helpers::AsGlesRenderer;
|
use crate::render_helpers::AsGlesRenderer;
|
||||||
use crate::utils::get_monotonic_time;
|
use crate::utils::get_monotonic_time;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use std::rc::Rc;
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::Config;
|
||||||
use smithay::backend::allocator::dmabuf::Dmabuf;
|
use smithay::backend::allocator::dmabuf::Dmabuf;
|
||||||
use smithay::backend::renderer::damage::OutputDamageTracker;
|
use smithay::backend::renderer::damage::OutputDamageTracker;
|
||||||
use smithay::backend::renderer::gles::GlesRenderer;
|
use smithay::backend::renderer::gles::GlesRenderer;
|
||||||
@@ -18,7 +19,6 @@ use smithay::reexports::winit::window::WindowBuilder;
|
|||||||
use smithay::utils::Transform;
|
use smithay::utils::Transform;
|
||||||
|
|
||||||
use super::RenderResult;
|
use super::RenderResult;
|
||||||
use crate::config::Config;
|
|
||||||
use crate::niri::{RedrawState, State};
|
use crate::niri::{RedrawState, State};
|
||||||
use crate::utils::get_monotonic_time;
|
use crate::utils::get_monotonic_time;
|
||||||
use crate::Niri;
|
use crate::Niri;
|
||||||
|
|||||||
@@ -193,16 +193,25 @@ delegate_xdg_shell!(State);
|
|||||||
impl XdgDecorationHandler for State {
|
impl XdgDecorationHandler for State {
|
||||||
fn new_decoration(&mut self, toplevel: ToplevelSurface) {
|
fn new_decoration(&mut self, toplevel: ToplevelSurface) {
|
||||||
let mode = if self.niri.config.borrow().prefer_no_csd {
|
let mode = if self.niri.config.borrow().prefer_no_csd {
|
||||||
Some(zxdg_toplevel_decoration_v1::Mode::ServerSide)
|
zxdg_toplevel_decoration_v1::Mode::ServerSide
|
||||||
} else {
|
} else {
|
||||||
None
|
zxdg_toplevel_decoration_v1::Mode::ClientSide
|
||||||
};
|
};
|
||||||
toplevel.with_pending_state(|state| {
|
toplevel.with_pending_state(|state| {
|
||||||
state.decoration_mode = mode;
|
state.decoration_mode = Some(mode);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn request_mode(&mut self, toplevel: ToplevelSurface, mode: zxdg_toplevel_decoration_v1::Mode) {
|
fn request_mode(
|
||||||
|
&mut self,
|
||||||
|
toplevel: ToplevelSurface,
|
||||||
|
mut mode: zxdg_toplevel_decoration_v1::Mode,
|
||||||
|
) {
|
||||||
|
// If prefer-no-csd is unset, then insist on CSD.
|
||||||
|
if !self.niri.config.borrow().prefer_no_csd {
|
||||||
|
mode = zxdg_toplevel_decoration_v1::Mode::ClientSide;
|
||||||
|
}
|
||||||
|
|
||||||
toplevel.with_pending_state(|state| {
|
toplevel.with_pending_state(|state| {
|
||||||
state.decoration_mode = Some(mode);
|
state.decoration_mode = Some(mode);
|
||||||
});
|
});
|
||||||
@@ -215,12 +224,12 @@ impl XdgDecorationHandler for State {
|
|||||||
|
|
||||||
fn unset_mode(&mut self, toplevel: ToplevelSurface) {
|
fn unset_mode(&mut self, toplevel: ToplevelSurface) {
|
||||||
let mode = if self.niri.config.borrow().prefer_no_csd {
|
let mode = if self.niri.config.borrow().prefer_no_csd {
|
||||||
Some(zxdg_toplevel_decoration_v1::Mode::ServerSide)
|
zxdg_toplevel_decoration_v1::Mode::ServerSide
|
||||||
} else {
|
} else {
|
||||||
None
|
zxdg_toplevel_decoration_v1::Mode::ClientSide
|
||||||
};
|
};
|
||||||
toplevel.with_pending_state(|state| {
|
toplevel.with_pending_state(|state| {
|
||||||
state.decoration_mode = mode;
|
state.decoration_mode = Some(mode);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only send configure if it's non-initial.
|
// Only send configure if it's non-initial.
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use niri_config::{Action, Binds, LayoutAction, Modifiers};
|
||||||
use smithay::backend::input::{
|
use smithay::backend::input::{
|
||||||
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Device, DeviceCapability, Event,
|
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Device, DeviceCapability, Event,
|
||||||
GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _,
|
GestureBeginEvent, GestureEndEvent, GesturePinchUpdateEvent as _, GestureSwipeUpdateEvent as _,
|
||||||
@@ -20,7 +21,6 @@ use smithay::utils::{Logical, Point, SERIAL_COUNTER};
|
|||||||
use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
|
use smithay::wayland::pointer_constraints::{with_pointer_constraint, PointerConstraint};
|
||||||
use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
|
use smithay::wayland::tablet_manager::{TabletDescriptor, TabletSeatTrait};
|
||||||
|
|
||||||
use crate::config::{Action, Binds, LayoutAction, Modifiers};
|
|
||||||
use crate::niri::State;
|
use crate::niri::State;
|
||||||
use crate::screenshot_ui::ScreenshotUi;
|
use crate::screenshot_ui::ScreenshotUi;
|
||||||
use crate::utils::{center, get_monotonic_time, spawn};
|
use crate::utils::{center, get_monotonic_time, spawn};
|
||||||
@@ -1338,8 +1338,9 @@ fn allowed_during_screenshot(action: &Action) -> bool {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use niri_config::{Action, Bind, Binds, Key, Modifiers};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::config::{Action, Bind, Binds, Key, Modifiers};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn bindings_suppress_keys() {
|
fn bindings_suppress_keys() {
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
use std::iter::zip;
|
use std::iter::zip;
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
|
use niri_config::{self, Color};
|
||||||
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
||||||
use smithay::backend::renderer::element::Kind;
|
use smithay::backend::renderer::element::Kind;
|
||||||
use smithay::utils::{Logical, Point, Scale, Size};
|
use smithay::utils::{Logical, Point, Scale, Size};
|
||||||
|
|
||||||
use crate::config::{self, Color};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FocusRing {
|
pub struct FocusRing {
|
||||||
buffers: [SolidColorBuffer; 4],
|
buffers: [SolidColorBuffer; 4],
|
||||||
@@ -21,7 +20,7 @@ pub struct FocusRing {
|
|||||||
pub type FocusRingRenderElement = SolidColorRenderElement;
|
pub type FocusRingRenderElement = SolidColorRenderElement;
|
||||||
|
|
||||||
impl FocusRing {
|
impl FocusRing {
|
||||||
pub fn new(config: config::FocusRing) -> Self {
|
pub fn new(config: niri_config::FocusRing) -> Self {
|
||||||
Self {
|
Self {
|
||||||
buffers: Default::default(),
|
buffers: Default::default(),
|
||||||
locations: Default::default(),
|
locations: Default::default(),
|
||||||
@@ -33,7 +32,7 @@ impl FocusRing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_config(&mut self, config: config::FocusRing) {
|
pub fn update_config(&mut self, config: niri_config::FocusRing) {
|
||||||
self.is_off = config.off;
|
self.is_off = config.off;
|
||||||
self.width = config.width.into();
|
self.width = config.width.into();
|
||||||
self.active_color = config.active_color;
|
self.active_color = config.active_color;
|
||||||
|
|||||||
+11
-10
@@ -33,6 +33,7 @@ use std::mem;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::{self, Config, SizeChange, Struts};
|
||||||
use smithay::backend::renderer::element::AsRenderElements;
|
use smithay::backend::renderer::element::AsRenderElements;
|
||||||
use smithay::backend::renderer::{ImportAll, Renderer};
|
use smithay::backend::renderer::{ImportAll, Renderer};
|
||||||
use smithay::desktop::space::SpaceElement;
|
use smithay::desktop::space::SpaceElement;
|
||||||
@@ -51,7 +52,6 @@ use self::workspace::{
|
|||||||
compute_working_area, ColumnWidth, OutputId, Workspace, WorkspaceRenderElement,
|
compute_working_area, ColumnWidth, OutputId, Workspace, WorkspaceRenderElement,
|
||||||
};
|
};
|
||||||
use crate::animation::Animation;
|
use crate::animation::Animation;
|
||||||
use crate::config::{self, Config, SizeChange, Struts};
|
|
||||||
use crate::utils::output_size;
|
use crate::utils::output_size;
|
||||||
|
|
||||||
mod focus_ring;
|
mod focus_ring;
|
||||||
@@ -137,8 +137,8 @@ pub struct Options {
|
|||||||
gaps: i32,
|
gaps: i32,
|
||||||
/// Extra padding around the working area in logical pixels.
|
/// Extra padding around the working area in logical pixels.
|
||||||
struts: Struts,
|
struts: Struts,
|
||||||
focus_ring: config::FocusRing,
|
focus_ring: niri_config::FocusRing,
|
||||||
border: config::FocusRing,
|
border: niri_config::FocusRing,
|
||||||
/// Column widths that `toggle_width()` switches between.
|
/// Column widths that `toggle_width()` switches between.
|
||||||
preset_widths: Vec<ColumnWidth>,
|
preset_widths: Vec<ColumnWidth>,
|
||||||
/// Initial width for new columns.
|
/// Initial width for new columns.
|
||||||
@@ -151,7 +151,7 @@ impl Default for Options {
|
|||||||
gaps: 16,
|
gaps: 16,
|
||||||
struts: Default::default(),
|
struts: Default::default(),
|
||||||
focus_ring: Default::default(),
|
focus_ring: Default::default(),
|
||||||
border: config::default_border(),
|
border: niri_config::default_border(),
|
||||||
preset_widths: vec![
|
preset_widths: vec![
|
||||||
ColumnWidth::Proportion(1. / 3.),
|
ColumnWidth::Proportion(1. / 3.),
|
||||||
ColumnWidth::Proportion(0.5),
|
ColumnWidth::Proportion(0.5),
|
||||||
@@ -164,7 +164,8 @@ impl Default for Options {
|
|||||||
|
|
||||||
impl Options {
|
impl Options {
|
||||||
fn from_config(config: &Config) -> Self {
|
fn from_config(config: &Config) -> Self {
|
||||||
let preset_column_widths = &config.preset_column_widths;
|
let layout = &config.layout;
|
||||||
|
let preset_column_widths = &layout.preset_column_widths;
|
||||||
|
|
||||||
let preset_widths = if preset_column_widths.is_empty() {
|
let preset_widths = if preset_column_widths.is_empty() {
|
||||||
Options::default().preset_widths
|
Options::default().preset_widths
|
||||||
@@ -178,17 +179,17 @@ impl Options {
|
|||||||
|
|
||||||
// Missing default_column_width maps to Some(ColumnWidth::Proportion(0.5)),
|
// Missing default_column_width maps to Some(ColumnWidth::Proportion(0.5)),
|
||||||
// while present, but empty, maps to None.
|
// while present, but empty, maps to None.
|
||||||
let default_width = config
|
let default_width = layout
|
||||||
.default_column_width
|
.default_column_width
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|w| w.0.first().copied().map(ColumnWidth::from))
|
.map(|w| w.0.first().copied().map(ColumnWidth::from))
|
||||||
.unwrap_or(Some(ColumnWidth::Proportion(0.5)));
|
.unwrap_or(Some(ColumnWidth::Proportion(0.5)));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
gaps: config.gaps.into(),
|
gaps: layout.gaps.into(),
|
||||||
struts: config.struts,
|
struts: layout.struts,
|
||||||
focus_ring: config.focus_ring,
|
focus_ring: layout.focus_ring,
|
||||||
border: config.border,
|
border: layout.border,
|
||||||
preset_widths,
|
preset_widths,
|
||||||
default_width,
|
default_width,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use std::cmp::min;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::SizeChange;
|
||||||
use smithay::backend::renderer::element::utils::{
|
use smithay::backend::renderer::element::utils::{
|
||||||
CropRenderElement, Relocate, RelocateRenderElement,
|
CropRenderElement, Relocate, RelocateRenderElement,
|
||||||
};
|
};
|
||||||
@@ -15,7 +16,6 @@ use super::workspace::{
|
|||||||
};
|
};
|
||||||
use super::{LayoutElement, Options};
|
use super::{LayoutElement, Options};
|
||||||
use crate::animation::Animation;
|
use crate::animation::Animation;
|
||||||
use crate::config::SizeChange;
|
|
||||||
use crate::utils::output_size;
|
use crate::utils::output_size;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use std::iter::zip;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use niri_config::{PresetWidth, SizeChange, Struts};
|
||||||
use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement;
|
use smithay::backend::renderer::element::surface::WaylandSurfaceRenderElement;
|
||||||
use smithay::backend::renderer::element::utils::RelocateRenderElement;
|
use smithay::backend::renderer::element::utils::RelocateRenderElement;
|
||||||
use smithay::backend::renderer::{ImportAll, Renderer};
|
use smithay::backend::renderer::{ImportAll, Renderer};
|
||||||
@@ -17,7 +18,6 @@ use super::focus_ring::{FocusRing, FocusRingRenderElement};
|
|||||||
use super::tile::Tile;
|
use super::tile::Tile;
|
||||||
use super::{LayoutElement, Options};
|
use super::{LayoutElement, Options};
|
||||||
use crate::animation::Animation;
|
use crate::animation::Animation;
|
||||||
use crate::config::{PresetWidth, SizeChange, Struts};
|
|
||||||
use crate::utils::output_size;
|
use crate::utils::output_size;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
+4
-6
@@ -3,7 +3,6 @@ extern crate tracing;
|
|||||||
|
|
||||||
mod animation;
|
mod animation;
|
||||||
mod backend;
|
mod backend;
|
||||||
mod config;
|
|
||||||
mod cursor;
|
mod cursor;
|
||||||
#[cfg(feature = "dbus")]
|
#[cfg(feature = "dbus")]
|
||||||
mod dbus;
|
mod dbus;
|
||||||
@@ -28,12 +27,11 @@ use std::process::Command;
|
|||||||
use std::{env, mem};
|
use std::{env, mem};
|
||||||
|
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
use config::Config;
|
|
||||||
#[cfg(not(feature = "xdp-gnome-screencast"))]
|
#[cfg(not(feature = "xdp-gnome-screencast"))]
|
||||||
use dummy_pw_utils as pw_utils;
|
use dummy_pw_utils as pw_utils;
|
||||||
use git_version::git_version;
|
use git_version::git_version;
|
||||||
use miette::{Context, NarratableReportHandler};
|
|
||||||
use niri::{Niri, State};
|
use niri::{Niri, State};
|
||||||
|
use niri_config::Config;
|
||||||
use portable_atomic::Ordering;
|
use portable_atomic::Ordering;
|
||||||
use sd_notify::NotifyState;
|
use sd_notify::NotifyState;
|
||||||
use smithay::reexports::calloop::{self, EventLoop};
|
use smithay::reexports::calloop::{self, EventLoop};
|
||||||
@@ -110,13 +108,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let _client = tracy_client::Client::start();
|
let _client = tracy_client::Client::start();
|
||||||
|
|
||||||
// Set a better error printer for config loading.
|
// Set a better error printer for config loading.
|
||||||
miette::set_hook(Box::new(|_| Box::new(NarratableReportHandler::new()))).unwrap();
|
niri_config::set_miette_hook().unwrap();
|
||||||
|
|
||||||
// Handle subcommands.
|
// Handle subcommands.
|
||||||
if let Some(subcommand) = cli.subcommand {
|
if let Some(subcommand) = cli.subcommand {
|
||||||
match subcommand {
|
match subcommand {
|
||||||
Sub::Validate { config } => {
|
Sub::Validate { config } => {
|
||||||
Config::load(config).context("error loading config")?;
|
Config::load(config)?;
|
||||||
info!("config is valid");
|
info!("config is valid");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -130,7 +128,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Load the config.
|
// Load the config.
|
||||||
let (mut config, path) = match Config::load(cli.config).context("error loading config") {
|
let (mut config, path) = match Config::load(cli.config) {
|
||||||
Ok((config, path)) => (config, Some(path)),
|
Ok((config, path)) => (config, Some(path)),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!("{err:?}");
|
warn!("{err:?}");
|
||||||
|
|||||||
+1
-1
@@ -10,6 +10,7 @@ use std::{env, mem, thread};
|
|||||||
|
|
||||||
use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode;
|
use _server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as KdeDecorationsMode;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
use niri_config::{Config, TrackLayout};
|
||||||
use smithay::backend::allocator::Fourcc;
|
use smithay::backend::allocator::Fourcc;
|
||||||
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
||||||
use smithay::backend::renderer::element::surface::{
|
use smithay::backend::renderer::element::surface::{
|
||||||
@@ -86,7 +87,6 @@ use smithay::wayland::virtual_keyboard::VirtualKeyboardManagerState;
|
|||||||
use crate::animation;
|
use crate::animation;
|
||||||
use crate::backend::tty::{SurfaceDmabufFeedback, TtyFrame, TtyRenderer, TtyRendererError};
|
use crate::backend::tty::{SurfaceDmabufFeedback, TtyFrame, TtyRenderer, TtyRendererError};
|
||||||
use crate::backend::{Backend, RenderResult, Tty, Winit};
|
use crate::backend::{Backend, RenderResult, Tty, Winit};
|
||||||
use crate::config::{Config, TrackLayout};
|
|
||||||
use crate::cursor::{CursorManager, CursorTextureCache, RenderCursor, XCursor};
|
use crate::cursor::{CursorManager, CursorTextureCache, RenderCursor, XCursor};
|
||||||
#[cfg(feature = "dbus")]
|
#[cfg(feature = "dbus")]
|
||||||
use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri};
|
use crate::dbus::gnome_shell_screenshot::{NiriToScreenshot, ScreenshotToNiri};
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use std::mem;
|
|||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
|
use niri_config::Action;
|
||||||
use smithay::backend::allocator::Fourcc;
|
use smithay::backend::allocator::Fourcc;
|
||||||
use smithay::backend::input::{ButtonState, MouseButton};
|
use smithay::backend::input::{ButtonState, MouseButton};
|
||||||
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
use smithay::backend::renderer::element::solid::{SolidColorBuffer, SolidColorRenderElement};
|
||||||
@@ -18,7 +19,6 @@ use smithay::output::{Output, WeakOutput};
|
|||||||
use smithay::utils::{Buffer, Physical, Point, Rectangle, Scale, Size, Transform};
|
use smithay::utils::{Buffer, Physical, Point, Rectangle, Scale, Size, Transform};
|
||||||
|
|
||||||
use crate::backend::tty::{TtyFrame, TtyRenderer, TtyRendererError};
|
use crate::backend::tty::{TtyFrame, TtyRenderer, TtyRendererError};
|
||||||
use crate::config::Action;
|
|
||||||
use crate::render_helpers::PrimaryGpuTextureRenderElement;
|
use crate::render_helpers::PrimaryGpuTextureRenderElement;
|
||||||
|
|
||||||
const BORDER: i32 = 2;
|
const BORDER: i32 = 2;
|
||||||
|
|||||||
+1
-2
@@ -11,12 +11,11 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use anyhow::{ensure, Context};
|
use anyhow::{ensure, Context};
|
||||||
use directories::UserDirs;
|
use directories::UserDirs;
|
||||||
|
use niri_config::Config;
|
||||||
use smithay::output::Output;
|
use smithay::output::Output;
|
||||||
use smithay::reexports::rustix::time::{clock_gettime, ClockId};
|
use smithay::reexports::rustix::time::{clock_gettime, ClockId};
|
||||||
use smithay::utils::{Logical, Point, Rectangle, Size};
|
use smithay::utils::{Logical, Point, Rectangle, Size};
|
||||||
|
|
||||||
use crate::config::Config;
|
|
||||||
|
|
||||||
pub fn clone2<T: Clone, U: Clone>(t: (&T, &U)) -> (T, U) {
|
pub fn clone2<T: Clone, U: Clone>(t: (&T, &U)) -> (T, U) {
|
||||||
(t.0.clone(), t.1.clone())
|
(t.0.clone(), t.1.clone())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user