about:config Tweaks for Firefox 7 (and up)

A couple of days ago, it finally occurred to me to look for a way to turn off the sluggish (on Linux, at least) drag-and-drop previews in Firefox. So, while I’m at it, I thought I’d list a few of the more interesting about:config keys which aren’t exposed by the Firefox 7 GUI.

Performance Tweaks

browser.panorama.animate_zoom Whether to animate when entering/leaving Tab Groups view
browser.sessionstore.max_concurrent_tabs When set to 0, defers restoring tabs from a saved session until you actually click on them.
browser.tabs.animate Whether to animate tab opening/closing
nglayout.enable_drag_images Disable drag-and-drop thumbnails

UI Customizations

browser.backspace_action Set to 2 to stop the Backspace key from navigating back in history when focus lies outside editable fields. (or 1 to make it mean PageUp)
browser.search.context.loadInBackground Set to true in Firefox 13+ to restore the old “open in background” behaviour to the “Search Google for [selected text]” context menu.
browser.urlbar.clickSelectsAll
browser.urlbar.doubleClickSelectsAll
Set both of these to false for Chrome-like selection behavior
browser.urlbar.trimURLs Bring back http:// in your address bar
middlemouse.contentLoadURL Disable for predictable middle-click tab-closing on Linux
keyword.URL Set the search engine Firefox uses by default when you type keywords in the address bar
keyword.enabled Just disable keywords in the address bar altogether
ui.key.contentAccess Controls which modifier key is used for web access keys.I often use web keys and never use browser keys, so I swapped values with ui.key.chromeAccess so web access keys use Alt and browser access keys use Alt+Shift.)
view_source.wrap_long_lines Enable word-wrap in “View Source”

“It’s My Computer”

browser.blink_allowed Set to false to kill blink tags while browsing Geocities-era pages.
browser.history.allowReplaceState For if you’ve got a website which is abusing history.replaceState.
browser.link.open_newwindow Set to 1 to prevent links and JavaScript from opening new windows/tabs.
browser.link.open_newwindow.restriction Set to 0 to force JavaScript to always open new tabs rather than windows.
browser.link.open_newwindow.override.external Lets you specify a different behaviour than open_newwindow for links opened from outside the browser. Set to 3 to open them in tabs.
browser.send_pings Disable <a ping>
browser.send_pings.require_same_host Just limit <a ping>‘s utility for tracking you across multiple sites
browser.sessionstore.privacy_level Set to 2 to keep Session Restore from persisting cookies.
dom.disable_open_click_delay Adjust this to fix some sneaky sites which open a pop-up AND navigate the existing tab when you click
dom.disable_window_open_feature.* A bunch of properties for limiting what JavaScript can control when opening new windows/tabs
dom.popup_allowed_events This controls what the popup blocker counts as “user-triggered”
image.animation_mode Lets you control whether GIF and APNG will animate. Would be better if someone wrote a FlashBlock-like extension for it though.
layout.frames.force_resizability Always show the splitter handles for <frameset>-based pages.
media.autoplay.enabled Ignore autoplay="true" on HTML5 <video> and <audio> tags. (Doesn’t stop sites from calling play())

Let me know if there’s anything I’ve missed.

Posted in Geek Stuff | 3 Comments

Information-richness in a compact zsh Prompt

Note: While this post focuses on zsh, everything I do should be possible to implement in bash too.

When I look at people’s shell prompts, the first thing I always seem to notice is that they’re bulky and eye-grabbing. Seeing a textual version of GNOME Panel get duplicated into my terminal after every command isn’t something that appeals to me, so I thought I’d come up with something just as useful, but a little more compact.

What follows is a step-by-step story, with pseudo-screenshots, of how I went from a bog-standard zsh prompt to a fairly advanced prompt that only looks different when it has something to say, ending in a link to the .zshrc source I use to actually implement it. Feel free to skip ahead.

Because I like the color scheme and because I already have it, I’m starting with the default Gentoo prompt:

ssokolow@monolith ~ %

Obviously, this already has the usual Gentoo prompt’s “you are root” indicators (user ID turns red and % turns into #) and the ability to tell zsh and bash apart at a glance (For those who don’t know, zsh uses % while bash uses $) but I do a lot of programming and I use git for all my code, so the most useful thing I could possibly add is a way to never forget which branch I’m working on. Thankfully, that’s already been done for me:

ssokolow@monolith quicktile [master] %

I’d also wanted a way to see, at a glance, whether there were any jobs running in the background. The %(1j.%%.) ternary expression fixed that one right up:

ssokolow@monolith quicktile [master] % git gui &
ssokolow@monolith quicktile [master] %%

Finally, not all of my programs are clear about when they send a non-zero exit code, so it’d be nice to know that too. Another ternary expression, namely %(0?..%F{yellow}), takes care of that:

ssokolow@monolith quicktile [master] % false
ssokolow@monolith quicktile [master] %

I like how the prompt, by default, only displays the last component of $PWD so I left that unchanged. You’re free to add in other things but I tend to struggle with performance issues when both Firefox and GCC have to fight for “only” 4GiB of RAM so I decided not to hook in any more subprocess calls.

A pruned-down, streamlined version of the code for it is available on GitHub as zshrc.d/gentoo_prompt_setup but you’ll also need this line from my master .zshrc:

typeset -ga precmd_functions
Posted in Geek Stuff | Leave a comment

Installing a new Ttk/Tile theme

By a lucky coincidence, I discovered that PySolFC comes with a Clearlooks pixmap theme nicer than the built-in one I was using. Unfortunately, there seemed to be no documentation on how to install your own Ttk themes beyond forum posts saying “run the build scripts”. Geeking time!

After a little puttering around and a bit of uncertain code-diving (I don’t code TCL.), I figured out that all you have to do is grab your theme’s top-level directory (the one with pkgIndex.tcl) and put it somewhere TCL’s library loader can find it.

Here’s what I used on Gentoo Linux: (Roughly. I actually use zsh.)

mkdir -p ~/.local/share/tkthemes
cp -r /usr/share/games/pysolfc/themes/clearlooks ~/.local/share/tkthemes/
echo "export TCLLIBPATH=~/.local/share/tkthemes" >> ~/.bashrc
vim ~/.Xdefaults

Keep in mind that if you don’t either use startx to launch your X sessions or launch your Tk applications from a terminal, you’ll need to set TCLLIBPATH somewhere like ~/.kde4/env/set_ttk_theme.sh or ~/.xsessionrc instead.

UPDATE: In some Tk applications, you can force the menu bar to match the color of the Clearlooks Ttk theme by setting *background: #efebe7 in your ~/.Xresources file.

Posted in Geek Stuff | 2 Comments

What good is a browser that’s not being used?

About a week ago, I read about how Adobe is doing an opt-out bundling deal, including Chrome with Flash and Adobe Reader X. What struck me as odd was how there seemed to be no business case for whomever was footing the bill to make it happen. If you have to trick people into installing Chrome, what are the odds that they’ll just magically start clicking on the icon?

Today, I finally found the probable business case. It seems Google Chrome Frame now comes free (disabled, but in quick-enable mode) with every copy of Chrome and doesn’t require elevated privileges to install. (If you haven’t heard of it, it’s an Internet Explorer plugin which plugs the guts of Chrome into Internet Explorer so websites can opt out of Microsoft’s rendering engine… sort of like IE Tab in reverse)

That means that, every time Adobe tricks someone into installing Chrome, that’s one more copy of Internet Explorer that will use offer Webkit/V8 as an alternative to Trident/JScript when it encounters this variant of Microsoft’s X-UA-Compatible:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

Apparently IE7 users have already joined their IE6-using neighbors in being asked to either upgrade or install Chrome Frame when they open up GMail.

 

Posted in Web Wandering & Opinion | 2 Comments

URxvt: Pros and cons

After getting fed up with Yakuake‘s bloat, Yeahconsole‘s broken embedding, and Tilda‘s flickering, broken scrollbar, and broken URL handling, I decided to try URxvt, since it has a Perl extension that’ll turn it into a slide-down terminal without being embedded in Yeahconsole.

(And because stjerm, though well-recommended by some, is the name of two seemingly independent Google Code projects and somehow feels just a touch shady to me)

After a few days of intermittent fiddling, my reactions were mixed:

Pros Cons
Like XTerm, an order of magnitude lighter and more responsive than anything else out there. Like XTerm, terribly documented by 2011 standards for something you must personalize heavily.[1]
Extensible in Perl Extensible in Perl
Has a URL-recognizer (unlike XTerm) and opens unselected URLs with one middle-click. You can’t amend the context menu for selected text via the config file. You need Perl.
Beautifully accurate “smart selection” plugin Needed Perl hackery and /usr/bin/xclip just to rebind Copy/Paste keys.
Elegant ISO 14755 Unicode codepoint input support ISO 14755 breaks Ctrl+Shift+C/V clipboard bindings.
Backspace and Ctrl+Backspace produce distinct keycodes by default URxvt’s default Ctrl+Backspace is the only XTerm Backspace that termcap/terminfo gives to vim/man on my machine so I had to rebind anyway to stay compatible.
I love the “plain” scrollbar style No way to feed the scrollback buffer with secondaryScroll but hide the scrollbar when vim makes it un-clickable.
  • Doesn’t flicker like VTE-based terminals
  • Unbeatable font support
  • Yet another set of Ctrl+Up/Down, Home/End, etc. keycodes needed in in my .zshrc.
  • Keybinds alias to other keys like in Vim, not to internal functions like in XTerm.

Nonetheless, it’s generally a decent terminal and I’ve switched to its kuake Perl extension. It has its warts but, so far, I get the impression that URxvt’s warts won’t bother me as much as XTerm’s warts do.

Still, I did almost gave up on it several times before I stumbled on the little fix I needed and, if I weren’t procrastinating something else right now, I probably would have given up. In case anyone wants it for reference purposes, my URxvt config is up on GitHub.

1. Manpages seem to be the source format and, even with table-of-contents generation and hyperlinking for the manpage cross-references in HTML and texinfo converters, it still involves a lot of fumbling, fiddling, and Ctrl+F-ing within too-long pages where there are no links direct to the relevant sections and quite a few “See the …” references which aren’t hyperlinked and don’t give any clue where to look for the materials suggested.

Posted in Geek Stuff | 2 Comments

Research: Letting clicks through the transparent part of the GitHub ribbon

While I was working to de-uglify one of my GitHub pages (no time to prettify yet), I noticed that, the more fluid I made the layout, the more likely it was that the “Fork me” ribbon would cover up my most visible download buttons.

Obviously, this needs to be fixed, but according to what I could search up, there’s no general solution for clicking through the transparent parts of a PNG. However, given that the ribbon doesn’t necessarily have to be a PNG and that it’s not something like a frame with clear stuff in the center to be clicked through, there may be a specific solution.

None of the ones I’ve found are perfect, but here’s my research so far:

pointer-events
This nifty little property does exactly what I want… but only with an SVG image (For PNGs, it’s an all-or-nothing deal) and it’s apparently only implemented for HTML in Webkit and Gecko-based browsers.
CSS transform
This has actually been done (and since that was written, Opera 10.50 added support for it via the -o- vendor prefix) and you could probably use a polyfill like Transformie or cssSandpaper to make it work on Internet Explorer, but Firefox 6 and below on Linux don’t anti-alias it, so it looks awful. (I haven’t tested Firefox 7+ yet)
CSS clip and border-radius
This is paradoxically the best and worst for graceful degradation, not to mention being a less than ideal solution.If you use clip on your “position: absolute” container to shave off as much whitespace as you can without noticeably affecting the shadow in the PNG, and then use large values of border-radius on the image itself for the bottom-left and top-right corners, you can shave off a pretty respectable amount of the clickable region… but only in Gecko-based browsers (Firefox, SeaMonkey, Fennec, etc.). It turns out that, in other rendering engines, border-radius is a purely visual thing.

Anyway, that’s all I’ve found so far. If anyone has any further suggestions, leave them in the comments and I’ll work them into the post with credit.

Posted in Geek Stuff | Leave a comment

VFFA and FicFan Quote Randomizer Renovated

Throughout the years, I’ve started many projects at times when I didn’t really have time to do them well. Lately, I’ve been working on cleaning them up and this week, it was FicFan.org’s turn. The placeholder page is still up, but the Vanished FanFic Archive got a major renovation and some of it spilled over.

I’m not done, but this is a good place to stop for now and I can’t spare any more time,  so let’s focus on the good things rather than the remnants of the old look, like the ugly navigation box and the dated look for the randomizer’s tab box.

Here are the highlights of the new look:

  • Both the randomizer and the VFFA look pretty good now. (I may still change the color scheme, but it’s acceptable now)
  • Fluid layout tested all the way down to portrait-mode cellphones. (Developed on desktop development builds of Fennec and tested by a friend on his iPhone. One minor known bug still to be fixed.)
  • Print stylesheets (especially useful for the quote randomizer but I’m surprised how many workarounds the VFFA needed for Chrome print renderer bugs)
  • Tested with Fangs and tuned to work well with screen readers (I’m still a novice here, so I’m sure there’s more to be done)
  • Information on how to help the site is now clearly marked and includes a “fics wanted” list (that I’m still disentangling from the other VFFA TODOs).
  • Clear indicator icons for what will download rather than open in the browser.
  • Lemons are clearly marked and will ask for confirmation before opening.
  • Last updated dates for quotes and last checked dates for external links are now pretty-printed as relative intervals  if Javascript is enabled. (eg. 2 Months Ago)
  • Fandom information has been moved out of the description into the story header.
  • Stories without descriptions now automatically ask users to submit them.
  • Supplementary text is more concise and to the point.
  • Quote Randomizer’s tabs no longer trigger a full reload of the page if Javascript is enabled. (Known bug: The stats bar at the bottom stays on the category the page loaded on)

Of course, equally interesting (and time-consuming) is what’s going on under the hood. I’d have made these renovations months ago, but I was running in circles trying to “do the right thing” and reuse an existing static templating tool. I ended up deciding it was simpler and easier to just write my own.

It’s still got a lot of hard-coded stuff, but here are some of the things I’ve already got done:

  • Exports over 21,000 quotes to gzipped bundles in 10 seconds. (8 seconds for Mako, 2 seconds for GZip)
  • Validates HTML, CSS, and XML using OpenSP and µTidyLib, cssutils, and lxml, respectively. (JSHint and CoffeeScript support planned)
  • Lets me define most of the site in a mixture of Mako templates and markdown. (Jinja2, Textile, reStructuredText, and asciidoc support planned)
  • Minifies CSS using cssutils. (UglifyJS support and CSS/JS bundling planned)
  • Is much easier for me to hack on than Blogofile since I wrote it and also try to keep the codebase lean and well-documented with EPyDoc. (With Blogofile, I couldn’t even figure out how I was supposed to hook in code that takes more than one file in the source tree and produces a single zip in the build directory)

Obviously there’s a ton of stuff I’m not talking about (like how it doesn’t yet rebuild only files that have changed) that makes this only useful to me right now, but once doing so won’t be a procrastination risk for my coursework, I will be putting it up on GitHub. (Probably under an MIT license)

tl;dr It’s pretty, it works nicely with cellphones and printers now, and it’s easier for me to maintain.

Posted in Geek Stuff, Otaku Stuff, Site Updates | Leave a comment