Hacker News new | comments | show | ask | jobs | submit login
Show HN: Phoenix 2.6 – a macOS window and app manager scriptable with JavaScript (github.com)
183 points by khirviko 3 months ago | hide | past | web | favorite | 58 comments

I spent quite a bit of time writing my configuration for Phoenix, if you're thinking about writing your own I think you might find starting from mine useful.

It's easy to customize, there are gifs in the readme, and it comes packed with features, I hope you'll like it:


This is fantastic! The readme with animated GIF's is really helping me learn the shortcuts. Thanks for sharing.

I'm glad you like it! :D

I’m really happy people are sharing these! +1

I like the idea of space switcher. Is there any other way of switching spaces than alfred?

One could take a similar approach to mine, but use the list of spaces in an application other than Alfred, or just use the shortcuts macOS provides. I'm not aware of any already available alternative.

After many ours spent on several scriptable window managers I've settled on Spectacle, which is a lot less powerful, but proved to be enough for me, while being dead easy and hassle free.

Ditto. It's brilliant and one of the things stopping me switching to linux at this point.

I use MacOS at home and happily use Hammerspoon to manage these interactions, in the past using Slate—I use Windows at work and I really wish it had something better than AutoHotKey: is this just something I'm unaware of or does the design of windows really hamper the creation of tools like these?

I've been using Phoenix for 2 years straight and it's been pretty smooth sailings. Kasper has done an excellent job maintaining and implementing new features every once in a while, thanks Kasper!

My personal configuration is written in TypeScript and I maintain typings for Phoenix as well. I try to find ways to improve my every-day and implement them in Phoenix, things like: moving/resizing windows, coffee timer, monitor brightness, terminal hotkey, etc. In the past I've used it to track what applications I spend my time in or to automatically switch Karabiner-Element profiles based on which monitor is connected. If you're looking for inspiration, feel free to have a look:



I used Spectacle: https://www.spectacleapp.com/

It is not scriptable but gets the job done.

I have a 34" 1440p screen and I use Mozaic.app (https://www.lightpillar.com/mosaic.html) for managing my windows. Usually, i'll divide my windows as either 1:1, 1:2:1 or 1:4 sizes. It's pretty useful as I can use keyboard shortcuts to position my windows. Is there any added benefits that I can get by using phoenix or hammerspoon?

As a hammerspoon user, probably not if that's all you're using it for. Hammerspoon does add a bunch of extra features mosaic doesn't add—but if you don't need them and you've already invested in software to solve your problem: not likely.

If you don't mind, what are the use cases that makes hammerspoon very useful for you?

Basically the same reason you're using mosaic + the ability to change what exactly is being done. I use it to map 'hyper'+key (where hyper is the equivalent of ctrl+cmd+shift+option and is assigned to control, capslock is assigned to the original control functionality) to move windows between screens and on their own grid. Effectively I just didn't pay for mosaic-like functionality. I have better touch tool, but I never liked having to drag to snap and had hammerspoon implemented already.

My use case is to split the screen in two, editor on one side and terminal on the other. I specifically want the terminal to be 80 characters wide (inside that window I use tmux), and the editor to take up the rest of the space.

I've tried most of the simpler, GUI-based window managers for macOS but I haven't found one that let's me set window sizes explicitly in pixels yet. With hammerspoon I figure out the width of the terminal app I want, and adjust the windows accordingly.

Both Phoenix and Hammerspoon are free and open-source. You can also configure them in endless ways, so either you can have a really simple setup or a very dynamic one that works just the way you like.

Interesting. Yeah, I think I'm missing out but, have no idea what they are. What are the dynamic flows that might be useful?


From a user higher up in the thread. Nice example.

There’s some examples of custom configurations here: https://github.com/kasper/phoenix/wiki/.

Say for example you want to do something dynamically when an app launches. You could open an app and the windows would automatically be arranged across your monitors the way you want.

I've been enjoying chunkwm as a tiling WM. Hard to go back to non-tiling when you've experienced it.


I’ve tried tiling WM (well, MacOS’ Amethyst, before that used kwm for a while, used fluxbox a long time ago on arch which can be used with tiling) but still can’t get the “why”, they don’t help my process and mostly stand on my way. Anything I’m missing? What do you find so changing?

What I find valuable in a tiling window manager is what it doesn't have. Usually, I want a window full screen. Ocassionally, I want two windows side by side. I can't think of a time I want a window halfway transparent with its upper left corner at (0,32) that's partially occulding another window. It's just so much faster when all the things I don't want to do aren't possible.

My issue is that 90% of the time I just need all my windows full screen (and it's always at least 3 of them), and in the rare occasions I don't, I don't mind setting up something ad-hoc. But then, tiling gets in the way by trying to maximise or reposition everything when I open anything new, or I need to add more virtual desktops/screens

A few reasons: - I know what is going to happen when I open anything and can get things where they need to be very quickly (since it is keyboard driven).

- The wm is working with me to use the entire screen.

- You can always revert to making windows float if you need it.

- You can use supporting terminal with no title bar which saves space (see here https://www.dropbox.com/s/0f08qa0dbhhc6nv/Screen%20Shot%2020...)

It is occasionally annoying when something doesn't behave as expected but its a fun tool to use in general.

Basically I always get tripped with the fact that I always, always have emacs in full screen, as well as a terminal also maximised. Then I end up needing 5 or 6 spaces to hold all the windows I open and close during the day and starts to get hard to manage. But thanks for sharing your perspective, knowing me, I'll retry in a few months :)

Can you configure the margins between those three terminal windows? I currently use Tmux with one fullscreen terminal to achieve a similar effect, but this looks interesting too. I'd like to eliminate any margins though. A one-pixel border is all I would want.

Absolutely. You can configure everything (global padding, inter-tile padding etc...)

I have yet to use chunkwm, but I have tried a few of the precursors. They were all nice, but super glitchy, especially when it comes to multiple monitors. Does any of that seem better with chunkwm?

I've just tried it out with one external monitor (laptop + external) and chunkwm works as expected. Don't know how that scales past 1 external monitor though.

This is so well done.

I've looked at some links to examples in the wiki: https://github.com/kasper/phoenix/wiki#examples

...and Garrow Bedrossian's config: https://github.com/garrow/phoenix-configurations

...is da bomb!

Others look very good too.

Hacker News don't do Markdown style links.

I used Phoenix to reimplement some features of MercuryMover https://github.com/kemar/phoenix-mercury-mover You can almost do what you want with Phoenix. I'm a huge fan

If you prefer a tiling window manager that is automatic, check out https://github.com/ianyh/Amethyst .

Just a quick question for current Phoenix users — how is the multiple monitor performance? By that I mean a situation where I'm going from just the MacBook screen to three monitors on one desk to four monitors on another desk. Will it automatically detect how many monitors are present, without having to resort to hardware-specific configurations? This is a killer feature for me on Hammerspoon, but I much rather script with JS than Lua, out of familiarity.

I'm not entirely sure what you mean with performance, macOS is pretty sluggish at reacting to new monitors anyway.

That said, Phoenix has an event for when the screens change, you can use it to react, enumerate the new screens, etc. Something like:

Event.on('screensDidChange', () => { const sizes = Screen.all().map(s => s.flippedVisibleFrame()); })

Hope that helps!

I moved from MacOS to Linux for my desktop machine and still use a Macbook with MacOS on the go. I've tried chunkwm, Spectacle, and a few odd ones on GitHub. But none really come anywhere close to something like i3 on Linux if you're looking for a good window manager. MacOS is just too limited if you really want to have a predefined setup of (work)spaces and window regions.

Have you tried Amethyst[0]? It's a dynamic, automatic tiling WM for macOS; I enjoy it very much.

[0]: https://ianyh.com/amethyst/

Is anyone aware of configurations that mimic i3wm using Phoenix/Hammerspoon or modifications to Amethyst?

That’s nice! Does anyone already have an example to just add Windows like ALT + Tab like behavior? Thx!

How does windows alt tab differ from cmd tab? (Mostly out of curiosity)

How does it compare to hammerspoon?

Hammerspoon uses Lua for the configuration language. Phoenix uses JavaScript, or anything that translates to it. Personally I think Phoenix’s API is much simpler and easier to understand, but I’m of course bias. :) Hammerspoon does have some additional features that go beyond window and app management. Phoenix doesn’t cover those.

It looks like this just does window management, rather than the many things that Hammerspoon supports.

Yes! Though I’ve seen people extending the support in Phoenix cleverly by using the Task API. Basically you can run any external processes or scripts.

Wow. The named spaces switcher seems promising to me.

I think it would be great to have custom names for spaces, and assign various apps to each space, and then be able to log the time spent in each space to a text file.

Is this related at all to Slate (https://github.com/jigish/slate), which also has a JS API?

In many conceptual ways, such as sharing the same language for configuration, though this is a completely different project so they don’t share the same origin. Slate has become rather abandoned and unsupported nowadays. Phoenix hopefully continues strong in this area.

still works nicely though, i will add (slate)

This is really cool. Is there anything like that for Windows?

AutoIT is similar to this.

I've been shopping around for something like this. I currently just use BetterTouchTool with Windows-like shortcuts for window management.

Hahaha lol I thought Phoenix Framework had suddenly jumped from 1.3 to 2.6

Hah. :)

Is it possible to set window 'Always on Top' with Phoenix?

I don't think this is something you can do to windows you don't own.

You could create a shortcut that will always focus the window easily.

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