[PR #671] [MERGED] Feat: sway-mode module #7886

Closed
opened 2026-05-23 02:56:03 +01:00 by JakeStanger · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/JakeStanger/ironbar/pull/671
Author: @Rodrigodd
Created: 7/20/2024
Status: Merged
Merged: 8/5/2024
Merged by: @JakeStanger

Base: masterHead: feat/sway-mode-module


📝 Commits (9)

  • fa0175f feat: add sway-mode module
  • 6effd8c refactor: Avoid making multiple connections to SwayIPC
  • ec98e69 fix(sway-mode): better documentation and fix Styling section
  • c355c3b fix(sway-mode): avoid unwrap
  • d0a4a91 refactor: use try_send!(tx, ...) instead of await_sync(tx.send(...))
  • 9c30bc4 refactor: make add_listener receive event by Type
  • 853c5d7 refactor: move sway::Client out of compositor
  • 38414ec docs: add sway-mode to _Sidebar.md
  • ebe656d refactor(sway-mode): replace unwrap by expect

📊 Changes

11 files changed (+411 additions, -72 deletions)

View changed files

📝 Cargo.toml (+3 -1)
📝 docs/_Sidebar.md (+1 -0)
docs/modules/Sway-mode.md (+78 -0)
📝 src/clients/compositor/mod.rs (+7 -4)
📝 src/clients/compositor/sway.rs (+24 -66)
📝 src/clients/mod.rs (+20 -1)
src/clients/sway.rs (+181 -0)
📝 src/config/mod.rs (+6 -0)
📝 src/modules/mod.rs (+2 -0)
src/modules/sway/mod.rs (+1 -0)
src/modules/sway/mode.rs (+88 -0)

📄 Description

Add a new module, similar to the waybar "sway/module" module. It shows the current mode under sway. For that, it needs to communicate with the Sway IPC. In this PR, the module is called "sway-mode" because "sway/mode" didn't work in my YAML config file (it would probably work if I surrounded it with quotes, but I didn't test).

This PR has two commits: the first one implements the module using a new sway connection. The second one refactors the sway Client, under clients::compositor::sway, to allow dynamically registering events, instead of only handling Workspace update ones. This second commit avoid creating a new socket for each module that needs to communicate with the Sway IPC, not sure if that is a problem to begin with.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/JakeStanger/ironbar/pull/671 **Author:** [@Rodrigodd](https://github.com/Rodrigodd) **Created:** 7/20/2024 **Status:** ✅ Merged **Merged:** 8/5/2024 **Merged by:** [@JakeStanger](https://github.com/JakeStanger) **Base:** `master` ← **Head:** `feat/sway-mode-module` --- ### 📝 Commits (9) - [`fa0175f`](https://github.com/JakeStanger/ironbar/commit/fa0175fa93e57ac7c3ac2f284d45cd11d5b13cba) feat: add sway-mode module - [`6effd8c`](https://github.com/JakeStanger/ironbar/commit/6effd8c795d042206d18229c53568baa8c90017f) refactor: Avoid making multiple connections to SwayIPC - [`ec98e69`](https://github.com/JakeStanger/ironbar/commit/ec98e6944ed484e0791490235306cf98d8f94b39) fix(sway-mode): better documentation and fix Styling section - [`c355c3b`](https://github.com/JakeStanger/ironbar/commit/c355c3bada10e35506924ce5965e090afa2d20e3) fix(sway-mode): avoid unwrap - [`d0a4a91`](https://github.com/JakeStanger/ironbar/commit/d0a4a91335c3f512eb272454a9acfac763bc1add) refactor: use `try_send!(tx, ...)` instead of `await_sync(tx.send(...))` - [`9c30bc4`](https://github.com/JakeStanger/ironbar/commit/9c30bc4b4c0c2230ac9f4741bdc4d5ddb25f857f) refactor: make `add_listener` receive event by Type - [`853c5d7`](https://github.com/JakeStanger/ironbar/commit/853c5d70cb6b66541775868d34932ecf5c2a1c69) refactor: move `sway::Client` out of compositor - [`38414ec`](https://github.com/JakeStanger/ironbar/commit/38414ecb6e88cc290547b3b515681d99d74ceeb4) docs: add sway-mode to _Sidebar.md - [`ebe656d`](https://github.com/JakeStanger/ironbar/commit/ebe656d0572bc2106265b9a71d7a768532ee73a8) refactor(sway-mode): replace unwrap by expect ### 📊 Changes **11 files changed** (+411 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.toml` (+3 -1) 📝 `docs/_Sidebar.md` (+1 -0) ➕ `docs/modules/Sway-mode.md` (+78 -0) 📝 `src/clients/compositor/mod.rs` (+7 -4) 📝 `src/clients/compositor/sway.rs` (+24 -66) 📝 `src/clients/mod.rs` (+20 -1) ➕ `src/clients/sway.rs` (+181 -0) 📝 `src/config/mod.rs` (+6 -0) 📝 `src/modules/mod.rs` (+2 -0) ➕ `src/modules/sway/mod.rs` (+1 -0) ➕ `src/modules/sway/mode.rs` (+88 -0) </details> ### 📄 Description Add a new module, similar to the waybar "sway/module" module. It shows the current mode under sway. For that, it needs to communicate with the Sway IPC. In this PR, the module is called "sway-mode" because "sway/mode" didn't work in my YAML config file (it would probably work if I surrounded it with quotes, but I didn't test). This PR has two commits: the first one implements the module using a new sway connection. The second one refactors the sway `Client`, under `clients::compositor::sway`, to allow dynamically registering events, instead of only handling Workspace update ones. This second commit avoid creating a new socket for each module that needs to communicate with the Sway IPC, not sure if that is a problem to begin with. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
JakeStanger 2026-05-23 02:56:03 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#7886
No description provided.