2015-12-26
Adjusting mouse sensitivity on Linux, and why you might want to
Suppose, not entirely hypothetically, that you are moving from an old and relatively low resolution mouse to a new high resolution mouse, say a 1200 DPI mouse. If you do nothing, what you'll experience is that your new mouse is very twitchy and it's hard to point precisely to small things even when you're trying to move the mouse pointer slowly and carefully. This can easily wind up giving you unhappy feelings about your new mouse and of course it's generally frustrating. So what you want to do is turn down the mouse sensitivity so that it feels more like your old mouse.
(Some of this will depend on how your new mouse feels and moves relative to your old mouse. If you had to make sweeping moves with your old mouse and your new mouse is one that you can do tiny shifts with, you may not need to turn down the sensitivity very much at all. And the worst case is moving the other way, from a low resolution mouse that you just nudged around lightly to a high resolution mouse that wants you to move it around with sweeping gestures.)
As usual, the ArchLinux wiki has a pretty good page on mouse
acceleration
that steered me straight to the xinput command's ability to set
detailed properties, even on a per-mouse basis (this is potentially
important if you have more than one mouse that you might plug in).
For me the most important property to set was 'Device Accel Constant
Deceleration':
xinput --set-prop '<MOUSE NAME>' 'Device Accel Constant Deceleration' 2.2
The other setting I change is the 'Device Accel Velocity Scaling', because the default value of '10' is apparently based on a mouse sample rate of 100 Hz instead of my actual one of 125 Hz (see here for details on this). So I set:
xinput --set-prop '<MOUSE NAME>' 'Device Accel Velocity Scaling' 8
Note that total effect I get depends on both of these settings together, which means that there's no point in tuning everything carefully for one setting and then adjusting the other. Adjust them both first and tune from there.
(I never tried to 'tune' the velocity scaling, since it theoretically has a well defined proper value.)
I determined the deceleration figure by starting with 1200 DPI divided by the resolution of another mouse that I use and am happy with the feel of, but then I adjusted things to taste several times. The most important thing is that the mouse feel right to you; the math is just a starting point. This also means that you may not want to bother changing the velocity scaling; I did it because I'm the kind of person who usually sets that kind of stuff.
(Of course, one fly in the ointment of working out a careful DPI scaling if you also set the velocity scaling is that your old mouse will have been running not just at its lower DPI but also at the default velocity scaling. I have no idea what exact effect this has, but I expect that it has some.)
If or when I move to a high-DPI display, I expect that I'll want to reduce or reverse this mouse resolution reduction, since smaller pixels make the same mouse movement (in pixels) cover less physical area on screen. Of course by the time I get a high-DPI display, X or something else in the environment may be helpfully compensating for this effect (in much the same way that browsers on high-DPI displays redefine what a CSS 'pixel' means).
Also, I started out with higher values for deceleration and have been slowly adjusting it downwards (ie, less deceleration) over time. You may find that you have a similar adjustment process to a high-DPI mouse.
(Another reference to doing this is here, and also this StackExchange question and answers.)
PS: long distance movement of a high-DPI mouse also interacts with X's
basic xset-based mouse acceleration. I found that I was okay with the
normal default settings here once I'd set the deceleration in xinput,
but you may have to play around with that.
2015-12-18
Some things about the XSettings system
Yesterday I mentioned the XSettings standard for exposing (some) toolkit related configuration options to theoretically interested parties in a theoretically toolkit-independent way. There are some slightly non-obvious or not entirely documented things about this and daemon support for it.
First, as hinted by the 'X' in the name, this is is not a DBus-based
system. Instead it uses the old-fashioned approach of setting an X
property on the root window and having programs read this property.
Because this is an X property, all clients can see it, whether
they are on the local machine or on a remote machine. In turn this
means that remote clients may change their behavior if you start
running xsettingsd or the like, because now they can see your
(local) configuration settings. How your local configuration settings
interact with what's available on a remote machine can be potentially
chancy; for example, it's perfectly possible to specify a Gtk/FontName
that doesn't exist on other machines.
Some but not all settings daemons have side effects when run. For
example gnome-settings-daemon appears to also add some X resources for things like Xft
settings. This itself can cause (some) programs to change their
behavior, even if they don't use a toolkit with support for XSettings.
As far as I can tell, xsettingsd does not do this.
At least xsettingsd allows you to set essentially arbitrary
settings properties, including in existing namespaces; for instance,
it sure looks like you can set all sorts of XFT properties in
XSettings. However, this is an illusion. In practice, there is a
small set of known shared settings for
general cross-toolkit things and if
something's not in there, you setting it will do nothing. Where this really
starts to matter (at least to me) is that the available
XFT settings are pretty minimal. In particular, they don't include
the fontconfig lcdfilter setting,
which turns out to be one of the settings necessary to get fonts
to look how I want them to.
(It's not clear to me if lcdfilter can be set in the Xft.* X
resources either. I suspect not, but it probably can't hurt to try.)
At the same time, modern GTK has way more settings exposed through
XSettings than are documented in the registry. To
find out what all of them are, you basically need to fire up
gnome-settings-daemon temporarily and run dump_xsettings to
extract them all. I don't know what settings KDE exposes (if any);
I haven't tried to find and run the KDE equivalent of
gnome-settings-daemon.
For XFT settings specifically, I'm not sure what reads XSettings,
what reads the X resource database, and what ignores all of this.
I expect that GTK applications read XSettings, but I've seen some
basic X programs like xterm appear to read either XSettings or X
resources or perhaps both.
(And gnome-settings-daemon itself seems to do at least some DBus stuff, although I don't know if that's used for querying settings. All of this is annoyingly complicated. See this blog entry from 2010 for a picture of how complicated it was back then, and it's probably worse now.)
On the whole, if you have a mostly or entirely working environment
now without a settings daemon involved, it seems safest to have the
daemon publish only an extremely minimal set of XSettings settings.
I started out feeling quite enthused about setting all of the XFT
options but I'm now shifting more and more towards publishing only
Gtk/FontName as the minimal fix for my issues. Of course, the mere existence of an
active XSettings daemon may change program behavior (most especially
including on remote machines), but you take what you can get in the
world of modern X.
2015-12-17
Fixing the GTK UI font in my Fedora 23 setup
When I upgraded my office machine from Fedora 22 to Fedora 23, one thing I noticed immediately is that some of the fonts in a number of my applications had changed. After I looked at things for a while, it was clear that the font used for UI elements in GTK based applications had shrunk between Fedora 22 and Fedora 23. This font is used, for example, for Firefox's URL bar and in much of Liferea's interface, although in both cases the actual content (web pages and feed entries) was not affected. Trying to fix this sent me down a whole bunch of rabbit holes, because I don't use an existing desktop environment that has all of this solved and integrated; instead I have my own minimal desktop, which leaves me on my own to solve this sort of thing.
The first thing I discovered is that changing font settings in gnome-tweak-tool (for GTK 3) or gconf-editor (for GTK 2) didn't seem to do anything. The changes clearly got saved, but they didn't change how Firefox, Liferea, and so on looked (even when set to absurd values that should have forced clear changes). It turns out that GTK applications don't seem to look this information up directly (or at least not things like global font settings); instead they have an entire protocol to communicate with a settings daemon. If you do not have a settings daemon running, at least in Fedora 23 your applications use default values and ignore your theoretical changes. So it turned out that the first thing I needed was a settings daemon.
Gnome has one of these, gnome-settings-daemon, but it turns out
that there are better options, because of course this is actually
a freedesktop standard
called XSettings. I wound up with xsettingsd, which is a simple daemon
with a simple configuration system, and apparently XFCE also has
a relatively lightweight daemon that can be
configured via a GUI.
Part of what I like about xsettingsd is that it can be told to
only make a very few settings available, which is what I want
here; I only really want to fix my font issues, not start having
to maintain lots of GTK configuration options.
(I stumbled over this via the ArchWiki page on font configuration; see also their page on GTK+. One issue with just running gnome-settings-daemon is that it has a whole bunch of side effects, since it expects to be run as part of an integrated Gnome environment.)
Fiddling with the Gtk/FontName XSetting got me close to the Fedora
22 appearance but not quite on it; my best result was setting the
font to 'Sans 11' (which made things not obnoxiously small or
constantly bold). To solve the mystery of what actual font and font
size my applications were using on Fedora 22, I resorted to brute
force using my home machine (which is still running Fedora 22) via
fontconfig debugging options:
FC_DEBUG=1025 liferea
Per the fontconfig documentation, this dumps out enough information that you can determine what fonts the application is using at what font sizes. You get reports like:
Match Pattern has 25 elts (size 32)
family: [...]
[...]
size: 10.4443(f)(s)
[...]
Best score [...]
Pattern has 23 elts (size 23)
family: "DejaVu Sans"(w)
familylang: "en"(w)
style: "Book"(w)
[...]
Although someone who understands fontconfig can probably get a lot more out of these messages, for me this says that Liferea wound up getting DejaVu Sans at size '10.4443' [sic].
That weird fractional size turned out to be the missing piece of the puzzle. Although the Fedora default GTK UI font is apparently 'Sans 10' in both Fedora versions, in my Fedora 22 setup this was being scaled up just a bit and so it became Sans at 10.4443. In Fedora 23, it was no longer getting scaled up; 'Sans 10' was 10 points and so shrunk compared to Fedora 22. 'Sans 11' was of course just a bit bigger still.
(I suspect that Fedora 22 GTK was doing some DPI related scaling, although I can't make the numbers come out exactly right for scaling from 96 DPI. Fedora 23 may have dropped this scaling or it may have changed some DPI related thing in the environment so that no scaling gets done.)
Somewhat to my happy surprise, you can actually set Gtk/FontName
to "Sans 10.4443" and have it work. On my Fedora 22 machine, the
resulting font sizes are exactly the same with and without xsettingsd
running, so I expect that when I get back to work tomorrow this
will make Fedora 23 be completely happy.
On the whole this has been a very educational experience, even if it did basically eat up much of my day and frustrated me during chunks of it. I've learned a bunch more about how the Gnome and GTK environment operate, got a potentially useful surprise about Xft fonts and in the process I wound up stumbling over several other issues that are going to improve my environment a bit.
(I have some stuff to write about on XSettings and related issues, but this entry is already long enough so that's going in another entry.)
2015-12-16
I just had another smooth Fedora version upgrade with ZFS on Linux
When I gave in to temptation and started using ZFS on Linux, one of my big concerns was whether it would cause problems when I upgraded from one Fedora version to another. In my initial report on my experiences I wasn't able to say anything here because I hadn't done a version upgrade yet. Well, now I have; in fact, I've gone through three of them now (to Fedora 21, 22, and now 23). So I can say that for me, this was problem free. As I expected a year ago, it was basically like installing another kernel; DKMS rebuilt everything for me and it all just worked.
With that said, I think there are two important things that help me a lot here. First, Fedora keeps kernels basically in sync between their major versions. This means that a Fedora upgrade is very unlikely to turn up an incompatibility between ZFS on Linux and a new kernel (an extreme case would some change that means ZoL's kernel modules can't be built). I also stay pretty up to date with ZoL's development version, which means that I have the latest kernel compatibility fixes; as a result, I've never had problems with applying Fedora kernel updates in general.
Second, I do my Fedora upgrades via a live yum (now dnf) upgrade. I suspect that DKMS kernel module rebuilds work fine in other upgrade mechanisms, but there are at least more things that might go wrong there simply because things are happening in an environment that's at least somewhat different from the normal one. While a lot changes during a live upgrade, it's still reasonably close to a normal environment for rebuilding DKMS modules.
(Possibly this is just superstitious reassurance.)
As I mentioned back then, I do take the precaution of doing a test upgrade of a Fedora virtual machine (with ZoL installed and a pool running and so on) before I attempt the real upgrade. This can also be a reasonably good way of finding (and investigating) other upgrade surprises, although some things only become visible afterwards. Doing such a test VM upgrade doesn't take too long each time and I figure it's a good precaution to take in general (along with upgrading my work laptop first, because that's more dispensable than my office workstation).
2015-12-12
My views on the choice of Linux distribution
I have tangled and complicated feelings about the choice of a Linux distribution for myself and about the idea of changing distributions. So today I feel like trying to run down some of the complexities at play.
In more or less point form, because it's easier that way:
- Given that I use a basically completely hand-built custom environment
(I compile my own copy of fvwm, for example), in theory I'm
basically indifferent to the actual Linux distribution or even
Unix OS that I'm using. The out of box look of a distribution is
basically irrelevant. This sounds like it should make switching
easy (even all the way to eg FreeBSD).
(I don't even use a graphical login manager, so I wouldn't notice gdm or lightdm or xdm or whatever configuration differences.)
- However, setting up a highly custom environment that actually works
takes a lot of effort because many of the desirable pieces of a
modern desktop environment are neither standardized nor documented.
Working audio, working automatically mounted USB memory sticks,
fully working Gnome and KDE programs, all of that takes work, is
at least somewhat different between different distributions, and
is fragile. This creates a serious disincentive to switch
distributions or Unixes once I have one of them working.
(Having a fully hand-built custom environment makes this worse, since I expect to see basically no difference in my actual environment.)
- My actual environment is not just my desktop. Instead it
encompasses a bunch of things like heavily VLAN'd networking, a
GRE tunnel with IKE, policy based routing,
a webserver, ZFS on Linux with bind
mounts and so on. Most of these parts of
my machine are distribution dependent, because no one has
standardized this sort of system level setup. Switching Linux
distributions thus involves re-engineering at least some of it,
if only to account for things like drastically different ways
of configuring daemons.
- Some of the elements of my custom environment have to be (re)built
as system packages, which means that I wind up caring about how
easy it is to patch and (re)build packages. I have wound up with
strong opinions on this for RPMs versus .debs (cf) and I'm likely to wind up with equally
strong opinions for any other packaging system. On top of that, I'm
already quite familiar with building and working with RPMs;
anything else would have to be learned, adding to the cost of
switching.
I'm not going to say that you can't have a better package format than RPM, because RPM sure has problems. But I do think it's very hard to beat right now and most package formats are going to fall short.
- As a sysadmin, I have fairly strong opinions on right and wrong
ways for the overall system to be structured and managed. Normal
people would just ignore all of this, as it's not directly relevant
to my custom desktop or the overall custom environment, but I
care and so different distributions (or Unixes) have under the
surface differences for me. Switching is guaranteed to give me
exciting new things to be irritated about (as opposed to the old
irritating things that I'm already familiar with).
(There is also the simple mechanical issue of getting familiar with sysadmining a new distribution or OS. This always takes time and work.)
The overall effect here is to make switching much harder and far less attractive than it looks on the surface. At this point I am far less likely to someday switch to something than to someday switch away from Fedora, and I have a lot of reasons to hope that that day is a long way away (because it would be a pain for probably very little practical gain).
As a corollary, at this point I'm not sure what a Linux (or Unix) could do to get me to switch to it. Everyone is packaging more or less the same upstream open source software and it seems really unlikely that a distribution is going to magically achieve stunning and compelling packaging and system management.
(There certainly was a time when there was a real difference between Linux distributions, but major ones strike me as pretty close now. For example, Debian, Ubuntu, and Fedora are all pretty up to date, all have pretty good package selections, release pretty frequently, and so on.)
2015-12-11
The ArchLinux wiki has quietly become a good resource for me
I mentioned this on Twitter and it keeps showing up in my entries (eg), so I might as well say it explicitly: increasingly, the ArchLinux wiki is becoming one of my relatively highly trusted information sources, both for Linux specific information and also often for more general things like X. I don't yet search it first, but when it comes up in my web searches I'm more and more inclined to stop looking at anything else.
I like the ArchLinux wiki for two reasons. First, they have all sorts of information on all sorts of things, many of them kind of geeky and obscure, and the content is written for a fairly technical audience (and often includes specific commands that I can immediately use). Second, the information seems to be pretty solid and trustworthy, based both on reading about areas that I already know and using information from the wiki. I don't know exactly how ArchLinux has managed to wind up with such a good technical resource, but I imagine that it says something about the sort of users that it attracts (since, well, it takes users to build and maintain a wiki).
Of course, all of this makes me somewhat curious about ArchLinux itself; that it has a cool wiki suggests that it might be cool itself. Sadly I don't really have any machines that I'm looking to (re)install with alternate Linuxes any time soon, so I'm unlikely to do more than read about it (if that). Still, you never know. Maybe someday I'll get sufficiently disgruntled with all of the major alternatives.
(In theory I could install ArchLinux in a virtual machine. In practice I generally don't expect this to tell me anything interesting about an OS, and it suffers from the usual 'why am I doing this?' problem I have with just playing around with stuff in general. I've never been the kind of person who had installs of N different Linuxes sitting in partitions on their drive, just so they could play around with them.)