Wednesday, January 10, 2018

How to Fix: Firefox 57+ Status Bar


I used to use an extension called Status-4-Evar, which did a lot of neat things.  Mozilla has been ruining Firefox's status bar for a long time, and this extension let us get it back the way we wanted.  For me, I want an area of the screen where URLs and status text can appear, but does not vanish or move depending on where my cursor is.  I also don't want it to overlap with useful page real estate.  Basically everything the new Chrome-style corner status bubble is, I do not want.  Recently, Mozilla made more changes which make Status-4-Evar incompatible with new versions.

Many people would prefer to have their downloads and other extension icons down in the bottom bar as well.  That's where I used to have them, but it doesn't bother me terribly to have them up in the top bar instead.

This fix addresses only my consistent-status-area concern, not the icon stuff.  There are solutions out there which re-position and re-purpose the bookmark toolbar and let icons live there.  This is a much simpler and admittedly less-flexible hack.

Credit where it's due; I started with this:
https://github.com/MatMoul/firefox-gui-chrome-css/blob/master/chrome/userChrome.css

My solution is to create "~/.mozilla/firefox/(my profile)/chrome/userChrome.css" containing:
#browser-bottombox {
 height: 1.4em;
 border-top: solid thin #505050;
}
.browserContainer>statuspanel {
 left: 4px !important; bottom: 2px;
 transition-duration: 0s !important;
 transition-delay: 0s !important;
}
.browserContainer>statuspanel>.statuspanel-inner>.statuspanel-label {
 margin-left: 0px !important;
 border: none !important;
 padding: 0px !important;
 background: rgb(0,0,0,0) !important;
 color: silver !important;
}

window[inFullscreen="true"] #browser-bottombox {
 display:none !important;
}
window[inFullscreen="true"] .browserContainer>statuspanel[type="overLink"] .statuspanel-label {
 display:none !important;
}

Your mileage may vary, and unless you use a dark theme (like I do) you'll probably want something other than color: silver for the actual status bar text.

Mozilla, get your house in order.  Let us customize our browser; you are not Google or Apple, that is why we like you.

Tuesday, January 09, 2018

Arcade Sticks and MAME and Key Events, Oh My

This is a solution so simple I feel very silly for not thinking of it sooner.

from a virtual console: (as in ctrl+alt+f1 etc)
    xinit /usr/games/mame -- :1


So my actual problem, for anyone who's curious, is that while using MAME to play some arcade games, my window manager (spectrwm) was capturing the "Alt" key (player 1's second button by default) and doing whatever actions alt+this and alt+that were bound to, depending on what other buttons (keys) were being pressed.

"Just remap the buttons" is a common answer, and not a bad one in many situations.  But the keyboard I use when playing arcade games is this big ol' thing:
It looks and feels like and is in fact built from arcade joystick hardware, but for maximum compatibility it acts like a keyboard when plugged into a computer.  It does indeed support remapping its "keys", but I'm running linux for cripe's sake, there had to be a better way.

I started down this logical path:  VirtualBox (virtual machine container; think VMware but open) steals the entire keyboard so that Alt and other modifier keys end up going to the virtual machines it runs, rather than the host.  Now and then, I get trapped on a certain screen for a moment because I can't just alt+number my way to another one.  It's a mildly annoying but useful feature.  MAME, the software I use to run old arcade games, doesn't seem to have any such option, but it really ought to.

VirtualBox and MAME are both open, so I could dive into the code and see how the keyboard grabbing is done in the former, and possibly graft it into the latter.  I imagine the abstractions used in each case are quite different, but I bet given time I (or someone) could figure it out without too much hassle.

But if I'm going to dive into code, maybe there was something simpler I could do.  Spectrwm, my window manager, is tiny compared to VirtualBox or MAME.  It does almost nothing, which is why I like it.  One of the things it does manage is the ability to assign special behaviour to certain programs.  (It calls these special cases "quirks".)  Perhaps I could dig in there and have it ignore all hotkeys when a certain program (mame) is active.

Then it hit me, again, that I'm running linux, for cripe's sake.  Just because I'm using spectrwm on my X server doesn't mean I can't run another X server with no window manager at all.  And sure enough, if I fire up a second instance of X thusly:
    xinit /usr/games/mame -- :1
...then I have a completely isolated X running only MAME, and can switch between it and my main X session anytime.  For me, this is the best of all worlds.  I can keep up spectrwm and mame updated without having to manage any local patches, and I can mash any combination of those big joystick buttons without any unintended behaviour.

Some keyword search phrases, for any future schmucks having similar trouble:
  • mame grab alt key
  • mame spectrwm keys
  • mame window manager keys
  • wrap x keyboard events
  • linux x grab all keys
  • mame grab keys like virtualbox