GNOME

Random gnome-terminal profiles (themes) in Ubuntu

Introduction

Does it ever confuse you if you have too many terminals open at once that look alike? Perhaps you’re just looking to express your personality or tickle your brain. In any case, if you’re using the terminal in ubuntu a lot, you may be interested in having random profiles (colors / settings).

The concept of the method is pretty simple, define a hotkey that launches a script that picks a random profile you’ve created and then open the terminal with that profile as a parameter.

Prerequisites

- Compiz or other hotkey script that will allow you to link to a .sh file
- gnome-terminal
- bash

Getting Started

You can figure out what Profiles you have by going to Edit > Profiles in gnome-terminal. You likely only have one, “Default”, unless you’re already actively using terminal profiles. If you only have one, you should create a few, maybe 3 or 4 right now and play with the colors a bit. Important, don’t include spaces in the names of the profiles

The Script

Create a file in your scripts folder (or create a directory if you don’t have one):

mkdir ~/scripts
touch ~/scripts/gnome-terminal.sh && chmod +x ~/scripts/gnome-terminal.sh
gedit ~/scripts/gnome-terminal.sh

Paste the following replacing the Profile names with those of your own (delimited by spaces) and change the number 4 to that of the :

#!/bin/bash
p=( Default Delta Psi Sigma )
gnome-terminal --window-with-profile ${p[$((RANDOM%${#p[@]}))]}

That ugly looking bit right here is a calculation between a random number (echo RANDOM) and the size of the array (${#p[@]}), “random” % “length of array”. Where % means mod, or remainder of the division. (examples: 7%4 = 3; 6%4 = 2; 5%4 = 1; 4 % 4 = 0; 4 % 3 = 1; 321%321= 0).

To illustrate more, play with this code:

r=$RANDOM; echo $r; echo $((r % 4))

This is how we get a random index value for the array. This value is nested inside the array ${p[r]}, where r is the random, within bounds, array index. That array then corresponds with a name of our profile and we pass it as a paramater to gnome-terminal with “–window-with-profile”. So using my define array above, if the random index were “1″, “Delta” would be echoed. If the index were “0″, Default would be.

The Setup

Now, I use compiz with the commands plugin, setting my “command line 0″ to ~/scripts/./gnome-terminal.sh and my “run command 0″ under my key bindings tab to ctrl+alt+t, but you can associate this script with anything you’d like to kick it off. A shortcut icon for example.

May this inspire you to understand, extend and share.

Packages for nautilus you wish were installed by default in ubuntu

Intro

Thanks to a tip I picked up at Tombuntu about nautilus, after following up on a trick to add files to mocp through nautilus scripts trackback link from Hilltop Yodler (great article), when doing a google search for GiS for nautilus-actions (apt-get install nautilus-actions). I learned about 3 kick ass additions to the nautilus menu. I realized Fedora Linux and Linux Mint had some of these in their context menus but didn’t make the connection to ubuntu until now.

On with the Show

sudo apt-get install nautilus-open-terminal nautilus-image-converter nautilus-gksu

for some kick ass options in the context (right click) menu of nautilus (your default file manager in ubuntu). For more information, check out the tombuntu article I linked above.

pkill nautilus

to restart nautilus and have the new packages in your context menu

More

If you’re interested in this, you’ll probably also like my article about nautilus-actions.

screenshot-recordmydesktop-1

Make Screencasts in Ubuntu with gtk-recordmydesktop

Yeah, the name sounds cliche but man oh man is this app slick. Compared to some of the others I tried, this one _just_worked_ and had the options I needed, plus more.

sudo apt-get install gtk-recordmydesktop

screenshot-recordmydesktop-1

You can select a specific window or an arbitrary area and it compresses to ogv automatically.

Here’s a quick video I recorded in seconds — http://z.nexuizninjaz.com/videos/nst.ogv

Reverting two Ubuntu features 'removed' in 9.04

Ubuntu Jaunty 9.04 has many improvements on the prior release of Intrepid 8.10, however 2 things were removed that I didn’t agree with. They are pretty easy to change back so I wanted to share them with you all.

Update Notifier in system tray

I guess the idea behind this change was intended to make updates more obvious… but to power-users like myself, I consider it an annoyance. Every time I’d run apt-get, a “update yo shiz” window would pop up above my terminal and anger me. I’m not the stupid windows user Ubuntu’s starting to treat me like. I just don’t have time for updates that require a restart in the middle of the day when I’m trying to get some work done.

gconftool -s --type bool /apps/update-notifier/auto_launch false

tip from launchpad

Ctrl+Alt+Backspace

This would classically restart X… but for some reason they removed this as well?!?! Whatever, here’s how to fix it.

sudo aptitude install dontzap && sudo dontzap –d

tip from Chris Johnston