tilda
tilda copied to clipboard
Configurable list of custom commands to start in different tabs
This is an idea I am considering to implement before I release tilda 1.2. I am looking for feedback on ways to implement this and whether anyone would like to have such a feature.
Currently tilda has the ability to execute a command instead of the default shell. For example I can configure it to start a python interpretor instead of starting a shell and I can also configure what should happen when this commands ends (e.g. drop to the default shell).
The disadvantage in my opinion is, that this command will then always be executed in each shell. What I would like to have the ability to preconfigure how many tabs to create at startup, which commands to execute and what to do when that command ends.
The UI could look something like this:
| Tab No. # | Command | Action |
|------------------------------------------|
| 1 | | Combo Box |
| 2 | ipython | Combo Box |
| 3 | htop | Combo Box |
An options to: Add an entry, remove an entry, move an entry up or down. A blank field would start the default shell. The Combo box would still display three currently available options (Drop To Default Shell, Restart Command, Exit Terminal).
The only problem I see there, is that tilda uses libconfuse which does not allow to store lists of unstructured data. But a workaround would be to limit the number of entries to (for example) 10 and then just create separate entries for each entered command.
If anyone is reading this, let me know what you think about it.
I'm not sure I'd use this feature other than to say "start N tabs by default". In my usage, I normally have a tab open for source code, one for tests, and then N more for exploration or monitoring servers. So it's mostly just the raw shell. It would be nice if the working directories could be preserved, however since the majority of tabs are ssh, I'm not sure how you would implement that. I'm sure I don't speak for all users, though.
Here's a different approach. If I could run tilda newtab ipython
, or tilda run --in my-configured-tab-name "cd somewhere"
. It would mean you could put a lot of this feature into a startup script written by the user, for example:
tilda dropdown --name mainwindow
tilda newtab --in mainwindow
tilda newtab --in mainwindow --replace-shell ipython
tilda newtab --in mainwindow htop
tilda newtab --in mainwindow cd ~/myproject/src
I think that the implementation needed would also imply that you could get the session manager to save your tabs/windows.
This seems like a more general way to do what you want, but clearly would be more difficult. I recall having a singleton application and dbus interface has come up before.
+1, I am very looking forward to see this feature, it would be amazing. I was thinking about implementing it myself although I am not a true C/C++ programmer (Java one) but then I saw this post :).
The suggestion proposed by bnkr is very good in my opinion, in fact it is very similar to the one "tmux" implements. Here is an example script I am using to create a tmux instance with multi-panes:
SESSION=squid
tmux -2 new-session -d -s $SESSION
tmux new-window -t $SESSION:0 -k -n SquidLogs
tmux split-window -v -p 60
tmux select-window -t $SESSION:0
tmux select-pane -t 0
tmux send-keys "tail -f -n100 /var/log/squid/access.log" C-m
tmux select-pane -t 1
tmux send-keys "journalctl -f -n50 -u squid" C-m
tmux split-window -h -p 40
tmux send-keys "sudo watch \"netstat -ltp | grep 'tcp' | sed -e 's/tcp6*\s*0\s*0\s*\(.*\)$/\1/g'\"" C-m
tmux -2 attach -t $SESSION
You could write like this:
SESSION=squid
tmux -2 new-session -d -s $SESSION
tmux new-window -t $SESSION:0 -k -n "FistTab"
tmux new-window -t $SESSION:1 -k -n "SecondTab" -c "tail -f /var/log/messages"
tmux new-window -t $SESSION:3 -k -n "ThirdTab" -c "ssh [email protected]"
tmux select-window -t $SESSION:0
tmux -2 attach -t $SESSION
What is the status of this? I would love to see this feature implemented!
Hi @thorml,
I would also love to see this in tilda, but I currently have no time to work on this. Maybe I will find some time over the Christmas holidays, but I cannot promise anything. If you want to help speeding things up, you can do one of the following things:
- Make comments on what command line option this feature should support. I think @bnkr's suggestions are a good idea to start. If you have any suggestions feel free to leave a comment here or open a wiki page that documents the required options for this feature.
- Provide a patch that does some of the required work. This feature requires a change to how tilda is working now because we need to introduce DBUS support, possibly through GtkApplication.
- I also have not decided yet, if I want to allow running two or more tilda processes, or if there will be just one process that can spawn multiple windows. Deciding this will have an impact on how the GtkApplication stuff can and should be implemented.
In any case, help is definitely welcome.
In my opinion this dbus interfaces would be very useful:
add_tab (String directory) -> return nothings execute_command(String command) -> return nothing get_tab_name(int tab_number) -> return String with the tab name get_tab_count() -> return integer with the number of currently opened tabs rename_current_tab (String new_tab_name) -> return nothing select_tab (int index_of_tab) -> return nothing show() -> return nothing (causes tilda to show up like if F1 was pressed) hide () -> return nothing (causes tilda to hide)
optionally all of this interfaces could be called from the command line
if we do this i could write an app indicator like i did with guake (just google guake-indicator if interested )
What do you think?
Greetings all, I'm very interested in this topic since Nividia still freezes everything when I use suspend - It is just a cross to bear ~sigh~. And so, I can recommend
- xdotool ... https://github.com/jordansissel/xdotool
You can send the famous [CTRL]-T (aka: [CTRL]-[SHIFT]-t) like so to open a new TAB: xdotool key ctrl+T
I suggest some of the ideas floated herein can be delivered quite simply / robustly with this tool in a start-up script of some kind.
For instance, I made a _mini-_script called: tab-title
to set the label for Tilda tabs, using the escape command:
newTitle=$1
echo -e "\x1B]2;${newTitle}\x07 tab --> [${newTitle}]"
So (what-)if my ~/.bashrc
and a helper script or two ...
- Has a start script on the Tilda config or command line
- Can be trained to set a TITLE env variable and the title for new Tilda tabs;
- They (scripts) can know the "name"-of the current tab -- And so identify a "context"
- One may also execute a designated script based on the TAB-name from
~/.bashrc
or even/etc/bash.bashrc
... well I guess that's going to get things closer to an auto-start kind of script based on the TAB-s name/function; not just an "ordering" scheme.
note -- Using a CALL-BY-NAME scheme, as outlined can be very powerful, and can give interesting results even for experienced practitioners of such Dark Arts
What's the currently most recommended way to do this? xdotool?
xdotool key --window "$(xdotool search --class Tilda | head -1)" Ctrl+Shift+t
it doesn't seem to do anything at all on my arch :/