Yabai: Ability to name spaces

Created on 12 Jul 2019  路  8Comments  路  Source: koekeishiya/yabai

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
enhancement

All 8 comments

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?

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.

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

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

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.

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

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

Not currently. I've created a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brorbw picture brorbw  路  4Comments

koekeishiya picture koekeishiya  路  4Comments

koekeishiya picture koekeishiya  路  4Comments

fuckbitchesgitmoney picture fuckbitchesgitmoney  路  4Comments

stylerw picture stylerw  路  4Comments