-
Notifications
You must be signed in to change notification settings - Fork 48
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
Changed the workspace separation #19
Conversation
Strange. This works fine for me. Do you still have
I think it makes more sense to use a map to keep track of workspaces, like how it works now.
But the way it works now does not use a computation at all: it's just +1 and -1? Your code didn't really work for me. My monitors had these mappings which look very strange:
I would expect these to be [1-5], [6-10], [11-15]. Then you don't need to tell other programs to use the same formula: it makes sense by just looking at the numbers. |
I don't have any of those.
Well, we disagree. Obviously I don't want to enforce my fork, you guys do what you want. Personally I don't see how keeping a map is any logical and necessary. Given the monitor you're on and the workspace you want to go to, the actual workspace is given by a simple function
What do you mean it didn't work? Does it not switch the workspaces correctly? The mapping are correct. Your monitors clearly have IDs (0, 2, 1) (like mine). My method does not work with separating the workspaces into "[1-5], [6-10], [11-15]", it's a completely different approach. Say you have 3 monitors (well, we both do). IMO, this approach is easier. It does not require extra memory allocation and you can go as far as you want. You're not bound to allocate the workspaces 1-10 for the first monitors, you can go as much as you want since the workspaces are distribuited evenly as the number goes up. Again, I don't want to enforce anything on anybody. I just think this is a better and more flexible approach. Please let me know if the workspaces were all a mess or they did actually work, even though you thought the mappings were strange.
Well in the end you still have to tell it something. I think it's just easier with the formula. The main difference is that right now you also need to tell other programs the workspace count. With my approach you don't have to tell what the workspace count is (well, unless you need it for something else like displaying an icon for each monitor), it doesn't matter since you have the formula |
I see where you're coming from, but I feel like it makes more sense to me that each monitor has workspaces that follow each other up: with the current implementation, you know for a fact that the next workspace on your current monitor is
I think I misunderstood your formula, and it looked wrong to me when I tried it out, sorry. But I still feel it needlessly complicates things. For example: when you add another monitor, and the mappings are refreshed, the numbering has to be updated again, right? For 1-5, 6-10 and 11-15, this is easy to change: you just add 16-20. But for your approach, you now have to update every single monitor in the Waybar config (unless someone improves the persistent_workspace functionality), because the calculation is dependent on the number of monitors. I'd love to hear your thoughts. |
Ok so I want to start off by saying that both methods are valid.
Yes, and with my method the next is
I think this point is nonsense. Both my method and yours have a formula. Yours has the formula
Sorry but this is just obnoxious. As previously stated, other applications can compute your workspaces as
You are absolutely correct, it isn't much, but you don't really need it at all. There really is no good argument that I can find for
You make a great compelling point with this. Indeed, this is easier to handle with your method. You may have changed my mind a bit. The main reason why I believe or believed my approach was "cleaner", is because it works with the default 1,2,3 workspaces. Your method does not work with the default 1,2,3 and required to spawn the workspaces 1,11,21 (with As I said, I believe both approaches are completely valid. This was a productive discussion and if you want I can change my code to the 1-10,11-20,21-30 approach. But please consider ditching |
I should mention I have no affiliation with this repo, I'm simply an interested party like you ;) Apologies for not making this clear before. I think the main reason I preferred having a map saved in memory is to allow other applications to "ask" the plugin what the monitor state is, which would be useful for solving this issue I created in the Waybar repo: Alexays/Waybar#2243. But I realize now that even for that use-case, you don't need to hold it in memory at all and can just calculate it on the spot (in the application itself or in the plugin). I wonder what @Duckonaut thinks? |
Exactly! I think this is well-established now that we agree on it. It remains to decide which workspace numbering approach to use. I don't think it matters that much which one we use, but if we settle we can start implementing other features like |
There's an open issue for this, but I don't understand why. From my tests, the built-in |
It does not work perfectly. The built-in command goes to the next workspaces, yes. Since the plugin uses the Btw, is there a way to override the built-in command or is |
Not to my knowledge, I think with Hyprland's plugin implementation, you can only add dispatchers, not change them. |
Sorry for taking this long to respond, but I'm not really a fan of the change. I see how the different indexes could be useful to your workflow, but it just fundamentally changes the idea of the plugin (and breaks my personal scripts for eww 🕴️). I haven't personally tested this with 3 monitors, but if issues like jumping to different monitors than expected happen consistently, I'm sure that can be solved in another way. Memory for a map of 20-30 elements is a non-issue, I don't see a reason to remove the map. I'll keep this open for discussion but for now no plan to adopt it. |
I keep my fork updated with my own implementation, if you want to have a look: https://github.com/zjeffer/split-monitor-workspaces I understand if you don't want the same behaviour, though. But I like the automated aspect of it :) |
interesting fork, it seems pretty far away from what's currently here, but yeah i can see it. Maybe I'll get around to doing something similar when i decide to refactor the whole thing. But for now indexing and map probably stay where they are |
The nice thing is I adapted Waybar to use the same formula as the plugin, so the workspaces that are bound automatically by the plugin will match the ones in waybar perfectly, even when disconnecting/reconnecting monitors, or connecting new monitors. I can just use the following Waybar config for persistent_workspaces: "persistent_workspaces": {
"*": 5 // put 5 workspaces on each monitor, with same formula as the plugin
} |
@zjeffer do you mind sharing how you did that ? I'd love to do something similar. The only solution I found right now is having duplicated waybar config changing the EDIT: Oh so you forked it, awesome |
I have the exact same problem, and this seems to be an issue for no one else while it has been driving me crazy since I started using Hyprland over a year ago. Glad to hear I'm not the only one frustrated with this.
Keep in mind my changes to waybar have already been merged into master, you don't have to use my fork for that. I also recently added support for Hyprland's workspace rules, so if you want to define your persistent workspaces in your Hyprland config instead of the waybar config, that's also possible (make sure you don't mix them, though!). What makes it work the way I want to is my fork of this repo, which automatically writes those Hyprland persistent workspaces into my Hyprland config. It also has some other improvements, like ensuring the workspaces are always mapped the same way they are on Waybar, it has more logging, it listens to the configReloaded event so that whenever the config changes, the workspaces are kept up to date, etc... |
Thing is I don't want them to be in my hyprland config. Its config is managed with I can't really afford to dynamically update the config, except if I decide to re-run |
When I tried you |
See this PR for a fix for that: Alexays/Waybar#2946 |
Thank you ! Indeed it seems I can't read tonight. You're right, persistent workspace is a thing now in waybar, |
Hello. So I installed the plugin and it did not just work. Going to a workspace would just go to another monitor and create a mess. I think this is because i have monitors with IDs (from left to right) 0, 2, 1 rather than 0, 1, 2. (I don't know why that is, but this plugin should work nonetheless).
Furthermore, the plugin uses
g_vMonitorWorkspaceMap
to keep track of workspaces, which could totally be avoided.My solution is to compute the workspace as such: if you are on monitor ID=N and want to go to workspace W, the actual workspace is given by
(W - 1) * monitors + N + 1
. This means that1
,2
and3
are the first workspace of each monitor,4
,5
and6
are the second workspace of each monitor and so on.At initialization, or when a monitor is added/removed, the formula for the workspace is reversed and every workspace is moved to its correct monitor.
This solution is more simple and the workspace computation can be implemented elsewhere.
@zjeffer I think some of your problems may be solved by using this approach.
Please test the code as I only tested it with my weird monitor IDs, but it should work regardless of the ID order.
I also think it will be easier to implement features such as
previous
andm+1
(those things) since everything is just a simple computation. Tell me what you think :)