Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening new window into empty space #41

Open
mankeli opened this issue Apr 10, 2023 · 12 comments
Open

Opening new window into empty space #41

mankeli opened this issue Apr 10, 2023 · 12 comments

Comments

@mankeli
Copy link

mankeli commented Apr 10, 2023

Is it possible to open new window into already empty tile? It seems it currently always opens in the currently selected tile.

@project-repo
Copy link
Owner

Hi mankeli

What exactly do you mean?
Would you like new windows to automatically open in an empty tile?
What should happen if all tiles are already full?

Cheers
project-repo

@mankeli
Copy link
Author

mankeli commented Apr 11, 2023

My usecase is an emulator window and it's debugger in terminal.

With a stacking window manager, I launch the emulator from terminal window. The emulator's window opens somewhere on screen, and when i break to debugger I can just alt+tab to terminal window. Quit the emulator and repeat.

With cagebreak, the emulation window opens into same tile as console, then when I break to debugger, I need to split the tile which then puts emulator and terminal window next to each other. Then I can switch to the terminal tile and do my stuff there. If I now quit the emulator, there's an empty tile and need to use "only" command to remove the split. It's just a bunch of unnecessary keypresses.

Probably this could be solved by just having some kind of mechanism to select a tile where next window will be opened. Is it possible?

@project-repo
Copy link
Owner

I see - thanks for the clarification. Currently, there is no
method in cagebreak to natively achieve such behaviour. You
could try to use the socket to achieve what you are looking for.

I am thinking of a cagebreak keybinding which would run a skript
doing the following:

  • listen on the socket for a "new window" event.
  • split screen.
  • listen on the cagebreak socket for a "close window" event.
  • send the "only" command to the socket.

Depending on how complex you want to make it you could also check that the "new window"
and "close window" events come from the correct workspace, tile, pid etc. to
make the workflow more robust.

Does that sound like something that would work for you?
What do you think?

cheers
project-repo

@project-repo
Copy link
Owner

Hi mankeli

Since this issue has not seen any activity for quite some time and since
it does not concern a bug in Cagebreak, we are closing it for now. Feel
free to reopen if you have any more information.

cheers
project-repo

@mankeli
Copy link
Author

mankeli commented May 2, 2024

Hi! Sorry for fading out last year, my laptop running this experimental setup with Cagebreak got smashed to ice and it took me a while to get a new setup!

So a bit refined idea: I think semantically tagging slots would be a nice feature. To kind of build workspaces. So if you open programs, they would go to specific slots automatically.

I wonder if you could provide a scripting example to send new windows with matching names to specific slots?

Also a bit outlandish idea maybe: While I've been configuring this thing, I've been thinking how awesome it would be to have lua script interpreter integrated in this, but maybe it could be done with just exec and the socket interface?

@mankeli
Copy link
Author

mankeli commented May 3, 2024

@project-repo sorry I don't know if I have the power to re-open threads 🤔

@project-repo
Copy link
Owner

Hi mankeli

We are currently discussing this internally but find the idea interesting.

We will reopen this for now.

cheers
project-repo

@project-repo project-repo reopened this May 4, 2024
@project-repo
Copy link
Owner

Hi mankeli

We considered your proposal and came up with a tentative
implementation idea.

We would provide a command to move a view to a specific workspace.

syntax:

moveviewtoworkspace <view-id> <output> <workspace>

Using this command, you can write a script which listens for events
indicating that a new view has been created and executes a
moveviewtoworkspace command based on the title string and pid.

Because we expose almost everything over the socket as json, we don't feel
like a native lua interpreter is needed. You are welcome to use lua, or
any other language for that matter, to interact with the socket though.

cheers
project-repo

@mankeli
Copy link
Author

mankeli commented May 5, 2024

Does an empty workspace have 1 view, and once-splitted workspace has 2 views etc?
With my proposal I meant that I'd like to be able to identify views and send windows into specific views within a workspace.

@project-repo
Copy link
Owner

Hi mankeli

Ah I see. No, the correct terminology is that a fullscreen workspace has
1 tile which can have a view (window) displayed within it. What you
are planning to do requires a different command which we are also
planning on implementing:
moveviewtowtile <view-id> <tile-id>
The procedure is then as described in the previous post. Does that make
sense?

Cheers
project-repo

@mankeli
Copy link
Author

mankeli commented May 6, 2024

Ah, gotcha. Yes, I think that could enable automatic creation of those window (or view) ensembles I was thinking.

@sodface
Copy link

sodface commented Jun 21, 2024

Because we expose almost everything over the socket as json, we don't feel
like a native lua interpreter is needed. You are welcome to use lua, or
any other language for that matter, to interact with the socket though.

At the risk of being slightly off-topic and annoying, I wanted to mention something I've been working on for my vehicle mounted touchscreen infotainment system, which is based mainly on Cagebreak and mpv. I wanted to simplify (and eliminate) the touchscreen gesture application I was using and realized that in addition to lua scripts, mpv supports c plugins so I wrote one based on libinput that works well for my needs.

Once I did that, I wrote another c plugin for interacting with the Cagebreak socket. Previously I'd done this with lua in mpv but moving the socket interaction to c made more sense to me. Since mpv provides an internal function for message passing between scripts (and c plugins), it's trivial to pass socket activity to a lua script and vice versa.

As I mentioned in another issue here, mpv also provides some utility functions for working with json, so there's no need (that I've found so far) for using jq or other solution for that.

If you use mpv in this role, you can start it via your Cagebreak config and pass multiple arguments to turn off features, like:

exec mpv --idle --load-scripts=no --video=no --audio=no --sub-ass=no --osc=no --config=no --load-osd-console=no --load-stats-overlay=no --ytdl=no --input-terminal=no --load-auto-profiles=no --script=$HOME/.config/cagebreak/cg-ipcc.so --script=$HOME/.config/cagebreak/cg-ipcl.lua --log-file=$HOME/mpv.log

This may be kind of a silly mis-use of mpv, but if you already have it installed, it might be worth considering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants