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

Ability to name spaces #119

Closed
koekeishiya opened this issue Jul 12, 2019 · 8 comments
Closed

Ability to name spaces #119

koekeishiya opened this issue Jul 12, 2019 · 8 comments
Labels
enhancement New feature or request

Comments

@koekeishiya
Copy link
Owner

koekeishiya commented Jul 12, 2019

This was briefly discussed in chunkwm, and lately mentioned in #116

After looking into this previously it appears that the display name visible in mission-control is simply an enumeration of available user-spaces - thus a space is not assigned a name that we can alter, you'd have to intercept and change the code that draws the mission-control overlay.
This is not something I'll bother looking into, however..

As the query system in yabai outputs a lot of useful info (more to come as of writing this) it would be possible to add a command yabai -m space <space_sel> --name or --alias or something, that would map the space with the given mission-control index to some name.
The mission-control index would only be used from the users side of things - the actual mapping would store the internal space id such that the name would persist through movement. names would then become a valid option for SPACE_SEL.

This sort of a system could then be used together with a query command inside the config file to map a range of spaces during startup.

I imagine this would be something like:

# config stuff..
# ...
# ...
#
# 1. get all spaces
# 2. filter away native-fullscreen spaces (or maybe name them as well, if you want)
# 3. map range of spaces based on their current mission-control index to a range of names
@koekeishiya koekeishiya added discussion Discussion suggestion Request for new feature or some form of enhancement labels Jul 12, 2019
@dominiklohmann
Copy link
Collaborator

dominiklohmann commented Jul 12, 2019

More generally speaking, do you think it makes sense to allow unique names as selectors for windows, spaces and displays and either disallow existing selectors as names or require names to have a certain prefix?

@koekeishiya
Copy link
Owner Author

I'm not sure yet what the best option is - but I'd be fine with having selectors as reserved words, and everything else the user can use as their own names.

@dominiklohmann
Copy link
Collaborator

I've had some thoughts on designs for this, and I think labels fit yabai best. They are easy to implement and offer versatility when used in combination with jq or shell scripts.

  • Any entity (window/space/display) should be able to get a per-domain unique label assigned to it
  • The default label should just be an empty string
  • A label may be anything that does not begin with a digit and is not a valid selector for the entities domain
  • Labels should be unique within each domain, and assigning an existing label to another entity of the same domain should remove the label from its previous entity

@dominiklohmann
Copy link
Collaborator

I was looking around SkyLight.framework and noticed the procedures SLSSpaceGetName and SLSSpaceSetName (and also SLSSpaceCreate and SLSSpaceDestroy). Did you try these already, @koekeishiya?

@koekeishiya
Copy link
Owner Author

The name in these functions simply refer to the internal uuid of said space. SLSSpaceCreate/Destroy are functionally equivalent to CGS versions as far as I have been able to tell.

@koekeishiya koekeishiya added enhancement New feature or request and removed discussion Discussion suggestion Request for new feature or some form of enhancement labels Oct 16, 2019
koekeishiya added a commit that referenced this issue Oct 16, 2019
…sed as an alias in commands that take a SPACE_SEL parameter
@koekeishiya
Copy link
Owner Author

koekeishiya commented Oct 16, 2019

Did my first initial take on this, allowing the user to label a space, and refer to that label in every command that takes a SPACE_SEL. Labels are not currently returned in space queries, but it will eventually.

This can later be expanded to work on windows and displays.

yabai -m space 1 --label main
yabai -m space 2 --label sm

yabai -m space --focus main

@koekeishiya koekeishiya added the addressed on master; not released Fixed upstream, but not yet released label Oct 16, 2019
koekeishiya added a commit that referenced this issue Oct 16, 2019
@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Nov 9, 2019
@chunkhang
Copy link

Is there a way to remove the label after assigning it to a space?

@dominiklohmann
Copy link
Collaborator

Not currently. I've created a new issue.

evantayloryates pushed a commit to evantayloryates/yabai-wiki-fork that referenced this issue Oct 9, 2023
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