project-repo / cagebreak

Cagebreak: A Wayland Tiling Compositor Inspired by Ratpoison
MIT License
286 stars 19 forks source link

Feature request: ratpoison's colon command #27

Closed ghost closed 2 years ago

ghost commented 2 years ago

I'm not sure if this would be outside the scope of what you want cagebreak to be able to do, but would it be possible to be able to execute cagebreak commands either through the command line or though a small gui window similar to ratpoison's colon. Outside of this, and issue #21, cagebreak works great, so thank you.

project-repo commented 2 years ago

Thank you for your suggestions.

  1. It is possible to send cagebreak commands over the command line via $CAGEBREAK_SOCKET (https://github.com/project-repo/cagebreak/blob/master/man/cagebreak.1.md#environment). Did you miss this or is this too indirect for you? Of course, you could write a shell script which passes arguments given to it on to cagebreak (let us know if you don't know how to do that), would that help?

(If you want information about the current state of cagebreak via ipc socket, you are just like us and you can check out a new feature on the development branch, where information on the current state can be dumped as json.)

  1. At this point cagebreaks "GUI" is limited to a minimum. As you stated, we try to stay away from creating new graphical interfaces. But again, you could implement this using the cagebreak socket (in its simplest form, it would open a terminal emulator which sends any input it receives over the socket and closes). What do you think? Or what exactly is it you want?

cheers, project-repo

ghost commented 2 years ago

Thank you for the response.

  1. I don't understand how I would use $CAGEBREAK_SOCKET to send cagebreak commands
  2. Implementing something that uses a terminal as its gui sounds interesting, but from what understand that terminal will be treated like any other terminal or browser, whereas I'm looking for something more akin to an application launcher that instead of providing a list of applications, allows you to type in and execute cagebreak commands without having to bind them.
project-repo commented 2 years ago
  1. I don't understand how I would use $CAGEBREAK_SOCKET to send cagebreak commands

You can use a tool such as openbsd-netcat to interact with an ipc socket: nc -U $CAGEBREAK_SOCKET (https://wiki.archlinux.org/title/Cagebreak Section: Interaction through socket)

Anything that can be used as cagebreak configuration (https://github.com/project-repo/cagebreak/blob/master/man/cagebreak-config.5.md) can be sent over the socket.

Does that help?

  1. Implementing something that uses a terminal as its gui sounds interesting, but from what understand that terminal will be treated like any other terminal or browser, whereas I'm looking for something more akin to an application launcher that instead of providing a list of applications, allows you to type in and execute cagebreak commands without having to bind them.

Yes, this would be possible. For example, you could bind some key in cagebreak to opening a terminal running a shell script. This shell script would then read a single line "<line>" from input, send exec <line> to cagebreak over the socket and then terminate closing the terminal. What do you think? Or what is it exactly that you would like to have done differently? Is this purely an aesthetic issue because it would not look as pretty as a launcher in e.g. cinnamon and be subject to splits? cheers, project-repo

ghost commented 2 years ago

thank you for the response

You can use a tool such as openbsd-netcat to interact with an ipc socket: nc -U $CAGEBREAK_SOCKET (https://wiki.archlinux.org/title/Cagebreak Section: Interaction through socket)

Anything that can be used as cagebreak configuration (https://github.com/project-repo/cagebreak/blob/master/man/cagebreak-config.5.md) can be sent over the socket.

Does that help?

That does help but, after installing netcat-openbsd and running nc -U $CAEGBREAK_SOCKET hsplit, all that happens is that the current terminal can't be used without hitting Crtl-c. Is there something i'm missing?

Yes, this would be possible. For example, you could bind some key in cagebreak to opening a terminal running a shell script. This shell script would then read a single line "<line>" from input, send exec <line> to cagebreak over the socket and then terminate closing the terminal. What do you think? Or what is it exactly that you would like to have done differently? Is this purely an aesthetic issue because it would not look as pretty as a launcher in e.g. cinnamon and be subject to splits? cheers, project-repo

Yes, it is an aesthetic issue, i'm not thinking about a full fledged customizable bemenu-like launcher, but a small input window similar to the message window already present, that can allow for the execution of cagebreak commands without the need to open another terminal.

project-repo commented 2 years ago

That does help but, after installing netcat-openbsd and running nc -U $CAEGBREAK_SOCKET hsplit, all that happens is that the current terminal can't be used without hitting Crtl-c. Is there something i'm missing?

The synatx for nc is simply nc -U $CAGEBREAK_SOCKET (careful, there is a typo in the variable name in the command you wrote). After that you can type cagebreak commands (press enter to send them). To send "hsplit" directly, you may use echo "hsplit"|nc -U $CAGEBREAK_SOCKET instead (note that nc does not terminate after sending "hsplit", see the -q and -w options for that).

Yes, it is an aesthetic issue, i'm not thinking about a full fledged customizable bemenu-like launcher, but a small input window similar to the message window already present, that can allow for the execution of cagebreak commands without the need to open another terminal.

Well, as you said, cagebreak will probably not be implementing this any time soon. The best way to go if you would still like to have this is probably to write a script (python or something) which opens a small window with an input bar and then sends cagebreak any commands entered.

ghost commented 2 years ago

Well, as you said, cagebreak will probably not be implementing this any time soon. The best way to go if you would still like to have this is probably to write a script (python or something) which opens a small window with an input bar and then sends cagebreak any commands entered.

ok, thank you