Archive for the ‘Linux’ Category

Randomize wallpaper upon KDE login

October 12th 2008

I wanted my wallpaper to change whenever I logged in, but found no easy way to do this. In KDE you can tell it to slideshow the wallpaper, but that’s not what I wanted. Just, when I log, switch to a new wallpaper. I want to say “pick a file randomly out of the files in a directory and set the wallpaper on all the desktops”

So here’s my ruby script.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env ruby
 
require 'rubygems'
require 'getopt/std'
 
module RandomArray
  def random
    self[rand(size)]
  end
end
 
opts = Getopt::Std.getopts("d:n:")
 
raise "No directory given. Use #{__FILE__} -d <directory> -n <number of desktops>" unless opts.include?('d')
raise "No desktop count given. Use #{__FILE__} -d <directory> -n <number of desktops>" unless opts.include?('n')
 
DIR = opts['d']
 
image = Dir.entries(DIR).map do |e|
  "#{DIR}#{File::Separator}#{e}"
end.reject do |e|
  File.directory?(e)
end.extend(RandomArray).random
 
1.upto(opts['n'].to_i) do |i|
  system("dcop kdesktop KBackgroundIface setWallpaper #{i} #{image} 8")
end

I realize python has some dcop stuff and you can sort of just call it, and ruby probably does too, but I couldn’t find good docs on any of that, and I just found the command line thing to call, so I hacked this up in ruby, and it works quite well.

I realize the reject should really be done before the map, and originally had it like that, but then the File.directory? call was more complicated, so I changed it to this.

Make a bash script in ~/.kde/Autostart and add the following.

1
2
3
#!/usr/bin/env bash
 
random-wp.rb -d $HOME/wallpaper -n 4

I have 4 workspaces, hence the 4 at the end. Alter appropriately.

Posted by darkhelmet under Computers & Linux & Programming | No Comments »

Texas cop doesn’t care about dog

August 25th 2008

Stuff like this makes me sick. While I realize this incident isn’t because they are in Texas, or anything like that, it doesn’t exactly help the stereotype Texas and it’s people have.

Video

Posted by darkhelmet under Intraweb & Linux | No Comments »

rush - The ruby shell

April 28th 2008

This looks cool. I will have to try it out.

rush

Posted by darkhelmet under Intraweb & Linux & Software | No Comments »

Ubuntu + Dell laptop + screen not shutting off

April 17th 2008

I finally got around to fixing my stupid screen not shutting off when I closed the lid. Here is the fix I used.

Force Monitor Turn On When You Open the Lid – Ubuntu Forums

Posted by darkhelmet under Computers & Linux | No Comments »

Linus on git

October 10th 2007

I need to watch this

Posted by darkhelmet under Linux | No Comments »

YaKuake

October 3rd 2007

I was using kuake, but this is better. Insta terminal on KDE! I usually have konsole running, but this might obsolete that…

YaKuake – Home Page

Posted by darkhelmet under Computers & Linux | No Comments »

Next »

My wishlist

 Subscribe in a reader
  • Categories

  • Tags

  • Monthly

  • Pages

  • Blogroll

  • Last.fm

  • Einstein@home

  • Word of the Day