Jekyll2021-07-17T23:51:24+03:00http://blogshit.baka.fi/BlogshitA very, very shitty blog that you really shouldn't read.
Remapping left channel ONLY from a stereo source to mono in PipeWire2021-07-17T00:00:00+03:002021-07-17T00:00:00+03:00http://blogshit.baka.fi/2021/07/pipewire-microphone<p>I recently upgraded to Fedora 34, which meant switching from PulseAudio to PipeWire (precisely the reason I kept putting the upgrade off).</p>
<p>I have a certain circumstance in my audio setup: my audio interface has two inputs (for microphones, instruments, etc.) which are recognized by ALSA as a single stereo input. I want a mono input that only has my microphone on it and not the second channel. Granted, the second channel is almost always empty, but mixing stereo to mono involves something called the <a href="https://en.wikipedia.org/wiki/Pan_law">pan law</a> (which isn’t a law, just an audio engineering convention), which, to make a long story short, ends up reducing my microphone’s maximum volume by up to 6 decibels as it gets downmixed to mono.</p>
<p>In PulseAudio I did this with the following line in <code class="highlighter-rouge">~/.config/pulse/default.pa</code>: <code class="highlighter-rouge">pactl load-module module-remap-source master=alsa_input.usb-BEHRINGER_UMC204HD_192k-00.analog-stereo master_channel_map=front-left channel_map=mono rate=48000 format=s24le</code></p>
<p>This would create a virtual microphone device that only had the left channel of input on it, and avoided the -6dB pan “law” effect.</p>
<h2 id="enter-pipewire">Enter PipeWire</h2>
<p>Doing this on PipeWire was a little harder, because the PipeWire documentation is… well, let’s say it’s a work in progress. I did not want to use the PulseAudio compatibility functionality of PipeWire (which would let me just use the Pulse command from above) because I suspect it has worse performance than the native PipeWire solution, and instead wanted to use the native solution.</p>
<p>Reading <a href="https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices">the relevant PipeWire documentation on Virtual Devices</a> I managed to do something like what I wanted with the following command:</p>
<p><code class="highlighter-rouge">pw-loopback --capture-props='audio.position=[FL, FL]' --playback-props='media.class=Audio/Source node.name=testsource audio.position=[mono]'</code></p>
<p>However, this had two issues: (1) it did not persist through restarts, and (2) if I selected the virtual interface as my default input, PipeWire would try to be smart and re-link it to itself, causing it to stop working. This is to my understanding not a bug but a feature, as the documentation page says:</p>
<blockquote>
<p>Streams are normally automatically linked to devices by the session manager. This means that coupled streams don’t need any manual intervention to get linked and can also be moved around with tools like pavucontrol or pw-metadata.</p>
</blockquote>
<p>I wanted a solution that persisted through restarts, and one that I could just set as my system-wide default microphone input and forget about.</p>
<h2 id="the-solution">The solution</h2>
<p>First, copy a default PipeWire session manager config file to your <code class="highlighter-rouge">~/.config</code> (or under <code class="highlighter-rouge">/etc/pipewire/</code> if you want it to be system-wide):</p>
<p><code class="highlighter-rouge">cp /usr/share/pipewire/media-session.d/media-session.conf ~/.config/pipewire/media-session.d</code></p>
<p>Then, open up that config file and insert the following at the bottom of the <code class="highlighter-rouge">context.modules</code> section. Mind your braces and square brackets; humans are second-class citizens in the PipeWire config format.</p>
<div class="language-text highlighter-rouge"><pre class="highlight"><code> { name = libpipewire-module-loopback
args = {
capture.props = {
audio.position = [FL, FL]
node.target = alsa_input.usb-BEHRINGER_UMC204HD_192k-00.analog-stereo
}
playback.props = {
media.class = Audio/Source
node.name = mono-microphone
node.description = "Behringer Left"
audio.position = [mono]
}
}
}
</code></pre>
</div>
<p>This <em>must</em> go in the session manager config (something that took me a long time to figure out), and PipeWire is <em>very</em> fussy about the parameters; specifying <code class="highlighter-rouge">media.class</code> for the <code class="highlighter-rouge">capture.props</code> section will break everything, as does <code class="highlighter-rouge">node.name</code> and what have you.</p>
<p>The configuration here works for me, and I hope it works for the future me who came back here to remind himself of how to configure this, and I hope it works for you. If it doesn’t, god help you (or me).</p>BurneddiI recently upgraded to Fedora 34, which meant switching from PulseAudio to PipeWire (precisely the reason I kept putting the upgrade off).
I have a certain circumstance in my audio setup: my audio interface has two inputs (for microphones, instruments, etc.) which are recognized by ALSA as a single stereo input. I want a mono input that only has my microphone on it and not the second channel. Granted, the second channel is almost always empty, but mixing stereo to mono involves something called the pan law (which isn’t a law, just an audio engineering convention), which, to make a long story short, ends up reducing my microphone’s maximum volume by up to 6 decibels as it gets downmixed to mono.
In PulseAudio I did this with the following line in ~/.config/pulse/default.pa: pactl load-module module-remap-source master=alsa_input.usb-BEHRINGER_UMC204HD_192k-00.analog-stereo master_channel_map=front-left channel_map=mono rate=48000 format=s24le
This would create a virtual microphone device that only had the left channel of input on it, and avoided the -6dB pan “law” effect.
Enter PipeWire
Doing this on PipeWire was a little harder, because the PipeWire documentation is… well, let’s say it’s a work in progress. I did not want to use the PulseAudio compatibility functionality of PipeWire (which would let me just use the Pulse command from above) because I suspect it has worse performance than the native PipeWire solution, and instead wanted to use the native solution.
Reading the relevant PipeWire documentation on Virtual Devices I managed to do something like what I wanted with the following command:
pw-loopback --capture-props='audio.position=[FL, FL]' --playback-props='media.class=Audio/Source node.name=testsource audio.position=[mono]'
However, this had two issues: (1) it did not persist through restarts, and (2) if I selected the virtual interface as my default input, PipeWire would try to be smart and re-link it to itself, causing it to stop working. This is to my understanding not a bug but a feature, as the documentation page says:
Streams are normally automatically linked to devices by the session manager. This means that coupled streams don’t need any manual intervention to get linked and can also be moved around with tools like pavucontrol or pw-metadata.
I wanted a solution that persisted through restarts, and one that I could just set as my system-wide default microphone input and forget about.
The solution
First, copy a default PipeWire session manager config file to your ~/.config (or under /etc/pipewire/ if you want it to be system-wide):
cp /usr/share/pipewire/media-session.d/media-session.conf ~/.config/pipewire/media-session.d
Then, open up that config file and insert the following at the bottom of the context.modules section. Mind your braces and square brackets; humans are second-class citizens in the PipeWire config format.
{ name = libpipewire-module-loopback
args = {
capture.props = {
audio.position = [FL, FL]
node.target = alsa_input.usb-BEHRINGER_UMC204HD_192k-00.analog-stereo
}
playback.props = {
media.class = Audio/Source
node.name = mono-microphone
node.description = "Behringer Left"
audio.position = [mono]
}
}
}
This must go in the session manager config (something that took me a long time to figure out), and PipeWire is very fussy about the parameters; specifying media.class for the capture.props section will break everything, as does node.name and what have you.
The configuration here works for me, and I hope it works for the future me who came back here to remind himself of how to configure this, and I hope it works for you. If it doesn’t, god help you (or me).Configure mouse thumb buttons as F13 in Linux2021-02-13T00:00:00+02:002021-02-13T00:00:00+02:00http://blogshit.baka.fi/2021/02/mouse-button-f13<p>Like most people, I have a mouse with thumb buttons on it. Mouse designers of the late 90s and early
00s decided to call these buttons “Back” and “Forward” and make them navigate backwards and forwards
in web browsers and such. Not a feature I use very much.</p>
<p>What I do use a lot is VoIP communications software, where I use push-to-talk bound to one of these
thumb buttons. Therein lies the problem: whenever I press push-to-talk with my web browser active,
it takes me off the page I was on and onto the previous page I was on. I don’t want that to happen.</p>
<p>Browser designers clearly don’t relate to this issue, so there’s no easy, universal way to disable
this backwards-forwards functionality of the thumb buttons. And even if I did disable it in Firefox,
my file browser would still use them for navigation, and if I disabled it there, there’d still be
some app out there that insists on using these buttons for this purpose. It’s a battle I can’t win.</p>
<p>Some years ago I discovered a great solution for this. My Logitech mouse allows rebinding the mouse
buttons to arbitrary keyboard buttons, so why don’t I just change it to some keyboard button I almost
never use like the Pause button? Even better, the F-keys that normally run from F1 to F12 actually
run all the way up to F24. Modern keyboards obviously never go that high, but due to legacy reasons
operating systems still support these “high F” keys.</p>
<p>So I opened the Logitech Control Panel on Windows, entered the key binding interface and… wait,
I can’t actually input F13 in here. How do I do it? I’ll spare you the suspense and say that I did
it with a simple AutoHotKey script that sent the F13 keystroke which the Logitech software happily
accepted. I don’t have that script anymore because I don’t use Windows, but it was a oneliner so
you’ll figure it out. I’m counting on you.</p>
<p>But then I switched to Linux, and the Logitech Control Panel doesn’t work on Linux and unfortunately,
the forwards/backwards buttons do. What now?</p>
<h2 id="the-actual-solution">The actual solution</h2>
<p>Enter <a href="https://github.com/libratbag/libratbag/">libratbag</a>, a community-maintained effort to enable
features in modern mice (and a small handful of other peripherals) that would normally be accessed
through the driver software, which is unfortunately typically exclusive to Windows.</p>
<p>It’s supposed to be a library/dbus daemon type thing to enable GUI frontends to access these devices,
and it has a GUI frontend called <a href="https://github.com/libratbag/piper/">Piper</a>. Unfortunately, Piper
doesn’t want to accept the F13 key.</p>
<p>Thankfully libratbag also comes with a command line utility called <code class="highlighter-rouge">ratbagctl</code>.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ ratbagctl
singing-gundi: Logitech MX518 Gaming Mouse
</code></pre>
</div>
<p>When invoked, it shows us a list of supported devices along with a human-readable ID.
In this case there’s only one supported device, “singing-gundi” the Logitech MX518 Gaming Mouse.</p>
<p>We read <code class="highlighter-rouge">man ratbagctl</code> like a good boy and piece together the following commands:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ ratbagctl singing-gundi button 3 get
Button: 4 is mapped to 'button 4'
</code></pre>
</div>
<p>Button 3 is the first thumb button, the one closer to the user. We can see it’s currently bound to
‘button 4’, which is the default and not at all confusing (ratbag indexes the buttons from 0 while
X11 – or whatever is handling the input – indexes from 1). We want to rebind it to F13.</p>
<p>The manpage specifies the command <code class="highlighter-rouge">button N action set button B</code>, but this is for setting it to
<em>mouse</em> buttons, not keyboard keys, so we can’t rebind it to F13 this way. Instead we need to use</p>
<div class="highlighter-rouge"><pre class="highlight"><code>ratbagctl singing-gundi button 3 action set macro KEY_F13
</code></pre>
</div>
<p>The shell should be silent in response, which means the command succeeded. We can check that it
worked with</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ ratbagctl singing-gundi button 3 get
Button: 3 is mapped to macro '↕F13'
</code></pre>
</div>
<p>And that’s it! The first thumb button is now going to be sending the F13 keystroke, which X11 calls
<strong>XF86Tools</strong> by the way. This should be recognized in pretty much any app or game as a keybinding,
but browsers won’t go backwards when pressing it.</p>
<p>If you want to go back to the default, simply use</p>
<div class="highlighter-rouge"><pre class="highlight"><code>ratbagctl singing-gundi button 3 action set button 4
</code></pre>
</div>BurneddiLike most people, I have a mouse with thumb buttons on it. Mouse designers of the late 90s and early
00s decided to call these buttons “Back” and “Forward” and make them navigate backwards and forwards
in web browsers and such. Not a feature I use very much.
What I do use a lot is VoIP communications software, where I use push-to-talk bound to one of these
thumb buttons. Therein lies the problem: whenever I press push-to-talk with my web browser active,
it takes me off the page I was on and onto the previous page I was on. I don’t want that to happen.
Browser designers clearly don’t relate to this issue, so there’s no easy, universal way to disable
this backwards-forwards functionality of the thumb buttons. And even if I did disable it in Firefox,
my file browser would still use them for navigation, and if I disabled it there, there’d still be
some app out there that insists on using these buttons for this purpose. It’s a battle I can’t win.
Some years ago I discovered a great solution for this. My Logitech mouse allows rebinding the mouse
buttons to arbitrary keyboard buttons, so why don’t I just change it to some keyboard button I almost
never use like the Pause button? Even better, the F-keys that normally run from F1 to F12 actually
run all the way up to F24. Modern keyboards obviously never go that high, but due to legacy reasons
operating systems still support these “high F” keys.
So I opened the Logitech Control Panel on Windows, entered the key binding interface and… wait,
I can’t actually input F13 in here. How do I do it? I’ll spare you the suspense and say that I did
it with a simple AutoHotKey script that sent the F13 keystroke which the Logitech software happily
accepted. I don’t have that script anymore because I don’t use Windows, but it was a oneliner so
you’ll figure it out. I’m counting on you.
But then I switched to Linux, and the Logitech Control Panel doesn’t work on Linux and unfortunately,
the forwards/backwards buttons do. What now?
The actual solution
Enter libratbag, a community-maintained effort to enable
features in modern mice (and a small handful of other peripherals) that would normally be accessed
through the driver software, which is unfortunately typically exclusive to Windows.
It’s supposed to be a library/dbus daemon type thing to enable GUI frontends to access these devices,
and it has a GUI frontend called Piper. Unfortunately, Piper
doesn’t want to accept the F13 key.
Thankfully libratbag also comes with a command line utility called ratbagctl.
$ ratbagctl
singing-gundi: Logitech MX518 Gaming Mouse
When invoked, it shows us a list of supported devices along with a human-readable ID.
In this case there’s only one supported device, “singing-gundi” the Logitech MX518 Gaming Mouse.
We read man ratbagctl like a good boy and piece together the following commands:
$ ratbagctl singing-gundi button 3 get
Button: 4 is mapped to 'button 4'
Button 3 is the first thumb button, the one closer to the user. We can see it’s currently bound to
‘button 4’, which is the default and not at all confusing (ratbag indexes the buttons from 0 while
X11 – or whatever is handling the input – indexes from 1). We want to rebind it to F13.
The manpage specifies the command button N action set button B, but this is for setting it to
mouse buttons, not keyboard keys, so we can’t rebind it to F13 this way. Instead we need to use
ratbagctl singing-gundi button 3 action set macro KEY_F13
The shell should be silent in response, which means the command succeeded. We can check that it
worked with
$ ratbagctl singing-gundi button 3 get
Button: 3 is mapped to macro '↕F13'
And that’s it! The first thumb button is now going to be sending the F13 keystroke, which X11 calls
XF86Tools by the way. This should be recognized in pretty much any app or game as a keybinding,
but browsers won’t go backwards when pressing it.
If you want to go back to the default, simply use
ratbagctl singing-gundi button 3 action set button 4Better font rendering in Fedora2020-07-09T00:00:00+03:002020-07-09T00:00:00+03:00http://blogshit.baka.fi/2020/07/fedora-better-fonts<p>I’ve used Fedora for many years now on my laptop, and the default font rendering has served me well there…
but only because the laptop has a HiDPI screen which doesn’t need subpixel hinting as much as regular screens.
Subpixel hinting, as it turns out, is patented by Microsoft (accursed software patents) so most Linux distributions
don’t ship with it enabled, and its absence is painfully obvious on ye olde low-DPI screens especially when viewing
light text on dark backgrounds.</p>
<p>Anyway, there’s a helpful COPR repository that fixes all of this. <a href="https://github.com/silenc3r/fedora-better-fonts">https://github.com/silenc3r/fedora-better-fonts</a> (or more directly, <a href="https://copr.fedorainfracloud.org/coprs/dawid/better_fonts/">https://copr.fedorainfracloud.org/coprs/dawid/better_fonts/</a>).</p>
<p>Enable this repository and install the packages it offers and you’ll get prettier fonts, plus it installs
replacements for a bunch of common Microsoft fonts, making web pages appear closer to what they do on Windows
(if this is something you don’t want, I suppose you can just not install the <code class="highlighter-rouge">fontconfig-font-replacements</code> package.)</p>
<h2 id="installation-instructions-as-per-the-copr-repo-page">Installation instructions (as per the COPR repo page):</h2>
<ol>
<li>
<p>Enable COPR repository with packages from this repo: <code class="highlighter-rouge">dnf copr enable dawid/better_fonts</code></p>
</li>
<li>
<p>Install packages: <code class="highlighter-rouge">dnf install fontconfig-enhanced-defaults fontconfig-font-replacements</code></p>
</li>
<li>
<p>Log out and log in again or restart computer to see the effect</p>
</li>
</ol>BurneddiI’ve used Fedora for many years now on my laptop, and the default font rendering has served me well there…
but only because the laptop has a HiDPI screen which doesn’t need subpixel hinting as much as regular screens.
Subpixel hinting, as it turns out, is patented by Microsoft (accursed software patents) so most Linux distributions
don’t ship with it enabled, and its absence is painfully obvious on ye olde low-DPI screens especially when viewing
light text on dark backgrounds.
Anyway, there’s a helpful COPR repository that fixes all of this. https://github.com/silenc3r/fedora-better-fonts (or more directly, https://copr.fedorainfracloud.org/coprs/dawid/better_fonts/).
Enable this repository and install the packages it offers and you’ll get prettier fonts, plus it installs
replacements for a bunch of common Microsoft fonts, making web pages appear closer to what they do on Windows
(if this is something you don’t want, I suppose you can just not install the fontconfig-font-replacements package.)
Installation instructions (as per the COPR repo page):
Enable COPR repository with packages from this repo: dnf copr enable dawid/better_fonts
Install packages: dnf install fontconfig-enhanced-defaults fontconfig-font-replacements
Log out and log in again or restart computer to see the effectXorg, Nvidia and Custom Resolutions / Modes in 20202020-07-05T00:00:00+03:002020-07-05T00:00:00+03:00http://blogshit.baka.fi/2020/07/xorg-custom-resolutions<p>I have a now fairly old BenQ XL2420Z gaming monitor. It is a 144Hz refresh rate model
and has strobing backlight functionality for motion blur reduction. However, I run
it at 120Hz using some custom timings, because this reduces visual artifacting with the strobing backlight and makes the display brighter when the strobing is enabled. <a href="https://blurbusters.com/benq/strobe-utility/#largeverticaltotal">BlurBusters calls this the “1350 Vertical Total trick”</a>, or something along those lines. The why and how of
it is beyond me.</p>
<p>I had some issues setting this custom resolution up under Linux using Xorg and the
proprietary Nvidia drivers. Someone at the BlurBusters forums created a
<a href="https://forums.blurbusters.com/viewtopic.php?t=2205">guide</a> which was helpful, but
was missing some key details that were necessary to get this to work on my machine.</p>
<h2 id="the-configuration">The configuration</h2>
<p>Here’s the configuration for the impatient. If you have the exact same display I do,
this may work for you. However, you may want to read on to see how this configuration
came to be.</p>
<p>Save this into <code class="highlighter-rouge">/etc/X11/xorg.conf.d/</code> with some descriptive filename. If you are unfamiliar with conf.d style configs, these loose files are read after the main Xorg.conf (which on modern systems often doesn’t even exist anymore) and any changes in them are applied in alphabetical order. In my case, this file is <code class="highlighter-rouge">/etc/X11/xorg.conf.d/20-xl2420z-customres.conf</code>.</p>
<div class="highlighter-rouge"><pre class="highlight"><code>Section "Monitor"
Identifier "xl2420z" #This identifier can be anything; it's just the name of this config block.
#The next line defines the custom resolution.
#The exact meaning of the magic numbers here is beyond the scope of this blog post.
ModeLine "1920x1080_120_vt1350" 336.96 1920 1968 2000 2080 1080 1083 1088 1350 +hsync -vsync
EndSection
Section "Screen"
Identifier "Screen0"
#The next line disables some safety checks imposed by the Nvidia driver
#It uses the display's EDID so that they are only disabled for the XL2420Z and
#not any other displays.
#Without this line the custom resolution will be rejected as unsafe.
Option "ModeValidation" "DPY-EDID-edbe03be-f4a0-3a94-b9e8-00884a48f8f4: AllowNonEdidModes,NoMaxPClkCheck,NoEdidMaxPClkCheck,NoHorizSyncCheck"
Monitor "xl2420z" #This is important so that the monitor block above is actually used!
EndSection
</code></pre>
</div>
<h2 id="applying-the-configuration">Applying the configuration</h2>
<p>Once you’ve saved the config to a valid path, reboot your computer (or restart X, but it’s safer and easier to reboot).</p>
<p>After the reboot, use the <code class="highlighter-rouge">nvidia-settings</code> GUI to enable the custom resolution. Select “X Server Display Configuration” from the list on the left, then select your monitor, switch to Advanced mode on the bottom right, and then set the correct resolution. It will unhelpfully be categorized by the refresh rate, so you might be in a situation where the right resolution is 1920x1080 120 Hz (1) or something. Just select the correct dimensions, and then scroll through the refresh rate selection until you see the correct Mode Name; that’s the resolution you want.</p>
<p><img src="/media/nvidia-settings-2.png" alt="nvidia-settings GUI example 2" /></p>
<p>Once you’ve got the right resolution, click on Apply and then exit out of the GUI.
The resolution should now be applied, and the drivers will load it automatically every
boot, and you should be done! If not, read the debugging section below.</p>
<p>I’ve also seen the custom resolution defined in the config file directly using <a href="https://download.nvidia.com/XFree86/Linux-x86_64/396.51/README/xconfigoptions.html#MetaModes">the MetaModes option</a>, but I couldn’t get that to work either. Your mileage may vary.</p>
<h2 id="how-the-configuration-came-to-be">How the configuration came to be</h2>
<p>There are two key bits in this config that you may have to customize for your setup.</p>
<p>The first is the <strong>ModeLine</strong>, which is the set of magic numbers that defines our
custom resolution. The ModeLine here is from the BlurBusters forum guide linked above
and matches the timings I successfully used on Windows for many years on this monitor.</p>
<p>If you have to create your own ModeLine, <a href="https://www.epanorama.net/faq/vga2rgb/calc.html">this calculator</a> may come in handy to calculate the various timings.
I’m woefully clueless about the meaning of these values, but the calculator should help
you if you’re just trying to recreate the settings given in some Windows-oriented guide.</p>
<p>Note that Windows-oriented guides often omit the <em>Back Porch</em> values. This is because
those values can be inferred from the other values, and Windows tools like the Nvidia
Control Panel and ToastyX Custom Resolution Utility do so. The back porch values are
simply what’s left over after you subtract all the other values from the Horizontal or
Vertical Total values. For instance for a Vertical Total of 1350, subtract the
Resolution (1080), Front Porch (3) and Sync Pulse (5) values and you’re left with 262;
that is the Back Porch value.</p>
<p>The second is the <strong>EDID</strong> used in the ModeValidation option. This is a unique ID for a specific monitor model (or maybe even a specific monitor; I don’t know). There are more generic identifiers available, but using this one ensures that the option is never applied to the wrong monitor.</p>
<p>The Nvidia drivers come with a tool called <code class="highlighter-rouge">nvidia-settings</code> which you can use to discover these identifiers. Use <code class="highlighter-rouge">nvidia-settings -q dpys</code> to list all the display devices on your system, and then look for the right monitor:</p>
<div class="highlighter-rouge"><pre class="highlight"><code>$ nvidia-settings -q dpys
9 Display Devices on kotenbu:0
[...]
[7] kotenbu:0[dpy:7] (DP-4) (connected, enabled)
Has the following names:
DFP
DFP-6
DPY-EDID-edbe03be-f4a0-3a94-b9e8-00884a48f8f4
DPY-7
DP-4
Connector-2
[...]
</code></pre>
</div>
<p>If you have a lot of monitors and aren’t quite sure which one is which, you can use either <code class="highlighter-rouge">xrandr</code> or the <code class="highlighter-rouge">nvidia-settings</code> GUI (just run <code class="highlighter-rouge">nvidia-settings</code> with no parameters) to find the short identifier of the display, which you can then match to the long EDID identifier in the output above:</p>
<p><img src="/media/nvidia-settings-1.png" alt="nvidia-settings GUI example 1" /></p>
<p>Once you have the EDID, you can use that in the config.</p>
<h2 id="debugging">Debugging</h2>
<p>This can get frustrating if (or when) things go wrong. I had trouble getting Xorg to
actually load the config and the custom mode.
Increasing the Xorg logging verbosity can help here; this is done using the parameter <code class="highlighter-rouge">-logverbose 6</code>. 6 is the minimum level to display information on ModeLines and why they may or may not be loaded.</p>
<p>In my case the entire Monitor section was being ignored. The key to overcoming this was adding the <code class="highlighter-rouge">Monitor "xl2420z"</code> line into the Screen section. Another possible option is to use this feature, which should enable the Monitor section for only a specific device, but I couldn’t get this to work personally (quoting from <code class="highlighter-rouge">man xorg.conf</code>):</p>
<blockquote>
<p>Option “Monitor-outputname” “monitorsection”</p>
<p>(for example, Option “Monitor-VGA” “VGA monitor” for a VGA output)</p>
<p>In the absence of specific association of monitor sections to outputs, if a monitor section is present the server
will associate it with an output to preserve compatibility for previous single-head configurations.</p>
<p>Specifying video modes is optional because the server will use the DDC or other information provided by the monitor
to automatically configure the list of modes available. When modes are specified explicitly in the Monitor section
(with the Mode, ModeLine, or UseModes keywords), built-in modes with the same names are not included. Built-in
modes with different names are, however, still implicitly included, when they meet the requirements of the monitor.</p>
</blockquote>
<p>Good luck.</p>BurneddiI have a now fairly old BenQ XL2420Z gaming monitor. It is a 144Hz refresh rate model
and has strobing backlight functionality for motion blur reduction. However, I run
it at 120Hz using some custom timings, because this reduces visual artifacting with the strobing backlight and makes the display brighter when the strobing is enabled. BlurBusters calls this the “1350 Vertical Total trick”, or something along those lines. The why and how of
it is beyond me.
I had some issues setting this custom resolution up under Linux using Xorg and the
proprietary Nvidia drivers. Someone at the BlurBusters forums created a
guide which was helpful, but
was missing some key details that were necessary to get this to work on my machine.
The configuration
Here’s the configuration for the impatient. If you have the exact same display I do,
this may work for you. However, you may want to read on to see how this configuration
came to be.
Save this into /etc/X11/xorg.conf.d/ with some descriptive filename. If you are unfamiliar with conf.d style configs, these loose files are read after the main Xorg.conf (which on modern systems often doesn’t even exist anymore) and any changes in them are applied in alphabetical order. In my case, this file is /etc/X11/xorg.conf.d/20-xl2420z-customres.conf.
Section "Monitor"
Identifier "xl2420z" #This identifier can be anything; it's just the name of this config block.
#The next line defines the custom resolution.
#The exact meaning of the magic numbers here is beyond the scope of this blog post.
ModeLine "1920x1080_120_vt1350" 336.96 1920 1968 2000 2080 1080 1083 1088 1350 +hsync -vsync
EndSection
Section "Screen"
Identifier "Screen0"
#The next line disables some safety checks imposed by the Nvidia driver
#It uses the display's EDID so that they are only disabled for the XL2420Z and
#not any other displays.
#Without this line the custom resolution will be rejected as unsafe.
Option "ModeValidation" "DPY-EDID-edbe03be-f4a0-3a94-b9e8-00884a48f8f4: AllowNonEdidModes,NoMaxPClkCheck,NoEdidMaxPClkCheck,NoHorizSyncCheck"
Monitor "xl2420z" #This is important so that the monitor block above is actually used!
EndSection
Applying the configuration
Once you’ve saved the config to a valid path, reboot your computer (or restart X, but it’s safer and easier to reboot).
After the reboot, use the nvidia-settings GUI to enable the custom resolution. Select “X Server Display Configuration” from the list on the left, then select your monitor, switch to Advanced mode on the bottom right, and then set the correct resolution. It will unhelpfully be categorized by the refresh rate, so you might be in a situation where the right resolution is 1920x1080 120 Hz (1) or something. Just select the correct dimensions, and then scroll through the refresh rate selection until you see the correct Mode Name; that’s the resolution you want.
Once you’ve got the right resolution, click on Apply and then exit out of the GUI.
The resolution should now be applied, and the drivers will load it automatically every
boot, and you should be done! If not, read the debugging section below.
I’ve also seen the custom resolution defined in the config file directly using the MetaModes option, but I couldn’t get that to work either. Your mileage may vary.
How the configuration came to be
There are two key bits in this config that you may have to customize for your setup.
The first is the ModeLine, which is the set of magic numbers that defines our
custom resolution. The ModeLine here is from the BlurBusters forum guide linked above
and matches the timings I successfully used on Windows for many years on this monitor.
If you have to create your own ModeLine, this calculator may come in handy to calculate the various timings.
I’m woefully clueless about the meaning of these values, but the calculator should help
you if you’re just trying to recreate the settings given in some Windows-oriented guide.
Note that Windows-oriented guides often omit the Back Porch values. This is because
those values can be inferred from the other values, and Windows tools like the Nvidia
Control Panel and ToastyX Custom Resolution Utility do so. The back porch values are
simply what’s left over after you subtract all the other values from the Horizontal or
Vertical Total values. For instance for a Vertical Total of 1350, subtract the
Resolution (1080), Front Porch (3) and Sync Pulse (5) values and you’re left with 262;
that is the Back Porch value.
The second is the EDID used in the ModeValidation option. This is a unique ID for a specific monitor model (or maybe even a specific monitor; I don’t know). There are more generic identifiers available, but using this one ensures that the option is never applied to the wrong monitor.
The Nvidia drivers come with a tool called nvidia-settings which you can use to discover these identifiers. Use nvidia-settings -q dpys to list all the display devices on your system, and then look for the right monitor:
$ nvidia-settings -q dpys
9 Display Devices on kotenbu:0
[...]
[7] kotenbu:0[dpy:7] (DP-4) (connected, enabled)
Has the following names:
DFP
DFP-6
DPY-EDID-edbe03be-f4a0-3a94-b9e8-00884a48f8f4
DPY-7
DP-4
Connector-2
[...]
If you have a lot of monitors and aren’t quite sure which one is which, you can use either xrandr or the nvidia-settings GUI (just run nvidia-settings with no parameters) to find the short identifier of the display, which you can then match to the long EDID identifier in the output above:
Once you have the EDID, you can use that in the config.
Debugging
This can get frustrating if (or when) things go wrong. I had trouble getting Xorg to
actually load the config and the custom mode.
Increasing the Xorg logging verbosity can help here; this is done using the parameter -logverbose 6. 6 is the minimum level to display information on ModeLines and why they may or may not be loaded.
In my case the entire Monitor section was being ignored. The key to overcoming this was adding the Monitor "xl2420z" line into the Screen section. Another possible option is to use this feature, which should enable the Monitor section for only a specific device, but I couldn’t get this to work personally (quoting from man xorg.conf):
Option “Monitor-outputname” “monitorsection”
(for example, Option “Monitor-VGA” “VGA monitor” for a VGA output)
In the absence of specific association of monitor sections to outputs, if a monitor section is present the server
will associate it with an output to preserve compatibility for previous single-head configurations.
Specifying video modes is optional because the server will use the DDC or other information provided by the monitor
to automatically configure the list of modes available. When modes are specified explicitly in the Monitor section
(with the Mode, ModeLine, or UseModes keywords), built-in modes with the same names are not included. Built-in
modes with different names are, however, still implicitly included, when they meet the requirements of the monitor.
Good luck.Alt+numberkey combination stop working in PuTTY (and maybe others) in Windows 102020-05-19T00:00:00+03:002020-05-19T00:00:00+03:00http://blogshit.baka.fi/2020/05/photoshop-blocks-alt<p>I use PuTTY to run Weechat (an IRC client) over SSH. Over the years I’ve noticed that
the alt+numberkey combination suddenly stops working for no apparent reason, which is a bummer because
that’s how you change channel windows in Weechat.</p>
<p>After figuring out the reason this happens, forgetting all about it, then figuring it
out again, then forgetting it again, and then figuring it out once more, I figured that
I should just write it down here.</p>
<p><strong>It’s Photoshop.</strong> Yeah. I don’t know why or how, but Photoshop sometimes does this.
It doesn’t <em>always</em> do it, but occasionally it does. And when it does, closing it
immediately solves the issue (which, I guess, only makes sense). Anyway, go figure.</p>
<p>That’s all.</p>BurneddiI use PuTTY to run Weechat (an IRC client) over SSH. Over the years I’ve noticed that
the alt+numberkey combination suddenly stops working for no apparent reason, which is a bummer because
that’s how you change channel windows in Weechat.
After figuring out the reason this happens, forgetting all about it, then figuring it
out again, then forgetting it again, and then figuring it out once more, I figured that
I should just write it down here.
It’s Photoshop. Yeah. I don’t know why or how, but Photoshop sometimes does this.
It doesn’t always do it, but occasionally it does. And when it does, closing it
immediately solves the issue (which, I guess, only makes sense). Anyway, go figure.
That’s all.Suomalainen Dvorak-näppäimistö / Finnish Dvorak keyboard layout2017-08-03T00:00:00+03:002017-08-03T00:00:00+03:00http://blogshit.baka.fi/2017/08/dvorakfi<p><img src="/media/dvorakfi.png" alt="Finnish Dvorak layout" /></p>
<p><a href="/2017/08/dvorakfi/#english"><strong>(click here to skip to English)</strong></a></p>
<p>Olen jo useamman vuoden ajan kirjoittanut Dvorak-näppäimistöasettelulla tavallisen QWERTY:n sijaan.
Vaihdoin alunperin lähes hetken mielijohteesta erään irkkituttavan mainittua käyttävänsä Dvorakia joskus 2010-2011 paikkeilla.
Ajatus ergonomisemmasta kotirivistä oli houkuttava, ja saahan Dvorakilla nyt enemmän hipsteripisteitäkin, kuin QWERTY:llä.</p>
<p>Ongelmana vain oli, ettei suomenkielistä Dvorakia oikein ollut olemassa, ainakaan miltään “viralliselta” taholta.
Netistä löytyi pari olemassaolevaa layouttia, tosin nykyään niistä enää <a href="http://arkku.com/dvorak/"><strong>ArkkuDvorak</strong></a> näyttää olevan olemassa.
ArkkuDvorakissa on vähän, tai oikeastaan todella pöljästi aseteltu Ä ja Ö -merkit samaan näppäimeen, tuohon <>| -näppäimeen Z:n ja Shiftin välissä,
siten että napista tulee tavallisesti Ä ja shiftiä painamalla Ö, ja noiden isokirjaimiset versiot jostain AltGr:n takaa. En tykännyt ideasta lainkaan, joten päätin tehdä oman
Dvorak-variaationi.</p>
<!--more-->
<p>Oman Dvorak-layouttini pohjasin tuolloin verkosta löytyneeseen vaihtoehtoiseen suomenkieliseen Dvorakiin, joka tosin nyttemmin näyttää kadonneen bittiavaruudesta.
Kyseisen layoutin nimi oli <strong>Suomalainen monikielinen Dvorak</strong>, mutta tekijän nimeä en enää muista. Kiitos vaan, jos luet tätä!</p>
<p>Valitsemassani variaatiossa ääkköset löytyivät muistaakseni AltGr-muokkaimen takaa A:sta ja O:sta. En välittänyt tästäkään ideasta, joten tein niille tilaa tuosta <>| -napista ja Z:sta.
Tavallisessa Dvorakissa tuota jenkkinäppäimistöstä puuttuvaa <>| -nappia ei käytetty lainkaan, ja Z:ssa oli kaksoispiste : ja puolipiste ;.
Siirsin kaksoispisteen ja puolipisteen QWERTY-tyyliin pisteen ja pilkun Shift-muokkaimen taakse. Tavallisessa Dvorakissa noilla paikoilla oli < ja > -merkit,
jotka puolestaan siirsin AltGr-muokkaimen taakse. Tällä tapaa sain mahdutettua sekä Ä:n ja Ö:n omiin näppäimiinsä menettämättä toiminnallisuutta, ja vieläpä varsin mukavaan ja järkevään paikkaan;
Dvorakissa kaikki vokaalit kun painetaan vasemman käden sormilla.
Å sai luvan jäädä O-napin AltGr-muokkaimen taakse, sillä kirjoitan hyvin vähän ruotsia. Onpa tuo silti kohtalaisen sukkelassa paikassa.</p>
<p>Olen vuosien varrella muokkaillut tätä karttaa sitä mukaa, kun puutteita on löytynyt. Enimmäkseen tämä on tarkoittanut usein käytettyjen erikoismerkkien lisäämistä näppäimistöön.
Esimerkiksi astemerkki ° löytyy AltGr-0 -yhdistelmän takaa, en- ja em-dashit tavallisen viivamerkin (joka Dvorakissa on siis suomalaisen QWERTY-näppäimistön Ä-painikkeessa) takaa eri muokkaimilla;
en-dash AltGr:llä ja em-dash Shift-AltGr:llä. Myy-merkki µ löytyy AltGr-M:stä. Japanin kielen romanisoinnissa pitkä-äänteistä vokaalia merkitsevä makroni ¯ löytyy Shift-AltGr-Ö:stä
(eli QWERTY-näppäimistön Z), siinä missä tavallinen diereesi ¨ löytyy samasta napista ilman shiftiä. Ja kasa muita enemmän tai vähemmän hyödyllisiä erikoismerkkejä.</p>
<p>Minkään ulkomaan kielen kirjoittamiseen tätä ei kuitenkaan ole erityisesti suunniteltu. Pohjoismaisiin kieliin siitä tosin löytynee kaikki tarvittavat merkit.
Mikäli tarvitset puuttuvia merkkejä, lisää tokkiinsa niitä itse! Näppäinkartan muokkaaminen on verrattain helppoa.</p>
<h1 id="asennus">Asennus</h1>
<h2 id="windows">Windows</h2>
<ol>
<li><a href="/media/dvorakfi_windows.zip">Lataa näppäimistökartan asennin tästä</a></li>
<li>Pura arkisto</li>
<li>Aja setup.exe ja asenna näppäimistökartta</li>
<li>Aseta näppäimistökartta aktiiviseksi Ohjauspaneelin kielivalikosta (löytyy nimellä “Finnish Unofficial Dvorak Keyboard Layout”)</li>
</ol>
<p>Mikäli haluat poistaa näppäimistökartan kokonaan, voit tehdä sen Ohjauspaneelin Lisää tai Poista sovellus -valikosta.
Mikäli haluat muokata näppäimistökarttaa haluamaksesi, lataa Microsoftin tarjoama <a href="https://www.microsoft.com/en-us/download/details.aspx?id=22339">Keyboard Layout Creator</a>
ja avaa arkistosta löytyvä dvficstm.klc -tiedosto.</p>
<h2 id="linux-lyhyesti">Linux (lyhyesti)</h2>
<ol>
<li><a href="/media/dvorakfi_linux.zip">Lataa näppäimistökartan tiedostot tästä</a></li>
<li>Pura arkisto</li>
<li>Kopioi dvficstm -tiedosto (ilman tiedostopäätettä) XKB:n näppäimistökarttakansioon, joka ainakin Ubuntulla ja Fedoralla löytyy polusta <strong>/usr/share/X11/xkb/symbols/</strong></li>
<li>Lisää asettelun tiedot evdev.xml:ään (backuppaa se ensin), joka löytyy vastaavasti polusta <strong>/usr/share/X11/xkb/rules/evdev.xml</strong>. Avaa tiedosto, etsi rivi “</layoutList>”, ja lisää tämä pätkä ennen kyseistä riviä viimeisen </layout> tagin jälkeen:</li>
</ol>
<div class="language-xml highlighter-rouge"><pre class="highlight"><code><span class="nt"><layout></span>
<span class="nt"><configItem></span>
<span class="nt"><name></span>dvficstm<span class="nt"></name></span>
<span class="nt"><shortDescription></span>fi<span class="nt"></shortDescription></span>
<span class="nt"><description></span>Finnish Custom Dvorak keyboard<span class="nt"></description></span>
<span class="nt"><languageList></span>
<span class="nt"><iso639Id></span>fin<span class="nt"></iso639Id></span>
<span class="nt"></languageList></span>
<span class="nt"></configItem></span>
<span class="nt"><variantList/></span>
<span class="nt"></layout></span>
</code></pre>
</div>
<ol>
<li>Varmuuden vuoksi voit tehdä saman muutoksen myös samasta kansiosta löytyvään <strong>base.xml</strong> -tiedostoon.</li>
<li>Jos haluat käyttää näppäimistöasettelua virtuaalikonsolissa, kopioi dvficstm.map.gz -tiedosto KBD:n keymaps -kansioon,
jonka tarkka sijainti jälleen kerran riippuu distrostasi mutta esimerkiksi Fedoralla löytyy polusta <strong>/usr/lib/kbd/keymaps/xkb/</strong>.
Voit sitten ladata asettelun loadkeys -komennolla, tai (jälleen luultavasti distrosta riippuen) asettaa sen oletukseksi komennolla <code class="highlighter-rouge">localectl set-keymap dvficstm</code></li>
</ol>
<p>Näppäimistökartan säilymisestä päivitysten läpi ei ole mitään takeita. Lisäohjeita löytyy Googlesta, jonka käyttö on jokaiselle Linuxin käyttäjälle varmasti jo ennestään tuttua.</p>
<h2 id="os-x">OS X</h2>
<p>En omista Maccia, joten en voi tehdä OS X-versiota. Jos porttaat tämän itse mäkille, niin mailaa vaikka burneddi ät gmail piste com, jos haluat, että lisään sen tähän viestiin.</p>
<h1 id="english">English</h1>
<p>I’ve used a Dvorak keyboard layout over the standard QWERTY keyboard for many years now.
I originally swapped over almost extemporaneously sometime around 2010-2011 after an IRC acquintance mentioned he was using Dvorak.
I liked the idea of a more ergonomic home row, and Dvorak is worth way more hipster cred than the normie tier QWERTY.</p>
<p>Problem was, there is no “official” Finnish Dvorak layout. I could find a couple of existing layouts online, although only <a href="http://arkku.com/dvorak/"><strong>ArkkuDvorak</strong></a> seems to be around now.
ArkkuDvorak is a bit… well, very silly in that it puts the Finnish Ä and Ö characters on the same key — the <>| -key
that is present on the Finnish (and a handful of other European) keyboards, but missing on the US layout.
What’s more, it was done so that pressing the key normally produced a lower-case Ä, while pressing it with Shift produces a lower-case Ö.
The upper-case versions of these letters were behind an AltGr modifier. I didn’t like this at all, so I decided
to make my own flavour of Dvorak.</p>
<p>I based my layout on an alternate Finnish Dvorak layout I found online, which seems to have vanished from the intertubes since then.
The layout was called <strong>Suomalainen monikielinen Dvorak</strong> (<em>Finnish multilingual Dvorak</em>), but I can’t remember the name of the author. If you’re reading, thanks a bunch!</p>
<p>If I remember correctly, Ä and Ö were behind an AltGr modifier on A and O, respectively. I didn’t like that either; they’re common letters in the Finnish language, so I wanted them to have separate keys of their own.
I solved this by binding Ä to the extra <>| key which was unused in regular Dvorak, and Ö to the key next to it, the Z key on QWERTY.
On Dvorak, Z is used for colon : and semicolon ;, so to make room I moved these behind a shift modifier on comma and period, much like on QWERTY.
This displaced the < and > symbols, so I moved those behind an AltGr modifier instead. This way I could fit both Ä and Ö on their own keys without losing any functionality.
They ended up in a pretty good spot, too: in Dvorak all vowels are pressed with your left hand’s fingers.
The Swedish character Å, also occasionally used in Finnish, was left behind an AltGr-modifier on O, as I write very little Swedish.
It’s still a pretty alright place for it anyway.</p>
<p>Over the years I’ve modified the layout as the need arises. Mostly I’ve added commonly used symbols that were absent (and are also absent on the QWERTY layout!).
For instance the degree sign ° is behind AltGr-0, en and em dash are behind an AltGr modifier on the regular dash; en dash with just AltGr and em dash with AltGr-Shift.
The mu symbol µ is under AltGr-M. The macron, ¯, commonly used for Japanese romanization to mark a long vowel, is under Shift-AltGr-Ö (that’s QWERTY layout Z),
while the diaeresis ¨ is under the same key but without shift. And a bunch of other more or less useful special characters.</p>
<p>The layout isn’t designed to be complete for any particular foreign language, however. It should have all the necessary symbols for all Nordic languages, though.
If you need any missing glyphs, go ahead and add them yourself! Editing the keymap is pretty straightforward.</p>
<h1 id="installation">Installation</h1>
<h2 id="windows-1">Windows</h2>
<ol>
<li><a href="/media/dvorakfi_windows.zip">Download the installer here</a></li>
<li>Extract the archive</li>
<li>Run setup.exe to install the keymap</li>
<li>Activate the layout in the Control Panel’s language menu. It’s under the name “Finnish Unofficial Dvorak Keyboard Layout”.</li>
</ol>
<p>If you want to uninstall the layout entirely, you can do that from the Add and Remove Software section of the control panel.
If you want to edit the layout yourself, download Microsoft’s <a href="https://www.microsoft.com/en-us/download/details.aspx?id=22339">Keyboard Layout Creator</a> and open the dvficstm.klc file found in the archive.</p>
<h2 id="linux-in-short">Linux (in short)</h2>
<ol>
<li><a href="/media/dvorakfi_linux.zip">Download the keymap files here</a></li>
<li>Extract the archive</li>
<li>Copy dvficstm (no file extension) to the XKB keymap directory, which on at least Ubuntu and Fedora is <strong>/usr/share/X11/xkb/symbols/</strong></li>
<li>Add the layout to evdev.xml (make a backup first), which similarly is found somewhere like <strong>/usr/share/X11/xkb/rules/evdev.xml</strong>. Open the file, find the line “</layoutList>”, and add this before that line, after the last </layout> tag:</li>
</ol>
<div class="language-xml highlighter-rouge"><pre class="highlight"><code><span class="nt"><layout></span>
<span class="nt"><configItem></span>
<span class="nt"><name></span>dvficstm<span class="nt"></name></span>
<span class="nt"><shortDescription></span>fi<span class="nt"></shortDescription></span>
<span class="nt"><description></span>Finnish Custom Dvorak keyboard<span class="nt"></description></span>
<span class="nt"><languageList></span>
<span class="nt"><iso639Id></span>fin<span class="nt"></iso639Id></span>
<span class="nt"></languageList></span>
<span class="nt"></configItem></span>
<span class="nt"><variantList/></span>
<span class="nt"></layout></span>
</code></pre>
</div>
<ol>
<li>You can also make the same change to the <strong>base.xml</strong> file in the same folder if you want to be extra sure (I really don’t know what these files actually do).</li>
<li>If you want to use the keymap in the virtual console, copy dvficstm.map.gz to KBD’s keymaps folder,
the location of which again depends on your distro but on Fedora is at <strong>/usr/lib/kbd/keymaps/xkb/</strong>.
You can then switch to the layout using the <code class="highlighter-rouge">loadkeys</code> command, or (probably again depending on your distro) set it as default using <code class="highlighter-rouge">localectl set-keymap dvficstm</code></li>
</ol>
<p>No guarantees on this persisting through updates. It’s possible updates to xkb may overwrite your changes to evdev.xml. Extra info can be found on Google, which as a Linux user you’re probably quite familiar with.</p>
<h2 id="os-x-1">OS X</h2>
<p>I don’t own a Mac, so I can’t make a Mac version. If you port this over, mail me at burneddi ät gmail döt com if you want me to include it here.</p>Burneddi(click here to skip to English)
Olen jo useamman vuoden ajan kirjoittanut Dvorak-näppäimistöasettelulla tavallisen QWERTY:n sijaan.
Vaihdoin alunperin lähes hetken mielijohteesta erään irkkituttavan mainittua käyttävänsä Dvorakia joskus 2010-2011 paikkeilla.
Ajatus ergonomisemmasta kotirivistä oli houkuttava, ja saahan Dvorakilla nyt enemmän hipsteripisteitäkin, kuin QWERTY:llä.
Ongelmana vain oli, ettei suomenkielistä Dvorakia oikein ollut olemassa, ainakaan miltään “viralliselta” taholta.
Netistä löytyi pari olemassaolevaa layouttia, tosin nykyään niistä enää ArkkuDvorak näyttää olevan olemassa.
ArkkuDvorakissa on vähän, tai oikeastaan todella pöljästi aseteltu Ä ja Ö -merkit samaan näppäimeen, tuohon <>| -näppäimeen Z:n ja Shiftin välissä,
siten että napista tulee tavallisesti Ä ja shiftiä painamalla Ö, ja noiden isokirjaimiset versiot jostain AltGr:n takaa. En tykännyt ideasta lainkaan, joten päätin tehdä oman
Dvorak-variaationi.irssifying WeeChat2017-03-19T16:45:00+02:002017-03-19T16:45:00+02:00http://blogshit.baka.fi/2017/03/weechat<p><img src="/media/weechat.png" alt="After long hours spend messing with the settings, here's how my WeeChat now looks like" /></p>
<p>I recently changed shell providers from Unikko.org to myself, and with that I changed my IRC client of choice from irssi to WeeChat.</p>
<p>I didn’t go all cold turkey; I’d already used WeeChat for about a year as a secondary client because it has a really good bouncer-esque proxy thing that lets
you connect mobile clients (or regular clients, if you so desire and find one that supports it) to the main WeeChat client. This gets me mobile IRC, with my
main nickname and backlog and everything, without having to deal with the annoyances of mobile SSH. It really is a great feature, and is by itself enough
to make WeeChat better than irssi in my books.</p>
<p>There are some other nice features, too, like the support for graphical client-like nick- and channel lists, better search functionality, a more
robust and interactive UI (you can, for instance, scroll the topic bar with hotkeys so you can see long topics without typing /topic), better scripting language support,
etc. There’s mouse support, too, and it even works over SSH (I didn’t know that’s even possible), if that’s your thing. I don’t use it.
Ultimately it’s fairly minor stuff compared to the convenience of the mobile client as far as I’m concerned, though.</p>
<p>Even then, I had an itty bitty problem with WeeChat: it was butt ugly out of the box.</p>
<!--more-->
<p><img src="/media/weechat_stock.png" alt="Stock WeeChat is not easy on the eyes" /></p>
<p>The default UI seemed to follow a philosophy according to which every element must have a different, garish colour. I did personally finally cave to using
nickname colours, too, but that’s the <em>only</em> place I want a rainbow on my IRC client in.
Also, after half my life spent using irssi, the little things really got on my nerves:
differences in join/quit message appearance, or features like a line denoting unread messages, or that line between nicks and messages that makes sure all
messages start at the same column.</p>
<p>And so I spent a very long time customizing the client to look more like what I was used to. Irssifying it. And boy, there are a lot of
options in this thing. If you thought irssi’s settings were complicated, then you’re (not) gonna like this. There’s about a thousand options, literally,
and while a lot of them are repetition, changing similar things but for different parts of the UI, the total of unique things you can change is still easily
over five hundred.</p>
<p>It was no easy task searching through all the various configuration options to see what I want to change. I did most of the changes a year ago,
when I first installed WeeChat for the mobile client, and when I moved to it full time last month I found a bunch of more things I wanted to change.
I think it’s finally there, though. I changed all the colours (that I could change) to more closely match irssi, and the appearance of various
system messages and the status bar, and the behaviour of a whole bunch of things that worked subtly differently from irssi. I added keybindings to
hide and show the nick- and channel lists (ctrl-n and ctrl-p respectively), because most of the time I don’t want them visible. I added a couple of aliases,
such as /wc to close the current <em>buffer</em> (not <em>window</em> as it would be called in irssi). Normally you’d have to use /buffer close for that.
I also added keybinds for windows 11 through 19 to keys Q through O, just like in irssi.
Normally you’d change to two-digit windows with alt-J [window number], which required too many keystrokes for my liking.</p>
<p>I’m probably forgetting something, but whatever.</p>
<p>I’m quite happy with how the result turned out. While there are some small differences that I couldn’t change through the configuration (I’ve been told
it would be possible to change these through something called “triggers”, but they seem complicated so I didn’t look into using them), for the most part
it’s similar enough to irssi that I could easily adapt to it. There are <a href="https://gist.github.com/pascalpoitras/8406501">more advanced ricer configurations</a>
out there, but I couldn’t find one with the goal of bridging the gap between WeeChat’s good features and irssi’s familiarity.</p>
<p>In case you’re interested, <a href="/media/weechat.zip"><strong>here are the configuration files</strong></a> with hopefully all sensitive information removed.
WeeChat is a really good client, and has lots of useful features that irssi doesn’t (and probably never will) have. I hope that this configuration
will someday be of use to some irssi purist who wants to try out WeeChat.</p>BurneddiI recently changed shell providers from Unikko.org to myself, and with that I changed my IRC client of choice from irssi to WeeChat.
I didn’t go all cold turkey; I’d already used WeeChat for about a year as a secondary client because it has a really good bouncer-esque proxy thing that lets
you connect mobile clients (or regular clients, if you so desire and find one that supports it) to the main WeeChat client. This gets me mobile IRC, with my
main nickname and backlog and everything, without having to deal with the annoyances of mobile SSH. It really is a great feature, and is by itself enough
to make WeeChat better than irssi in my books.
There are some other nice features, too, like the support for graphical client-like nick- and channel lists, better search functionality, a more
robust and interactive UI (you can, for instance, scroll the topic bar with hotkeys so you can see long topics without typing /topic), better scripting language support,
etc. There’s mouse support, too, and it even works over SSH (I didn’t know that’s even possible), if that’s your thing. I don’t use it.
Ultimately it’s fairly minor stuff compared to the convenience of the mobile client as far as I’m concerned, though.
Even then, I had an itty bitty problem with WeeChat: it was butt ugly out of the box.Blog migration to Jekyll2017-03-19T13:44:00+02:002017-03-19T13:44:00+02:00http://blogshit.baka.fi/2017/03/blog-update<p>Hello my inexistent readers.</p>
<p>I worked hard yesterday and today to set up Jekyll and migrate my blog from Tumblr to the same server the rest of baka.fi runs on.
It’s finally more or less finished now.</p>
<p>Jekyll is a Ruby-based simple CMS solution that generates static webpages out of a mixture of various configuration and content files.
Compared to WordPress and its ilk, it’s very lightweight, secure (it uses no web-facing logins or databases or anything), and easy to set up and use. The main con is that all the content is
statically generated, and updating it requires regenerating the entire site from scratch. It’s not a big deal because it takes like 0.3 seconds,
but it does mean that you can’t just log in to an admin panel to post new things. Posting requires writing the article locally (using Markdown, a syntax
that I used to quite dislike, but have since come to accept that it’s good for what it does), then recompiling the site (using a virtual machine, because
all these hip development environments like Ruby are always a pain in the dick to set up on Windows, and almost as much of a pain to set up on
Debian-stable because the update cycle on these things is a little too fast for Debian to keep up with), and then uploading the product to the server.</p>
<p>In other words, it does exactly what I need it to do, and I’m okay with compromising on a little ease of use if that means not having to install the GAPING_SECURITY_HOLE that is WordPress.</p>
<p>The main hurdle with these things is always getting a nice blog theme. The stock themes are usually pretty ugly, so I always find myself doing a lot of tweaking
to the layout of the site until it looks exactly like I want it to. This time around I based the theme on the Tumblr theme I used on the old blog, because I quite liked it.
As a bonus a simple single-column theme like this is very easy to implement; it “only” took me like 10 hours of work to make this one. I’m not very good at web design.</p>
<p>This Jekyll deployment is missing some of the more fancy features the Tumblr blog had, notably comments, but I don’t need those.
And since no one but me reads this blog anyway, my opinion is the only thing that matters.</p>BurneddiHello my inexistent readers.
I worked hard yesterday and today to set up Jekyll and migrate my blog from Tumblr to the same server the rest of baka.fi runs on.
It’s finally more or less finished now.
Jekyll is a Ruby-based simple CMS solution that generates static webpages out of a mixture of various configuration and content files.
Compared to WordPress and its ilk, it’s very lightweight, secure (it uses no web-facing logins or databases or anything), and easy to set up and use. The main con is that all the content is
statically generated, and updating it requires regenerating the entire site from scratch. It’s not a big deal because it takes like 0.3 seconds,
but it does mean that you can’t just log in to an admin panel to post new things. Posting requires writing the article locally (using Markdown, a syntax
that I used to quite dislike, but have since come to accept that it’s good for what it does), then recompiling the site (using a virtual machine, because
all these hip development environments like Ruby are always a pain in the dick to set up on Windows, and almost as much of a pain to set up on
Debian-stable because the update cycle on these things is a little too fast for Debian to keep up with), and then uploading the product to the server.
In other words, it does exactly what I need it to do, and I’m okay with compromising on a little ease of use if that means not having to install the GAPING_SECURITY_HOLE that is WordPress.
The main hurdle with these things is always getting a nice blog theme. The stock themes are usually pretty ugly, so I always find myself doing a lot of tweaking
to the layout of the site until it looks exactly like I want it to. This time around I based the theme on the Tumblr theme I used on the old blog, because I quite liked it.
As a bonus a simple single-column theme like this is very easy to implement; it “only” took me like 10 hours of work to make this one. I’m not very good at web design.
This Jekyll deployment is missing some of the more fancy features the Tumblr blog had, notably comments, but I don’t need those.
And since no one but me reads this blog anyway, my opinion is the only thing that matters.A thing I hate: the concept of opportunity cost2016-03-28T00:00:00+03:002016-03-28T00:00:00+03:00http://blogshit.baka.fi/2016/03/opportunity-cost<p>In a series of things everyone else probably hates too.</p>
<p>A common fallacy I hate seeing on the internet, among all the other fallacies on the internet, is misusing the concept of opportunity cost. This commonly crops up in MMORPG discussions, used by people who are obsessed with amassing virtual wealth, and probably read Economics For Dummies or something thinking it’d help them to that end.</p>
<p>If you don’t know what opportunity cost is, it’s the age-old economics adage of “time is money” taken to its logical extreme. It refers to the lost (or gained) potential profit when choosing between actions A and B with different profitabilities. In simple terms, unless you are spending your time doing the most profitable thing possible, you’re wasting your opportunity cost. The fallacy lies in — typically of economics — oversimplifying the situation and assuming that the potential profit is the only thing one should consider when comparing activities.</p>
<p>The typical opportunity cost fallacy in internet context goes something like this:</p>
<blockquote>
<p>Guy 1: I can’t figure out how to make money in this game, anyone got any pointers?</p>
<p>Guy 2: Start by doing your dailies for a little bit of easy income. If you need more, level up a gathering profession; even low-level things like Steelium Ore are in high demand and are easy to gather.</p>
<p>Guy 3: NOOOOOOOOOOOO! That’s a complete waste of time! Get at least three extra accounts for max skill crafting mules, and use your crafting profits to buy out all competition at the auction house and relist their goods at a higher price! Alternatively get a minimum wage job at McDonald’s and just buy gold from the Chinese. Think of the opportunity cost!!</p>
</blockquote>
<p>Dear Guy 3: <strong>stop immediately.</strong></p>
<p>Here are some examples of situations where the concept of opportunity cost is a worthwhile consideration:</p>
<ul>
<li>Farmer Joe has a field, and has to choose whether to grow wheat or rye. Rye has 2/3rds the yield of wheat, and sells for a worse price. Thus, growing rye instead of wheat has a certain opportunity cost, which Farmer Joe should take into consideration when making his decision.</li>
<li>I can’t think of another example</li>
</ul>
<p>Here are a couple of examples of situations where the concept of opportunity cost is <strong>ABSOLUTELY FUCKING DISGUSTING</strong> and should be killed forever:</p>
<ul>
<li>Pants McSpacecaptain likes playing Eve Online. When he has nothing better to do, he belt rats in his corp’s staging system. Multiboxing Class 6 wormhole sites with a capital fleet is an order of magnitude more profitable. Pants is wasting his time.</li>
<li>Farmer Joe has a field, and has to choose whether to grow wheat or rye. Investment banking has much better profit margins than farming. Farmer Joe is wasting his time.</li>
</ul>
<p>A comic to go with the post:</p>
<p><a href="http://www.qwantz.com/index.php?comic=2911"><img src="/media/comic2-2917.png" alt="" /></a></p>BurneddiIn a series of things everyone else probably hates too.
A common fallacy I hate seeing on the internet, among all the other fallacies on the internet, is misusing the concept of opportunity cost. This commonly crops up in MMORPG discussions, used by people who are obsessed with amassing virtual wealth, and probably read Economics For Dummies or something thinking it’d help them to that end.
If you don’t know what opportunity cost is, it’s the age-old economics adage of “time is money” taken to its logical extreme. It refers to the lost (or gained) potential profit when choosing between actions A and B with different profitabilities. In simple terms, unless you are spending your time doing the most profitable thing possible, you’re wasting your opportunity cost. The fallacy lies in — typically of economics — oversimplifying the situation and assuming that the potential profit is the only thing one should consider when comparing activities.
The typical opportunity cost fallacy in internet context goes something like this:
Guy 1: I can’t figure out how to make money in this game, anyone got any pointers?
Guy 2: Start by doing your dailies for a little bit of easy income. If you need more, level up a gathering profession; even low-level things like Steelium Ore are in high demand and are easy to gather.
Guy 3: NOOOOOOOOOOOO! That’s a complete waste of time! Get at least three extra accounts for max skill crafting mules, and use your crafting profits to buy out all competition at the auction house and relist their goods at a higher price! Alternatively get a minimum wage job at McDonald’s and just buy gold from the Chinese. Think of the opportunity cost!!
Dear Guy 3: stop immediately.
Here are some examples of situations where the concept of opportunity cost is a worthwhile consideration:
Farmer Joe has a field, and has to choose whether to grow wheat or rye. Rye has 2/3rds the yield of wheat, and sells for a worse price. Thus, growing rye instead of wheat has a certain opportunity cost, which Farmer Joe should take into consideration when making his decision.
I can’t think of another example
Here are a couple of examples of situations where the concept of opportunity cost is ABSOLUTELY FUCKING DISGUSTING and should be killed forever:
Pants McSpacecaptain likes playing Eve Online. When he has nothing better to do, he belt rats in his corp’s staging system. Multiboxing Class 6 wormhole sites with a capital fleet is an order of magnitude more profitable. Pants is wasting his time.
Farmer Joe has a field, and has to choose whether to grow wheat or rye. Investment banking has much better profit margins than farming. Farmer Joe is wasting his time.
A comic to go with the post:Force a program to run as non-administrator even if it has the requireAdministrator flag set on Windows7/8/102016-02-18T00:00:00+02:002016-02-18T00:00:00+02:00http://blogshit.baka.fi/2016/02/force-program-run-non-administrator<p>A pet peeve of mine is programs that want to run using administrator rights even though there’s no need for them to. This is usually caused by the developer of the application being a retard and setting the requireAdministrator flag in the program manifest. In most cases this is completely unnecessary, a security issue, and most importantly causes annoyances such as push-to-talk not working for VoIP programs running in the background when the game window is in focus.</p>
<p>Windows has no easy way of blocking this, but there are a number of hidden ways. Here’s a couple of them:</p>
<p>1) A batch script that invokes the program using a special flag. Save the following as runasuser.bat or something:</p>
<figure class="highlight"><pre><code class="language-plain" data-lang="plain">set __COMPAT_LAYER=RunAsInvoker
start "" "%~dpnx1"</code></pre></code></pre></figure>
<p>Then either drag-and-drop the executable you want to run as user on top of this .bat file, or open Windows Explorer and type <em>shell:sendto</em> in the address bar and put the .bat in this folder. Then you can right-click the executable, and select the .bat file under “Send to” to run it as user.</p>
<p>2) A registry edit that adds a context menu option for this (courtesy of <a href="http://superuser.com/questions/171917/force-a-program-to-run-without-administrator-privileges-or-uac">this SuperUser thread</a>):</p>
<p>Save this as a .reg file, then run it. You should now see “Run without admin rights (UAC)” in the right-click dialog menu of executable files.</p>
<figure class="highlight"><pre><code class="language-plain" data-lang="plain">Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\forcerunasinvoker]
@="Run without admin rights (UAC)"
[HKEY_CLASSES_ROOT\*\shell\forcerunasinvoker\command]
@="cmd /min /C \"set __COMPAT_LAYER=RUNASINVOKER && start \"\" \"%1\"\""</code></pre></figure>
<p>3) Use a tool like Resource Hacker to manually change the requireAdministrator flag from the program manifest to asInvoker. I can’t be arsed to document this right now because you really should just use the above two methods.</p>BurneddiA pet peeve of mine is programs that want to run using administrator rights even though there’s no need for them to. This is usually caused by the developer of the application being a retard and setting the requireAdministrator flag in the program manifest. In most cases this is completely unnecessary, a security issue, and most importantly causes annoyances such as push-to-talk not working for VoIP programs running in the background when the game window is in focus.
Windows has no easy way of blocking this, but there are a number of hidden ways. Here’s a couple of them:
1) A batch script that invokes the program using a special flag. Save the following as runasuser.bat or something:
set __COMPAT_LAYER=RunAsInvoker
start "" "%~dpnx1"</code></pre>
Then either drag-and-drop the executable you want to run as user on top of this .bat file, or open Windows Explorer and type shell:sendto in the address bar and put the .bat in this folder. Then you can right-click the executable, and select the .bat file under “Send to” to run it as user.
2) A registry edit that adds a context menu option for this (courtesy of this SuperUser thread):
Save this as a .reg file, then run it. You should now see “Run without admin rights (UAC)” in the right-click dialog menu of executable files.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\forcerunasinvoker]
@="Run without admin rights (UAC)"
[HKEY_CLASSES_ROOT\*\shell\forcerunasinvoker\command]
@="cmd /min /C \"set __COMPAT_LAYER=RUNASINVOKER && start \"\" \"%1\"\""
3) Use a tool like Resource Hacker to manually change the requireAdministrator flag from the program manifest to asInvoker. I can’t be arsed to document this right now because you really should just use the above two methods.