Stephen Cofer

February 24, 2007

Firefox Tweaks

Filed under: Linux — doktorseven @ 11:47 pm

Two things bug me about Firefox that aren’t easily fixable at first glance.

* Recover From Crash: while some may like the feature that, if Firefox crashes, you can recover their session or start a new one by answering a dialog that pops up when you restart it, I find it annoying. So I finally found a setting from a Firefox site to disable it. Open about:config and right-click the listing. Choose New->Boolean. Type in browser.sessionstore.resume_from_crash, and set it to false. No more annoying dialog after crashing.

* Crappy new GTK file selection dialog: Actually this is a universal hatred since GTK changed their file dialog for saving/opening files a while back from a simple dropdown / filebox / file-or-path entry field dialog to some overly complicated dialog where you can’t even type a path in directly without the dialog loading the entire contents of that path into memory, annoying when you want to, say, select a program to open a downloaded file in and you choose /usr/bin, which contains tons of programs, of course.

Fortunately I found a fix for this long ago — for Firefox, at least — and have posted it on blogs and sites several times, but I believe it’s the first time I’ve posted it here. It does involve a hack of Firefox’s install files, so no simple about:config hacking here.

Go to where Firefox is installed (on my system, it’s /usr/lib/firefox) and enter the components subdirectory. (Note: Of course, if it’s outside of your home directory, you have to do this as root, so be careful.) Inside is a file called nsFilePicker.js. Make a backup of it. Open it, and scroll down to around line 275; you’ll see something that looks similar to the following:


compMgr.registerFactoryLocation(FILEPICKER_CID,
"FilePicker JS Component",
//@line 278 "/hdb4/build-directory/swiftfox-rel/mozilla/xpfe/components/filepicker/src/nsFilePicker.js.in"
"",
//@line 280 "/hdb4/build-directory/swiftfox-rel/mozilla/xpfe/components/filepicker/src/nsFilePicker.js.in"
fileSpec,
location,
type);

(Note: the paths after the “//@line 278″ and “//@line 280″ parts will most likely be different; note also that I’m doing this from Swiftfox, a Firefox derivative, thus the reference to “swiftfox” in the code, but the method is the same. Spacing may also be different; usually, all the lines are centered.)

We are interested in the line between “//@line 278″ and “//@line 280″:

"",

Change this to:

FILEPICKER_CONTRACTID,

Note the comma at the end of the line, so we’re basically only replacing the empty double-quotes.

Now save this file and run Firefox. We’re not done yet, though; Firefox doesn’t detect a change in this file automatically. To force it to read it, go to Tools->AddOns and click Disable on any installed add-on (go install an add-on if you have none installed; installing a new add-on is sufficient to force reading our change). Close and restart Firefox, go back to the Addons, and re-Enable the add-on. Restart again for good measure.

Now any Open or Save dialog will be the classic GTK dialog and not the newer, uglier one. If something goes wrong, copy the old nsFilePicker.js back (you may have to do a disable/enable on an add-on again) and try again.

Enjoy.

February 21, 2007

Random Day

Filed under: Linux — doktorseven @ 4:26 am

Some random stuff:

* I’ve made the move away from the GUI XChat to my other favorite IRC client irssi. just for the heck of it. Being able to survive an X restart via screen helps too. The biggest issue I had was that I have a channel I idle in because there’s not much activity, but when activity happens I wanted a simple audio notification. Fortunately there are plenty of scripts out there for irssi, and I found one to do exactly that.

* I’ve almost completely recreated gDoomsday using Mono; it’s been an interesting lesson on how C# and the whole .NET thing works, and it’s not too bad, really. I’m still not too keen on the idea of this weird interpreted/bytecode thing that .NET and Java have going — if I wanted an interpreted language, I’d use something like Python, otherwise I’d use a language that compiles to native machine code. But for this simple little program, it worked out well, I guess. Maybe I’ll release it on the gDoomsday site just for kicks.

* I’ve had some short freezing issues and lockups with games over the last couple of days. Not sure where the issue lies there, but it all makes me nervous. Doomsday has stuttered significantly occasionally, and completely froze my computer another time. I’m not running anything unusual. Damn it, I hope this doesn’t make me go find another distro to change to… again.

* Can some game companies, or independent programmers/contractors/developers, get busy on some new Linux games? Even ports of older Windows or console games would be nice. We’ve had a serious dry spell here lately; it makes even a couple of years ago seem like we had a wealth of commercial games for Linux. Linux is as popular as ever, and the only new things I’m aware of is X3 from Linux Game Publishing and (hopefully, still) UT3 and ET: Quake Wars. Even icculus.org, which had many game ports to Linux, seems to now only be concentrating on Linux game server binaries (Prey and ArmyOps). Come on, gamedevs, dump Microsoft already, or at least go cross-platform using SDL/OpenGL/OpenAL.

Microsoft’s new bloated OS is just going to slow your games down anyway.

February 18, 2007

Monodevelop

Filed under: Linux — doktorseven @ 5:27 am

Yes, C# (“C Sharp”) is the Microsoft language of the Devil, yet its conversion into a language capable of being run on a Linux system has always interested me. Named “Mono”, C# in Linux becomes possible. However, I’ve had serious issues with even compiling a simple GTK example program in the past with Mono, even in the supposedly simplified GUI, Monodevelop.

Tonight, I’ve succeeded in compiling a GTK program in Monodevelop, incredibly. It’s quite a chore trying to look up what the equivalent C# (and GTK#) instructions for what I’m used to in C. It’s similar, mind you, but there are a few odd things that disturbingly remind me of Visual BASIC (which C# is partially derived from, whether Microsoft and the designer of the C# language want to admit it or not). Regardless, I set out to at least partially reconstruct my Doomsday GUI gDoomsday using Mono. During the little time I had tonight, I was able to construct part of the GUI and at least do a simple execution of doomsday using the path to the WAD as an argument. I wanted to at least capture the output to display within the program similar to how I’d use popen in C (a command that creates a pipe to a forked command shell that allows one to read the standard output generated by the program, as gDoomsday does to display doomsday’s output as it is running), but I was not able to find any equivalent to the command, only finding System.Diagnostics.Process.Start to simply execute a command. I’ll do more digging since I’m sure (I hope!) an equivalent to popen exists…

Simple curiosity drives this exploration of mono/C#, mind you. It’s a decent prototyping language, but we’ll see how it fares on sheer power once I do more experiments. Maybe it won’t kill this cat.

Footnote: looking at the calendar of blog posts for this month reveals a depressing lack of posts… I really meant to post something more often! At *least* three times a week is what I want, and I’m not even coming close to that. Must try harder…

February 12, 2007

Another game!

Filed under: Linux — doktorseven @ 8:52 am

Quick post to mention Battle for Wesnoth, an awesome, complete turn-based strategy game that rivals many commercial games in its scope and complexity. Single- and multiplayer skirmishes, campaigns, and even a tutorial mode are available for play.

“Linux has no games.” Right. What a lie. :)

February 10, 2007

Games!

Filed under: Linux — doktorseven @ 2:32 pm

I still like games. And of course, gaming on Linux supposedly doesn’t exist, at least in the small minds of Windows elitists who think that gaming on Linux means playing a tic-tac-toe game in a console. They all seem genuinely surprised when I mention how many games have actually been released for Linux. Better yet, how many good free games are available as well.

Sure, there are a lot of games that are still under development; however, unlike most commercial games, most developers of open-source games let you play what they have at all times during development, which is maybe why people seem to think that all Linux games (and programs) are always unfinished. They are unfinished, but like Windows programs and games, development times are long. The difference is that Linux lets you experience early alphas and such without waiting for “official” beta releases or demos (or even the final version).

Here’s a sample of some of the best free (and Free, as in open-source) games out there:

VDrift – a very nice, realistic auto racing game with emphasis on realism and drifting. No arcadelike unrealistic car physics here, though so far things haven’t been tweaked to perfection. Still a lot of bugs and no real “racing” yet (just driving around tracks), but there are some nice cars modeled after real ones (no real names because of copyright), and some real life tracks, such as Laguna Seca, Nuerburgring, and Road Atlanta. Definately one to watch.

OpenArena – now that the Quake III sourcecode has been released, the only thing preventing a truly free, standalone game was the Quake III datafiles. Fortunately, someone stepped in and created a completely free set of data files that has none of the original Quake III data in it, allowing a Quake III-like game to be downloaded completely free. OpenArena is that game, and the quality of the replacement files (textures, models, sounds, etc) are very good. Play is exactly the same as Q3, with the same weapon types and powerups. It’s a nice replacement if you don’t want to buy Quake III.

Scorched 3D – a 3d remake of the old Scorched Earth game, a turn-based tank combat game where you set the direction, angle, and power of a shot and try to take out opposing tanks. The original was a simple 2d game, but this takes the concept into full 3d, with nice visuals, sounds, and the same classic gameplay with another dimension added.

LinCity-NG – a city simulation game like SimCity. It’s not quite as complex as the newer games in the SimCity series, but it does have solid gameplay and will get you addicted just as easily. The “NG” in the title stands for “next-generation”, since this is a newer game that improves on an older LinCity game that was closer to the original SimCity in features and graphics. This is a really well-done and mature game that definitely deserves a look.

Course, that’s not all the games out there. I do hope that game developers continue to support Linux (hopefully there will be a version of both Enemy Territory: Quake Wars and Unreal Tournament 3 for Linux as originally promised). Even without commercial support, however, gaming on Linux is doing quite fine, thanks to dedicated open-source development teams bringing us great games like the ones I mentioned above.

February 5, 2007

BASH rules.

Filed under: Linux — doktorseven @ 3:48 am

First of all, sorry about the anger on the last post. But when things like that happen, I get very frustrated, mostly because so many bad things happen in our society these days, and it seems those who are in the right are the vast minority. Majority rules doesn’t work when the majority is fundamentally, morally, and ethically wrong.

But anyway, back to actual Linux stuff.

As I have worked with Linux over the years, I have found that many things I do and take for granted are nearly impossible in a GUI environment, especially repetitive actions. An example I had today: I had about ten zip files, each containing several files that by default extracted in the current directory. The zip files were numbered sequentially, but from 11 to 20, and the filenames, while all the same except for the number, had a lot of spaces in it. What I wanted was to create a simple directory for each called Zipfile_[number], where [number] was the number in the zipfile. In a GUI, this would have taken a lot of repetitive, mindless clicking.

But with BASH? Simple.

for i in `seq 11 20`; do mkdir Zipfile_$i && unzip -d Zipfile_$i Individual\ Zip\ File\ Number\ $i.zip; done

seq a b counts from number a to b, and the for statement executes the mkdir and unzip command for each number, substituting $i for that number each time around. Simple, elegant, powerful.

Took me a few seconds to enter and saved me a ton of boring, carpal tunnel-causing repetitive clicking. Thanks, BASH and GNU/Linux. You rule.

February 1, 2007

Idiots

Filed under: Rants — doktorseven @ 5:29 pm

Edit – doesn’t really belong on this blog. Removed.

Blog at WordPress.com.