## SSH publickey denied?

I was suddenly having trouble connecting to GitHub, after pulling in an OpenSSH update to version 7. Chances are that means the problem is security-related, meaning it’s worthwhile to take the time to investigate the cause.

$git pullPermission denied (publickey).fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists. A little debugging showed the following: $ ssh -vT git@github.comOpenSSH_7.1p2 Debian-2, OpenSSL 1.0.2f  28 Jan 2016debug1: Reading configuration data /etc/ssh/ssh_configdebug1: /etc/ssh/ssh_config line 19: Applying options for *debug1: Connecting to github.com [192.30.252.130] port 22.debug1: Connection established.[…]debug1: Skipping ssh-dss key /home/frans/.ssh/id_dsa for not in PubkeyAcceptedKeyTypes[…]debug1: No more authentication methods to try.Permission denied (publickey).

Of course I could quickly fix the problem by adding PubkeyAcceptedKeyTypes ssh-dss to ~/.ssh/config, but checking OpenSSH.com tells me that “OpenSSH 7.0 and greater similarly disables the ssh-dss (DSA) public key algorithm. It too is weak and we recommend against its use.” So, although I could obviously re-enable it easily, I guess I’ll have to generate a new key. I hope GitHub’s guide is accurate for generating something sufficiently secure, because I’m kind of ticked off that something I generated in 2013 is already considered “legacy.” I hope I’m too blame and not an earlier version of GitHub’s guide.

Incidentally, to change the passphrase one would use the -p option, e.g.:

ssh-keygen -f id_rsa -p

## LuaLatex Font Hassles

The TeX Gyre Pagella font I was using turned out not to contain Cyrillic characters. Unfortunately, fontspec doesn’t seem to have an easy means of setting a fallback font — I checked the manual, I swear! So I found a lookalike font named Palladio Uralic and used it instead. Before you can use a newly installed font, you have to run luaotfload-tool --update.

%So is Palladio. Used as fallback. Thanks to http://tex.stackexchange.com/a/37251/32003
\DeclareTextFontCommand{\textpalladio}{\palladio}

## PulseAudio: How to Decouple Application Volumes And Global Volume

I wondered why e.g. my VLC volume kept getting lowered. As it turns out, there was a change.

PulseAudio seems to have copied one of Windows 6+’s most annoying features, at least in terms of the media framework: flat volumes.

Quick refresher: This is that annoying thing that Windows (and now, PulseAudio, by default) does, where turning up the volume in an application will increase the master system volume alongside it. This has the side-effect that any application which sets its own volume can commandeer the master volume of your system. Why is this bad? The short answer is headphones.

It’s not as if it’s only headphones that can blare at ridiculously loud volumes. Anyway, a quick search came up with this helpful suggestion regarding the flat-volumes setting.

PulseAudio supports per-application volume control, but by default this doesnt do much as you can only control these volumes from the pulseaudio volume control utility. Meaning that in an application like Audacious, when the output device is set to PulseAudio, and the volume control is set to hardware, it will adjust the master volume control, not the per-application volume control.

To fix this behavior, set the following in /etc/pulse/daemon.conf

flat-volumes = no

Now whenever Audacious goes to adjust the volume, it will adjust the audacious only volume and thus you wont have multiple applications fighting over the master volume control.

What a horribly annoying new default.

## Working around the broken Creative HS-720 headset

A few years ago I received a Creative HS-720 as a gesture of good will. I wasn’t displeased, but since I didn’t need it I didn’t really investigate. Recently I’ve been wanting to use it as a headphone and noticed that even at the lowest possible volume, it was still significantly too loud. What’s really crazy is that there are actually positive reviews for the product out there. Read this negative one instead. That’s all you need to know. Avoid this product. Ideally I’d acquire something like an Asus Xonar U3, a Creative Sound Blaster Play! 2 or a Creative Sound Blaster E1 in combination with proper headphones (although the HS-720 certainly doesn’t make me want to buy another Creative product), but I figured there just had to be a software solution.

Some searching gave me “Fix for USB Audio is Too Loud and Mutes at Low Volume in Ubuntu.” The title isn’t quite accurate, because it’s a workaround. No matter. It requires modifying the file /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common. But we might as well take a look at what else there is to play with while we’re at it.

/usr/share/pulseaudio/alsa-mixer/paths$ls analog-input-aux.conf analog-input-mic.conf analog-output-lineout.conf analog-input.conf analog-input-mic.conf.common analog-output-mono.conf analog-input.conf.common analog-input-mic-line.conf analog-output-speaker-always.conf analog-input-dock-mic.conf analog-input-rear-mic.conf analog-output-speaker.conf analog-input-fm.conf analog-input-tvtuner.conf hdmi-output-0.conf analog-input-front-mic.conf analog-input-video.conf hdmi-output-1.conf analog-input-headphone-mic.conf analog-output.conf hdmi-output-2.conf analog-input-headset-mic.conf analog-output.conf.common hdmi-output-3.conf analog-input-internal-mic-always.conf analog-output-desktop-speaker.conf iec958-stereo-output.conf analog-input-internal-mic.conf analog-output-headphones-2.conf analog-input-linein.conf analog-output-headphones.conf As you can see there’s a bunch of PulseAudio profiles. In my case I might be able to adjust one of the headphones files without changing the entire system, but as luck would have it I use a digital IEC958 output for my main sound system, so I could afford mess up all handling of analog output for the sake of these headphones. I’ll quote part of Chris Jean’s guide in case linkrot ever strikes. Search for the text “Element PCM”. You should see the following text: [Element PCM] switch = mute volume = merge override-map.1 = all override-map.2 = all-left,all-right Update this section of text to look like the following (changes are in bold): [Element PCM] switch = mute volume = ignore volume-limit = 0.01 override-map.1 = all override-map.2 = all-left,all-right Note that the value 0.01 can be adjusted as needed to change how quiet and loud the volume is. Making the number smaller reduces the max volume while making the number larger increases the max volume. I tested out 0.05 and found that the max volume was much louder than I would ever use. I also decided that 0.01 was technically louder than I’d ever use. I ended up with a value of 0.0075 (0.005 was too quiet) which I felt gave a good maximum volume and resulted in better overall control over the volume range. I’d add that it seems to work fine with volume-limit = 1.0 as well. After making that change run killall pulseaudio (or pulseaudio -k, but why bother with something non-generic) to get it to work. You can do some more volume play using alsamixer, but you’ll have to figure out which device to use first. $ pacmd list-sources | grep -e device.string -e 'name:'
name:
device.string = "1"
name:
device.string = "hw:2"
name:
device.string = "0"
name:
device.string = "3"

As you can see the headset is device 3. You can print some more info using amixer.

\$ amixer -c 3
Simple mixer control 'PCM',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 38
Mono:
Front Left: Playback 9 [24%] [-21.67dB] [on]
Front Right: Playback 9 [24%] [-21.67dB] [on]
Simple mixer control 'Mic',0
Capabilities: cvolume cvolume-joined cswitch cswitch-joined
Capture channels: Mono
Limits: Capture 0 - 16
Mono: Capture 14 [88%] [20.83dB] [on]
Simple mixer control 'Auto Gain Control',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]

And using alsamixer -c 3 you can play around with the volume a bit more, too.

My only regret is that I haven’t been able to find something like Identifier for xorg.conf. Oh well, it’ll save me some money in the short term.

PS On Windows, try EqualizerAPO (source).

## Just a Star

Messing about a little in Inkscape with my wife’s Wacom CTH-680S tablet on Linux 4.1, after first trying it in Xournal. It seems to be functioning a fair bit better than a few kernel versions ago.

The tablet is really good. I’d recommend it.

## Alt + Print screen in Xfce

Perhaps it’s merely a fluke of Debian Xfce, but the Print screen key does nothing by default. If you just want to use Print screen that’s easy to rectify through Settings > Keyboard > Application Shortcuts > Add. Use the command xfce4-screenshooter -f or -w for respectively full screen and window. As it turns out that interface doesn’t support the key combination of Alt + Print screen thanks to some kernel feature. The suggestion is to disable the kernel feature, but interestingly enough it works when you add the shortcut manually. Remember how we regained control of Ctrl + F1F12? Once again, edit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml. Look for the custom section, which should look a little something like this:

    <property name="custom" type="empty">
<property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
<property name="&lt;Primary&gt;&lt;Alt&gt;Delete" type="string" value="xflock4"/>
<property name="&lt;Alt&gt;F2" type="string" value="xfrun4"/>
<property name="override" type="bool" value="true"/>
<property name="&lt;Super&gt;p" type="string" value="xfce4-display-settings --minimal"/>
</property>

Next, we add in our custom setting:

      <property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>

Now it should look like this.

    <property name="custom" type="empty">
<property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
<property name="&lt;Primary&gt;&lt;Alt&gt;Delete" type="string" value="xflock4"/>
<property name="&lt;Alt&gt;F2" type="string" value="xfrun4"/>
<property name="override" type="bool" value="true"/>
<property name="&lt;Super&gt;p" type="string" value="xfce4-display-settings --minimal"/>
<property name="&lt;Alt&gt;Print" type="string" value="xfce4-screenshooter -w"/>
</property>

You're going to have to log out and log in again (or restart) for the changes to take effect. I have to admit it's probably more useful to bind Print screen to take window screenshots by default, but on the other hand it might be a good idea to stick to the global standard so you can still use desktop environments other than your own without feeling hampered.

## Custom page number count in Prince

Prince makes it really easy to do all of the usual things with page numbers, like a different numbering scheme in the front matter and whatnot. Unfortunately you can’t counter-increment on @page, but thanks to Prince.addScriptFunc() you’ve got something better.

h2 {counter-reset: page 50}

@page {
@bottom-left {
content: prince-script(fixpagenum, counter(page));
margin-left: 2cm;
}
}

In this CSS, instead of passing regular generated content, we’re passing a prince-script. That script has to be defined somewhere, like this.

Prince.addScriptFunc("fixpagenum", function(pagenum) {
pagenum = Number(pagenum);
pagenum = pagenum + pagenum - 50;
return pagenum;
});


The rationale in this case was to generate two separate documents, starting at page 50, one only left pages and the other only right pages. (Of course, the other one started at page 51.) I combined them with pdftk’s shuffle command.

pdftk left.pdf right.pdf shuffle output combined.pdf

I don’t think there’s a way to do something like this purely in Prince using CSS, but I’d love to be proved wrong.

## LaTeX: combining added margins with hanging indents

Since I’m using KOMA, the obvious method would seem to be:

\begin{addmargin}[1cm]{0cm}


Unfortunately, that doesn’t seem to combine with the hanging environment. So I did it a little more manually, which will probably have someone shaking their head while I’m stuck feeling pretty clever about it:

\parindent=1cm\hangindent=2cm Yada.

## Xfce: Keep Windows from Switching Workspaces

I thought applications switching workspaces was an issue in all window managers, but it never bothered me quite enough to investigate changing it. But what do you know, in Xfwm you can change it.

When using several workspaces in Xfce, I had the problem that when I pressed a link in Claws-Mail, it opened Iceweasel, but it also move my Iceweasel from workspace 3 to workspace 1 (where Claws-Mail was).

To avoid this, start the xfce4-settings-editor, select xfwm4 in the list, and go to general->activate_action (in my case it is the topmost entry), and change the string value from “bring” to “switch”.

Thanks to Gusnan.

## Introducing Nimbler: A Window Switcher

When I discovered SmartTab.org about a decade ago, I was quite happy. Never before had my window switching been so fast and nimble. The most important feature was of course the list-based view of window titles, rather than the standard mysterious icons that only coughed up their secret window titles once you landed on them. But one thing I hadn’t yet conceived of was switching to a far-off window without pressing Tab a dozen times or more. SmartTab.org quickly became so ingrained into my workflow that I even resisted changing my operating system because of it. If Windows 7 would mean giving up on all of my trusty tools like SmartTab.org and ASD Clock, I might as well upgrade to something completely different. In 2011 I switched to Debian Squeeze as my main OS and I haven’t looked back, barring perhaps the occasional game. To me, Linux is just so much more user-friendly these days. But enough about that. You can get Nimbler here or you can continue reading about my window switching philosophy.

Even before I switched, I looked for SmartTab.org alternatives. I discovered that both Openbox and KWin can display sane window lists, but superswitcher was much closer to what I wanted. Unfortunately, its C-based code was too complicated for now. I’d pretty much have to learn C first. Fast forward a few years and Fuzzy Window Switcher came out. It was a lovely little application, and it managed to scratch my itch. Someone quipped that a Compiz plugin could perform the same task. I replied that “The Compiz (plugins) source had absolutely no documentation when I last checked, nor was it so obvious that none was needed. Above all else I see [Fuzzy Window Switcher] as a great place to start for hacking together your own thing. Besides, not everyone uses Compiz. This can be useful regardless of whether you use Compiz, Mutter, xfwm4, OpenBox, KWin or whatever else there is.”

Still, I wasn’t ready. I had to learn the much easier Python first, which I didn’t start with until a few months later. By that time I was too busy, and when my schedule finally opened up again I’d forgotten about my plans. Until a couple of weeks ago a bug report reminded me that I could actually mimic what I liked about SmartTab.org. Several hours of coding later I can present Nimbler. Bear with me if you actually know GTK+ 3; I’m figuring this stuff out as I go along. Long story short, this is what it looks like:

So how does it work? I like to think it couldn’t be much more intuitive. You press the shortcut — at the moment I use <Super>grave — and the window pops up. Then you can immediately switch to any window using its identifier, the arrow keys or the mouse. You can also switch workspaces using F1-F12.

Currently non-functional, if you press colon (:) a text input box is added to the window. At some undefined point in the future I probably intend to couple this with Fuzzy Window Switcher’s fuzzy matching code, but don’t hold your breath. 😉 If I do get around to implementing something like that, I figure there should also be a configuration setting for this fuzzy-mode where you don’t have to press colon first. This sounds like a wasteful duplication of Fuzzy Window Switcher itself, but my thoughts are that if the text input is merely one character, no fuzzy matching would occur and instead it would just be treated as a window identifier. Theoretically I suppose you could also use such functionality to introduce double-character identifiers, easily quadrupling the amount of potential options.

Quadrupling, you ask? The current amount of identifiers is a little more than 90, so you would expect to easily get over 8,000 unique identifiers out of it. However, for usability purposes aa would is much faster than aA, let alone a0. Besides, who could possibly keep so many windows straight?

I hope someone besides me finds this useful. Enjoy!

Older Entries »