Posts Tagged ‘desktop’

Galactifying my desktop

Saturday, May 16th, 2009

I stumbled across a blog post today which described how to “insert” a terminal onto your Compiz desktop. Naturally I became all giddy over the idea since all these tv-shows, which present computers where the desktop is alive with various kinds of fictional data which flow by, has totally corrupted me, so I got to work setting it up per the instructions.

My previous wallpaper (white and black, and various shades of gray) didn’t make font-color selection easy, which ended up with me replacing the old wallpaper, with the beautiful Tricia Helfer (wallpaper).

Which got me thinking further, that I could do something funny with this terminal, and since my desktop was already taking on a strong feel of Battlestar Galactica (well, number six at least) I could have the terminal reinforce that feeling.

So, terminal font-color: red. Then I had another thought. Inside the .bashrc configuration file there is a small snippet of code which sets the PS1 variable to various things. Pontus has modified his, and helped me modify my, PS1 variable so that each terminal prompt now reads:

[username] [pwd]

Therefore it shouldn’t be that hard for me to modify it to look for this particular terminal-instance and output an altogether different prompt, say along the lines of:

By your command

This turned out to be a rather hard nut to crack actually. I figured I could write a shell script which would launch the terminal, with a correct set of parameters, and one of these parameters, in turn, would be another shell script to execute upon creation of the terminal window. The first shell script could then be called upon by the session manager at login.

That was the theory anyway. Actually getting it to perform all these things was less than easy. The shell script to be executed by the terminal wouldn’t conform (although this might have been my own ignorance putting a stop to it).

I won’t drag on about all the various ways I tried to fix this, in the end Pontus arrived and saved the day ;D

His solution: create a clone of the .bashrc file, change the PS1 variable modification in it to whatever I wanted (“By your command”), then have the session manager execute the following command:

gnome-terminal --window-with-profile=trans -x bash --rcfile ~/.nrsixrc

(where .nrsixrc is the cloned .bashrc file, containing the modified PS1 variable)

For interested parties, the interesting line in .nrsixrc is this one:

PS1='\nBy your command\n> '

And here’s the result:

by_your_command1 Oi! Stop ogling the b00bies and focus your attention at the upper left corner! I don’t know about you, but I find it pretty neat.

The one thing I have a hard time figuring out however, is why the terminal won’t either die, or recover, if I by accident forget myself and try to close that terminal. It will just “hang” and my two options at that time is to either use xkill (which coincidentally will also kill the terminal with which I initialize xkill) or do a killall gnome-terminal. None of these alternatives are especially attractive, and I can for the live of me not figure out why that is. But for the time being it will do just fine.