Archive

Posts Tagged ‘xorg’

Hardy Heron on the M1530

May 3rd, 2008

So, I upgraded my Ubuntu installation from Gutsy to Hardy today on my precious laptop. It went pretty well except for the nvidia driver. I ended up having to copy one of my old configurations over xorg.conf to actually make it work. Just so anyone who has the same problem again (including myself) can fix it without being really lucky, here’s a link:

A working xorg.conf for Gutsy and Hardy on the M1530

It ends up looking like this:

The above was done with emerald and Compiz Fusion.

Horray!


Uncategorized , , ,

Finding bad JPEGs with Xorg hacks in Ubuntu

November 25th, 2007

So, I have all these JPEGs, and I want to know which ones are corrupt (specifically, ones that end prematurely). qiv will spit out the following to STDERR when it finds one:


Premature end of JPEG file

So, this is nice, except it’s entirely unscriptable. The solution I found was using the following script to the display the images in sequence:


perl -e 'for(glob("*.png *.jpg")){$output = `qiv "$_" 2>&1;`; if($output =~ /Premature/){print $_, "\n";}}'

All this does is mix STDERR with STDOUT for a qiv of the file, and check the output for the word “Premature”. If it finds the word, it prints the filename. Simple.

The only problem is that qiv doesnt have a way to just check whether a JPEG file is corrupt (and if there is a command line utility that does, please let me know). To make it go thru the list, I wrote this little gem:


while(true); do xte "key q"; done

All this does is send the q key to the Xserver infinitely. All I have to do is put focus on the first qiv window to make it and all subsequent qiv windows receive q’s. So, just run it, and click on the window. Then there are lots of flashes, and eventually that perl script will print out the names of the bad files. It’s totally ghetto, but it’s the best I’ve got right now. The point of this post is to hopefully find new ways to do this more programmatically.


Uncategorized , , , , , , , ,

Gutsy Fusion Pain

October 21st, 2007

I couldn’t get my stupid mouse to work properly, so I took action and edited my xorg.conf!


Section "InputDevice"
  Identifier  "Configured Mouse"
  Driver    "mouse"
  Option    "CorePointer"
  Option    "Device"  "/dev/input/mice"
  Option    "Protocol"  "ExplorerPS/2"
  Option    "Buttons"   "7"
  Option    "ZAxisMapping"  "4 5"
  Option    "Emulate3Buttons" "false"
EndSection

Also, Compiz Fusion seemed to keep control of my Windows key after I disabled all it’s bindings for it, and wouldn’t let it go until I restarted X. Oh well, my Amarok rating global hotkeys work again now!

The fonts are a little screwy in Gutsy – I’m going to check someone’s Feisty/Edgy install to see what I have set badly.


Uncategorized , , ,

Automagic blending of wallpapers using RMagick

July 24th, 2007

I wanted a program that let me blend random wallpapers from a directory together and set them every minute with increasing opacity on one image, and then to select a new random image and repeat the process. I did this using RMagick and some Ruby.

Make the following tree:


~/.wallmold/
  current.yml

Fill current.yml with this:


---
file2: someimage
wallpaperdir: wallpaper directory
dissolution: 0.1
file1: anotherimage

Replacing the image names and directory with the proper stuffs, full path on directory and relative on image names. Here’s mine:


---
file2: w09.jpg
wallpaperdir: /home/hank/MyDocs/Wallpapers
dissolution: 0.8
file1: Looking_Forward.jpg

Then, get this, make it executable, and put it somewhere:


#!/usr/bin/env ruby
# Wallmold - a wallpaper melding script
require 'RMagick'
require 'yaml'

class Array
  def randomize
   arr=self.dup
   arr.collect { arr.slice!(rand(arr.length)) }
  end

  def randomize!
   arr=self.dup
   result = arr.collect { arr.slice!(rand(arr.length)) }
   self.replace result
  end
end

# Load State
configpath = "#{ENV['HOME']}/.wallmold/current.yml"
configfile = File.open(configpath, 'r')
config = YAML.load(configfile)
out = "#{ENV['HOME']}/.wallmold/dissolve.jpg"

# Open the Wallpaper directory
dir = Dir.open(config['wallpaperdir'])
newconfig = config

if config['dissolution'] == 0.9
  # Get new images
  files = dir.to_a.randomize

  newconfig['file1'] = config['file2']
  newconfig['file2'] = files.pop
  newconfig['dissolution'] = 0.1
else
  newconfig['file1'] = config['file1']
  newconfig['file2'] = config['file2']
  newconfig['dissolution'] = config['dissolution'] + 0.1
end

bgnd = Magick::Image.read(dir.path+"/"+newconfig['file1']).first
overlay = Magick::Image.read(dir.path+"/"+newconfig['file2']).first

# Make the first image is the same size as the second
bgnd.crop_resized!(overlay.columns, overlay.rows)

composited = bgnd.dissolve(overlay, newconfig['dissolution'])
composited.write(out)

`fbsetbg #{out}`

# Write new config
configfile.close
configfile = File.open(configpath, 'w')
configfile.puts newconfig.to_yaml

Now, just edit your crontab:


* * * * * DISPLAY=:0 ruby -r rubygems /home/hank/bin/wallmold.rb > /dev/null 2>&1

Uncategorized , , , ,

Killing Caps Lock

March 22nd, 2007

As seen here:


    Option  "XkbOptions"    "ctrl:nocaps"

Horray. Awesomeness. Changes the caps lock key to a control key in Linux via xorg.conf.

Uncategorized , , , ,

Xorg Screen Rotation with RandR and Nvidia

January 23rd, 2007

To get rotation to work, jam this into the device section of xorg.conf:


Option “RandRRotation” “true”

Then you can use xrandr to rotate the screen:


xrandr -o left # Also 'normal', 'inverted', and 'right'

It rocks on my 21” Samsung LCD.

Uncategorized ,