I'm using Ubuntu 22.04. I have three profiles in my terminal, a default builtin and two I made myself :
My "OCaml" profile has a blue background color among other things :
But when I try to use xdotool
as suggested in the answers from this older question to set my profile programmatically, none of them work :
the background color stays unchanged.
Any ideas ?
Update: Just to be clear, I'm not looking for a way to set my default profile to "OCaml", I want to leave the default as it is, and only use my Ocaml profile when you guessed it, I'm progaramming in the OCaml language. The reason I want to do it programmatically, using the command line, is that as of now, when I start programming in OCaml in my terminal I do two separate things : calling a bash script to setup my OCaml environment and setting the profile to OCaml using the Gnome GUI. I would like to merge those two actions into one to save time.
There's no need to use
xdotool
in this case, asgnome-terminal
accepts a--profile
parameter which will make it spawn a terminal instance with a transient profile.Furthermore, if you signal it the end of the arguments list using
--
,gnome-terminal
will execute the remainder of the command line.As explained in the comments you need to setup your environment by running
cd $CAML_DIR && codium . && dune utop lib
. Putting everything toghether:The
exec bash
bit at the end is what forces the terminal to stay open after the other commands have been executed. If you want to close the original terminal after the fact, you can simply chainexit
to the command above:You could also look into putting the first command into a .desktop file; that way you could have a convenient double-click method of setting up the whole thing without having to spawn (and close) a terminal instance just to set up the environment.