├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── SECURITY.md ├── dependabot.yml └── workflows │ └── ci.yml ├── .gitignore ├── CHANGELOG.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── PKGBUILD ├── README.md ├── build.rs ├── rustfmt.toml ├── src ├── cli.rs ├── hyprland.rs ├── lib.rs └── main.rs └── tests ├── get_next_id.rs ├── get_previous_id.rs └── release.rs /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Did you run into an issue while using hyprnome? 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Bug Report 11 | 12 | ## Environment 13 | 14 | - Output of `uname -a`: 15 | - Output of `hyprnome -V`: 16 | - Output of `hyprctl version`: 17 | 18 | ## Expected Behavior 19 | Tell us what should have happened. 20 | 21 | ## Current Behavior 22 | Tell us what happens instead of the expected behavior. 23 | 24 | ## Step to Reproduce 25 | Please provide the steps to reproduce the issue. 26 | 27 | 28 | 29 | ## Priorities 30 | Add a :+1: [reaction] to [issues you find important]. 31 | 32 | [reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/ 33 | [issues you find important]: https://github.com/donovanglover/hyprnome/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project. 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Feature Request 11 | 12 | ## Summary 13 | Briefly describe what this feature request is about. 14 | 15 | ## Motivation 16 | Why should this feature be implemented? How will it benefit the project and its users? 17 | 18 | ## Detailed Description 19 | Please provide a detailed description of the proposed feature, including any suggestions you have for how it could be implemented. 20 | 21 | ## Additional Context 22 | Add any other context or screenshots about the feature request here. If this feature request is related to a problem, please describe it. 23 | 24 | 25 | 26 | ## Priorities 27 | Add a :+1: [reaction] to [issues you find important]. 28 | 29 | [reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/ 30 | [issues you find important]: https://github.com/donovanglover/hyprnome/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc 31 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description of changes 2 | 3 | 4 | 5 | ## Things done 6 | 7 | 8 | 9 | - [ ] Formatted code with `cargo fmt` 10 | - [ ] Checked for linting issues with `cargo clippy` 11 | - [ ] Tested that the binary works as expected with `cargo build` 12 | - [ ] Ran software tests with `cargo test` 13 | - [ ] Commits follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) 14 | 15 | ### Priorities 16 | 17 | Add a :+1: [reaction] to [pull requests you find important]. 18 | 19 | [reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/ 20 | [pull requests you find important]: https://github.com/donovanglover/hyprnome/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc 21 | -------------------------------------------------------------------------------- /.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting a Vulnerability 2 | 3 | To privately report a security issue, use the contact information available on . 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: "cargo" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | RUSTFLAGS: -Dwarnings 12 | 13 | jobs: 14 | build: 15 | name: cargo build 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v4 19 | - run: cargo build 20 | test: 21 | name: cargo test 22 | runs-on: ubuntu-latest 23 | steps: 24 | - uses: actions/checkout@v4 25 | - run: cargo test 26 | format: 27 | name: cargo fmt --check 28 | runs-on: ubuntu-latest 29 | steps: 30 | - uses: actions/checkout@v4 31 | - run: cargo fmt --check 32 | clippy: 33 | name: cargo clippy 34 | runs-on: ubuntu-latest 35 | steps: 36 | - uses: actions/checkout@v4 37 | - run: cargo clippy 38 | pkgbuild: 39 | name: makepkg -si 40 | runs-on: ubuntu-latest 41 | steps: 42 | - uses: actions/checkout@v4 43 | - uses: edlanglois/pkgbuild-action@v1 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## Unreleased 9 | 10 | ## 0.3.1 - 2024-08-09 11 | 12 | - Added support for Hyprland v0.42.0+ 13 | 14 | **Full Changelog**: https://github.com/donovanglover/hyprnome/compare/0.3.0...0.3.1 15 | 16 | ## 0.3.0 - 2024-05-14 17 | 18 | - New `--cycle` flag to cycle between workspaces in a given direction 19 | - Added support for Hyprland v0.40.0+ 20 | 21 | **Full Changelog**: https://github.com/donovanglover/hyprnome/compare/0.2.0...0.3.0 22 | 23 | ## 0.2.0 - 2023-10-30 24 | 25 | ### New Features 26 | 27 | - Added colors to `--help`. Optionally disable with `NO_COLOR=1`. 28 | - Simplified `--no-empty-before` and `--no-empty-after` to `--no-empty`. Old flags are preserved for backwards compatibility. 29 | - Special workspaces now close by default when switching workspaces. Optionally disable with `--keep-special`. 30 | 31 | **Full Changelog**: https://github.com/donovanglover/hyprnome/compare/0.1.0...0.2.0 32 | 33 | ## 0.1.0 - 2023-08-30 34 | 35 | - Initial release. 36 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "ahash" 22 | version = "0.8.11" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" 25 | dependencies = [ 26 | "cfg-if", 27 | "once_cell", 28 | "serde", 29 | "version_check", 30 | "zerocopy", 31 | ] 32 | 33 | [[package]] 34 | name = "aho-corasick" 35 | version = "1.1.3" 36 | source = "registry+https://github.com/rust-lang/crates.io-index" 37 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 38 | dependencies = [ 39 | "memchr", 40 | ] 41 | 42 | [[package]] 43 | name = "anstream" 44 | version = "0.6.14" 45 | source = "registry+https://github.com/rust-lang/crates.io-index" 46 | checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" 47 | dependencies = [ 48 | "anstyle", 49 | "anstyle-parse", 50 | "anstyle-query", 51 | "anstyle-wincon", 52 | "colorchoice", 53 | "is_terminal_polyfill", 54 | "utf8parse", 55 | ] 56 | 57 | [[package]] 58 | name = "anstyle" 59 | version = "1.0.8" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" 62 | 63 | [[package]] 64 | name = "anstyle-parse" 65 | version = "0.2.4" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" 68 | dependencies = [ 69 | "utf8parse", 70 | ] 71 | 72 | [[package]] 73 | name = "anstyle-query" 74 | version = "1.0.3" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" 77 | dependencies = [ 78 | "windows-sys 0.52.0", 79 | ] 80 | 81 | [[package]] 82 | name = "anstyle-wincon" 83 | version = "3.0.3" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" 86 | dependencies = [ 87 | "anstyle", 88 | "windows-sys 0.52.0", 89 | ] 90 | 91 | [[package]] 92 | name = "assert_cmd" 93 | version = "2.0.16" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | checksum = "dc1835b7f27878de8525dc71410b5a31cdcc5f230aed5ba5df968e09c201b23d" 96 | dependencies = [ 97 | "anstyle", 98 | "bstr", 99 | "doc-comment", 100 | "libc", 101 | "predicates", 102 | "predicates-core", 103 | "predicates-tree", 104 | "wait-timeout", 105 | ] 106 | 107 | [[package]] 108 | name = "autocfg" 109 | version = "1.3.0" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 112 | 113 | [[package]] 114 | name = "backtrace" 115 | version = "0.3.71" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" 118 | dependencies = [ 119 | "addr2line", 120 | "cc", 121 | "cfg-if", 122 | "libc", 123 | "miniz_oxide", 124 | "object", 125 | "rustc-demangle", 126 | ] 127 | 128 | [[package]] 129 | name = "bstr" 130 | version = "1.9.1" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" 133 | dependencies = [ 134 | "memchr", 135 | "regex-automata", 136 | "serde", 137 | ] 138 | 139 | [[package]] 140 | name = "bytes" 141 | version = "1.6.0" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" 144 | 145 | [[package]] 146 | name = "cc" 147 | version = "1.0.96" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" 150 | 151 | [[package]] 152 | name = "cfg-if" 153 | version = "1.0.0" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 156 | 157 | [[package]] 158 | name = "clap" 159 | version = "4.5.20" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" 162 | dependencies = [ 163 | "clap_builder", 164 | "clap_derive", 165 | ] 166 | 167 | [[package]] 168 | name = "clap_builder" 169 | version = "4.5.20" 170 | source = "registry+https://github.com/rust-lang/crates.io-index" 171 | checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" 172 | dependencies = [ 173 | "anstream", 174 | "anstyle", 175 | "clap_lex", 176 | "strsim", 177 | ] 178 | 179 | [[package]] 180 | name = "clap_complete" 181 | version = "4.5.36" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "86bc73de94bc81e52f3bebec71bc4463e9748f7a59166663e32044669577b0e2" 184 | dependencies = [ 185 | "clap", 186 | ] 187 | 188 | [[package]] 189 | name = "clap_derive" 190 | version = "4.5.18" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" 193 | dependencies = [ 194 | "heck", 195 | "proc-macro2", 196 | "quote", 197 | "syn 2.0.82", 198 | ] 199 | 200 | [[package]] 201 | name = "clap_lex" 202 | version = "0.7.0" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" 205 | 206 | [[package]] 207 | name = "clap_mangen" 208 | version = "0.2.24" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | checksum = "fbae9cbfdc5d4fa8711c09bd7b83f644cb48281ac35bf97af3e47b0675864bdf" 211 | dependencies = [ 212 | "clap", 213 | "roff", 214 | ] 215 | 216 | [[package]] 217 | name = "colorchoice" 218 | version = "1.0.1" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" 221 | 222 | [[package]] 223 | name = "derive_more" 224 | version = "0.99.17" 225 | source = "registry+https://github.com/rust-lang/crates.io-index" 226 | checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" 227 | dependencies = [ 228 | "proc-macro2", 229 | "quote", 230 | "syn 1.0.109", 231 | ] 232 | 233 | [[package]] 234 | name = "difflib" 235 | version = "0.4.0" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" 238 | 239 | [[package]] 240 | name = "doc-comment" 241 | version = "0.3.3" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" 244 | 245 | [[package]] 246 | name = "equivalent" 247 | version = "1.0.1" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 250 | 251 | [[package]] 252 | name = "gimli" 253 | version = "0.28.1" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" 256 | 257 | [[package]] 258 | name = "hashbrown" 259 | version = "0.14.5" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" 262 | 263 | [[package]] 264 | name = "heck" 265 | version = "0.5.0" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 268 | 269 | [[package]] 270 | name = "hyprland" 271 | version = "0.4.0-alpha.3" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "2de3f836e02af5a12f374d3a986867c1dc487a63a6d19477d66c7de50f715895" 274 | dependencies = [ 275 | "ahash", 276 | "derive_more", 277 | "hyprland-macros", 278 | "num-traits", 279 | "once_cell", 280 | "paste", 281 | "regex", 282 | "serde", 283 | "serde_json", 284 | "serde_repr", 285 | "tokio", 286 | ] 287 | 288 | [[package]] 289 | name = "hyprland-macros" 290 | version = "0.4.0-alpha.1" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "5dd8ce4c182ce77e485918f49262425ee51a2746fe97f14084869aeff2fbc38e" 293 | dependencies = [ 294 | "quote", 295 | "syn 2.0.82", 296 | ] 297 | 298 | [[package]] 299 | name = "hyprnome" 300 | version = "0.3.1" 301 | dependencies = [ 302 | "assert_cmd", 303 | "clap", 304 | "clap_complete", 305 | "clap_mangen", 306 | "hyprland", 307 | "rustympkglib", 308 | "serde", 309 | "toml", 310 | ] 311 | 312 | [[package]] 313 | name = "indexmap" 314 | version = "2.2.6" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" 317 | dependencies = [ 318 | "equivalent", 319 | "hashbrown", 320 | ] 321 | 322 | [[package]] 323 | name = "is_terminal_polyfill" 324 | version = "1.70.0" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" 327 | 328 | [[package]] 329 | name = "itoa" 330 | version = "1.0.11" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 333 | 334 | [[package]] 335 | name = "libc" 336 | version = "0.2.154" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" 339 | 340 | [[package]] 341 | name = "memchr" 342 | version = "2.7.2" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" 345 | 346 | [[package]] 347 | name = "miniz_oxide" 348 | version = "0.7.2" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" 351 | dependencies = [ 352 | "adler", 353 | ] 354 | 355 | [[package]] 356 | name = "mio" 357 | version = "0.8.11" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" 360 | dependencies = [ 361 | "libc", 362 | "wasi", 363 | "windows-sys 0.48.0", 364 | ] 365 | 366 | [[package]] 367 | name = "num-traits" 368 | version = "0.2.19" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 371 | dependencies = [ 372 | "autocfg", 373 | ] 374 | 375 | [[package]] 376 | name = "object" 377 | version = "0.32.2" 378 | source = "registry+https://github.com/rust-lang/crates.io-index" 379 | checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" 380 | dependencies = [ 381 | "memchr", 382 | ] 383 | 384 | [[package]] 385 | name = "once_cell" 386 | version = "1.19.0" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 389 | 390 | [[package]] 391 | name = "paste" 392 | version = "1.0.14" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 395 | 396 | [[package]] 397 | name = "pin-project-lite" 398 | version = "0.2.14" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" 401 | 402 | [[package]] 403 | name = "predicates" 404 | version = "3.1.0" 405 | source = "registry+https://github.com/rust-lang/crates.io-index" 406 | checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" 407 | dependencies = [ 408 | "anstyle", 409 | "difflib", 410 | "predicates-core", 411 | ] 412 | 413 | [[package]] 414 | name = "predicates-core" 415 | version = "1.0.6" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" 418 | 419 | [[package]] 420 | name = "predicates-tree" 421 | version = "1.0.9" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" 424 | dependencies = [ 425 | "predicates-core", 426 | "termtree", 427 | ] 428 | 429 | [[package]] 430 | name = "proc-macro2" 431 | version = "1.0.88" 432 | source = "registry+https://github.com/rust-lang/crates.io-index" 433 | checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" 434 | dependencies = [ 435 | "unicode-ident", 436 | ] 437 | 438 | [[package]] 439 | name = "quote" 440 | version = "1.0.36" 441 | source = "registry+https://github.com/rust-lang/crates.io-index" 442 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 443 | dependencies = [ 444 | "proc-macro2", 445 | ] 446 | 447 | [[package]] 448 | name = "regex" 449 | version = "1.10.4" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" 452 | dependencies = [ 453 | "aho-corasick", 454 | "memchr", 455 | "regex-automata", 456 | "regex-syntax", 457 | ] 458 | 459 | [[package]] 460 | name = "regex-automata" 461 | version = "0.4.6" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" 464 | dependencies = [ 465 | "aho-corasick", 466 | "memchr", 467 | "regex-syntax", 468 | ] 469 | 470 | [[package]] 471 | name = "regex-syntax" 472 | version = "0.8.3" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" 475 | 476 | [[package]] 477 | name = "roff" 478 | version = "0.2.1" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" 481 | 482 | [[package]] 483 | name = "rustc-demangle" 484 | version = "0.1.23" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 487 | 488 | [[package]] 489 | name = "rustympkglib" 490 | version = "0.1.1" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "39a6a04e9c4cc5d0fd4291f8ce8e1aa9d438d3e7b5ea09699cc81acd83272a16" 493 | dependencies = [ 494 | "serde", 495 | "tree-sitter", 496 | "tree-sitter-bash", 497 | ] 498 | 499 | [[package]] 500 | name = "ryu" 501 | version = "1.0.17" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" 504 | 505 | [[package]] 506 | name = "serde" 507 | version = "1.0.214" 508 | source = "registry+https://github.com/rust-lang/crates.io-index" 509 | checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" 510 | dependencies = [ 511 | "serde_derive", 512 | ] 513 | 514 | [[package]] 515 | name = "serde_derive" 516 | version = "1.0.214" 517 | source = "registry+https://github.com/rust-lang/crates.io-index" 518 | checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" 519 | dependencies = [ 520 | "proc-macro2", 521 | "quote", 522 | "syn 2.0.82", 523 | ] 524 | 525 | [[package]] 526 | name = "serde_json" 527 | version = "1.0.116" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" 530 | dependencies = [ 531 | "itoa", 532 | "ryu", 533 | "serde", 534 | ] 535 | 536 | [[package]] 537 | name = "serde_repr" 538 | version = "0.1.19" 539 | source = "registry+https://github.com/rust-lang/crates.io-index" 540 | checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" 541 | dependencies = [ 542 | "proc-macro2", 543 | "quote", 544 | "syn 2.0.82", 545 | ] 546 | 547 | [[package]] 548 | name = "serde_spanned" 549 | version = "0.6.7" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" 552 | dependencies = [ 553 | "serde", 554 | ] 555 | 556 | [[package]] 557 | name = "socket2" 558 | version = "0.5.7" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" 561 | dependencies = [ 562 | "libc", 563 | "windows-sys 0.52.0", 564 | ] 565 | 566 | [[package]] 567 | name = "strsim" 568 | version = "0.11.1" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 571 | 572 | [[package]] 573 | name = "syn" 574 | version = "1.0.109" 575 | source = "registry+https://github.com/rust-lang/crates.io-index" 576 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 577 | dependencies = [ 578 | "proc-macro2", 579 | "quote", 580 | "unicode-ident", 581 | ] 582 | 583 | [[package]] 584 | name = "syn" 585 | version = "2.0.82" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" 588 | dependencies = [ 589 | "proc-macro2", 590 | "quote", 591 | "unicode-ident", 592 | ] 593 | 594 | [[package]] 595 | name = "termtree" 596 | version = "0.4.1" 597 | source = "registry+https://github.com/rust-lang/crates.io-index" 598 | checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" 599 | 600 | [[package]] 601 | name = "tokio" 602 | version = "1.37.0" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" 605 | dependencies = [ 606 | "backtrace", 607 | "bytes", 608 | "libc", 609 | "mio", 610 | "pin-project-lite", 611 | "socket2", 612 | "tokio-macros", 613 | "windows-sys 0.48.0", 614 | ] 615 | 616 | [[package]] 617 | name = "tokio-macros" 618 | version = "2.2.0" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" 621 | dependencies = [ 622 | "proc-macro2", 623 | "quote", 624 | "syn 2.0.82", 625 | ] 626 | 627 | [[package]] 628 | name = "toml" 629 | version = "0.8.19" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" 632 | dependencies = [ 633 | "serde", 634 | "serde_spanned", 635 | "toml_datetime", 636 | "toml_edit", 637 | ] 638 | 639 | [[package]] 640 | name = "toml_datetime" 641 | version = "0.6.8" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" 644 | dependencies = [ 645 | "serde", 646 | ] 647 | 648 | [[package]] 649 | name = "toml_edit" 650 | version = "0.22.20" 651 | source = "registry+https://github.com/rust-lang/crates.io-index" 652 | checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" 653 | dependencies = [ 654 | "indexmap", 655 | "serde", 656 | "serde_spanned", 657 | "toml_datetime", 658 | "winnow", 659 | ] 660 | 661 | [[package]] 662 | name = "tree-sitter" 663 | version = "0.19.5" 664 | source = "registry+https://github.com/rust-lang/crates.io-index" 665 | checksum = "ad726ec26496bf4c083fff0f43d4eb3a2ad1bba305323af5ff91383c0b6ecac0" 666 | dependencies = [ 667 | "cc", 668 | "regex", 669 | ] 670 | 671 | [[package]] 672 | name = "tree-sitter-bash" 673 | version = "0.19.0" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | checksum = "c629e2d29ebb85b34cd195a1c511a161ed775451456cde110470e7af693424db" 676 | dependencies = [ 677 | "cc", 678 | "tree-sitter", 679 | ] 680 | 681 | [[package]] 682 | name = "unicode-ident" 683 | version = "1.0.12" 684 | source = "registry+https://github.com/rust-lang/crates.io-index" 685 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 686 | 687 | [[package]] 688 | name = "utf8parse" 689 | version = "0.2.1" 690 | source = "registry+https://github.com/rust-lang/crates.io-index" 691 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 692 | 693 | [[package]] 694 | name = "version_check" 695 | version = "0.9.4" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 698 | 699 | [[package]] 700 | name = "wait-timeout" 701 | version = "0.2.0" 702 | source = "registry+https://github.com/rust-lang/crates.io-index" 703 | checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" 704 | dependencies = [ 705 | "libc", 706 | ] 707 | 708 | [[package]] 709 | name = "wasi" 710 | version = "0.11.0+wasi-snapshot-preview1" 711 | source = "registry+https://github.com/rust-lang/crates.io-index" 712 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 713 | 714 | [[package]] 715 | name = "windows-sys" 716 | version = "0.48.0" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 719 | dependencies = [ 720 | "windows-targets 0.48.5", 721 | ] 722 | 723 | [[package]] 724 | name = "windows-sys" 725 | version = "0.52.0" 726 | source = "registry+https://github.com/rust-lang/crates.io-index" 727 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 728 | dependencies = [ 729 | "windows-targets 0.52.5", 730 | ] 731 | 732 | [[package]] 733 | name = "windows-targets" 734 | version = "0.48.5" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 737 | dependencies = [ 738 | "windows_aarch64_gnullvm 0.48.5", 739 | "windows_aarch64_msvc 0.48.5", 740 | "windows_i686_gnu 0.48.5", 741 | "windows_i686_msvc 0.48.5", 742 | "windows_x86_64_gnu 0.48.5", 743 | "windows_x86_64_gnullvm 0.48.5", 744 | "windows_x86_64_msvc 0.48.5", 745 | ] 746 | 747 | [[package]] 748 | name = "windows-targets" 749 | version = "0.52.5" 750 | source = "registry+https://github.com/rust-lang/crates.io-index" 751 | checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" 752 | dependencies = [ 753 | "windows_aarch64_gnullvm 0.52.5", 754 | "windows_aarch64_msvc 0.52.5", 755 | "windows_i686_gnu 0.52.5", 756 | "windows_i686_gnullvm", 757 | "windows_i686_msvc 0.52.5", 758 | "windows_x86_64_gnu 0.52.5", 759 | "windows_x86_64_gnullvm 0.52.5", 760 | "windows_x86_64_msvc 0.52.5", 761 | ] 762 | 763 | [[package]] 764 | name = "windows_aarch64_gnullvm" 765 | version = "0.48.5" 766 | source = "registry+https://github.com/rust-lang/crates.io-index" 767 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 768 | 769 | [[package]] 770 | name = "windows_aarch64_gnullvm" 771 | version = "0.52.5" 772 | source = "registry+https://github.com/rust-lang/crates.io-index" 773 | checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" 774 | 775 | [[package]] 776 | name = "windows_aarch64_msvc" 777 | version = "0.48.5" 778 | source = "registry+https://github.com/rust-lang/crates.io-index" 779 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 780 | 781 | [[package]] 782 | name = "windows_aarch64_msvc" 783 | version = "0.52.5" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" 786 | 787 | [[package]] 788 | name = "windows_i686_gnu" 789 | version = "0.48.5" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 792 | 793 | [[package]] 794 | name = "windows_i686_gnu" 795 | version = "0.52.5" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" 798 | 799 | [[package]] 800 | name = "windows_i686_gnullvm" 801 | version = "0.52.5" 802 | source = "registry+https://github.com/rust-lang/crates.io-index" 803 | checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" 804 | 805 | [[package]] 806 | name = "windows_i686_msvc" 807 | version = "0.48.5" 808 | source = "registry+https://github.com/rust-lang/crates.io-index" 809 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 810 | 811 | [[package]] 812 | name = "windows_i686_msvc" 813 | version = "0.52.5" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" 816 | 817 | [[package]] 818 | name = "windows_x86_64_gnu" 819 | version = "0.48.5" 820 | source = "registry+https://github.com/rust-lang/crates.io-index" 821 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 822 | 823 | [[package]] 824 | name = "windows_x86_64_gnu" 825 | version = "0.52.5" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" 828 | 829 | [[package]] 830 | name = "windows_x86_64_gnullvm" 831 | version = "0.48.5" 832 | source = "registry+https://github.com/rust-lang/crates.io-index" 833 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 834 | 835 | [[package]] 836 | name = "windows_x86_64_gnullvm" 837 | version = "0.52.5" 838 | source = "registry+https://github.com/rust-lang/crates.io-index" 839 | checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" 840 | 841 | [[package]] 842 | name = "windows_x86_64_msvc" 843 | version = "0.48.5" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 846 | 847 | [[package]] 848 | name = "windows_x86_64_msvc" 849 | version = "0.52.5" 850 | source = "registry+https://github.com/rust-lang/crates.io-index" 851 | checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" 852 | 853 | [[package]] 854 | name = "winnow" 855 | version = "0.6.18" 856 | source = "registry+https://github.com/rust-lang/crates.io-index" 857 | checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" 858 | dependencies = [ 859 | "memchr", 860 | ] 861 | 862 | [[package]] 863 | name = "zerocopy" 864 | version = "0.7.33" 865 | source = "registry+https://github.com/rust-lang/crates.io-index" 866 | checksum = "087eca3c1eaf8c47b94d02790dd086cd594b912d2043d4de4bfdd466b3befb7c" 867 | dependencies = [ 868 | "zerocopy-derive", 869 | ] 870 | 871 | [[package]] 872 | name = "zerocopy-derive" 873 | version = "0.7.33" 874 | source = "registry+https://github.com/rust-lang/crates.io-index" 875 | checksum = "6f4b6c273f496d8fd4eaf18853e6b448760225dc030ff2c485a786859aea6393" 876 | dependencies = [ 877 | "proc-macro2", 878 | "quote", 879 | "syn 2.0.82", 880 | ] 881 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hyprnome" 3 | description = "GNOME-like workspace switching in Hyprland." 4 | version = "0.3.1" 5 | authors = ["Copyright (C) 2023-2024 Donovan Glover "] 6 | repository = "https://github.com/donovanglover/hyprnome" 7 | edition = "2021" 8 | license = "GPL-3.0-or-later" 9 | 10 | [dependencies] 11 | clap = { version = "4.5.20", features = ["derive"] } 12 | hyprland = "0.4.0-alpha.3" 13 | 14 | [build-dependencies] 15 | clap = { version = "4.5.20", features = ["derive"] } 16 | clap_complete = "4.5.36" 17 | clap_mangen = "0.2.24" 18 | 19 | [dev-dependencies] 20 | assert_cmd = "2.0.16" 21 | rustympkglib = "0.1.1" 22 | serde = "1.0.214" 23 | toml = "0.8.19" 24 | 25 | [lints.rust] 26 | unsafe_code = "forbid" 27 | missing_docs = "deny" 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Donovan Glover 2 | pkgname=hyprnome 3 | pkgver=0.3.1 4 | pkgrel=1 5 | pkgdesc="GNOME-like workspace switching in Hyprland" 6 | arch=('x86_64') 7 | url="https://github.com/donovanglover/hyprnome" 8 | license=('GPL3') 9 | depends=('gcc-libs') 10 | makedepends=('cargo') 11 | source=("$pkgname-$pkgver.tar.gz::https://github.com/donovanglover/$pkgname/archive/$pkgver.tar.gz") 12 | sha256sums=('SKIP') 13 | 14 | build() { 15 | cd "$pkgname-$pkgver" 16 | 17 | cargo build --release --locked 18 | } 19 | 20 | package() { 21 | cd "$pkgname-$pkgver" 22 | 23 | install -Dm755 "target/release/hyprnome" "$pkgdir/usr/bin/hyprnome" 24 | 25 | install -Dm644 "target/completions/_hyprnome" "$pkgdir/usr/share/zsh/site-functions/_hyprnome" 26 | install -Dm644 "target/completions/hyprnome.bash" "$pkgdir/usr/share/bash-completion/completions/hyprnome" 27 | install -Dm644 "target/completions/hyprnome.fish" "$pkgdir/usr/share/fish/vendor_completions.d/hyprnome.fish" 28 | install -Dm644 "target/man/hyprnome.1" "$pkgdir/usr/share/man/man1/hyprnome.1" 29 | 30 | install -Dm644 "README.md" "$pkgdir/usr/share/doc/$pkgname/README.md" 31 | install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" 32 | } 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hyprnome 2 | 3 | [GNOME](https://www.gnome.org/)-like workspace switching in [Hyprland](https://hyprland.org/). 4 | 5 | ## Features 6 | 7 | - Switch between workspaces without worrying about which numbered workspace you're on. 8 | - Reduce the amount of effort it takes to switch workspaces since you no longer have to reach for keys 3-9. 9 | - Use multiple monitors without worrying about which monitor a workspace is on. 10 | - **Difference between `m+1`**: Does not wrap and instead creates new workspaces when reaching the end. 11 | - **Difference between `r+1`**: Does not show an empty workspace if there's a non-empty workspace with a higher id. 12 | 13 | ## Installation 14 | 15 | hyprnome has official support for NixOS, Arch Linux (AUR), and Fedora (Copr). 16 | 17 | [![Packaging status](https://repology.org/badge/vertical-allrepos/hyprnome.svg)](https://repology.org/project/hyprnome/versions) 18 | 19 | ### [NixOS](https://wiki.nixos.org/wiki/Overview_of_the_NixOS_Linux_distribution) (Recommended) 20 | 21 | Add [`hyprnome`](https://search.nixos.org/packages?channel=unstable&query=hyprnome) to your `systemPackages` and rebuild. 22 | 23 | ```nix 24 | { pkgs, ... }: 25 | 26 | { 27 | environment.systemPackages = with pkgs; [ 28 | hyprnome 29 | ]; 30 | } 31 | ``` 32 | 33 | Alternatively, use `nix run nixpkgs#hyprnome` to try hyprnome without installing it. 34 | 35 | ### [Arch Linux](https://archlinux.org/) (AUR) 36 | 37 | Use an AUR helper like [yay](https://github.com/Jguer/yay) to install [`hyprnome`](https://aur.archlinux.org/packages/hyprnome). 38 | 39 | ```fish 40 | yay hyprnome 41 | ``` 42 | 43 | ### [Fedora](https://fedoraproject.org/) (Copr) 44 | 45 | [`hyprnome`](https://copr.fedorainfracloud.org/coprs/solopasha/hyprland/package/hyprnome) is available in the [solopasha/hyprland](https://copr.fedorainfracloud.org/coprs/solopasha/hyprland) Copr repository. 46 | 47 | ```fish 48 | sudo dnf copr enable solopasha/hyprland && sudo dnf install hyprnome 49 | ``` 50 | 51 | ### Other distributions 52 | 53 | Follow the [install guide](https://www.rust-lang.org/tools/install) for Rust. Then, use cargo to install hyprnome. 54 | 55 | ```fish 56 | cargo install --git https://github.com/donovanglover/hyprnome --tag 0.3.1 57 | ``` 58 | 59 | ## Usage 60 | 61 | ```man 62 | Usage: hyprnome [OPTIONS] 63 | 64 | Options: 65 | -p, --previous Go to the previous workspace instead of the next 66 | -m, --move Move the active window to the dispatched workspace 67 | -n, --no-empty Don't create empty workspaces in the given direction 68 | -k, --keep-special Don't auto-close special workspaces when switching workspaces 69 | -c, --cycle Cycle between workspaces instead of creating new ones 70 | -v, --verbose Print debugging information 71 | -h, --help Print help (see more with '--help') 72 | -V, --version Print version 73 | ``` 74 | 75 | Example `hyprland.conf`: 76 | 77 | ```bash 78 | bind = SUPER, 1, exec, hyprnome --previous 79 | bind = SUPER, 2, exec, hyprnome 80 | bind = SUPER_SHIFT, 1, exec, hyprnome --previous --move 81 | bind = SUPER_SHIFT, 2, exec, hyprnome --move 82 | ``` 83 | 84 | ## Contributing 85 | 86 | This software should be bug-free, however contributions are welcome. Remember to write tests for any new functionality and ensure that all existing tests pass. 87 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | //! Generates man pages and shell completions for hyprnome. 2 | 3 | include!("src/cli.rs"); 4 | 5 | use clap::Command; 6 | use clap::CommandFactory; 7 | use clap_complete::generate_to; 8 | use clap_complete::Shell::{Bash, Fish, Zsh}; 9 | use clap_mangen::Man; 10 | use std::error::Error; 11 | use std::fs; 12 | use std::path::PathBuf; 13 | 14 | static NAME: &str = "hyprnome"; 15 | 16 | fn generate_man_pages(cmd: Command) -> Result<(), Box> { 17 | let man_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/man"); 18 | let mut buffer = Vec::default(); 19 | 20 | Man::new(cmd).render(&mut buffer)?; 21 | fs::create_dir_all(&man_dir)?; 22 | fs::write(man_dir.join(NAME.to_owned() + ".1"), buffer)?; 23 | 24 | Ok(()) 25 | } 26 | 27 | fn generate_shell_completions(mut cmd: Command) -> Result<(), Box> { 28 | let comp_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("target/completions"); 29 | 30 | fs::create_dir_all(&comp_dir)?; 31 | 32 | for shell in [Bash, Fish, Zsh] { 33 | generate_to(shell, &mut cmd, NAME, &comp_dir)?; 34 | } 35 | 36 | Ok(()) 37 | } 38 | 39 | fn main() { 40 | let mut cmd = Cli::command(); 41 | cmd.set_bin_name(NAME); 42 | 43 | if let Err(err) = generate_man_pages(cmd.clone()) { 44 | println!("cargo::warning=Error generating man pages: {err}"); 45 | } 46 | 47 | if let Err(err) = generate_shell_completions(cmd) { 48 | println!("cargo::warning=Error generating shell completions: {err}"); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | max_width = 200 2 | -------------------------------------------------------------------------------- /src/cli.rs: -------------------------------------------------------------------------------- 1 | use clap::builder::styling::{AnsiColor, Effects, Styles}; 2 | use clap::Parser; 3 | 4 | const LONG_ABOUT: &str = " 5 | hyprnome is a program that enables you to achieve GNOME-like workspace switching in Hyprland. 6 | 7 | Unlike Hyprland's r+1/r-1, empty workspaces between two occupied workspaces are skipped. 8 | 9 | Unlike Hyprland's m+1/m-1, new workspaces are created instead of wrapping to existing ones. 10 | 11 | Example hyprland.conf: 12 | 13 | bind = SUPER, 1, exec, hyprnome --previous 14 | 15 | bind = SUPER, 2, exec, hyprnome 16 | 17 | bind = SUPER_SHIFT, 1, exec, hyprnome --previous --move 18 | 19 | bind = SUPER_SHIFT, 2, exec, hyprnome --move 20 | 21 | This program is free software: you can redistribute it and/or modify 22 | it under the terms of the GNU General Public License as published by 23 | the Free Software Foundation, either version 3 of the License, or 24 | (at your option) any later version. 25 | 26 | This program is distributed in the hope that it will be useful, 27 | but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29 | GNU General Public License for more details."; 30 | 31 | fn styles() -> Styles { 32 | Styles::styled() 33 | .header(AnsiColor::Red.on_default() | Effects::BOLD) 34 | .usage(AnsiColor::Red.on_default() | Effects::BOLD) 35 | .literal(AnsiColor::Blue.on_default() | Effects::BOLD) 36 | .placeholder(AnsiColor::Green.on_default()) 37 | } 38 | 39 | #[derive(Parser)] 40 | #[command(author, version, about, long_about = LONG_ABOUT, styles = styles())] 41 | struct Cli { 42 | /// Go to the previous workspace instead of the next 43 | /// 44 | /// By default hyprnome will advance to the next workspace. --previous is necessary 45 | /// when you want to go backwards in the list of occupied workspaces. 46 | #[arg(short, long, default_value_t = false)] 47 | previous: bool, 48 | 49 | /// Move the active window to the dispatched workspace 50 | /// 51 | /// This flag lets you move windows across workspaces without having to worry about 52 | /// the current workspace you're in. 53 | #[arg(short, long, default_value_t = false)] 54 | _move: bool, 55 | 56 | /// Don't create empty workspaces in the given direction 57 | /// 58 | /// This prevents empty workspaces from being created when no occupied workspaces 59 | /// remain in the given direction. 60 | #[arg(short, long, default_value_t = false)] 61 | no_empty: bool, 62 | 63 | /// Don't create empty workspaces to the left 64 | /// 65 | /// NOTE: This flag is deprecated and has been replaced with --no-empty. The flag is 66 | /// kept for backwards compatibility with v0.1.0, but is hidden by default. 67 | #[arg(long, default_value_t = false, hide = true)] 68 | no_empty_before: bool, 69 | 70 | /// Don't create empty workspaces to the right 71 | /// 72 | /// NOTE: This flag is deprecated and has been replaced with --no-empty. The flag is 73 | /// kept for backwards compatibility with v0.1.0, but is hidden by default. 74 | #[arg(short = 'N', long, default_value_t = false, hide = true)] 75 | no_empty_after: bool, 76 | 77 | /// Don't auto-close special workspaces when switching workspaces 78 | /// 79 | /// With --move: 80 | /// 81 | /// Hyprland v0.29.0 and above allow opening empty special workspaces. This changed 82 | /// the behavior of special workspaces, most notably not auto-closing them by default 83 | /// when moving windows outside them. 84 | /// 85 | /// hyprnome v0.2.0 auto-closes special workspaces by default to mimic the old behavior. 86 | /// In order to avoid breaking people's workflows, it's possible to keep the special workspace 87 | /// open with this flag, although you'd then have to manually close the special workspace. 88 | /// 89 | /// Without --move: 90 | /// 91 | /// Special workspaces are cool when used with translucent or non-opaque windows that let you 92 | /// see the workspaces behind them. They become problematic when there's an opaque window 93 | /// preventing you from seeing the workspaces you're switching to. 94 | /// 95 | /// By default when switching workspaces, any windows in the workspace behind are focused. To 96 | /// avoid accidentally thinking that the special workspace is focused, hyprnome will automatically 97 | /// close special workspaces by default when switching between non-special workspaces. 98 | /// 99 | /// This flag makes it possible to keep the special workspace visible when switching workspaces, 100 | /// although it won't be focused if the workspace behind it has one or more windows. 101 | /// 102 | /// Summary: This flag is available so users can choose the old behavior, however automatically 103 | /// closing special workspaces (the default) does have its benefits. 104 | #[arg(short, long, default_value_t = false)] 105 | keep_special: bool, 106 | 107 | /// Cycle between workspaces instead of creating new ones 108 | /// 109 | /// This flag makes it possible to cycle to the last workspace on a monitor when there are no 110 | /// other workspaces before, and to cycle to the first workspace on a monitor when there are no 111 | /// other workspaces after. 112 | #[arg(short, long, default_value_t = false)] 113 | cycle: bool, 114 | 115 | /// Print debugging information 116 | #[arg(short, long, default_value_t = false)] 117 | verbose: bool, 118 | } 119 | 120 | /// Log information with --verbose 121 | pub fn log(text: &str) { 122 | let Cli { verbose, .. } = Cli::parse(); 123 | 124 | if verbose { 125 | println!("{text}"); 126 | } 127 | } 128 | 129 | /// Gets an ID to dispatch based on the current workspace state and cli options 130 | pub fn get_options() -> [bool; 7] { 131 | let Cli { 132 | _move, 133 | keep_special, 134 | previous, 135 | no_empty, 136 | no_empty_before, 137 | no_empty_after, 138 | cycle, 139 | .. 140 | } = Cli::parse(); 141 | 142 | [_move, keep_special, previous, no_empty, no_empty_before, no_empty_after, cycle] 143 | } 144 | -------------------------------------------------------------------------------- /src/hyprland.rs: -------------------------------------------------------------------------------- 1 | use hyprland::data::Client; 2 | use hyprland::data::Monitors; 3 | use hyprland::data::Workspace; 4 | use hyprland::data::Workspaces; 5 | use hyprland::dispatch::{Dispatch, DispatchType, WorkspaceIdentifierWithSpecial}; 6 | use hyprland::prelude::*; 7 | use hyprnome::WorkspaceState; 8 | 9 | pub fn get_state() -> hyprland::Result { 10 | let monitors = Monitors::get()?; 11 | let workspaces = Workspaces::get()?.into_iter().filter(|workspace| workspace.id > 0); 12 | let current_id = Workspace::get_active()?.id; 13 | 14 | let monitor_ids: Vec = workspaces 15 | .clone() 16 | .filter(|workspace| { 17 | if let Some(monitor) = monitors.clone().into_iter().find(|monitor| monitor.focused) { 18 | workspace.monitor == monitor.name 19 | } else { 20 | false 21 | } 22 | }) 23 | .map(|workspace| workspace.id) 24 | .collect(); 25 | 26 | let occupied_ids: Vec = workspaces.map(|workspace| workspace.id).collect(); 27 | 28 | Ok(WorkspaceState::new(current_id, monitor_ids, occupied_ids)) 29 | } 30 | 31 | /// Gets whether the current workspace is a special workspace or not. 32 | /// 33 | /// This function works by getting which workspace the active window is in. 34 | /// 35 | /// The if statement is used to make sure this function works when no window 36 | /// is the active window. 37 | pub fn is_special() -> hyprland::Result { 38 | if let Some(client) = Client::get_active()? { 39 | let Client { workspace, .. } = client; 40 | 41 | return Ok(workspace.name.contains("special")); 42 | } 43 | 44 | Ok(false) 45 | } 46 | 47 | pub fn change_workspace(id: i32, _move: bool, keep_special: bool) -> hyprland::Result<()> { 48 | let id = WorkspaceIdentifierWithSpecial::Id(id); 49 | 50 | if _move { 51 | let was_special = is_special()?; 52 | 53 | hyprland::dispatch!(MoveToWorkspace, id, None)?; 54 | 55 | if !keep_special && was_special { 56 | hyprland::dispatch!(ToggleSpecialWorkspace, None) 57 | } else { 58 | Ok(()) 59 | } 60 | } else { 61 | if !keep_special && is_special()? { 62 | hyprland::dispatch!(ToggleSpecialWorkspace, None)?; 63 | } 64 | 65 | hyprland::dispatch!(Workspace, id) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Library that can be used to get previous/next workspaces from a given state. 2 | 3 | use std::fmt; 4 | 5 | /// Struct to keep related workspace state together 6 | #[derive(Default)] 7 | pub struct WorkspaceState { 8 | current_id: i32, 9 | monitor_ids: Vec, 10 | occupied_ids: Vec, 11 | no_empty_before: bool, 12 | no_empty_after: bool, 13 | previous: bool, 14 | cycle: bool, 15 | } 16 | 17 | /// A `WorkspaceState` is the current state of Hyprland. 18 | /// 19 | /// A `WorkspaceState` also contains boolean options that affect which workspace a user is 20 | /// interested in next. 21 | impl WorkspaceState { 22 | /// Given the `current_id`, `monitor_ids`, and `occupied_ids`, create a new `WorkspaceState`. 23 | /// 24 | /// Vectors are sorted so it's easier to perform operations on them. 25 | #[must_use] 26 | pub fn new(current_id: i32, mut monitor_ids: Vec, mut occupied_ids: Vec) -> Self { 27 | monitor_ids.sort_unstable(); 28 | occupied_ids.sort_unstable(); 29 | 30 | Self { 31 | current_id, 32 | monitor_ids, 33 | occupied_ids, 34 | no_empty_before: false, 35 | no_empty_after: false, 36 | previous: false, 37 | cycle: false, 38 | } 39 | } 40 | 41 | /// Gets the previous workspace on a monitor, or try to choose the next left-most empty workspace 42 | /// 43 | /// 1) If we're the first workspace on a monitor: 44 | /// 1.1) If we're at the lowest possible id 1 OR the user doesn't want empty workspaces OR the user wants to cycle: 45 | /// 1.1.1) If the user wants to cycle, go to the last workspace. Otherwise return the current id 46 | /// 1.2) Otherwise, return the first unoccupied workspace before the current id 47 | /// 1.2.1) If all other workspaces before are occupied, return the current id instead 48 | /// 2) Otherwise, since there are workspaces before on the same monitor, select the one before. 49 | #[must_use] 50 | pub fn get_previous_id(&self) -> i32 { 51 | if self.monitor_ids[0] == self.current_id { 52 | if self.monitor_ids[0] == 1 || self.no_empty_before || self.cycle { 53 | if self.cycle { 54 | self.monitor_ids[self.monitor_ids.len() - 1] 55 | } else { 56 | self.current_id 57 | } 58 | } else { 59 | let mut i = self.current_id - 1; 60 | 61 | while i > 0 { 62 | if !self.occupied_ids.contains(&i) { 63 | return i; 64 | } 65 | 66 | i -= 1; 67 | } 68 | 69 | self.current_id 70 | } 71 | } else { 72 | self.monitor_ids[self.monitor_ids.iter().position(|&x| x == self.current_id).unwrap() - 1] 73 | } 74 | } 75 | 76 | /// Gets the next workspace on a monitor, or try to choose the next right-most empty workspace 77 | /// 78 | /// 1) If we're the last workspace on a monitor: 79 | /// 1.1) If we're at the MAX OR the user doesn't want empty workspaces OR the user wants to cycle: 80 | /// 1.1.1) If the user wants to cycle, go to the first workspace. Otherwise return the current id 81 | /// 1.2) Otherwise, return the first unoccupied workspace after the current id 82 | /// 1.2.1) If all other workspaces after are occupied, return the current id instead 83 | /// 2) Otherwise, since there are workspaces after on the same monitor, select the one after. 84 | #[must_use] 85 | pub fn get_next_id(&self) -> i32 { 86 | if self.monitor_ids[self.monitor_ids.len() - 1] == self.current_id { 87 | if self.monitor_ids[self.monitor_ids.len() - 1] == i32::MAX || self.no_empty_after || self.cycle { 88 | if self.cycle { 89 | self.monitor_ids[0] 90 | } else { 91 | self.current_id 92 | } 93 | } else { 94 | let mut i = self.current_id + 1; 95 | 96 | while i < i32::MAX { 97 | if !self.occupied_ids.contains(&i) { 98 | return i; 99 | } 100 | 101 | i += 1; 102 | } 103 | 104 | if !self.occupied_ids.contains(&i) { 105 | i 106 | } else { 107 | self.current_id 108 | } 109 | } 110 | } else { 111 | self.monitor_ids[self.monitor_ids.iter().position(|&x| x == self.current_id).unwrap() + 1] 112 | } 113 | } 114 | 115 | /// Sets `no_empty_before` 116 | pub fn set_no_empty_before(&mut self, no_empty_before: bool) { 117 | self.no_empty_before = no_empty_before; 118 | } 119 | 120 | /// Sets `no_empty_after` 121 | pub fn set_no_empty_after(&mut self, no_empty_after: bool) { 122 | self.no_empty_after = no_empty_after; 123 | } 124 | 125 | /// Sets `previous` 126 | pub fn set_previous(&mut self, previous: bool) { 127 | self.previous = previous; 128 | } 129 | 130 | /// Sets `cycle` 131 | pub fn set_cycle(&mut self, cycle: bool) { 132 | self.cycle = cycle; 133 | } 134 | 135 | /// Derives the id a user wants based on the current state 136 | #[must_use] 137 | pub fn derive_id(&self) -> i32 { 138 | if self.previous { 139 | self.get_previous_id() 140 | } else { 141 | self.get_next_id() 142 | } 143 | } 144 | } 145 | 146 | impl fmt::Display for WorkspaceState { 147 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 148 | write!(f, "Current ID:\t{}\nMonitor IDs:\t{:?}\nOccupied IDs:\t{:?}", self.current_id, self.monitor_ids, self.occupied_ids) 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | 3 | mod cli; 4 | mod hyprland; 5 | 6 | /// Main function in charge of hyprnome logic. 7 | /// 8 | /// Specific features are abstracted into lib to make things testable. 9 | fn main() { 10 | let [_move, keep_special, previous, no_empty, no_empty_before, no_empty_after, cycle] = cli::get_options(); 11 | 12 | if let Ok(mut state) = hyprland::get_state() { 13 | state.set_no_empty_before(no_empty || no_empty_before); 14 | state.set_no_empty_after(no_empty || no_empty_after); 15 | state.set_previous(previous); 16 | state.set_cycle(cycle); 17 | 18 | cli::log(&format!("{state}")); 19 | 20 | let id = state.derive_id(); 21 | 22 | if hyprland::change_workspace(id, _move, keep_special).is_ok() { 23 | cli::log(&format!("Dispatched ID:\t{id}")); 24 | } else { 25 | cli::log(&format!("Failed to dispatch ID {id}")); 26 | } 27 | } else { 28 | cli::log("Tried to get state but wasn't able to. Is Hyprland running?"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/get_next_id.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(rustfmt, rustfmt_skip)] 2 | 3 | use hyprnome::WorkspaceState; 4 | 5 | #[test] 6 | fn only_workspace() { 7 | let current_id = 500; 8 | let monitor_ids = [500].to_vec(); 9 | let occupied_ids = [500].to_vec(); 10 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 11 | 12 | assert_eq!(state.get_next_id(), 501, "should return next workspace on monitor when only workspace"); 13 | 14 | let current_id = 498; 15 | let monitor_ids = [498].to_vec(); 16 | let occupied_ids = [498].to_vec(); 17 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 18 | 19 | state.set_no_empty_after(true); 20 | 21 | assert_eq!(state.get_next_id(), 498, "should return the same workspace if only workspace and no_empty_after"); 22 | } 23 | 24 | #[test] 25 | fn next_workspace_on_monitor() { 26 | let current_id = 500; 27 | let monitor_ids = [500, 502].to_vec(); 28 | let occupied_ids = [500, 502].to_vec(); 29 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 30 | 31 | assert_eq!(state.get_next_id(), 502, "should return next workspace on monitor"); 32 | 33 | let current_id = 500; 34 | let monitor_ids = [500, 504].to_vec(); 35 | let occupied_ids = [500, 502, 504].to_vec(); 36 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 37 | 38 | assert_eq!(state.get_next_id(), 504, "should return next workspace on monitor with occupied workspaces in-between on other monitors"); 39 | } 40 | 41 | #[test] 42 | fn next_empty() { 43 | let current_id = 502; 44 | let monitor_ids = [500, 502].to_vec(); 45 | let occupied_ids = [500, 502].to_vec(); 46 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 47 | 48 | assert_eq!(state.get_next_id(), 503, "should return next empty workspace if last workspace on monitor"); 49 | 50 | let current_id = 502; 51 | let monitor_ids = [500, 502].to_vec(); 52 | let occupied_ids = [500, 502, 503, 504].to_vec(); 53 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 54 | 55 | assert_eq!(state.get_next_id(), 505, "should return next empty workspace if last workspace on monitor with occupied workspaces on other monitors"); 56 | } 57 | 58 | #[test] 59 | fn no_empty_after() { 60 | let current_id = 502; 61 | let monitor_ids = [500, 502].to_vec(); 62 | let occupied_ids = [500, 502].to_vec(); 63 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 64 | 65 | state.set_no_empty_after(true); 66 | 67 | assert_eq!(state.get_next_id(), 502, "should return the same workspace if last workspace on monitor"); 68 | 69 | let current_id = 502; 70 | let monitor_ids = [500, 502].to_vec(); 71 | let occupied_ids = [500, 502, 503, 504].to_vec(); 72 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 73 | 74 | state.set_no_empty_after(true); 75 | 76 | assert_eq!(state.get_next_id(), 502, "should return the same workspace if last workspace on monitor with occupied workspaces on other monitors"); 77 | } 78 | 79 | #[test] 80 | fn out_of_bounds() { 81 | let current_id = i32::MAX; 82 | let monitor_ids = [500, i32::MAX].to_vec(); 83 | let occupied_ids = [500, i32::MAX].to_vec(); 84 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 85 | 86 | assert_eq!(state.get_next_id(), i32::MAX, "should return the same workspace if last workspace is i32::MAX"); 87 | 88 | let current_id = i32::MAX - 2; 89 | let monitor_ids = [i32::MAX - 2].to_vec(); 90 | let occupied_ids = [i32::MAX - 2, i32::MAX - 1, i32::MAX].to_vec(); 91 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 92 | 93 | assert_eq!(state.get_next_id(), i32::MAX - 2, "should return the current workspace if all next workspaces are occupied"); 94 | } 95 | 96 | #[test] 97 | fn fill_the_gaps() { 98 | let current_id = 4; 99 | let monitor_ids = [3, 4].to_vec(); 100 | let occupied_ids = [3, 4, 6].to_vec(); 101 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 102 | 103 | assert_eq!(state.get_next_id(), 5, "should return workspace 5 if the occupied workspaces are [3, 4, 6], the monitor workspaces are [3, 4], and the current workspace is 4"); 104 | 105 | let current_id = 5; 106 | let monitor_ids = [4, 5].to_vec(); 107 | let occupied_ids = [4, 5, 6, 7, 9].to_vec(); 108 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 109 | 110 | assert_eq!(state.get_next_id(), 8, "should return workspace 8 if the occupied workspaces are [4, 5, 6, 7, 9], the monitor workspaces are [4, 5], and the current workspace is 5"); 111 | } 112 | 113 | #[test] 114 | fn returns_the_last_id() { 115 | let current_id = i32::MAX - 1; 116 | let monitor_ids = [i32::MAX - 1].to_vec(); 117 | let occupied_ids = [i32::MAX - 1].to_vec(); 118 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 119 | 120 | assert_eq!(state.get_next_id(), i32::MAX, "should return i32::MAX if it's unoccupied"); 121 | 122 | let current_id = i32::MAX - 2; 123 | let monitor_ids = [i32::MAX - 2].to_vec(); 124 | let occupied_ids = [i32::MAX - 2, i32::MAX - 1].to_vec(); 125 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 126 | 127 | assert_eq!(state.get_next_id(), i32::MAX, "should return i32::MAX if it's unoccupied and there are in-between workspaces on other monitors"); 128 | } 129 | 130 | #[test] 131 | fn cycle() { 132 | let current_id = 504; 133 | let monitor_ids = [500, 502, 504].to_vec(); 134 | let occupied_ids = [498, 500, 502, 504, 506].to_vec(); 135 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 136 | 137 | state.set_cycle(true); 138 | 139 | assert_eq!(state.get_next_id(), 500, "should return the first workspace on monitor if last workspace on monitor"); 140 | } 141 | -------------------------------------------------------------------------------- /tests/get_previous_id.rs: -------------------------------------------------------------------------------- 1 | #![cfg_attr(rustfmt, rustfmt_skip)] 2 | 3 | use hyprnome::WorkspaceState; 4 | 5 | #[test] 6 | fn only_workspace() { 7 | let current_id = 500; 8 | let monitor_ids = [500].to_vec(); 9 | let occupied_ids = [500].to_vec(); 10 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 11 | 12 | assert_eq!(state.get_previous_id(), 499, "should return previous workspace on monitor when only workspace"); 13 | 14 | let current_id = 500; 15 | let monitor_ids = [500].to_vec(); 16 | let occupied_ids = [500].to_vec(); 17 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 18 | 19 | state.set_no_empty_before(true); 20 | 21 | assert_eq!(state.get_previous_id(), 500, "should return the same workspace if only workspace and no_empty_before"); 22 | } 23 | 24 | #[test] 25 | fn previous_workspace_on_monitor() { 26 | let current_id = 502; 27 | let monitor_ids = [500, 502].to_vec(); 28 | let occupied_ids = [500, 502].to_vec(); 29 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 30 | 31 | assert_eq!(state.get_previous_id(), 500, "should return previous workspace on monitor"); 32 | 33 | let current_id = 504; 34 | let monitor_ids = [500, 504].to_vec(); 35 | let occupied_ids = [500, 502, 504].to_vec(); 36 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 37 | 38 | assert_eq!(state.get_previous_id(), 500, "should return previous workspace on monitor with occupied workspaces in-between on other monitors"); 39 | } 40 | 41 | #[test] 42 | fn previous_empty() { 43 | let current_id = 500; 44 | let monitor_ids = [500, 501].to_vec(); 45 | let occupied_ids = [500, 501].to_vec(); 46 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 47 | 48 | assert_eq!(state.get_previous_id(), 499, "should return previous empty workspace if first workspace on monitor"); 49 | 50 | let current_id = 500; 51 | let monitor_ids = [500, 501].to_vec(); 52 | let occupied_ids = [499, 500, 501].to_vec(); 53 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 54 | 55 | assert_eq!(state.get_previous_id(), 498, "should return previous empty workspace if first workspace on monitor with occupied workspaces on other monitors"); 56 | } 57 | 58 | #[test] 59 | fn no_empty_before() { 60 | let current_id = 500; 61 | let monitor_ids = [500, 502].to_vec(); 62 | let occupied_ids = [500, 502].to_vec(); 63 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 64 | 65 | state.set_no_empty_before(true); 66 | 67 | assert_eq!(state.get_previous_id(), 500, "should return the same workspace if first workspace on monitor"); 68 | 69 | let current_id = 500; 70 | let monitor_ids = [500, 502].to_vec(); 71 | let occupied_ids = [498, 499, 500, 502].to_vec(); 72 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 73 | 74 | state.set_no_empty_before(true); 75 | 76 | assert_eq!(state.get_previous_id(), 500, "should return the same workspace if first workspace on monitor with occupied workspaces on other monitors"); 77 | } 78 | 79 | #[test] 80 | fn out_of_bounds() { 81 | let current_id = 1; 82 | let monitor_ids = [1, 2].to_vec(); 83 | let occupied_ids = [1, 2].to_vec(); 84 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 85 | 86 | assert_eq!(state.get_previous_id(), 1, "should return the same workspace if first workspace is 1"); 87 | 88 | let current_id = 3; 89 | let monitor_ids = [3, 4].to_vec(); 90 | let occupied_ids = [1, 2, 3, 4].to_vec(); 91 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 92 | 93 | assert_eq!(state.get_previous_id(), 3, "should return the current workspace if all previous workspaces are occupied"); 94 | } 95 | 96 | #[test] 97 | fn fill_the_gaps() { 98 | let current_id = 3; 99 | let monitor_ids = [3, 4].to_vec(); 100 | let occupied_ids = [1, 3, 4].to_vec(); 101 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 102 | 103 | assert_eq!(state.get_previous_id(), 2, "should return workspace 2 if the occupied workspaces are [1, 3, 4], the monitor workspaces are [3, 4], and the current workspace is 3"); 104 | 105 | let current_id = 4; 106 | let monitor_ids = [4, 5].to_vec(); 107 | let occupied_ids = [1, 3, 4, 5].to_vec(); 108 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 109 | 110 | assert_eq!(state.get_previous_id(), 2, "should return workspace 2 if the occupied workspaces are [1, 3, 4, 5], the monitor workspaces are [4, 5], and the current workspace is 4"); 111 | } 112 | 113 | #[test] 114 | fn returns_the_first_id() { 115 | let current_id = 2; 116 | let monitor_ids = [2, 3].to_vec(); 117 | let occupied_ids = [2, 3].to_vec(); 118 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 119 | 120 | assert_eq!(state.get_previous_id(), 1, "should return 1 if it's unoccupied"); 121 | 122 | let current_id = 4; 123 | let monitor_ids = [4, 5].to_vec(); 124 | let occupied_ids = [2, 3, 4, 5].to_vec(); 125 | let state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 126 | 127 | assert_eq!(state.get_previous_id(), 1, "should return 1 if it's unoccupied and there are in-between workspaces on other monitors"); 128 | } 129 | 130 | #[test] 131 | fn cycle() { 132 | let current_id = 500; 133 | let monitor_ids = [500, 502, 504].to_vec(); 134 | let occupied_ids = [498, 500, 502, 504].to_vec(); 135 | let mut state = WorkspaceState::new(current_id, monitor_ids, occupied_ids); 136 | 137 | state.set_cycle(true); 138 | 139 | assert_eq!(state.get_previous_id(), 504, "should return the last workspace on monitor if first workspace on monitor"); 140 | } 141 | -------------------------------------------------------------------------------- /tests/release.rs: -------------------------------------------------------------------------------- 1 | use assert_cmd::Command; 2 | use rustympkglib::pkgdata::PkgData; 3 | use serde::Deserialize; 4 | use std::fs; 5 | 6 | #[derive(Debug, Deserialize)] 7 | struct Config { 8 | package: Option, 9 | } 10 | 11 | #[derive(Debug, Deserialize)] 12 | struct PackageConfig { 13 | version: Option, 14 | description: Option, 15 | } 16 | 17 | #[test] 18 | /// We have the version number in quite a few places. This test ensures that all 19 | /// version numbers are updated as appropriate when a new version is released. 20 | fn versions_are_the_same() { 21 | let pkgbuild = &fs::read_to_string("PKGBUILD").unwrap(); 22 | let pkgbuild = PkgData::from_source(pkgbuild).unwrap(); 23 | let pkgbuild = pkgbuild.pkgver; 24 | 25 | let cargo = &fs::read_to_string("Cargo.toml").unwrap(); 26 | let cargo: Config = toml::from_str(cargo).unwrap(); 27 | let cargo = cargo.package.unwrap().version.unwrap(); 28 | 29 | assert_eq!(pkgbuild, cargo.as_str(), "Cargo.toml and PKGBUILD should have the same version"); 30 | } 31 | 32 | #[test] 33 | /// Ensures that the description is the same across the project 34 | /// 35 | /// Note that the PKGBUILD should not have a period at the end. 36 | fn descriptions_are_the_same() { 37 | let pkgbuild = &fs::read_to_string("PKGBUILD").unwrap(); 38 | let pkgbuild = PkgData::from_source(pkgbuild).unwrap(); 39 | let pkgbuild = pkgbuild.pkgdesc.unwrap() + "."; 40 | 41 | let cargo = &fs::read_to_string("Cargo.toml").unwrap(); 42 | let cargo: Config = toml::from_str(cargo).unwrap(); 43 | let cargo = cargo.package.unwrap().description.unwrap(); 44 | 45 | assert_eq!(pkgbuild, cargo.as_str(), "Cargo.toml and PKGBUILD should have the same description"); 46 | } 47 | 48 | #[test] 49 | /// Ensures that the usage code block in the README is the same as the output of hyprnome -h 50 | fn usage_is_the_same() { 51 | let cargo_description = &fs::read_to_string("Cargo.toml").unwrap(); 52 | let cargo_description: Config = toml::from_str(cargo_description).unwrap(); 53 | let cargo_description = cargo_description.package.unwrap().description.unwrap(); 54 | 55 | let readme = &fs::read_to_string("README.md").unwrap(); 56 | let mut inside_code_block = false; 57 | 58 | // Initialize with cargo_description since we don't duplicate this in the README 59 | let mut readme_usage: String = format!("{cargo_description}\n\n"); 60 | 61 | for line in readme.lines() { 62 | if line == "```" { 63 | inside_code_block = false; 64 | continue; 65 | } 66 | 67 | if inside_code_block { 68 | readme_usage.push_str(&(line.to_owned() + "\n")); 69 | continue; 70 | } 71 | 72 | if line == "```man" { 73 | inside_code_block = true; 74 | } 75 | } 76 | 77 | let mut cmd = Command::cargo_bin("hyprnome").unwrap(); 78 | cmd.arg("-h").assert().stdout(readme_usage); 79 | } 80 | 81 | #[test] 82 | /// Ensures that the correct version of hyprnome is found in the README 83 | fn current_version_is_used() { 84 | let cargo_version = &fs::read_to_string("Cargo.toml").unwrap(); 85 | let cargo_version: Config = toml::from_str(cargo_version).unwrap(); 86 | let cargo_version = cargo_version.package.unwrap().version.unwrap(); 87 | 88 | let readme = &fs::read_to_string("README.md").unwrap(); 89 | 90 | assert!(readme.contains(&("--tag ".to_owned() + cargo_version.as_str())), "should have the correct tag version in the README"); 91 | } 92 | --------------------------------------------------------------------------------