Getting active workspace with command #2866
Replies: 1 comment
-
|
COSMIC purposefully avoids using DBus for compositor-level state like workspaces to keep things Wayland-native and performant.
You need to use the zcosmic_workspace_unstable_v2 protocol. This is the custom extension COSMIC uses to manage and expose workspace states to external clients like panels and docks.
You can use the following crates to build a small background "listener" that outputs the current workspace to stdout for EWW:
You can find the exact implementation of this logic in the official cosmic-workspaces-epoch repository. Specifically, look at how the workspace applet handles events to update its UI—you can effectively "strip down" that logic into a CLI tool. There isn't a "one-liner" CLI tool like swaymsg yet, so writing a small Rust utility that stays open and prints the active workspace index/name to stdout whenever it changes is the most robust way to integrate with EWW's subscribe pollers. PLEASE DO MARK AS ANSWER IF THIS HELPED YOU IN ANY WAY |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to get the active workspace using the terminal? Looked into dbus but does not seem to be used by the compositor at least.
Want this for EWW (custom topbar/panel) to show the current workspace.
I don't mind making a small program myself since I use Rust, but I don't know how an external can access the this state from the compositor at all right now.
Beta Was this translation helpful? Give feedback.
All reactions