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

[FEAT]: Monitor specific workspace config #803

Closed
CtByte opened this issue May 3, 2024 · 1 comment
Closed

[FEAT]: Monitor specific workspace config #803

CtByte opened this issue May 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@CtByte
Copy link
Contributor

CtByte commented May 3, 2024

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>
          }
        }
@CtByte
Copy link
Contributor Author

CtByte commented May 17, 2024

#828 (comment)

@CtByte CtByte closed this as completed May 17, 2024
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

1 participant