How can I set gnome-terminal's X and Y startup position?

I don't think there's such a file: such a setting doesn't show up at all, neither in gnome-terminal's preferences nor in gnome-terminal's profile preferences.

However, even though you can't directly set how gnome-terminal starts, you can always set how your system invokes gnome-terminal:

cp /usr/share/applications/gnome-terminal.desktop ~/.local/share/applications
sed -i 's/^Exec=gnome-terminal$/& --geometry=80x24+100+100/' ~/.local/share/applications/gnome-terminal.desktop
gsettings set org.gnome.desktop.default-applications.terminal exec 'gnome-terminal --geometry=80x24+100+100'
  • cp /usr/share/applications/gnome-terminal.desktop ~/.local/share/applications: copies /usr/share/applications/gnome-terminal.desktop in ~/.local/share/applications, i.e. it creates a user-specific version of the system-wide gnome-terminal's desktop file;
  • sed -i 's/^Exec=gnome-terminal$/& --geometry=80x24+100+100/' ~/.local/share/applications/gnome-terminal.desktop: changes the line Exec=gnome-terminal in the user-specific version of the system-wide gnome-terminal's desktop file to Exec=gnome-terminal --geometry=80x24+100+100;
  • gsettings set org.gnome.desktop.default-applications.terminal exec 'gnome-terminal --geometry=80x24+100+100': changes dconf's settings so to tell the desktop environment to run gnome-terminal --geometry=80x24+100+100 instead of gnome-terminal when hitting CTRL+ALT+T.

To revert:

rm ~/.local/share/applications/gnome-terminal.desktop
gsettings set org.gnome.desktop.default-applications.terminal exec 'gnome-terminal'

I have also been annoyed by the terminal window popping up in random locations, and it was compounded by the fact that I have multiple monitors flipped vertically and each time the bash terminal would appear at the very top of my screen causing me to have to drag it down to the bottom of the screen, so finally I had to do something about it to fix this issue.

Also, using the solution provided above(making a custom gnome-terminal.desktop file) does not fix the issue in nearly all the cases, like when you right-click on the desktop to launch the Terminal using the "Open Terminal" menu (which I do quite frequently), or if you do "Terminal->New Terminal" from the Terminal's menu, or if you use the hotkey from within the terminal to launch a new window. It does work if you only launch a terminal by clicking the desktop button but for me that was insufficient. So I came up with a solution that would fix this issue and dynamically place the Terminal window at your current pointer position.

I wrote a little bash script that you can put at the very end of your ~/.bashrc and it positions any Terminal window you open at the $X and $Y position of your current mouse pointer position. The script should work right out of the box if you're using the Unity display manager (should just work with other DMs but you might have to tweak the script) and running Ubuntu 16.x (tested on on 16.04).

You'll first need to make sure you install wmctrl and xdotool in a shell type:

sudo apt-get install wmctrl xdotool

Here is the script, copy/paste it using a text editor into the end of your .bashrc file in your home directory:

# This opens new terminal windows at the specified window size
# positioned at your current mouse position on screen 
# On 16.04 Terminals were defaulting to the TOP OF THE SCREEN and 
# since I have vertical 4k monitors this was driving me crazy. 
# This is a good little hack to fix all instances of gnome-terminal
# some which are baked into a core .so like the desktop "Open Terminal" 
# menu for example.  This is fun and should work in all cases :)
#
if [ -n "$XDG_CURRENT_DESKTOP" ] && [ -z ${GIO_LAUNCHED_DESKTOP_FILE+x} ]; 
then
    ###
    # change these to whatever resolution you want
    # the shell width and height to be in pixels:
    xWinWidth=1000
    yWinHeight=750

    xScreenRes=$(xdpyinfo  | grep dimensions | uniq | awk '{print $2}' | cut -d 'x' -f1)
    yScreenRes=$(xdpyinfo  | grep dimensions | uniq | awk '{print $2}' | cut -d 'x' -f2)

    #cool cmd to get mouse postion, returns result into $X and $Y:  
    eval $(xdotool getmouselocation --shell)

    # make sure window's x width stays on screen:
    if(( $(expr $xWinWidth + $X) > xScreenRes ));
    then
        X=$(expr $xScreenRes - $xWinWidth + 30)
    fi

    # make sure the window height stays on screen:
    if(( $(expr $yWinHeight + $Y) > yScreenRes ));
    then
        Y=$(expr $yScreenRes - $yWinHeight + 60)
    fi

    # set the current active window positon which, since this
    # is being run from .bashrc is always the terminal window!
    wmctrl -r :ACTIVE: -e 0,"$X","$Y","$xWinWidth","$yWinHeight"
                         #0,left, top,width,height  
fi