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

Return of window borders #565

Closed
koekeishiya opened this issue Jun 10, 2020 · 29 comments
Closed

Return of window borders #565

koekeishiya opened this issue Jun 10, 2020 · 29 comments
Labels
enhancement New feature or request

Comments

@koekeishiya
Copy link
Owner

koekeishiya commented Jun 10, 2020

So I have recently due to a discussion in a different OSS application been able to come across some information that I believe will be able to solve all the issues with window borders that I talked about in #487

My basic testing so far has made me quite optimistic that this is now achievable.

This will require the scripting-addition to be installed, but this is once more a feature I think is worth that trade-off. Apologize in advance to people who cannot run with SIP disabled for whatever reason, you can still use limelight instead (a much lower quality version).

@koekeishiya koekeishiya added the enhancement New feature or request label Jun 10, 2020
@koekeishiya
Copy link
Owner Author

koekeishiya commented Jun 10, 2020

Implemented a more efficient border system on the master branch. Window borders will now require SIP to be disabled and the scripting-addition to be installed. If you install from the master branch or whenever this is put into a new release, you will have to update/reinstall the scripting-addition for this feature to work.

Some information regarding this new border system:

There is no longer any need for yabai to track when a window border should be hidden, shown, moved to a different space etc, so this solution is very efficient in comparison to the old system.

The border window will always remain above the window it belongs to, and only that window, avoiding the previous issue where the border would also draw above tooltips, notifications, menus and whatever else. This also improves the usage of window borders combined with ffm autofocus.

When a window is moved, the border is moved together with the window, seamlessly.
Borders also appear properly while in mission-control/expose (and it does add some pretty good visuals).

There is still some slight delay during expensive window resize operations, or when a lot of windows get resized at the same time. This is sadly unavoidable no matter what, but I think it is at an acceptable level.

Borders are not drawn in native-fullscreen spaces, with the exception of Safari fullscreen videos because they work differently somehow.

The border system does not support border radius and placement like the old system did, and it probably never will; guess we'll see. Also borders are either on or off and cannot be toggled for specific windows or through rules at this time; this may change before a release is done.

commands (as before):

yabai -m config window_border on | off
yabai -m config window_border_width 6
yabai -m config active_window_border_color 0xff775759
yabai -m config normal_window_border_color 0xff555555

yabai -m window --toggle border
yabai -m rule --add app=Terminal border=off

@malfario
Copy link

Testing this right now, looking really good!

@rockyzhang24
Copy link

What should I say? No words can truly express how excited I am!!
Thank you very much!

@tuananh
Copy link

tuananh commented Jun 10, 2020

This is awesome! Thanks

@itgoyo
Copy link

itgoyo commented Jun 11, 2020

awesome work! Thanks

@burlapsax
Copy link

This is terrific @koekeishiya, but I am wondering: is there a way to prevent the borders being drawn when a window goes into native fullscreen mode? that feels pretty distracting IMHO, especially in cases like maximizing a video.

@glepnir
Copy link

glepnir commented Jun 11, 2020

Oh, welcome to back border!

@koekeishiya
Copy link
Owner Author

koekeishiya commented Jun 11, 2020

Borders are no longer drawn in native-fullscreen spaces (with the exception of Safari videos, because they apparently work differently). Also improved efficiency of resizing operations.

Edit: Don't forget to reinstall the scripting addition (again), for these changes.

koekeishiya added a commit that referenced this issue Jun 11, 2020
@malfario
Copy link

Awesome, thank you so much!

malfario added a commit to malfario/dotfiles that referenced this issue Jun 11, 2020
@burlapsax
Copy link

Borders are no longer drawn in native-fullscreen spaces (with the exception of Safari videos, because they apparently work differently). Also improved efficiency of resizing operations.

Edit: Don't forget to reinstall the scripting addition (again), for these changes.

@koekeishiya truly outstanding! thank you 🙌

koekeishiya added a commit that referenced this issue Jun 11, 2020
@rross101
Copy link

Borders looking great here.

@cmacrae
Copy link

cmacrae commented Jun 12, 2020

This is great news!

For anyone using the Nix package/module who wants to test this out, you can use an overlay with overrideAttrs to follow master. Just be sure to sudo yabai --install-sa manually after for this to work:

{
  yabai = super.yabai.overrideAttrs (o: {
    version = "master";
    src = super.fetchFromGitHub {
      owner = "koekeishiya";
      repo = "yabai";
      rev = "17fcfb73d8bc013b0250a9be42adb91c1a7cb72e";
      sha256 = "065qdf5q955jr2cic47w0nxmp8n13dvjpmi6b779kggr38b1l7wz";
    };
  });
}

So far so good, the performance is much better! Thanks very much for your endeavours @koekeishiya 💜

@koekeishiya
Copy link
Owner Author

koekeishiya commented Jun 13, 2020

Borders can now be toggled per window and specified to be enabled/disabled through rules regardless of the window_border setting. This should make it easier for people who may only want borders for some specific windows. There is also a border attribute in the result of window queries indicating whether or not the window currently has a border.

@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Jun 13, 2020
@rockyzhang24
Copy link

rockyzhang24 commented Jun 17, 2020

Hi @koekeishiya,
Is it possible to toggle border for a space like yabai -m space --toggle border? Thank you very much.

@dominiklohmann
Copy link
Collaborator

Is it possible to toggle border for a space like yabai -m space --toggle border? Thank you very much.

yabai -m query --windows --space |
  jq '.[].id' |
  xargs -I{} yabai -m window {} --toggle border

@rockyzhang24
Copy link

rockyzhang24 commented Jun 17, 2020

Hi @dominiklohmann, Thank you.

What my requirement is that when I change a space layout to float, all windows in this space will not have border. "All windows" here I mean:

  1. all existing windows in this space
  2. all newly-created windows in this space
  3. all windows sent to this space in the future.

"1" could be achieved by using your script. For "2", what I am thinking is to use yabai signals with an event window_created. The action part is to first check whether the type of the space is float or not (via yabai -m query --spaces --space | jq .type), and if it is float, I will toggle its border via yabai -m window --toggle border. Am I correct? For "3", I don't have a good idea. Can I also use yabai signal with an event window_moved? I don't find an event related to "move window to another workspace".

However, this way looks burdensome. I'm wondering whether yabai could add the value border to --toggle of space like yabai -m space --toggle border so that after setting this, "1", "2", and "3" above will be implemented. @koekeishiya

I think this feature is very useful. the scenario to apply this feature is that sometimes we want to make a workspace temporarily perform as vanilla macOS (i.e., no tiling, no border).
So if we want to work temporarily without yabai in a certain space, we just need to run yabai -m space --layout float && yabai -m space --toggle border, and that's it.

Thank you.

@dominiklohmann
Copy link
Collaborator

You surely could implement that using the signals API, but it's far from a trivial task.

Have you considered turning window borders on/off globally depending on what space you're in, i.e., toggling them globally based on the signal event=space_changed?

@rockyzhang24
Copy link

rockyzhang24 commented Jun 17, 2020

Thank you. But you get me wrong (I updated my comment above). Briefly, my scenario is like this:

I am working in space no. 3 and suddenly I want to change this space to perform as plain macOS, i.e., floating and no border (because for some work, tiling window and border are not that convenient). And later, I may change it back. To implement this, I just need to bind a key to yabai -m space --layout float && yabai -m space --toggle border, and that's it. I don't change space here and I stay in space 3 all the way.

So I think add a value border to --togge for space is a very nice feature. Lol. What's your opinion @dominiklohmann ?

Thanks.

@rockyzhang24
Copy link

rockyzhang24 commented Jun 17, 2020

My implementation so far is:

Step1. In skhdrc

alt + ctrl - f : yabai -m space --layout float && \
                 yabai -m config window_border off
alt + ctrl - b : yabai -m space --layout bsp && \
                 yabai -m config window_border on

When I change the space layout to float, I turn off the global border. And when I change the space layout back to bsp, I turn on the global border.

Step2. In yabairc

yabai -m signal --add event=space_changed action="type=\$(yabai -m query --spaces --space | jq .type) && [ \$type = '\"bsp\"' ] && yabai -m config window_border on"
yabai -m signal --add event=space_changed action="type=\$(yabai -m query --spaces --space | jq .type) && [ \$type = '\"float\"' ] && yabai -m config window_border off"

When switch space, if the target space is bsp, turn on the global border, and if the target space is float, turn off the global border.

My implementation above basically meets my requirement, but it has a drawback. That is when I switch to a float space, I can see the border momently before it is off.

@tuananh
Copy link

tuananh commented Jun 18, 2020

UPDATE: my bad, it seesm to be related to SIP. disable it and this seems to work fine.

border doesn't seem to work consistently for me.

for new windows, it's ok. click somewhere else and the border becomes like this

image

when it supposes to look like this

image

@jzelner
Copy link

jzelner commented Jun 18, 2020

Having the exact same issue.

@tuananh
Copy link

tuananh commented Jun 18, 2020

Having the exact same issue.

you need to disable SIP and install sa. i updated my comment above.

@jzelner
Copy link

jzelner commented Jun 18, 2020 via email

@Aleppi
Copy link

Aleppi commented Jun 18, 2020

Is it only for me that the borders don't disappear in native fullscreen, and that the borders cover parts of the app? For example the left most letter in Alacritty is partially underneath the border. I have SIP disabled and the scripting addon installed.

@cmacrae
Copy link

cmacrae commented Jun 19, 2020

@Aleppi I have observed the border being drawn on native fullscreen applications, but only after starting/restarting yabai when the window is already in that state.

Regarding Alacritty, I think that's just the nature of where Alacritty is drawing its characters. You can address this by setting window.padding.y (there's also window.padding.x). I have both mine set to 15, and my windows look like this:
image

@Aleppi
Copy link

Aleppi commented Jun 19, 2020

@cmacrae For me it draws a border over fullscreen apps regardless if they were fullscreen before or after restarting yabai, but on my laptop it doesn't happen. It is not only alacritty where the overlap happens, it happens in all apps, for example the leftmost part of Discord where one sees if there are any notifications for a server is partially covered by the bar.

orther added a commit to orther/nix-config that referenced this issue Jun 22, 2020
Use overlay to install master branch yabai w/ window borders:
  koekeishiya/yabai#565 (comment)
@sluukkonen
Copy link

Hey, I'd just like to give a big thank you for re-introducing window borders. My productivity took a big hit when they disappeared and I am delighted to see them return. Thank you so much for your hard work!

@Liquidmantis
Copy link

I've just started using Yabai today, and have been working on getting my config built out. I've disabled SIP, installed the scripting additions, killed Dock, but still have an issue with the borders getting stuck. If I maximize a window to native-fullscreen a seemingly random normal (not active) border from another window is stuck. The only way I've been able to make it go away is to toggle borders.

@refracts
Copy link

Could we have the border system separate from yabai, kind of like limelight? i would love window borders but i choose no to use yabai due to some limitations.

unrevre pushed a commit to unrevre/yabai that referenced this issue Jan 26, 2022
unrevre pushed a commit to unrevre/yabai that referenced this issue Jan 26, 2022
unrevre pushed a commit to unrevre/yabai that referenced this issue Jan 26, 2022
unrevre pushed a commit to unrevre/yabai that referenced this issue Jan 26, 2022
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