i3-workspace-groups icon indicating copy to clipboard operation
i3-workspace-groups copied to clipboard

Support pinned workspaces

Open Ruborcalor opened this issue 3 years ago • 3 comments

What's This?

The polybar module is great but does not support pinned workspaces like the internal/i3 module.

Pinning workspaces means only showing workspaces defined on the same output of a bar. This is useful if you want to show monitor specific workspaces on different bars.

These changes add a -m flag to the i3-groups-polybar-module script which allows you to specify a monitor for which to show workspaces.

In order to use the -m flag, you must update the hook script flags. This is how I do it.

When calling polybar I export an environment variable called I3_MOD_HOOK with the monitor specifying script to call:

export I3_MOD_HOOK="i3-groups-polybar-module -m \"$MONITOR\""
polybar -q main -c "$dir/$style/config.ini" &

Then in the module configuration I set the hook value equal to this environment variable as follows:

[module/i3-mod]
type = custom/ipc
hook-0 = ${env:I3_MOD_HOOK}
initial = 1

It would have been nice to just pass the monitor as an environment variable instead of the whole script, but I couldn't find a nice way to do this because of polybar's configuration limitations: https://github.com/polybar/polybar/issues/954

This PR is a draft. I have only tested it on my machine. It identifies monitors based on their viewport position. If there is interest I can try to improve it to be more robust to variant across machines.

Screenshots

This is what it looks like on my machine.

Monitor 1 image

Monitor 2 image

Ruborcalor avatar Sep 01 '21 22:09 Ruborcalor

Thanks a lot for this improvement. I'm fine with merging it as is if it works on your machine. I'm personally using my polybar fork, but since it's unlikely to ever be merged upstream, using the module is probably better for users. At some point I want to rewrite i3-workspace-groups in go to reduce the latency, and I may then rewrite the polybar module in go as well.

infokiller avatar Sep 02 '21 11:09 infokiller

@Ruborcalor do you still want to merge this? it's still in draft mode

infokiller avatar Dec 13 '21 09:12 infokiller

I don't think it's ready to merge in its current state, but I'll make some improvements over the holidays and then we can merge it in :)

Ruborcalor avatar Dec 23 '21 03:12 Ruborcalor

Took me a while but revisited this recently. Closing for #56

Ruborcalor avatar Oct 30 '22 02:10 Ruborcalor