Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to show number of indows on the workspace #672

Open
bklaase opened this issue Apr 18, 2020 · 1 comment
Open

Option to show number of indows on the workspace #672

bklaase opened this issue Apr 18, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@bklaase
Copy link

bklaase commented Apr 18, 2020

This seems probably like a strange request, but some workspace/app combinations work better in floating mode. However in those cases it would be nice to know of windows hidden behind others. Would this be easy to implement?

Using custom in combination with swaymsg -t get_tree | jq somefilter seems somewhat wastefull

@Alexays Alexays added the enhancement New feature or request label May 28, 2020
@nktnet1
Copy link

nktnet1 commented Jun 30, 2024

Update 2024-08-24

Made a PR with cpp windowcount module:

Mainly wanted "separate-outputs", i.e. windows count should be specific to each monitor.

Original

I was able to achieve something similar for Hyprland workspaces with a custom module that listens to events - documentation here:

For example, in ~/.config/waybar/scripts/hyprland_clients.sh:

#!/bin/sh

: "${XDG_RUNTIME_DIR:?Environment variable XDG_RUNTIME_DIR not set}"
: "${HYPRLAND_INSTANCE_SIGNATURE:?Environment variable HYPRLAND_INSTANCE_SIGNATURE not set}"

handle() {
  case "$1" in
    workspace* | focusedmon* | openwindow* | closewindow* | movewindow*)
      update_active_clients
    ;;
  esac
}

update_active_clients() {
  active_clients=$(hyprctl activeworkspace -j | jq -r .windows)
  echo "$active_clients"
}

# Initial update
update_active_clients

# Listen to events and handle them
socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while IFS= read -r line; do
  handle "$line"
done

and then in ~/.config/waybar/config.jsonc:

    // ...

    "modules-left": [
        "custom/hyprland_clients",
        "hyprland/workspaces"
    ],

    // ...

    "custom/hyprland_clients": {
        "exec": "~/.config/waybar/scripts/hyprland_clients.sh",
        "format": "[{}]"
    },

    // ...

One caveat is that on a multi-monitor setup, it will still show the count for the currently active/focused workspace of the focused monitor, instead of the visible workspace of each individual monitor separately.

Would be nice to see this supported natively. Feature was also requested in this Reddit post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants