-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use yabai signals for events #13
Conversation
@alin23 !! These changes are AWESOME! Thank you! I just read through all the changes, and they look very very good. I'm going to merge this so anyone who's trying this out has a less bad experience :-) Some more specific thoughts:
Ha! My v0 prototype used signals + hs.ipc. The performance wasn't great, and I also had issues with excessive re-stacking causing flicker. I think this was due to tons of yabai signals being fired and not debounced. The move to Hammerspoon's window filter was an attempt to fix these issues, which caused other issues. The way you've weaved yabai signals back into the mix to patch up those issues is pretty neat. It doesn't seem many people know about the Hammerspoon ipc tool, so nice find!
Oops! Just a minute while I change all of my hashbangs… haha.
Yea. Not only is it unnecessary to symlink (from ~/Downloads?!), I just plain messed up the instructions in the readme. Big improvement.
This is the only one that confuses me. 🤨️ I'll followup with a gif of running
This is just great! I wanted to create an issue for reading from a settings file yesterday, but forgot. You implemented it before I could do it tonight! The icons look really really excellent. I'll test this real quick and then merge. Thanks again! PS:
Tis true. I have a lot of local changes that I haven't pushed yet, but it's looking promising. MUCH better performance when switching the focused window within a stack. Also, tracking the state of hammerspoon window objects instead of ingesting json and building our own window objects cleans up a lot of stuff. Also, I discovered The major problem I ran into is that the premise of #8 isn't true: There's a key bit of info that only (as far as I can tell) exists in yabai: stack index. Hammerspoon window filters order windows by last focused by default, which causes the indicators to appear as if they aren't changing when they're actually changing and reordering (I wasted a lot of time trying to solve the wrong problem there). That said, I actually think most of your changes here will survive (settings, icon beautification, and even some of the yabai signals). |
Okay! Everything should be merged in. I added your yabai signals, toggle_icons command, and improved icons screenshot to the readme (I hope it's okay that I used the image). Can you confirm that the flicker seen in the gif below is also present on your system? Just want to make sure it's not caused by something weird in my setup. |
@AdamWagner the Eval is not that wild, a lot of other init scripts use it (ssh-agent, pyenv, gpg-agent etc.) and About the flicker, it is caused by the But of course, this means that closing a window leaves the stackline with a window that does not exist anymore. |
Thanks for merging this! I did not expect that, seeing how much work you've put into using Hammespoon's window events. |
Shame on me for not RTFM ;-) . I think what tripped me up is that |
* format: auto-formatted per luaformat config. Functions folded with 'set fdm=marker' in vim * WIP: Working toward addressing #8 in stackline/query.lua, which replaces bin/yabai-get-stacks. The goal of this file is to eliminate the need to 'shell out' to yabai to query window data needed to render stackline, which would address #8. The main problem with relying on yabai is that a 0.03s sleep is required in the yabai script to ensure that the changes that triggered hammerspoon's window event subscriber are, in fact, represented in the query response from yabai. There are probably secondary downsides, such as overall performance, and specifically *yabai* performance (I've noticed that changing focus is slower when lots of yabai queries are happening simultaneously). ┌────────┐ │ Status │ └────────┘ We're not yet using any of the code in this file to actually render the indiators or query ata — all of that is still achieved via the "old" methods. However, this file IS being required by ./core.lua and runs one every window focus event, and the resulting "stack" data is printed to the hammerspoon console. The stack data structure differs from that used in ./stack.lua enough that it won't work as a drop-in replacement. I think that's fine (and it wouldn't be worth attempting to make this a non-breaking change, esp. since zero people rely on it as of 2020-08-02. ┌──────┐ │ Next │ └──────┘ - [ ] Integrate appropriate functionality in this file into the Stack module - [ ] Update key Stack module functions to have basic compatiblity with the new data structure - [ ] Simplify / refine Stack functions to leverage the benefits of having access to the hs.window module for each tracked window - [ ] Integrate appropriate functionality in this file into the Core module - [ ] … see if there's anything left and decide where it should live ┌───────────┐ │ WIP NOTES │ └───────────┘ Much of the functionality in this file should either be integrated into stack.lua or core.lua — I don't think a new file is needed. Rather than calling out to the script ../bin/yabai-get-stacks, we're using hammerspoon's mature (if complicated) hs.window.filter and hs.window modules to achieve the same goal natively within hammerspon. There might be other benefits in addition to fixing the problems that inspired tracked by stackline, which will probably make it easier to implement enhancements that we haven't even considered yet. This approach should also be easier to maintain, *and* we get to drop the jq dependency! * WIP: basic working state with lots of cruft to clean up and edge cases to fix * Bring over some changes from #13 * Bring over indicator styling improvements from #13 * Move self.colorOpts into Window:drawIndicator() so that the latter can be called in place of Window:process() to redraw a window. * A small bit of much-needed cleanup * Basic functionality working well. Parameterized display options. Indicators display on left/right edge of window based on which side of the screen the window resides. Known bug: changes broke multiple stacks on the same space. * Fixed issue where only 1 of N stacks responded to focus events. Moved all stack-is-occluded functionality from Query to StackMgr and Stack modules. * Workaround hammerspoon bug (Hammerspoon/hammerspoon#2400) to ensure indicators update when switching between windows of the same app. * Fold Window:getScreenSide() * Modifying existing indicators on focus change is MUCH faster than destroying them & rendering from scratch. * Cleanup (one of the) utils.lua files * Add a status update to readme describing recent changes * Included a bunch of cleanup/reorg changes missed in last commit * Fix path to dash shell (again) * Add hs._asm.undocumented.spaces dependency * Remove unused StackConfig:handleSignal() method (it needs to be available outside of class) * Cleanup comments & delete unused bluclass.lua * Don't use hs._asm.undocumented.spaces. Uncomment window.filter.notInCurrentSpace which depends on it.' * Fill gap left behind by hs._asm.undocumented.spaces with hs.spaces.watcher * Increase threshold in window:getSide() to fix issue w/ large yabai padding values * Cleanup comments in query.lua * Removed hs._asm.undocumented.spaces from list of dependencies * Delete unused utils, consolidate utils into single file. * Track stack focus state, indicate last-focused window in unfocused stack, and centralize indicator config settings & retrieval. * Fix misleading comment * Remove garbage characters in comment * Fix error stackline/window.lua:95: attempt to perform arithmetic on a nil value (field 'stackIdx') by checking for stackIdx > 0 * Remove completed TODO comments, try to keep TODO comments on single line to work well with leasot / rg * Enable keybindings in init.lua by returning stackConfig & stackManager instances from main stackline.lua Remove keybinding from config.lua & move to readme. * Fix #21 - Limit stack left/right edge to screen boundary so it doesn't go off screen * Update version to 0.1.50
Hi Adam!
I see you are already working on another branch to use
hs.window.filter
everywhere, so this PR will mostly serve as a reference if you have already made up your mind about that.This PR does the following:
hs.ipc
for checking for changes at the right time/bin/dash
instead of the brew installed/usr/local/bin/dash
. The default/bin/dash
starts almost twice as fast as you can see in the below screenshot:stackline
by directly cloning it into the~/hammerspoon
directoryrequire "stackline.stackline.core"
expects the whole repo, not separate symlinkspath_helper
which outputs executablesh
code, not aPATH
valueshowIcons
configurable throughhs.settings
echo ":toggle_icons:1" | hs -m stackline-config
This is how icons look right now (pills look the same so no need for a screenshot):
This is what one would need to add in their
.yabairc
for the signals:fixes #12 #9