7 ms·
Show HN: Phoenix – a macOS window and app manager scriptable with JavaScript
- ketzo 7y agoInteresting, I need to check this out. I currently use Amethyst[1], and while I like it, it’s definitely got some bugs/performance issues. I’ve also heard people use chunkwm with good results, but haven’t tried it myself. [1]ianyh.com/amethyst
- jonfw 7y agoYabai is the tool that replaced chunkWM, made by the same guy. You'd probably want that one.
- simplify 7y agoNot to be confused with Phoenix[0], the Rails-like web framework for Elixir/Erlang. [0]: https://www.phoenixframework.org https://www.phoenixframework.org
- mrspeaker 7y agoI don't think anyone will be confused... seeing as it's also the name of about a billion other things (Pre-Firefox, I still remember you!). I feel like "Pheonix" is the second most common project name behind "Matrix". And on a less nit-pick-y note if the author is reading this - the project looks really fun and is certainly going to take up a chunk of my weekend!
- khirviko 7y agoCool! Let me know what you come up with. :)
- guessmyname 7y agoThe 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 https://github.com/kasper/phoenix/blob/bfcb684/docs/API.md [2] https://news.ycombinator.com/item?id=16787836 https://news.ycombinator.com/item?id=16787836 [3] https://www.spectacleapp.com/ https://www.spectacleapp.com/ [4] https://rectangleapp.com/ https://rectangleapp.com/ [5] https://www.hammerspoon.org/ https://www.hammerspoon.org/
- heavyset_go 7y ago> 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.
- gigatexal 7y agoOh man that is a nice little life hack!
- mtrpcic 7y agoI'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.
- gingerlime 7y agoPretty 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.
- greyskull 7y agoCmd+Backtick (next to 1 key) lets you swap between windows of the same application. Is that what you're looking for?
- gingerlime 7y agoThat'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...
- city41 7y agoThe window api makes me think one could pretty easily create an i3 like window manager. But my past experience with OSX window managers like amethyst has been subpar. Often the sizing/positioning is taken more as a “suggestion” by the window than a command. I also found eventually windows would get into a bad state. Has window management on OSX improved in the past couple years? On Linux with X11, window managers truly have control and thus provide a more reliable experience.
- macinjosh 7y agoI have good success with yabai: https://github.com/koekeishiya/yabai https://github.com/koekeishiya/yabai
- gigatexal 7y agoYeah I’ll check it I it after the many testimonials here but m leery about having to disable system integrity protection even temporarily
- toyg 7y agoI have run with SIP disabled pretty much since it was introduced. Nothing happened. Unless you are a three-letter-agency target or a person clicking on random files, you’ll be fine.
- athorax 7y agoI actually run it with SIP still active. Some features are disabled, but it still does everything I need it to.
- athorax 7y agoI have had a pretty stable setup using yabai[0] for my wm and skhd[1] for my hotkey daemon. Both are by the same dev and I have nothing but good things to say about them. Occasionally windows will get in a wonky state, but I have a hot key to reset them. It is usually stable for a week+ [0]https://github.com/koekeishiya/yabai https://github.com/koekeishiya/yabai [1]https://github.com/koekeishiya/skhd https://github.com/koekeishiya/skhd
- ecliptik 7y agoSloppy mouse focus? It’s the one feature I can never seem to find in macOS window managers. That and “highlight-to-copy” “middle-click-to-paste” are two things I really miss from an X11 environment.
- ken 7y agoFocus-follows-mouse, even sloppy, is problematic on macOS due to the menu bar. Moving the mouse up to the menu bar means covering space which can belong to a different window, which would change the meaning of the menu item when you got there.
- rsync 7y ago"Focus-follows-mouse, even sloppy, is problematic on macOS due to the menu bar. Moving the mouse up to the menu bar means covering space which can belong to a different window, which would change the meaning of the menu item when you got there." This is true, but easily surmountable. Mondomouse, which is the last bona-fide focus-follows-mouse add-on that existed for OSX (circa snow leopard) had a switch timer that was user-definable. So you could set the switch timer to .5 seconds or 1 second or something which would allow you to run the mouse across other windows without changing focus. That solved the menu bar problem that you are, correctly, pointing out. I think it's also worth mentioning that if you're at the point where you're demanding FFM, you're probably already doing everything with hotkeys anyway so it's not like you're running up to the menu bar often ...
- Sir_Omnomnom 7y agoyabai has a feature that allows for focus following mouse. It's a little wonky with the menu bar, but it works pretty well and replicates the X11 feel pretty well.
- tempodox 7y agoHighlight-to-copy works inside the Terminal app, it just doesn't use the public pasteboard. You Shift-Command-V to paste. Dunno whether MMB would work too, or could be configured to do it.
- 7y ago
- xrd 7y agoIs there something similar for Linux? I was just reviewing Guile and thought it would be something like that, but it isn't, and is Lisp. I would love something similar on Linux.
- lytedev 7y agoTons! I use bspwm. I would check out AwesomeWM, herbstfluftwm, xmonad, i3, and many more[0]! [0]: https://github.com/aleksandar-todorovic/awesome-linux/blob/master/README.md#x-windows-managers https://github.com/aleksandar-todorovic/awesome-linux/blob/m...
- heavyset_go 7y agoKWin is scriptable with JavaScript.
- omaranto 7y agoGnome Shell is scriptable in JavaScript.
- xrd 7y agoThis just worked, I like it. Thanks! https://developer.gnome.org/gnome-devel-demos/stable/dialog.js.html.en https://developer.gnome.org/gnome-devel-demos/stable/dialog....
- newscracker 7y agoBased on other links listed [1] in this comment right here and a little bit of reading up, it seems like Phoenix focuses on window and app management whereas Hammerspoon supports many more types of events and hooks to develop actions/plugins on. Does anyone have a better comparison of these two? [1]: https://news.ycombinator.com/item?id=22143917 https://news.ycombinator.com/item?id=22143917
- khirviko 7y agoSo many good options nowadays! I think a few years ago, you would only find a handful of projects focusing on similar matters.
- jrs95 7y ago> JavaScript Dear god, why? Don’t I have to suffer enough in my day job? For real though this is a cool project despite my own personal JavaScript fatigue.
- tonyedgecombe 7y agoIt could be worse, it could have been AppleScript.
- ken 7y agoWouldn't that be better? Anything you can script with AppleScript (OSA) you can also script with JavaScript, but not the other way around.
- travolter 7y agoSounds like you need another job.
- ironmagma 7y agoMaybe you could write it in Haxe and compile to JS?
- fabiospampinato 7y agoHere's my configuration for Phoenix (with gifs): https://github.com/fabiospampinato/phoenix https://github.com/fabiospampinato/phoenix You might find it useful as a starting point or as a source of inspiration.
- newscracker 7y agoI got your link from an older post about Phoenix on HN. It’s really well done (as some replies to you on the older thread said)! Have you, by any chance, tried Hammerspoon (hammerspoon.org)? That seems to be tool with a broader feature set compared to Phoenix. I was looking for some kind of well analyzed and written comparison.
- fabiospampinato 7y agoI have not tried Hammerspoon but I've skimmed through their docs, I'd say ultimately it boils down to: do you want to write JS or Lua? And do you need any of the Hammerspoon-specific features? I personally don't know any Lua and actually quite like writing JS, I don't think I need any of extra features HS provides, and with Phoenix you can still run a shell script and still achieve many things HS provides explicitly.
- robenkleene 7y agoYou can do a lot of this stuff without a full app, you just need a way to trigger an AppleScript with a keyboard shortcut. This is my framework for this approach. https://github.com/robenkleene/windowpane https://github.com/robenkleene/windowpane
- Fnoord 7y agoSpectacle is another alternative on macOS [1]. There's also Amethyst. I'm not sure which one's best. It is a matter of getting used to the default keybinds IMO. With Spectacle, the default keybinds are using Alt and Cmd as super key. I like that one; I rather keep Caps Lock as Esc (else I'd use it as Ctrl). As for i3, there's a backwards compatible Wayland successor called Sway [2]. [1] https://github.com/eczarny/spectacle https://github.com/eczarny/spectacle [2] https://github.com/swaywm/sway https://github.com/swaywm/sway
- bobwaycott 7y ago> I rather keep Caps Lock as Esc (else I'd use it as Ctrl). Why not both? My caps is esc when pressed alone, but it’s ctrl when pressed in combination with other keys. :)
- Fnoord 7y agoYeah, I'm using that, but I find it does not work well under high load.
- zackmorris 7y agoI grew up in the 80s during the era of MacroMaker and QuickKeys, when you could just hit the record button and make macros to play back sequences of mouse and keyboard events. It was especially useful in programs like Photoshop before they added their own macro systems. I'm having trouble finding links about it: https://en.wikipedia.org/wiki/System_6#MacroMaker https://en.wikipedia.org/wiki/System_6#MacroMaker http://basalgangster.macgui.com/RetroMacComputing/The_Long_View/Entries/2010/11/21_AppleScript.html http://basalgangster.macgui.com/RetroMacComputing/The_Long_V... The frontier was to eventually make everything scriptable and deterministic by getting more apps to have hooks that could be controlled directly (so like a specific command to click the close box of a window for example, rather than sending a click event right and down from the top left corner). Anyway, this whole concept of how to use computers seems to be all but dead today and I can't help but feel that something of tremendous value has been lost. Please, if you ever write macro tools like Phoenix, add a record feature.
- l_t 7y agoIt does seem like we've realized that GUIs are not really the most automation-friendly way to interact with programs. But there are a lot of nice macro tools out there still. For Windows, there is a macro scripting language Autohotkey [0], which has powerful recording GUIs built on it [1]. Although it doesn't support application-specific hooks that I'm aware of, it does allow introspection into the rendered GUI of the application, so you can "click a button" instead of "click a pixel". OS X has Keyboard Maestro [2], which I've heard is good. Also, many keyboards have macro recording built in. My Ducky keyboard can record and save macros with no custom software/driver needed. (the macros can even include mouse clicks, but that's a little janky.) As a final note, I think the place I've seen macro recording still used the most is in gaming. In most other areas of computing, it's seen as preferable to make a special-purpose utility to solve a problem instead of building layers of automation on top of a more general-purpose tool. (btw, this is just based on my personal experience -- I love automation so I've never been far from the macro-space. I'm not trying to argue against your point.) [0]: https://www.autohotkey.com/ https://www.autohotkey.com/ [1]: https://www.macrocreator.com/ https://www.macrocreator.com/ [2]: https://www.keyboardmaestro.com/main/ https://www.keyboardmaestro.com/main/
- synthecypher 7y agoWhat can this do that Spectacle can't? Long time Spectacle user and JavaScript developer here. https://www.spectacleapp.com/ https://www.spectacleapp.com/
- lrizzo 7y agoI have been using Spectacle for ages (with a custom javascript config, another post...). The problem is, Spectacle uses a 32bit API that is scheduled to go away and I am afraid that at some point (or 10.15 already?) it will stop working.
- tomThom 7y agowhich takes more memory (and is slower)? LISP interpreter or v8/node?
- lrizzo 7y agoI have two links related to tiled window management: The links are for WM configurations that let you move or resize windows keeping the corners on a configurable grid: [1] https://github.com/luigirizzo/lrtile-chrome https://github.com/luigirizzo/lrtile-chrome (chrome extension) Ctrl+Shift+Arrow move the current window, Ctrl+Search+Arrows resize it This works for all Chrome windows so it platform independent. [2] https://github.com/luigirizzo/lrtile-cinnamon https://github.com/luigirizzo/lrtile-cinnamon (cinnamon extension, linux) Alt+Arrows move the current window, Shift+Arrows resize it (I have a similar Javascript configuration for Spectacle, I can post it if there is interest. I believe the javascript is easily portable to other scriptable window managers.) My rationale for developing lrtile is the following: I like having window corners on a grid because it helps locating information. However, in many tiled WMs, resizing one window causes resizing of nearby ones (very distracting) _and_ windows generally do not overlap (a severe limitation especially on small screen). Finally, shortcuts to place windows on half or a quarter of the screen are often built-in (in chrome, windows, spectacle default...) but very few WMs have larger, configurable grids suitable for large monitors (I use a 40" 4K screen). lrtile addresses the above problems as follows: - the grid is configurable; - movement/resize only affect the current window, allowing overlap if user wants; - commands are arrows + 1/2 modifiers, and try to be intuitive - screen borders act as hard stops, also making behavior more intuitive. In detail, I typically use a 6x6 grid on small screens (so I can have halves or thirds) and 12x10 or even bigger on large screens. Each window side must be at least two units, and resize extends or reduces one dimension at a time and by one unit. My typical workflow is to make windows visible with a comfortable size and no overlap, and occasionally expand the window I care about (e.g. make the browser wider when a page does not render well; or expand the editor window vertically when I want to see a larger chunk of code), reverting back when done. The fact that move and resize commands are very similar to other cursor movements makes the operation very quick.