1

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.

#!/bin/bash
gnome-terminal --title="abvtrm" --geometry 80x10-0--255
wmctrl -a abvtrm -b add,above
exit

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?

A J
  • 11,367
  • 17
  • 44
  • 59
  • 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. http://www.linuxquestions.org/questions/linux-newbie-8/is-there-a-always-on-top-option-for-gnome-terminal-809611/ – Mark Kirby Aug 26 '14 at 11:53

2 Answers2

1

Use

wmctrl -r :ACTIVE: -b toggle,above

use toggle instead of add (reason : Source)

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

1

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
xterm*|rxvt*)
    # JEFFYEE REMOVED because it makes commands to title() not work
    #PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

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

Mark Kirby
  • 18,529
  • 19
  • 78
  • 114
  • 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! – Jonas Dahlbæk 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. – Jonas Dahlbæk 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! – Jonas Dahlbæk Aug 26 '14 at 12:33