Hey for scripting stack and tile

Does anyone use hey to script stack and tile? If so, care to share some insight and possibly script examples? Stack and tile is great, but getting it set up each session is time consuming and unproductive.

4 Likes

I don’t think it’s possible with just passing a BMessage with hey. It’s definitely a desireable feature for stack & tile and having some sort of session management in general.

Imagine you had some stack&tile arrangement of a few apps/windows. Click and hold with the right mouse button on a tab of that S&T arrangement and some icon appears that you drag’n’drop to e.g. the Desktop. This would create a ‘launcher’ file with a mix of the icons of the apps involved. Double-click it to open all those apps with those documents in that S&T arrangemet (or put into ~/config/settings/boot/launch to autostart).
You could also open a ‘launcher’ file with a ‘LauncherEditor’ to edit some properties, like what documents an app should load, or what location a Tracker window shows, or on what workspace to open etc.

Maybe I should create an enhancement ticket for the above… :slight_smile:

11 Likes

That’s a great idea @humdinger , would love to have such a feature in Haiku :+1:

1 Like

Hey can query the screen size, window sizes and make modifications to windows. I would think it could stack and tile windows too, if paired with a more general purpose scripting language to glue all the calculations together. Is stack and tile not done through BMessage()? Of course it could also be implemented in native C++. I’m thinking along the lines of showcasing and perhaps improving hey. This would make Haiku more attractive to Linux refugees coming from the tiling WM ecosystems.

This is definitely worthy of an enhancement ticket. My personal wishes: easy configuration, preferably stored in text files with GUI front end. Plays well with the Shortcuts preferences and Workspaces.

1 Like

I don’t know. I’d have guessed that it’s some S&T magic in the app_server…
In any case, being able to hack things with hey etc. is nice, but the basics should be standard behaviour of the GUI.

2 Likes

That said, key bindings should probably be part of the behavior. I’m wondering if Shortcuts could be overhauled into a central control center for system wide key bindings. Adding bindings to something like this project would take a number of slots. From a UI/UX standpoint, it would make sense to make a more central point of key binding configuration. Or at least have it as something to consider beforehand.

I think we should indeed do what you describe. It might be a bit of a project though. I have wanted to overhaul the Shortcut preferences for a while, and I know nephele has interest too, and has already done some work I think. It needs much improvement in the UX and UI, and there is a fundamental bug in how it works that makes it break when the system is set to use another language (unless someone has fixed that since the last time I looked.)

But with that said, putting all system actions into Shortcuts would require deeper work to change hard-coded keyboard handling for various things to be something based on messages. Of course a side effect would be that then something like stack and tile which is hard-coded into app_server would then indeed be scriptable with hey. Of course there might be some reasons why switching from keyboard handling to using messages is either hard to do or somehow makes the experience worse. Though we won’t know until someone gives it a try.

2 Likes

There is never any magic involved in code, otherwise it needs to be rewritten :slight_smile:

Stack and Tile is implemented by decorators, but it is accessible from the API with the BWindowStack class (for stacling but not tiling yet, I think?). This is how NetSurf and Coder create stacks of windows.

It should be possible to add some scripting endpoints to BWindow to access that with hey (“hey xxx getsuites of Stack of Window yyy” or something like that).

3 Likes

As promised, here’s a ticket describing the above idea to drag an icon from an S&T-arrangement to the Desktop to save/load that arrangement: ticket #17589: Saving/loading stack&tiled apps/windows between sessions.
Like and subscrbe… :smiley:

9 Likes

You’ve been quite the humdinger of this community for a long time.

3 Likes