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

How to execute a command in a tab that already exist ? #2264

Open
fredmo opened this issue Oct 15, 2024 · 2 comments
Open

How to execute a command in a tab that already exist ? #2264

fredmo opened this issue Oct 15, 2024 · 2 comments

Comments

@fredmo
Copy link

fredmo commented Oct 15, 2024

guake -h
-e COMMAND, --execute-command COMMAND
Execute an arbitrary command in a new tab.

I am in the tab number 3
I want to run a command in another tab , how could I do ?

guake --select-tab=2 --execute-command="echo hello"
This command is executing in a new tab

guake --select-tab=2 && echo "hello" , the echo arrive in the current tab ( number 3 )

Could you modify --execute-command to be executed in --select-tab if present

@egmontkob
Copy link

egmontkob commented Oct 22, 2024

(I'm not a guake developer, just chiming in.)

--execute-command works pretty much by simulating that you pressed those keys on the keyboard, including a final Enter.

It's reasonably safe to do it when starting up a new terminal tab with your shell. There might be some tricky corner cases when this goes wrong (e.g. if your default shell is configured to interactively ask you a question at first startup) but in practice this is extremely rare.

Once that shell is open and running there, this operation becomes much more risky. You might have entered a partial command, the new command would be appended to (or inserted into) it, resulting in garbage. You may be running a text editor, the "command" being inserted there as text. You may be running any application where those letters of the desired command instead invoke menu operations or other actions, a lot of them in a row, nothing to do with the command you wished to execute, but causing lots of unwanted side effects that you'd have a hard time tracking down and undoing.

It would be a feature that causes minor additional convenience at its best, but allows you to easily shoot yourself in the foot at its worse.

@fredmo
Copy link
Author

fredmo commented Oct 22, 2024

As ugly workaround :

in tab 1 :
tmux new-session -s mysession

in tab 2:
tmux send-keys -t mysession 'echo hello' C-m

I would declare an alias to overcharge : "guake --rename-tab" with "tmux new-session -s" , but it s ugly...

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

2 participants