2009-05-19
For a while now, after starting my computer and launching a terminal, I've been maximizing and undecorating the terminal window. Unfortunately, I was unable to find a way to use command line arguments to launch my current favorite terminal: Sakura, in maximized and undecorated mode. To put it simply, I had three options:
I elected for "code my own app" and I called it muterm because it is a (m)aximized (u)ndecorated (term)inal emulator. This would also be a good introduction for anyone interested in adding a terminal emulator to a Vala project.
Here is my main.vala code:
The code is compiled with:
It took me a while to realize that I didn't need to have values for all of the Vte.Terminal.fork_command() function. Howerver, I should allow passing a directory as an arguement and have muterm start in that directory as the `pwd`. Copying and pasting text in the terminal would also be a great idea. Maybe, we'll see what the future holds.
I'd show a screenshot, but really, how different do terminals really look?
- Try to find another terminal app that does what I need
- Edit the Sakura soure code to add the maximize and undecorate option
- Code my own app
I elected for "code my own app" and I called it muterm because it is a (m)aximized (u)ndecorated (term)inal emulator. This would also be a good introduction for anyone interested in adding a terminal emulator to a Vala project.
Here is my main.vala code:
using Gtk; using Vte; private class Term { private Term() { //start with a gtk window Window w; //we also need a vte terminal Terminal term; //create our new window w = new Window(Gtk.WindowType.TOPLEVEL); //create the new terminal term = new Terminal(); //connect exiting on the terminal with quiting the app term.child_exited.connect ( (t)=> { Gtk.main_quit(); } ); //fork a command to run when the terminal is started term.fork_command(null,null,null,null, true, true,true); //add the terminal to the window w.add(term); //maximize the window w.maximize(); //undecorate the window w.set_decorated(false); //try to set the icon try{ w.set_icon_from_file("/usr/share/pixmaps/gnome-term.png"); }catch(Error er) { //we don't really need to print this error stdout.printf(er.message); } //show our window and all children of our window w.show_all(); } private void run() { //start the gtk mainloop Gtk.main(); } private static void main(string[] args) { Term t; Gtk.init(ref args); t = new Term(); t.run(); } }
The code is compiled with:
valac --pkg gtk+-2.0 --pkg vte main.vala -o muterm
It took me a while to realize that I didn't need to have values for all of the Vte.Terminal.fork_command() function. Howerver, I should allow passing a directory as an arguement and have muterm start in that directory as the `pwd`. Copying and pasting text in the terminal would also be a great idea. Maybe, we'll see what the future holds.
I'd show a screenshot, but really, how different do terminals really look?
term.set_backspace_binding(TerminalEraseBinding.ASCII_BACKSPACE);