I want Ubuntu to open a terminal in the lower right corner when I log in, with the always on top mode enabled. I have made a script which does this when I run it from a terminal, but it does not work when I run the script by using Startup Applications. The window appears in the right spot, but always on top is not enabled. Below is my script.

gnome-terminal --title="abvtrm" --geometry 80x10-0--255
wmctrl -a abvtrm -b add,above

The idea is that I want to force the name of the window into being something I decide, so I have a name to refer to for wmctrl. I have noticed that if I run the command

wmctrl -a abvtrm -b add,above

manually in a terminal (after logging, having the window present but not in always on top mode), it has no effect, which suggests to me that for some reason I am not allowed to pick a name for the window when working through Startup Applications.

I call the script by envoking the command

bash myscriptname.sh

Bonus question: Intuition tells me that in order to have the window appear in the bottom right, I should put

gnome-terminal --title="abvtrm" --geometry 80x10-0-0

but when I do this, the window ends up somewhere in the mid-right area of my screen. Why is this?

  • OK First your window open fine bottom right like you want, but the code for the wmctrl always on top will not work at all for me I tried it in a script as different commands at start up, there is no error but it does not work, please show me where you got this code thwmctrl -a abvtrm -b add,above
    – Mark Kirby
    Aug 26 '14 at 11:27
  • @Mark your comment is quite confusing, what is the end but?
    – Tim
    Aug 26 '14 at 11:34
  • @Tim he wants it in the right bottom..
    – AlexGreg
    Aug 26 '14 at 11:38
  • @Tim I don't see end but, did you meen bit, in that case I meant which website or forum etc did find his code on. So I can review it. But I think I found it. linuxquestions.org/questions/linux-newbie-8/…
    – Mark Kirby
    Aug 26 '14 at 11:53

OK here is a real fix first open a terminal

sudo gedit~/.bashrc

Find this section and add a # to the line like in the code I pasted below, this will let you chane the names of terminals and your original code is fine.

case "$TERM" in
    # JEFFYEE REMOVED because it makes commands to title() not work
    #PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"

Here is my source, but tested and working by me.

  • Using your old answer, I found that it worked if I put in a small sleep time between opening the terminal and imposing the 'always on top' mode. You are completely correct that I simply was not changing the name of the terminal. I am a bit confused that my original code worked when I ran it from a terminal. I am sure the new answer also works (since it solves the problem of not being able to rename the terminal), but for now I am satisfied with not changing the name. Thanks a lot for the help! Aug 26 '14 at 12:16
  • The new answer will make it perfect for you all you have to do is put 1 # in a file and you are done, you can change the names
    – Mark Kirby
    Aug 26 '14 at 12:18
  • I still think I need the small sleep time between the two commands though. Aug 26 '14 at 12:19
  • Yes keep it if it works for you, add that to your original script, do the new answer and you can open as many terminals with as many names as you want
    – Mark Kirby
    Aug 26 '14 at 12:21
  • I did as you suggested and this certainly works. I still need the sleep time, which I think is a bit weird since I don't need it when running the script from the terminal, but whatever works, right? Again, thanks a bunch! Aug 26 '14 at 12:33


wmctrl -r :ACTIVE: -b toggle,above

use toggle instead of add (reason : Source)

For bottom right, i am working and will update this answer.

  • for bottom right I used gnome-terminal --title="abvtrm" --geometry 80x10-0+10000
    – AlexGreg
    Aug 26 '14 at 11:40
  • The source doesn't explain the reason.
    – Tim
    Aug 26 '14 at 11:40
  • @Alex that only goes to the bottom of my first screen - not the second. Do you know why?
    – Tim
    Aug 26 '14 at 11:41
  • 'cause it goes to the bottom of the current active screen
    – AlexGreg
    Aug 26 '14 at 11:44
  • I tried this before and it did not work for me. It works (for me) when done in a terminal, but not when done at login. Aug 26 '14 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.