Focus space without disabling SIP #803
-
Hi, I noticed that with SIP enabled it seems like it is not possible to move a window to another space. Amethyst seems to be able to do that, so I did some digging and looks like they use Would it be possible to implement the feature to move windows to a different space in yabai using this API so that SIP can remain enabled? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 10 replies
-
I think "moving a window to another space or display" does not require SIP disabled. It is not listed on the wiki page https://github.com/koekeishiya/yabai/wiki/Disabling-System-Integrity-Protection and #13 (comment). I uninstalled scriping-addition just now by |
Beta Was this translation helpful? Give feedback.
-
You are completely correct. I got confused between the move window to space
and the focus space commands. It is focusing a space that does not work
without SIP disabled.
Sorry for the confusion. I guess it is safe to ignore me here then.
Any idea how Mission Control might be doing that? I would assume there
might be some private API for it that could be used?
…On Fri, Jan 15, 2021, 11:25 PM R0ckyY2 ***@***.***> wrote:
I think "moving windows to another space or display" does not require SIP
disabled. It is not listed on the wiki page
https://github.com/koekeishiya/yabai/wiki/Disabling-System-Integrity-Protection
and #13 (comment)
<#13 (comment)>.
I uninstalled scriping-addition just now by sudo yabai --uninstall-sa,
killall Dock. Then I tested "moving a window in space 1 to space 2viayabai
-m window space 2`, and it works well.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#795 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF5IA2OT6CYVNNI4PKJ5D3S2EINPANCNFSM4WE6BAPQ>
.
|
Beta Was this translation helpful? Give feedback.
-
I don't know the underlying techniques that Mission Control uses to do that. But I have another way to switch workspace with SIP disabled by means of the macOS Keyboard shortcuts. Firstly, I set the shortcuts in "System Preferences -> Keyboard -> shortcuts -> Mission Control" for workspace switching. For example Then I create a shell script. I can pass in an argument as the target workspace id, and this script will help us switch to that workspace. The shell script is here (https://github.com/yanzhang0219/dotfiles/blob/master/.config/yabai/scripts/focus-space-SIP.sh) Finally, in |
Beta Was this translation helpful? Give feedback.
-
Yeah, that is what I have been doing. Only problem I have with that is that
there doesnt seem to be a reliable way of exporting those keyboard
shortcuts from MacOS, so whenever I setup a new machine I have to recreate
those shortcuts manually.
I will google around some more and see if I can find any pointers.
…On Fri, Jan 15, 2021, 11:57 PM R0ckyY2 ***@***.***> wrote:
I don't know the underlying techniques that Mission Control uses to do
that. But I have another way to switch workspace with SIP disabled by means
of the macOS Keyboard shortcuts.
I set the shortcuts in "System Preferences -> Keyboard -> shortcuts ->
Mission Control" for workspace switching. For example ^1, ^2, ..., ^N for
switching to workspace 1, 2, ..., N.
Then I create a shell script. I can pass in an argument as the target
workspace id, and this script will help us switch to that workspace. The
shell script is here (
https://github.com/yanzhang0219/dotfiles/blob/master/.config/yabai/scripts/focus-space-SIP.sh
)
Next, in skhdrc, we just need to create some keybindings for switching
workspaces using this script. For example, alt - 3 :
~/.config/yabai/scripts/focus-space-SIP.sh 3 for switch to workspace 3.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#795 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAF5IA47WV7TX7NZSBAPYH3S2EMDTANCNFSM4WE6BAPQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Exactly. However, at least for me, this is not the most troublesome. What bothers me the most is that there are no shortcuts in macOS to create and destroy workspaces. For workspace creation, what I can come up with is using a piece of AppleScript to simulate the mouse operation, i.e., open Mission Control, click the |
Beta Was this translation helpful? Give feedback.
-
Not to jump on the thread here, but creating a completely separate repository that describes how one can successfully mimic the same behavior as yabai without disabling SIP would be extremely useful. Im sure many others would not only find this useful but also happily try and resolve some issues if you were to collect all of this in one place. |
Beta Was this translation helpful? Give feedback.
-
@hpl002 Thank you for your advice. I am a heavy user of yabai, and that's what I am thinking. In the Discussions, we have a section called "Ideas" and I think that's a great place to gather tips/skills. I learned a lot during my using and configuring yabai. I am really desired to share them. I will create a brand new thread there later to share what I've learned and come up with. |
Beta Was this translation helpful? Give feedback.
-
Awesome! Thank you for your willingness. Looking forward to having a look 🎉 |
Beta Was this translation helpful? Give feedback.
-
Moved to disussions and renamed. In short, the only way to properly focus a space without the scripting-addition is to use the shortcuts provided through mission-control. The operation of switching spaces is a combination of some lower-level functions that are a part of the SkyLight.framework and some state that is stored internally inside the Dock.app process. In fact, the entire workspaces (and mission-control) functionality of macOS is implemented inside Dock.app. |
Beta Was this translation helpful? Give feedback.
-
There is another options besides Mission Control. I use Total Spaces for that, it brings the benefit that you can combine display to desktops. |
Beta Was this translation helpful? Give feedback.
-
this isn't as elegant as the solution posted by @yanzhang0219 but this seems to work for me:
I got asked to allow skhd usability access and then it worked, althoug not always completely reliable. btw: what I fount out was that you must not keep the modifier keys pressed longer than abolutely necessary – otherwise the osescript will see those as well and won't work. |
Beta Was this translation helpful? Give feedback.
Moved to disussions and renamed.
In short, the only way to properly focus a space without the scripting-addition is to use the shortcuts provided through mission-control. The operation of switching spaces is a combination of some lower-level functions that are a part of the SkyLight.framework and some state that is stored internally inside the Dock.app process. In fact, the entire workspaces (and mission-control) functionality of macOS is implemented inside Dock.app.