Ubuntu – Can we control a terminal-window size from a ‘.desktop’ file

desktopgnome-terminalresizescriptswindow

The .desktop file opens a python script in the terminal. (with 'Exec' and Terminal = true). Could any other parameters be included so as to open the gnome-terminal in a specific profile or a particular window size?

Best Answer

  • In this case, it is not necessary to use Terminal=true in your .desktop file. To open your python script in gnome-terminal with a specific profile or a particular window size you can use:

    Exec=gnome-terminal --profile=Profile_name --geometry=widthxheight -e '/path/to/script.py'
    

    You have more other options if you look at man gnome-terminal.

    Also, be sure that you have this two lines at the end of your python script if you want to keep the terminal open after the execution of the script is finished:

    import os            # Use this line only if you have not already imported the os module
    os.system("$SHELL")