[FEAT]: Monitor specific workspace config
Is your feature request related to a problem? Please describe. When having multiple monitors, the workspace configuration is applied randomly.
The ABC workspaces are used on monitor1 and the 123 workspaces are used on monitor2, but sometimes it is swapped. It can simply be replicated by using different layouts (or Zebar, using the config in appendix).
I am using a laptop with 2 monitors (laptop closed and screen unused). Which can be the reason for the randomness or it is simply due to connection race issue to the monitors.
"monitors": [
{
"workspaces": [
{ "name": "A", "layout": "UltrawideVerticalStack" },
{ "name": "B", "layout": "UltrawideVerticalStack" },
{ "name": "C", "layout": "BSP" }
]
},
{
"workspaces": [
{ "name": "1", "layout": "BSP" },
{ "name": "2", "layout": "UltrawideVerticalStack" },
{ "name": "3", "layout": "Rows" }
]
}
]
Describe the solution you'd like
Have the option to specify the monitor name (same as from komorebic state) in the configuration.
"monitors": [
{
"workspaces": [
{ "name": "A", "layout": "UltrawideVerticalStack" },
{ "name": "B", "layout": "UltrawideVerticalStack" },
{ "name": "C", "layout": "BSP" }
]
},
{
"name": "MONITOR2",
"workspaces": [
{ "name": "1", "layout": "BSP" },
{ "name": "2", "layout": "UltrawideVerticalStack" },
{ "name": "3", "layout": "Rows" }
]
}
]
If the monitor cannot be found by that name, then ignore it and fallback to a default config.
The current default would suffice, but with at least a default name. Meaning { "name": "BSP", "layout": "BSP" }.
The current behaviour seems to be that in the case of a single config and 2 monitors, the second monitor will get a 1xBSP config. It can be up to debate, that the default behaviour in this case should rather be a copy of the first unnamed config.
Meaning, a config like this on 2 monitors:
"monitors": [
{
"workspaces": [
{ "name": "A", "layout": "UltrawideVerticalStack" },
{ "name": "B", "layout": "UltrawideVerticalStack" },
{ "name": "C", "layout": "BSP" }
]
}
]
Would be more like this:
"monitors": [
{
"workspaces": [
{ "name": "A", "layout": "UltrawideVerticalStack" },
{ "name": "B", "layout": "UltrawideVerticalStack" },
{ "name": "C", "layout": "BSP" }
]
},
{
"workspaces": [
{ "name": "A", "layout": "UltrawideVerticalStack" },
{ "name": "B", "layout": "UltrawideVerticalStack" },
{ "name": "C", "layout": "BSP" }
]
}
]
Current default fallback seems to be:
"monitors": [
{
"workspaces": [
{ "name": "A", "layout": "UltrawideVerticalStack" },
{ "name": "B", "layout": "UltrawideVerticalStack" },
{ "name": "C", "layout": "BSP" }
]
},
{
"workspaces": [
{ "name": "", "layout": "BSP" }
]
}
]
Appendix Zebar config for multiple monitors.
template/komorebi:
styles: |
.workspace {
display: inline-block;
margin: 0px !important;
padding: 4px 20px 2px 20px;
&.active {
border: 1px solid white;
}
}
providers: ['komorebi','self']
template: |
@for (monitor of komorebi.allMonitors) {
@if (self.args.MONITOR_NAME.endsWith(monitor.name)) {
<div title="Self: {{self.args.MONITOR_NAME}} | {{monitor.name}}({{monitor.focusedWorkspaceIndex}})">
@for (workspace of monitor.workspaces) {
<div title="{{workspace.layout}}" class="workspace {{monitor.workspaces.indexOf(workspace) === monitor.focusedWorkspaceIndex && 'active'}}">
{{workspace.name}}
</div>
}
</div>
}
}