Cleaner Firefox Context Menus Using Stylish

Since the Firefox Menu Editor extension doesn’t get along with the new HTML5 context menu support in Firefox 8 and up (it prevents site-added entries from appearing with no option to allow them), I thought I’d whip up a few userstyles to get the same, more Chrome-like (useful, but cruft-free) context menu I normally have without sacrificing that feature.

Here are the ones I’ve written:

The one to clean out Firefox-native entries is especially important to me since Firefox devs seem to care more about moving the RSS icon out of the address bar (fix) and hiding behind their toolbar heatmaps than even doing a heatmap study on the context menu. I seriously doubt things like “Send Image…” get used often enough to be in the top level of a context menu without Chrome’s “one entry or submenu per extension” rule. (And why is “Select All” not shown only in text fields in this day and age?)

If you want to make your own, the process is very simple. Use mine as an example and then follow the instructions on Mozillazine’s Menu customization page.

If you want to remove something with a name that changes based on what you select or you want to “do it right” so your script works for everyone, rather than just people who share your locale, follow the “Using ID selectors” instructions rather than the “Using attribute selectors” ones. Finding the ID is a bit technical, but, here’s how I do it:

  • locate your profile folder, then go into the extensions folder.
  • One of those files or folders holds the code to the extension, so use your favorite archive tool to poke around until you find the right one. (.xpi files are .zip files with a different extension, so use your favorite archive tool)
  • Use grep -r "text from the menu item" path/to/unpacked/xpi or a grep-like tool to find the file and line number to start at. (If you get no results, try a smaller fragment)
  • Go to that line number in that file using your favorite text editor. The ID should be nearby, either as id="waggawagga" or in a bit of Javascript which looks up the object by ID
Posted in Geek Stuff | Tagged | 5 Comments

Getting your way with setxkbmap

If you’ve ever poked around in the KDE or GNOME control panels, you know that the X11 keyboard system is very customizable and, as the KDE keyboard controls clearly show, that it’s all done using a little command named setxkbmap.

The problem is, Google isn’t very helpful if you want to use this tool directly. All the results seem to tell you to read the raw config files or only give you single, purpose-specific examples.

The good news is that your system actually DOES include a single file equivalent to (and probably the source for) the listings you get in the GUI tools:

/usr/share/X11/xkb/rules/base.lst

For those who haven’t used KDE and need an example, here’s the command I run on login (These can also be specified in xorg.conf via Option directives, but I prefer something I can keep in my roaming profile):

setxkbmap \
  -variant altgr-intl \
  -option \
  -option compose:rctrl \
  -option lv3:ralt_switch \
  -option terminate:ctrl_alt_bkspc \
  -option eurosign:e \
  -option nbsp:level3n

As usual, the backslashes are only necessary if you’re splitting it across multiple lines. Here’s what they actually do when used with a us104 or us105 layout:

-variant altgr-intl
The default variant of the US 104 layout doesn’t have tertiary symbols like ¢ and þ for AltGr to access, so I’m selecting one that does.
You can also use the intl variant here but, for some reason, it maps ² to AltGr+2 and ³ to AltGr+3 but ¹ to AltGr+Shift+1.
-option
An empty -option resets the layout options so I’m starting from a clean slate.
-option compose:rctrl
This remaps the Control_R keysym to Compose, so I can access glyphs like ½, ±, and é by typing “Ctrl 1 2” or “Ctrl + -" or "Ctrl e '“.
-option lv3:ralt_switch
This remaps Alt_R to AltGr, granting access to ¬ (AltGr+\) for making ¬_¬ smileys and giving me simpler key combos for commonly-used glyphs like µ (AltGr+m) and © (AltGr+c).
You can also use ralt_switch_multikey here to make Shift+AltGr the Compose key on compact keyboards but my muscle memory has already settled on Control_R. (Note: Make sure you press Shift first or it’ll just send an ordinary AltGr+Shift)
Note:If anyone knows why ¬ is no longer on AltGr+`, please leave a comment.
-option terminate:ctrl_alt_bkspc
Restore Ctrl+Alt+Backspace as the “Kill X Server” shortcut without relying on a superior but root-privileged and Linux-only config tweak.
(Again, I like settings I can store in my roaming profile)
-option eurosign:e
I’m Canadian, so on the occasions I need to type €, it can take me a while to remember that it has two cross-bars so I know to use “Compose e =“. Since my muscle memory already uses “Compose e '” for é anyway, let’s remap AltGr+e to €.
-option nbsp:level3n
Lets me type non-breaking spaces with AltGr+Space for those times when   doesn’t have special meaning.
Using level3n rather than level3 lets me type thin non-breaking spaces with Shift+AltGr+Space.

The beauty of doing things this way is that you’re unlikely to break things badly. It’s nearly impossible to paint yourself into a corner using variants and options alone (It’s models and layouts you have to be careful with) and, if you ever try to apply your settings to a keyboard they weren’t intended for, an unrecognized variant will abort the process and unrecognized options will simply have no effect.

Have fun and, if you’ve got any other interesting keyboard tweaks, share them in the comments. If I like one that applies to us104 enough to use it myself, I’ll update the example in the post body.

Posted in Geek Stuff | 32 Comments

Activism and Human Psychology

Given the recent focus on harmful attempts at law like SOPA and ACTA, I’ve spent more than the usual amount of time, lately, thinking on why it’s so hard to build up a stable, strong political movement and I’ve narrowed it down to two fundamental psychological problems that activists often don’t seem to address:

First, that humans are creatures of habit, yet activists seem obsessed with converting the general public to their cause. I can’t count the number of causes I’ve sympathized with but lost interest in because the only option they offered me for participation was, in essence, a firehose of all the day-to-day details of their fight. As an activist, you need to accept that not everyone can be made to care about your cause as deeply as you do. Provide services for all levels of engagement, so people who just want to be notified of new petitions and phone-call campaigns won’t be overwhelmed while those who want more can easily step up to the next level of involvement.

Second, that we instinctively desire, on an emotional level, a clear victory which our opponent acknowledges… something which activism doesn’t provide. Activists struggle against parties who will never concede defeat and we must find ways to help people focus on incremental victories and long-term trends, rather than dwelling on the occasional inevitable loss or being demoralized by the endless nature of the struggle against selfishness.

Finally, while not a point about psychology in and of itself, the adage “It’s always darkest before the dawn” does characterize activism quite well. Opponents never fight harder than when they’re desperate and, in the case of the current battle against online censorship, SOPA and ACTA will quite probably, if defeated, prove to be the turning point in the fight for freedom from the old media oligarchies.

Update: Though, as Cory Doctorow points out, that’s just a fragment of the issue. The real fight is for the right to use our computer-based technologies without government-mandated spyware locking down what we can and can’t do with them.

Posted in Geek Stuff | 1 Comment

Personal Status Update and Some Extra Modules for Porteus

TL;DR: Porteus modules here

Roughly two weeks ago, my main PC died and, since I didn’t feel like re-ripping 2.5TiB of movies and music, I spent two weeks of playing Towers of Hanoi with my media library to squeeze it all onto either my brothers’ PCs or one of 100 DVD+Rs.

With that finished and my backup PC (too slow) and backup backup PC (too little expansion room) part-way to being comfortable, I’ve come to several conclusions:

First, that I need to prioritize the completion and enhancement of my roaming profile. (Already in progress with my goal being to use it, a Lubuntu CD, and Dropbox to go from blank hard drive to comfortable PC in under two hours.)

Second, that 32-bit Porteus is the best LiveUSB Linux distro I’ve ever tried and, aside from backsliding on the UI since it was called Slax (something I may volunteer to fix eventually), it’s great… but it doesn’t have all the modules (packages, basically) I want and lacks Slax’s big, community-populated collection.

Therefore, I’ve taken it upon myself to build modules for everything I want.

Some of them (like BasKet Note Pads and Filelight) are converted Slax modules that still work perfectly well, many are converted Slackware packages which have been adjusted if necessary, and some are converted Debian packages.

It’s actually not that hard to do (the website has instructions and Porteus comes with conversion scripts) but it can be somewhat time-consuming so I’m offering the ones I create in case they help anyone else. (I really don’t have the time to be a maintainer in any official sense, or I’d see if the Porteus guys are interested. These’ll probably only get updated when it causes me problems.)

Feel free to use them or not. If you want to verify that I haven’t done anything funny to them, they’re generally easy to match to Slackware, Debian, or Slax packages/modules and diff -ur will tell you the rest.

Posted in Geek Stuff | Leave a comment

Ultra-lightweight Network File Moving for Linux/UNIX

A few days ago, my main machine went kaput and I needed a fast way to copy several hundred gigs of data to a slow, old 2Ghz Celeron. Thus began my search for the lightest file-copying solution I could find. So far, that’s tar with netcat.

The problem is that netcat, while a swiss army knife, is also very much a power-user’s tool and, with at least three flavors and multiple versions of each in use, the instructions for using netcat with tar to copy files are often using a subtly incompatible syntax.

It also doesn’t help that, because netcat has no clue what you’re planning to do with it, it takes a little experimentation to figure out which instructions match up with your expectations for how a file-moving tool should behave.

Here is a little wrapper script I wrote myself (¾ comments) to keep the use of tar+netcat simple and easy to remember. Use it as you will.

If you aren’t on a LAN and bandwidth is more the issue, you can either compress the tar stream the same way you’d compress a tar archive (check out lzop for something lighter on the CPU than gzip) or you can use a tool like rsync which will only transfer changes and makes resuming an interrupted transfer effortless.

You may also want to check out these pages for alternatives:

Posted in Geek Stuff | 1 Comment

Voting Systems: Why Civics Is Important

TL;DR: Here are some entertaining, easy-to-understand videos explaining the fundamental flaws and relative merits of different voting systems.

Update: See also this video on the best voting system for simple things like “What restaurant should we go to?”

Of all the things we have to deal with in our daily lives, politics is (often, by design) probably one of the most frustrating, misunderstood aspects of modern daily life. Campaigns are annoying and time-consuming, politicians are infamously bad at keeping promises, and the one thing everyone can seem to agree on is that nobody is satisfied.

What most people don’t understand is that, in many countries, this isn’t our fault as citizens. Voting systems like First Past The Post (A.K.A. Winner Takes All, as used in countries like Canada), Electoral College (as used in the United States), and Alternative Vote (as used in countries like Australia) have deep, proven flaws which are only made worse by common solutions.

The sad thing is that most people don’t even know this, or just dismiss it as “politics” when, if offered, it actually falls under a different branch of the public education curriculum. As someone who grew up in Ontario, Canada, my high school required me to spend half a semester on this sort of thing in a course simply called “Civics“. However, in retrospect, it didn’t really sink in very well, despite my finding the topic somewhat fascinating.

I suppose my point here is that, if we’re ever to enact meaningful, long-lasting political change, we need to do a better job of educating ourselves and others about the less obvious flaws that in our political systems. Otherwise, when we ask for change, we’ll just end up asking for band-aid solutions that can be easily eroded away later.

For that reason, I strongly recommend checking out these great videos by C.G.P. Grey:  (For any given video, the videos below it on the list will also be relevant concerns)

Don’t forget to check out his other stuff too. He’s got some great stuff on things like what continents arethe origins and effects of Daylight Savings Time, and the story of how Scotland joined Great Britain.

UPDATE: Canadians will also want to watch Rick Mercer’s Canada Explained for an explanation of what votes of no confidence are and how they fit into things. (Proroguing is a feature of the Canadian parliament which, when used properly, lets members of parliament agree that there’s nothing left to do and go on vacation early.)

UPDATE: And now U.S. Primary Elections explained.

UPDATE: Single Transferable Vote is now finally in the list above, completing the set of big-name voting systems.

Posted in Web Wandering & Opinion | Leave a comment

How And Why To Bring Back The Border On The Firefox 8 Reload Button

TL;DR: Install this userstyle.

After about a week of delay (not bad), Gentoo Unstable finally offered up Firefox 8 and, much to my dismay, the removal of the border on the in-address bar reload button wasn’t just another graphical glitch to be fixed before it left Aurora and Beta.

You may wonder what the big deal is but, to me, it’s as big a deal as things like “Tabs on Top” and preserving the distinction between browser-scoped actions (toolbar buttons) and page-scoped actions (address bar icons).

There are two main reasons:

Aesthetics and Consistency
It feels sloppy and confusing to not have the drop-down arrow the right-most thing in a combo-box and the awesomebar is intuitively understood to be a very fancy combo-box. (Also, without the line, I think the spacing between the icons looks inconsistent with padding to the left and right of the drop-down arrow seeming unbalanced)
Intuitiveness and Predictability
While Firefox doesn’t use the “Page/Browser Action” terminology that Chrome does, the distinction is an apt one. The presence (or, in the case of the bookmark icon, state) of icons within the address bar depends on the content of the tab while icons outside it are either stateless or dependant on the state of the browser chrome. (eg. The toggle-button for the history sidebar)
Integrating the button into the address bar but using a border to separate it is an apt design decision because it implies that it’s a mixture of the two: Stateful relative to the current page, but always present and more a browser action than a page action.

Thankfully, this is Firefox, so with a few lines of CSS, the Stylish extension can fix things.

Here’s my solution: Firefox 8 – Restore left border on reload button

Update: Switch “preserving” link to an extension that uses the proper RSS icon which fits in with things like the Share icon, rather than the borderless variant.

Posted in Geek Stuff | Tagged | 2 Comments