Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, November 12, 2012

Setting up multiple Firefox profiles in Ubuntu 12.04 and Windows 7

Introduction

One of the more underrated features of the Firefox Web Browser is the ability to set up different user profiles.

This feature comes quite a bit in handy when you have different people using the same computer, but don't require the overhead of setting up separate user accounts for each individual using it.

Setting up separate profiles allows multiple people to have Firefox configured the way they like it: with different bookmarks, saved passwords,  personal history, and so on.

Plenty of people like to keep their browsers signed in to the services they like for convenience (not having to keep signing back in), but when multiple people share a computer, signing people in and out all the time can be a hassle. Enter Profiles, unique "Firefox's" (so to speak) for each person. On my system, I have three profiles: One of myself, one for my better half, and one for guests which uses Firefox In-Private mode so their personal passwords, etc., are not tracked. You could even have different profiles for work and personal use, if you choose.

Firefox profiles are very easy to set up and manage, in today's post, I'll show you how to set them up on both Ubuntu 12.04 and Windows 7.

Ubuntu 12.04

I'll start off with a few assumptions here: You already have one Firefox profile set up and one short cut in your Unity Launcher (or other launcher of your choice). This is how Ubuntu comes by default, so it's not too crazy to assume this. If for some reason this isn't the case, you can easily install Firefox with the Ubuntu Software Center. Also, we'll assume that your secondary profiles (for other users), will also be accessed from the Unity launcher.

Creating new profiles

Before adding the new Firefox sessions to the Ubuntu browser, we'll have to set them up in Firefox first. First, launch a Terminal. Then, from the command line, run:

firefox -no-remote -ProfileManager

Most likely, you already have one profile named something like "Default". Feel free to keep this named Default, or rename it to your own name. Just remember whatever name you give it.

To make a new profile, click the "Create Profile" button:



Firefox will give you some data about profiles (pretty much what I summed up above), and then you can click "Next" and enter a name for the new profile. You can also change the directory the profile is stored, although most likely the default will be sufficient.

Create as many profiles as you desire, remembering the name for each. When you are done, close the Profile Manager.

Setting up different launchers for each Profile

There are actually two different ways you could go about this. You could just keep using your single Firefox launcher, but have it ask on launch what profile to use. To do this, from the Profile Manager, simply uncheck "Don't ask on startup". This will allow you to pick which profile you want each time you start.

But personally, I prefer to have a separate Unity launcher for each profile. This allows each person to access their own profile with just a single click. This is pretty each to set up, but also requires some more Terminal to work. Basically, we're going to change the default launcher to open one profile (your own for instance), then make new launchers for the other profiles.

From Terminal, navigate to:

/usr/share/applications

Here, you'll find all (or at least most) of the launchers used by Ubuntu and Unity, there should be one for Firefox called "firefox.desktop". Open it in your favourite text editor (with root access).

There is a lot of stuff in here, but you only have to make a very minor change or two. Look in the file for the lines beginning with "Exec=". This is the command which is executed when the launcher is run. For example:

Exec=firefox %u

To make it launch a specific profile, use the -P flag:


Exec=firefox -no-remote -P Jason %u

The "-no-remote" flag causes Firefox to launch it's own process rather than trying to connect to an existing process. This way, we can have different Firefox sessions with each profile open simultaneously. Make the change to all Exec lines in the file and save.

Pro-Tip: You might notice upon saving that the Firefox icon disappears from the Unity launcher. If it does, no sweat. Just open /usr/share/applications in Nautilus, find the "firefox.desktop" file, and drag it over to the Unity launcher. Keep Nautilus open since you'll need to do this for subsequent launchers.



To make a new launcher for another profile, just copy the firefox.desktop file to a different name, e.g. "profile2_firefox.desktop". Open it in a text editor and make the same changes to the "Exec" line. But don't save yet.

In order for Unity to isolate this launcher from the original, it's important that you also change the "Name=" line. For example, change:

Name=Firefox Web Browser

to something more personal like:

Name=Profile2_Firefox

Do this for all instances of "Name".

You can also change the icon easily too, so there aren't two Firefox icons in the Launcher. To do this, change the "Icon=" from:

Icon=firefox

To something else. One icon I like looks like a small picture of the planet:

Icon=/usr/share/icons/gnome/48x48/emblems/emblem-web.png

But feel free to poke around /usr/share/icons and find one you like better!

Finally, once you've saved the launcher, don't forget to to to /usr/share/applications on Nautilus and drag it over to the Unity launcher!

That's about it, just repeat the process for each profile you want. If you'd like a "Private" session to use (to avoid tracking passwords, etc), use the "-private" flag in your Exec line.

You can also keep using a "default" Firefox icon if you wish. This will cause the last profile to be launched which was launched with the ProfileManager. One might want to do this if you frequently launch links from other other applications (e.g. Thunderbird). In this case, just keep the default Firefox icon using the most frequently used profile (your own), but use alternate icons to launch other profiles.

Pro-Tip: I also set up a keyboard shortcut to launch the Guest Firefox session. To do this, just make a script (in the "Home", or "Home/Scripts" folder for example) with the following content:


firefox -P Guest -no-remote -private

Replace "Guest" with whatever you might have named the Guest profile. Save, then right click on the file and go to "Properties", then the "Permissions" tab. Check "Allow executing this file as a program":



Now, launch the HUD and type "keyboard". Open the Keyboard settings and go to "Shortcuts". Under "Custom Shortcuts" click the "+" button. Give it a name, and point the command to your script. Click Apply. To active the new short cut, click on where it says "Disabled", then hit the key combination you want to trigger it (for example CTRL-ALT-P). Now try hitting CTRL-ALT-P and you should see the private Guest profile launch.



Windows 7

The process in Windows 7 is quite similar, but seems to be less flexible then Ubuntu.

To open the ProfileManager in Windows 7, hit Win+R to open the Run menu. Then, type "firefox -no-remote -p" to open the Profile manager.

Create your Profiles exactly as described above.You can also un-check "Don't ask at start up" if you want to pick the profile to use every time.

Assuming to have your Firefox icon docked on the Start Bar (a.k.a. Task Bar), you can continue to just click on that icon, which will launch whatever the last profile started with the Profile Manager was. Unfortunately, I haven't figured out how to make the docked Firefox icon always start a specific profile (but if you know, please mention it in the comments).

You also also create shortcuts to launch other Firefox profiles. To do this, from the Desktop, Right-click and say "New->Shortcut". Use "Browse" to select the Firefox executable (you'll likely find it near C:\Program Files (x86)\Mozilla Firefox").

But before saving it, make the following change:

Before: "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -no-remote -P "Profile1"

Where "Profile1" is the name of an alternate profile.

You can make as many of these on the Desktop as you want, and even drag them into the Start Menu. Unfortunately, the Start Bar only seems to allow us to have a single icon, which launches whatever was last launched with the ProfileManager. I'm not sure why this is, but it's a limitation we'll have to live with for now (again, if you have any advice, please let us know).


Hopefully this is a feature of Firefox you'll find useful, I certainly do. Just one of the things that makes Firefox such a great browser!

One final tip: You can protect your saved passwords in Firefox by using a Master Password. This can come in handy in case your computer is ever stolen or its security otherwise compromised.





Sunday, June 24, 2012

A few Myth TV tips for Ubuntu 12.04

Good morning all!

I've been using MythTV 0.25 on Ubuntu 12.04 for a little over a month now, and while pleased overall, there were a few annoyances that caused me to scour the Interwebs for a solution. Things are working better now, so I wanted to share my tips for others out there!

1) Legacy Full Screen Support

If you are using Ubuntu with Unity, you may notice the MythTV interface doesn't completely go "full screen". That is, it's somewhat shadowed by the Unity bar and top bar.

To fix this, you'll need the CompizConfig Settings Manager. I don't think this is installed by default, so find it in the Ubuntu Software Center. Note that this is an advanced tool to mess with your settings, and while there is some pretty cool stuff in here, do be careful.

To get MythTV full screen over the Ubuntu panels, use "Legacy Full Screen" support.

1) Under CompizConfig Settings Manager, go to "Utility"
2) Go to "Work arounds"
3) Check "Legacy Full Screen" support.

After that, your MythTV should go properly full screen. Restart if necessary.

Reference: http://www.thegoss.com.au/content/ubuntu-1204-precise-pangolin-mythtv

2) Mythfilldatabase takes forever to run

(Note: These seems to have been fixed in a recent version of mythfilldatabase. A fresh MythTV install on Ubuntu 12.04 seems to no longer have this issue, but the instructions are still here for reference).

One bizarre thing I noticed is that mythfilldatabase never seems to end (actually, my girlfriend pointed out that hard drive was clicking loudly causing me to investigate and finding mythfilldatabase and mysql hogging the I/O. Hint: iotop is a cool program).

This is apparently due to a mythfilldatabase bug, and is fixed in the newest builds, but if you need a work around, here it is:

1) Set up a TMPFS for /tmp
Add the following to '/etc/fstab':

tmpfs   /tmp   tmpfs   nodev,nosuid    0 0

2) Change MYSQL configuration parameter:

Add the following to '/etc/mysql/conf.d/mythtv.cn':

default_storage_engine=MyISAM

Note: It's important to know that in step 1, you are actually switching your /tmp to a TMPFS file system. This means that any data written to /tmp is written to your RAM, and not to your hard disk as usual.

This can have both positive and negative consequences.

Using a tmpfs for /tmp can have some all around nice performance improvements since writing to RAM is far faster than writing to disc. Therefore, programs using /tmp will have their write operations quicker, therefore improving performance.

The downside is that the side of /tmp will be limited to the size of available RAM. This can be issue if /tmp ever becomes full, writes will fail. So, if you run into this issue, your programs may stop working.

If this becomes a recurring problem, you might need to revert your /tmp back to the HD and use the bug fixed version of mythfilldatabase. But, I've been using /tmp as a tmpfs for a good month now and have had no ill effects with moderate usage (I also have 6GB of RAM...just saying.)

Tip: Keep track of /tmp usage with the df command on the command line. Mine is currently only at 1% full.

References:
http://ubuntuforums.org/showthread.php?t=1991684
http://ubuntuforums.org/showpost.php?p=11918589&postcount=35

3) Mythweb PHP errors

I noticed some unusual errors in Mythweb. Simple functions like setting up recordings didn't seem to take, and there were some php error message along the top of some of the pages. This was a bit irritating to fix.

Rather than repeat everything I did, I'll just point you to the official ticket:
http://code.mythtv.org/trac/ticket/10142

I just manually clicked on the individual *.patch files and applied the changes by hand. There's probably a better way to do it, but that worked for me. Hope you find it useful.

4) A new Remove_Commercials script

My first attempt to use my old remove_commercials script failed miserably. Not surprising, since some of the command line parameters changed between versions. But, there's an updated one you can use here:

http://www.mythtv.org/wiki/Script_-_RemoveCommercials 

The script didn't quite work out of the box for me. A few tweaks I made:

1) Replacing all of the usages of $START with "$START"
2) Adding --user=mythtv --password=PASSWORD (where PASSWORD is your mysql password, from the mythbackend settings) to the mysql command
3) You might also get better results if you use -f on mythcommflag instead of --chanid and --starttime, but if they work for you then great.

I'm still playing with the commercial cut script a bit, so I may make some more updates, but hopefully that'll give you something to start with.




One issue I still have is the display mythfrontend runs on. I haven't yet been able to control what display it opens on from the command line as setting $DISPLAY has no effect. But I'll keep trying!

If you have any of your own tips, let us know. Take care, and have a great day!

Tuesday, May 29, 2012

Ubuntu 12.04: The Good. The Bad. The (Not So?) Ugly.

Hello friends!

I recently upgraded by home PC from Ubuntu 10.04 to Ubuntu 12.04. I decided to make a hardware change as well, specifically, upgrading my primary hard drive from a 320GB SATA to a 2TB SATA.

Now, I didn't actually "upgrade" the 10.04 to Ubuntu 12.04 in place, I installed a fresh copy of Ubuntu 12.04 on the 2TB drive and manually migrated my programs, settings and files over to the new system. I personally like to start with fresh installs when possible, and given all the custom modifications I had made to my system, I feared an upgrade would cause more problems then it was worth (if you've had a different experience, let us know).

I didn't take the choice of upgrading to Ubuntu 12.04 lightly. I knew I would have to upgrade 10.04 sooner or later, only having a year 10.04 support left, and didn't want to let it go until the last minute. Having heard a lot of dislike between versions 10.10, 11.04, and 11.10 (the Unity UI for example), I seriously considered switching to another distribution such as Linux Mint.

In the end, I decided to give Ubuntu 12.04 a try. From looking at the screen shots and reading the design philosophy, I decided Unity was worth a try. Even if I didn't like it, I knew I could always install another desktop on top, like classic GNOME, Cinnamon, or GNOME 3, without having to switch distros.

So far, I'm happy with what I see, and think I'll be sticking around with Ubuntu, at least for now. The future is always open though!

The Good


Off the bat, a lot of 12.04, including the GUI, impressed me. Install and format process was very fast, even on the 2TB drive. I haven't tried setting up a dual boot system (Linux only) but that has been extremely easy since at least 9.10 so assuming it's been kept up to date with newer versions of other OS's, I don't imagine much of an issue.

Nvidia Binary Drivers


Nvidia Binary Drivers were detected and installed out of the box, no configuration needed. This gave me access to 3D acceleration and advanced multi-display configuration - a must have for a HTPC. I did use the Hardware Drivers option to upgrade to the "bleeding edge" drivers, though rather this was necessary or not, I'm not sure.

HDMI Audio Support


Remember this post? Thanks to an updated ALSA, HDMI Audio worked out of the box too. They also fixed the under-enumeration problem present in 10.04. I immediately had a (single) HDMI audio option in the Sound Devices that I could select and move back and forth seemlessly, no fuss. Success!

New MythTV & HVR1600 support


Since one of the main purposes of the my machine is to use as a HTPC and DVR, I installed MythTV straight from the repositories, and no issues setting up my card. Just don't forget to add you cx18.conf file to /etc/modprobe.d :)

Webcam Support

In 10.04 I was never quite able to get my Webcam and my HVR1600 working together. In 12.04, they seem to both work happily, though I haven't tried unplugging the webcam yet (that may still cause some issues to be aware of)

Improved Third Party Software

Firefox and Thunderbird are installed by default. Maybe you don't like them, but I do. Skype works fairly well and is easily installable. The Ubuntu Software Center is really nice, so far I haven't had any need to use another package manager (though I may need to at some point).

The Bad


USB3.0


I never got USB3.0 working reliably on 10.04, and 12.04 doesn't seem to have improved much. Although the Linux kernel officially supports USB3.0, I'm guessing the there is something amiss with the drivers for my specific chipset (the 3.0 ports are build into the motherboard). I am certain the ports, cords and external hard drive are all USB3.0, but I've never gotten any more then a sustained 60 MB/sec (480Mb/sec, USB2.0) transfer speeds when connected to the USB3.0 ports. Worse, I get sporadic "unmounting" of the USB drive when connected over 3.0, and cannot remount without restarting the computer. I realize this is likely the fault of a driver, or missing kernel module (and less Ubuntu), but it's still irritating. Hopefully I can figure out the bottle neck and start getting reliable USB 3.0 support.

Flash

So basically, YouTube videos have a blueish tint. Yep, you heard me right. Apparently, this is a bug in Flash,  but since Adobe has officially discontinued Flash for Linux, with 11.2 being the last version, it is unlikely the bug will be fixed. Now, there are workarounds, the easiest being to disable hardware acceleration,  but come on, something like this shouldn't be necessary as now I have to drive my CPU hotter. 

Another bizarre issue with Flash if you are using dual desktops: Full screen sometimes only appears on your *primary* display, even if the originating window was on the second. Now, I didn't have this problem with YouTube (full screen was on the correct display), but I did have this problem with sites that used their own custom player based on Flash, such as video from the sites of TV Networks. I found a work around for this using gDevilspie (see this thread). But this only addressed the *position* of the window, *not* the size. so unless the two displays were running at the resolution, the full screen was cropped and I could only see the top-left portion. My only work around of this (for now) is to run both displays at the same resolution. 

Hopefully with Flash for Linux discontinued, Canonical (or someone out there) will do the right thing and take over the reigns of support Flash going into the future. Even if you wish Flash would just die, pretending it's already dead is not the solution to a good user experience.

LIRC

LIRC is a great program, unless your card just happens to not be supported. This isn't LIRC's fault, it tries its best, but for legal reasons there are certain remote they just can't support. Getting LIRC to work for my HVR1600 card was a *huge* pain on 10.04, requiring me to build a custom kernel module. I did eventually get it, but if memory serves, it took several months.

Unfortunately, my card *still* isn't supported in the newest version of LIRC with 12.04. Likely, it never will. On 10.04, I was able to build the kernel module thanks to the lirc-modules-source package and a very nice Fedora user, but it wasn't fun. Unfortunately, it appears lirc-modules-source is not available for 12.04! So until it is, I can't update the patch for 12.04, nor build my kernel module or use my IR Blaster/Receiver.

UPDATE!  I *have* gotten LIRC for my HVR1600 card working on 12.04! Without too much difficulty. I happened across a pre-complied version of the necessary module, lirc_zilog, here inside of a DEB file (32 and 64-bit versions available). I'll post a more comprehensive tutorial as soon as I have a spare moment :).

The (Not So?) Ugly

Unity

Hey, I like it. Been using it for a few weeks now and I find it pretty fluid and easy to use. The HUD feature is very cool. Now, now, I know what you are thinking...that damn Unity bar is glued to the left side!!! While I agree that, in principle, this was a poor choice on the part of the Unity developers, you have to remember that Unity is just one desktop environment. You aren't forced to use it, and there are even forks out there (or could fire one up yourself) to get it on the bottom if it's really important to you. Or use an alternative like Cairo dock, or another desktop environment. So it's not really a reason to abandon the distribution altogether, at least IMHO. And if you give it try, you might just like it too. While I do hope they add an supported option to move it in the future, for now I can deal.

X-Session Weirdness

In Ubuntu 10.04, I ran GNOME on two separate X-sessions, one of the PC display, and one of the TV display. I liked this better then running a single display on both, since applications seemed to handle it better (e.g. full screen Flash), even though it meant you couldn't move windows between displays (no biggie to me).

When I enabled dual X-sessions (with the Nvidia-config tool) in 12.04, I was very confused. On one display was the normal Ubuntu desktop, but on the other was just a pure white background with a "X" for a cursor. Obviously 12.04/Unity wasn't designed to handle dual X-sessions this way.

So, I flipped over to Twinview, to see if I could configure that the way I wanted. To my vast surprise, I found two separate desktops (complete with Launcher and top menu bar) just as if I was using dual X-sessions! But now, I had the ability to move windows between desktops. Pretty cool, considering I had been expecting something similar to way Windows handles extended displays, just making a blank window space on the other monitor, but no separate task bar.

So it seems like they tried to take the best of dual X-sessions and the best of Twinview (extended desktop) and munge them together (as a new form of Twinview). And honestly, it works pretty well, except for two problems I've found so far:

1) The "Flash" full screen issue I mentioned above
2) Applications don't quite "understand" it.

What I mean by #2 is that I'm used to being able to launch an X program on either GUI from the command line simply by setting the "DISPLAY" environment variable. Well, in 12.04 no such luck, the DISPLAY environment variable has the same value (0) regardless of what display you are on. So now, launching applications based on the X-session is a little trickier than it used to be - not a good thing. For the most part, applications do work correctly if you launch them on the correct display, but I haven't yet figured out how to launch an application on a specific display from the command line. Unfortunately, MythTV was one of the applications that didn't quite behave, it was showing up on the primary display regardless of what display I launched it from. No good - I need Myth on my secondary (TV) display. Thankfully I found an option in the MythTV appearance settings which allowed me to choose between display "0" and "1". Setting to 1 put it on the TV display....just as if I had set the environment variable. So there is some support similar to the old methods, but it appears to be application specific.

But sometimes (like when I'm running mythbackend), I *do* want it on the primary display. I used to have separate scripts that I could run for which display I wanted to appear on...but even trying to use the "--display" option on the mythfrontend command line, it goes to whatever display I set it to in the options. So, I have a workaround for now (setting the display option in the settings), but this is irritating...having a way to move it on the command line would be much preferred.

It's only been a few weeks, but so far I like what I see in 12.04 and find it a worthy successor to 10.04 (I usually skip non-LTS versions...due to the work involved with upgrading). So I'll be sticking with Ubuntu for now, and hope others out there enjoy it as well.

Have a great day!

Saturday, May 8, 2010

Upgrading to 10.04? Might need to fix your display settings.

Call me an "early adopter", but I love playing with bleeding edge tech (when I have the cash :) even though it might cause a few buggy issues.

As such I was excited when Ubuntu 10.04 LTS was released just over a week ago. After installing the latest Karmic upgrades, I was presented with a friendly request to upgrade to 10.04 and decided to take it. And as always for Linux, the monetary cost isn't something I need to worry about :).
Link
The Install Process

Installing over my Karmic install was fairly painless, but slow. It had to download about 2.5GB, which surprised me since the install CD's themselves are usually only around 700 MB. The download proceeded smoothly and after a few hours the install began. Again, there wasn't a heck of lot of user interaction on my part, just a few dialogs I needed to answer. After an hour or two more, I was prompted for a reboot to continue.

What the....?

Not sure I was quite prepared for what came next. As you might have seen before in my blog, I have a rather customized Gnome desktop, including a custom Xorg.conf file for extended displays. Upon rebooting, my entire desktop was...rather messed up. It's hard to describe, but the desktop seemed to be flipped 180 degrees, and the icons themselves were inverted. The entire desktop was also completely unresponsive. I couldn't click anything, nor would the keyboard or any of my short cuts respond!


Very strange, though I had an inkling it had to with my various desktop modifications. A close up on the Gnome menu:

What next?

Strange looking, hmmm? That's what I thought. However, this isn't the first time I've totally borked my Gnome desktop, so I knew what I had to do to reset it. I restarted and used grub to enter recovery mode which allowed me to boot into a command line interface (Tip: You can also try CTRL-ALT-F1 to get to a command line).

I then gained root access with a sudo bash command, and made a backup folder. From there, a copied the following four folders: .gnome2, .gconf, .gconfd and .gnome_private into the backup folder (Tip: You can use cp -r to move directories and their contents recursively).

I then used rm -rf to remove each of the folders (Don't do this as root from your / directory lest you delete your entire file system!)

Upon rebooting, Ubuntu decided it needed to do a disk check. Considering my last few hard reboots, this was expected:


After it was finished (~20 minutes), I booted into Gnome. My customized desktop was gone *but* everything was still oddly "inverted":



Still borked, apparently. The only other thing I could think of that might be causing such an odd issue is my custom Xorg.conf file, as these haven't officially been in Ubuntu for a while.

So I booted back into the terminal and removed it. And voila! I was presented with:


First thoughts on 10.04

As Bender would say, we're back baby! I then tried restoring my old Gnome settings from the backup (with the removed Xorg.conf, after backing up the current settings first), though this caused my Gnome to freeze on restart, so I put the old desktop back. Still, if you run into a similar issue, I recommend simply trying to remove your Xorg.conf first before resetting Gnome. I'll spend some time with the new Gnome theme before I decide how I want to customize it. So far it's pretty spiffy, if odd looking, not sure if I'll get used to the window controls being on the left side of the screen! No problems with my wi-fi, connected with no issues. My sound isn't working, though I have yet to figure out why, and I'll need to figure out how to bring back my extended display, such is the price you occasionally pay for trying out the latest and greatest. Still, the OS itself seems solid enough though (blazing fast on this outdated hardware!), and I look forward to playing with it more. Hope this post gives a hand to any others who run into the odd display issue I did!

Saturday, January 30, 2010

Extending your desktop to TV with Karmic Koala

Introduction

Ever since I've been using Ubuntu on my original laptop, I've been having great fun poking and prodding with its configuration, getting it to do some pretty fantastic things! My eventual goal is to turn this machine into a full fledged Linux-based HTPC (Home Theatre PC), and have been working on the project on and off to achieve that goal.

I don't have a high definition television, but the laptop comes equipped with a S-video out port, perfect for connecting the PC to my standard definition television. When I used to run openSuse, I had the proprietary ATI drivers installed and could use aticonfig to turn the extended desktop on and off.

Problems

Since switching to Karmic, I haven't quite been able to get this to work. The ATI drivers don't come installed by default, and they aren't open source anyway. I did make an attempt to install the drivers, but the OS seemed to ignore them and continue to use the open source drivers. I didn't want them unless necessary anyway, but the question remained: how to configure extended desktop without ATI config?

...and solutions!

The answer lies in the X Resize and Rotate Extension (RandR), or xrandr. If you run xrandr from Terminal, you should see something that looks like this:

Screen 0: minimum 320 x 200, current 1280 x 800, maximum 1280 x 1280
VGA-0 disconnected (normal left inverted right x axis y axis)
LVDS connected 1280x800+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1280x800 59.9*+
1280x720 59.9
1152x768 59.8
1024x768 60.0 59.9
800x600 60.3 59.9
640x480 59.9 59.4

On my laptop, LVDS refers to the LCD screen. Listed there are a number of possible resolutions and screen refresh rates.

To activate your S-video out (or VGA), you'll need to add a display mode for it. Use the addmode function of xrandr for this:

xrandr --addmode S-video 800x600

In this case, I want to set an S-video out mode of 800x600 resolution. You should then see the mode if you run xrandr again:

S-video disconnected (normal left inverted right x axis y axis)
800x600 60.3

In order to actually use the S-video out, there are a number of options. The simplest is merely to activate it:

xrandr --output S-video --mode 800x600

But not quite...

This'll clone the desktop onto the S-video out. Unfortunately, since the LCD is running at 1280x800, you'll only see the top-left 800x600 pixels of your LCD display. This isn't particularly useful now is it? You can use the --pos YYYxZZZ option (e.g. --pos 100x100) option to move the output display around, but you'll still always be missing some of the screen.

Unfortunately, it was at this point that I hit a road block. I could clone the output, and move it around, but not get a dedicated output for the S-video out. What I decided to to was alter the command a little, I would turn off the LCD display, set the resolution to 800x600, then send it via the S-video:

xrandr --output LVDS --off --output S-video --mode 800x600

Now, I could have either a 1280x800 desktop on my LCD, or an 800x600 desktop on the TV. Not exactly what I wanted, but still sufficient for watching movies, videos, and even using the desktop on the TV.

Eventually, I realized what had to be done in order to extend the desktop.

  1. Make the "virtual desktop" (amount of screen area) bigger
  2. Use the --pos command to move the S-video output to the right of the LCD desktop.
xrandr has a --fb command for increasing the size of the "Frame Buffer" (the virtual desktop size). Alas, everytime I would try to change it, I'd get an error like this:



xrandr: screen cannot be larger than 1280x1280

Xorg.conf

Doing some searching, it seems the best advice was to configure the virtual desktop size in the Xorg.conf file (so the virtual screen size would be set while X server was starting). But hold on a moment...Ubuntu did away with Xorg.conf files in version 9.10! What to do? I made a few attempts at writing an Xorg.conf file by hand, but was always missing something causing my machine to reboot in "Low Graphics Mode". And my searches for changing the frame buffer without an xorg.conf, including a post on the Ubuntu forums, revealed no results.

Luckily, I found a post today on how to generate an xorg.conf from your current configuration. Essentially:

1. Reboot. When in grub, select to boot in recovery mode.
2. After logging in to a command prompt, run:
sudo Xorg -configure
3. This will create a xorg.conf.new file for you, likely in your home directory.
4. As root, copy this file into your /etc/X11/ folder (remember: back up the old one if there's already one there!)
5. Rename it to xorg.conf
6. Open your favorite editor (you can run startx now and do this from X Windows if you don't want to from the command line)
7. Find the "screen" module.
8. You'll see listed a number of display sections like so:

SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
To the most common ones (or even just the ones you'll use), add the following line:

Virtual 2080 800

9. Save, and restart.

Upon running xrandr at a command line now, you should see your virtual desktop has changed:

Screen 0: minimum 320 x 200, current 1280 x 800, maximum 2080 x 800.


You can now use the --pos to set your S-video output to 1280x0, which will put the video output to the right of the current desktop and Volia! Extended Desktop! You can now drag windows over to it (such as videos), full screen them, move them, even see your desktop effects!

Wrapping it up

To prevent having to use xrandr all the time, I made a few simple scripts for configuring the TV Out.

1. Go into your home folder. Create a folder called "Scripts".
2. We're going to make three scripts:
One for turning the TV out on in Extended Desktop, One for Clone Mode, and one for turning it off. First the deactivate script:
3. First, deactivate: In gedit (or another editor), paste the following into a text file:

xrandr --output LVDS --mode 1280x800 --output S-video --off
This'll deactivate the S-video and make sure your LCD is the main display. Save it as "Deactivate_TV_Out" or something alone those lines.

4. Now, activate in clone mode:

xrandr --addmode S-video 800x600
xrandr --output LVDS --off --output S-video --mode 800x600
and save as "Activate_TV_Out_Clone"

5. Finally, extended mode!

xrandr --addmode S-video 800x600
xrandr --output S-video --mode 800x600 --pos 1280x0

Call it "Activate_TV_Out_Extended"

6. For each file, right click and go to "Properties".

7. Under the permissions tab, click to allow for executing as program.

You can now click each of those to move back and forth between the various mode. Sometimes, you might have to deactivate the TV-out in order to activate it in a different mode. You can make shortcuts to these scripts, or as I did, set keyboard shortcuts:

1. Go to System->Preferences->Keyboard Shortcuts
2. Go to Add.
3. Give the shortcut a name "Activate_TV_Out_Extended", and point command to your script, e.g.
/home/jason/Scripts/Activate_TV_Out_Extended.
4. Do this for each of the other two scripts.

Make sure to use unassigned shortcuts, I used Ctrl-F1, F2 and F3 respectively. I am a bit unsure of including the "xrandr --addmode S-video 800x600" each time the script is run, but it doesn't seem to cause any problems. Without the mode being added, activating the TV out won't work. If I do find a way to keep the mode consistent, I'll update it here. Good luck, I hope others find these instructions useful (provided without any guarantees)! To end my post: something I haven't shown you yet on my blog: Jay's Desktop! I suppose it's about time =P.

Take care everyone!

Friday, January 15, 2010

New Virtual Box version fixes Gnome display issues

Happy Friday!

As a frequent user of virtual machines, I find myself quite impressed with their usefulness. Virtual machines allow you to emulate entire other operating systems within a host operating, called a virtual machine. You can even carry virtual machines with you from computer to computer and always have a custom system set up for your needs. Three common Virtual Machine platforms include Virtual Box, VMWare and Windows Virtual PC.

Due to it's freedom and flexibility, I tend to choose Virtual Box over option options. It has an extensive suite of features including seamless mode, mouse/keyboard integration, various device support and many more. It's also available for free under the personal use and evaluation license, and also has an open source edition.

One minor problem I've been having with Virtual Box involves the GNOME desktop environment used in many Linux distributions including Ubuntu.

The problem being that when one saves the VM execution state, and then resumes that state, the GNOME desktop graphic set (that is, its look and feel) appears to mysteriously change. Here's how it should look (click on the image to enlarge):


and after returning from a saved state:



As you can see, a number of icons have changed including the mail icon, terminal icon, network, sound, recycle bin. I would have to shut down GNOME and restart it (log back in) in order to restore their icons to the normal state.

I spent some time trying to figure out what was causing the odd issue, but to no avail. Nevertheless, I'm happy to report that upgrading to Virtual Box, 3.1.2, appears to fix this issue. Upon resuming from a saved state, the icons are no longer changed, or if they are, will immediately revert to the correct form! Fantastic!