You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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
> Visualize yabai window stacks on macOS. Works with yabai & hammerspoon.
10
10
11
-
## ⚠️ WARNING: THIS IS A PROOF-OF-CONCEPT
11
+
## ⚠️ ~~WARNING: THIS IS A PROOF-OF-CONCEPT~~ (it's more like an 'alpha' now!)
12
12
13
-
Currently, [stackline](https://github.com/AdamWagner/stackline) is a proof-of-concept for visualizing the total number and status of stacked windows. Feel free to try it out and open [issues](https://github.com/AdamWagner/stackline/issues) / PRs, but using stackline full-time is not recommended (yet).
13
+
My humble thanks to all who have been suffering through error-ridden setup instructions, spinning fans, flickering UI, and crashes. I'm happy to say that I _think_ this branch fixes enough of these issues that it _should_ be reasonable for actual use ;-)
14
14
15
-
There is much crucial fuctionality that is either missing or broken. For example, stack indicators do not refresh when:
15
+
As before, if you notice something that's off, or could be better, please open an issue (or a PR!).
16
16
17
-
1. the tree is rotated or mirrored
18
-
2. updating padding or gap values
19
-
3. a stacked window is warped out of the stack
20
-
4. app icons are toggled on/off
17
+
---
21
18
22
-
## What is stackline & why do I need it?
19
+
20
+
## What is stackline & why would I want to use it?
23
21
24
22
Consider a browser window with many tabs.
25
23
26
24
A tabbed user interface consists of a collection of windows that occupy the same screen space. Only _one_ tabbed window may be visible at any given time, and it's the user's job to specify the 'active' window.
27
25
28
-
To enable this task, tabbed interfaces provide visual indicators for each tab, each occupying much less space than the tab it references, which enables all indicators to be visible at all times. Each indicator _identifies the contents of a window_ & _communicates its position relative to the active window_.
29
-
30
-
A 'stack' provides a generalized subset of the functionality provided by tabbed user interfaces: it enables multiple to windows to occupy the same screen space, and provides mechanisms to navigate its member windows. It also provides mechanisms to add & remove windows from the stack.
26
+
Tabbed interfaces provide visual indicators for each tab. The indicators are relatively small, so they can be visible at all times. Each indicator _identifies the contents of a window_ & _communicates its position relative to the active window_.
31
27
32
-
Critically for stackline, a 'stack' does not provide the visual indicators necessary to identify how many windows belong to a stack or understand the relative position of the active window within the stack.
28
+
A 'stack' provides a generalized subset of a tabbed UI: it enables multiple to windows to occupy the same screen space, and provides mechanisms to navigate its member windows. It also provides mechanisms to add & remove windows from the stack.
33
29
34
30
Stacks are a recent addition (June 2020) to the (_excellent!_) macOS tiling window manager [koekeishiya/yabai,](https://github.com/koekeishiya/yabai,) and visualization UI is not yet in-the-box.
35
31
36
-
Enter stackline, which adds non-obtrusive visual indicators to yabai's stacking functionality.
32
+
Enter stackline, which adds non-obtrusive visual indicators to yabai'e 's stacking functionality.
37
33
38
34

39
35
40
-
41
36
## Getting started with stackline
42
37
43
38
**Prerequisites**
@@ -47,11 +42,9 @@ Enter stackline, which adds non-obtrusive visual indicators to yabai's stacking
You're free to bind yabai commands using your favorite key remapper tool
51
-
(skhd, karabiner elements, and even hammerspoon are all viable options).
45
+
You're free to bind yabai commands using your favorite key remapper tool (skhd, karabiner elements, and even hammerspoon are all viable options).
52
46
53
-
That said, you're _probably_ using https://github.com/koekeishiya/skhd. If so,
54
-
now is a good time to map keys for navigating and manipulating yabai stacks.
47
+
That said, you're _probably_ using https://github.com/koekeishiya/skhd. If so, now is a good time to map keys for navigating and manipulating yabai stacks.
55
48
56
49
```sh
57
50
# Focus window up/down in stack
@@ -70,7 +63,6 @@ cmd + ctrl - right : yabai -m window east --stack $(yabai -m query --windows --w
70
63
71
64
1. Clone the repo into ~/.hammerspoon/stackline
72
65
2. Install the hammerspoon cli tool
73
-
3. Add signals to ~/.yabairc
74
66
75
67
#### 1. Clone the repo into ~/.hammerspoon/stackline
The default stack indicator style is a "pill" as seen ↑
132
+
173
133
To toggle icons:
174
134
175
135
```sh
@@ -180,33 +140,59 @@ To toggle icons:
180
140
181
141
Image (and feature!) courtesy of [@alin23](https://github.com/alin23).
182
142
143
+
144
+
#### Keybindings
145
+
146
+
If you use `shkd`, you can bind a key combo to toggle icons `~/.skhdrc` file using the hammerspoon cli we installed earlier.
147
+
148
+
```sh
149
+
# if this doesn't work, try using the absolute path to the hammerspoon cli: /usr/local/bin/hs
150
+
shift + alt - b :echo":toggle_icons:1"| hs -m stackline-config
151
+
```
152
+
153
+
Alternatively, you can control stackline by accessing the instance directly via Hammerspoon.
154
+
155
+
For example, to bind a key combo to toggle icons, you could add the following to your `~/.hammerspoon/init.lua` file, _after_ requiring the stackline module & assigning a local variable `stackline`:
156
+
157
+
```lua
158
+
localstackline=require"stackline.stackline.stackline" -- you should already have this line ;-)
159
+
160
+
-- bind alt+ctrl+t to toggle stackline icons
161
+
hs.hotkey.bind({'alt', 'ctrl'}, 't', function()
162
+
stackline.manager:toggleIcons()
163
+
end)
164
+
```
165
+
183
166
## Help us get to v1.0.0!
184
167
185
-
Give a ⭐️ if you think (a fully functional version of) stackline would be useful!
168
+
Give a ⭐️ if you think (a more fully-featured version of) stackline would be useful!
186
169
187
170
188
171
## Thanks to contributors!
189
172
190
173
All are welcome (actually, _please_ help us, 🤣️)! Feel free to dive in by opening an [issue](https://github.com/AdamWagner/stackline/issues/new) or submitting a PR.
191
174
192
-
[@AdamWagner](https://github.com/AdamWagner) wrote the initial proof-of-concept (POC) for stackline.
193
175
194
-
[@alin23](https://github.com/alin23), initially proposed the [concept for stackline here](https://github.com/koekeishiya/yabai/issues/203#issuecomment-652948362) and encouraged [@AdamWagner](https://github.com/AdamWagner) to share this mostly-broken POC publicly.
176
+
[@alin23(https://github.com/alin23), initially proposed the [concept for stackline here](https://github.com/koekeishiya/yabai/issues/203#issuecomment-652948362) and encouraged [@AdamWagner](https://github.com/AdamWagner) to share the mostly-broken proof-of-concept publicly. Since then, [@alin23](https://github.com/alin23) dramatically improved upon the initial proof-of-concept with https://github.com/AdamWagner/stackline/pull/13, has some pretty whiz-bang functionality on deck with https://github.com/AdamWagner/stackline/pull/17, and has been a great thought partner/reviewer.
195
177
196
-
- After [@alin23](https://github.com/alin23)'s https://github.com/AdamWagner/stackline/pull/13, stackline sucks a lot less.
178
+
[@zweck](https://github.com/zweck), who, [in the same thread](https://github.com/koekeishiya/yabai/issues/203#issuecomment-656780281), got the gears turning about how [@alin23](gh-alin23)'s idea could be implemented and _also_ urged Adam to share his POC.
197
179
198
-
Thanks to [@johnallen3d](https://github.com/johnallen3d) for being one the first folks to install stackline, and for identifying several mistakes & gaps in the setup instructions.
180
+
[@johnallen3d](https://github.com/johnallen3d) for being one the first folks to install stackline, and for identifying several mistakes & gaps in the setup instructions.
199
181
200
-
[@zweck](https://github.com/zweck), who, [in the same thread](https://github.com/koekeishiya/yabai/issues/203#issuecomment-656780281), got the gears turning about how [@alin23](gh-alin23)'s idea could be implemented and _also_ urged Adam to share his POC.
182
+
[@AdamWagner](https://github.com/AdamWagner) wrote the initial proof-of-concept (POC) for stackline.
201
183
202
184
### …on the shoulders of giants
185
+
203
186
Thanks to [@koekeishiya](gh-koekeishiya) without whom the _wonderful_[yabai](https://github.com/koekeishiya/yabai) would not exist, and projects like this would have no reason to exist.
204
187
205
188
Similarly, thanks to [@dominiklohmann](https://github.com/dominiklohmann), who has helped _so many people_ make chunkwm/yabai "do the thing" they want and provides great feedback on new and proposed yabai features.
206
189
207
-
Finally, thanks to [@cmsj](https://github.com/cmsj), [@asmagill](https://github.com/asmagill), and all of the contributors to [hammerspoon](https://github.com/Hammerspoon/hammerspoon) for opening up macOS APIs to all of us!
190
+
Thanks to [@cmsj](https://github.com/cmsj), [@asmagill](https://github.com/asmagill), and all of the contributors to [hammerspoon](https://github.com/Hammerspoon/hammerspoon) for making macOS APIs accessible to the rest of us!
191
+
192
+
Thanks to the creators & maintainers of the lua utility libaries [underscore.lua](https://github.com/mirven/underscore.lua), [lume.lua](https://github.com/rxi/lume), and [self.lua](https://github.com/M1que4s/self).
208
193
209
194
## License & attribution
195
+
210
196
stackline is licensed under the [↗ MIT License](stackline-license), the same license used by [yabai](https://github.com/koekeishiya/yabai/blob/master/LICENSE.txt) and [hammerspoon](https://github.com/Hammerspoon/hammerspoon/blob/master/LICENSE).
211
197
212
198
MIT is a simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.
Seems similar to what I'm doing, but it didn't run w/ SpoonInstall so I haven't used it yet
7
16
8
17
See how they manage window indicators:
@@ -25,6 +34,68 @@ See how they manage window indicators:
25
34
-[colorboard.lua](https://github.com/CommandPost/CommandPost/blob/develop/src/plugins/finalcutpro/touchbar/widgets/colorboard.lua): CommandPost Colorboard The opposite of above, this is *complicated*! Lots of state management, but not sure how applicable it is for me.
0 commit comments