Hacker News new | past | comments | ask | show | jobs | submit login

The API [1] is an interesting read, as well as this thread from two years ago [2].

I have used Spectacle [3] for years and recently switched to Rectangle [4].

These two are quite simple in comparison but I barely use all their features.

I have seen people using HammerSpoon [5] as well for these type of things.

Out of curiosity, what kind of things do people script in a window manager?

[1] https://github.com/kasper/phoenix/blob/bfcb684/docs/API.md

[2] https://news.ycombinator.com/item?id=16787836

[3] https://www.spectacleapp.com/

[4] https://rectangleapp.com/

[5] https://www.hammerspoon.org/




I'm using Hammerspoon on MaOS to give me a semi-tileable windows interface. Here is my config:

    local hyper = {"ctrl", "alt", "cmd"}

    hs.loadSpoon("MiroWindowsManager")

    hs.window.animationDuration = 0.3
    spoon.MiroWindowsManager:bindHotkeys({
      up = {hyper, "up"},
      right = {hyper, "right"},
      down = {hyper, "down"},
      left = {hyper, "left"},
      fullscreen = {hyper, "f"}
    })

    -- https://github.com/miromannino/miro-windows-manager
This allows me to place any MacOS window in either a horizontal or vertical third, or a quadrant, or a half, perfectly divided in such a way that I can maximise use of my screen while running multiple apps. My most common work environment is to have a terminal on one half of the screen, docs on the other - or two terms on top of each other on one side, docs on the other.

This is so useful for me that I yearn to make the same hotkeys work on my Linux machine, but I haven't worked out what window manager I want to use to do it .. probably Awesome of course, but I'd love to be able to use the same Hammerspoon scripts (Lua) somehow ..


I've been using Hammerspoon for years, and have been incredibly happy with it. It is still actively maintained, has a large userbase, and has a lot of pre-built solutions for things. Importantly, it's not just for window management. You can do a lot of powerful things with it.


> Out of curiosity, what kind of things do people script in a window manager?

KWin is scriptable, and I use it to change window shading behavior and to do some tiling. At one point I had it send SIGSTOP to processes that I minimized, and SIGCONT when they were raised, to save battery life.


Oh man that is a nice little life hack!


Pretty happy with spectacle overall. One thing I sorely miss from i3 however is the ability to switch focus to panes/windows/apps with the keyboard. Even something as next/prev window seems impossible on Mac (or I couldn’t work out a solution). I think you can cycle through apps(?), but not windows/panes in a logical order as far as I’m aware.


Cmd+Backtick (next to 1 key) lets you swap between windows of the same application. Is that what you're looking for?


That's as close as it gets, but it's not enough.

I mapped it to cmd-shift-right so it does go to the next window. But there's no way that I could find to map going to the previous window... So for example I might have two windows tiled side by side. I want to go cmd-shift-right to focus on the right one, and cmd-shift-left to focus on the left...


Hammerspoon can change focus by relative direction. Can be a bit iffy sometimes but between that and HyperSwitch I'm never really at a loss.


Thanks. I'm going to try Hammerspoon (and maybe HyperSwitch).

From other comments, it seems like yabai can also handle it, but it seems like a very "hard-core" way, including disabling some Mac security features, and I'm not sure I feel comfortable going that far yet :)


It's not exactly what you want, but have you tried binding "Move focus to next window" to alt+tab? Then you can use alt-tab-shift to cycle focus backwards, at least something. (I always forget where that setting is, it's in Keyboard->Shortcuts->Keyboard).


If you have two windows the order shouldn't matter?

Also, Cmd+` goes to the next window, Cmd+Shift+` goes to the previous window, your mappings having a shift in them might be the issue.


> If you have two windows the order shouldn't matter?

No. But I don't think it's too much to ask to cycle through more than two, now, is it? :)

> Also, Cmd+` goes to the next window, Cmd+Shift+` goes to the previous window, your mappings having a shift in them might be the issue.

I'm not sure I understand how having a shift in my mapping affects this, but cmd-shift-` isn't ergonomic at all. To me the arrows are far more logical way to go in a certain direction. Why can I map next window to any key, but there's no way to map another key to the previous window? I find it very strange.

For the sake of comparison, i3 makes all those things trivial.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: