Archive for Operating Systems

Using Syncthing to Replace Dropbox on Android

According to the timestamp on Getting Started.pdf, I’ve been a happy Dropbox user since 2010. For probably equally many years, they’ve had the most obnoxious Android app. Perhaps I don’t want to put my whole Dropbox on my Android phone (although I’m not so sure I don’t), but obviously you should be able to select a whole directory to sync. Solutions like Dropsync are unfortunately super slow, probably because it seems to be mostly a clever hack that syncs files one by one.

Instead of a similar alternative, I’ve really always been irked by the lack of an easy to use Unison-like sync for my phone. Running Unison in a chroot just doesn’t quite cut it… The obvious solution is something like Syncthing or Bittorrent Sync, which works regardless whether or not there’s a remote server involved. And if there is, it’d be a remote server under my own control.

Syncthing isn’t ideal because of its lack of subdirectory selection. But since in reality it’s almost exclusively a one-way street anyway, it doesn’t matter so much. The main point is that this is all easier than running an FTP server on the device, plugging it in over USB, running a webserver on it to drop files into a browser window or whatever other overly complicated solutions might exist. To install Syncthing, get it on F-Droid. Or Google Play, if you don’t think it’s obnoxious.

You can get by almost entirely on F-Droid alone. In fact it’s where most of the best software is found.

Unfortunately Syncthing can’t sync wherever. Oh well, we’ll just sync within its own directory instead.

On my phone, Syncthing can’t handle the MicroSD card, but we can trick it.

It’ll make some things a touch more complicated. Maybe a symlink? Oh drat, FAT32 strikes again. Meh.

Aard Dictionary doesn’t care where it’s located.
Add a favorite, a shortcut, or both. It’ll be difficult to interact with the directory otherwise.

The sync problem isn’t really solved yet, but it’s sure a lot better. All in all, Android is still awful and you should probably consider getting an Ubuntu Phone instead. The end.

As for Syncthing, perhaps its most interesting property is that it can largely replace both Dropbox and Unison. In fact it can probably completely replace Unison for me, because I haven’t actually bothered replicating my stuff onto a separate physical HDD in years. And Syncthing definitely makes it easier to add more of my laptops and whatnot into the mix. On the flipside, the fact that I run Unison once a week or so forces a kind of built-in review of the changes I made, so I can undo them if desired. In this way it’s more like a backup. But of course, Syncthing can sync between more than two computers at once, while the changes are happening. It’s worth a look, if nothing else.

Comments (1)Tags: , ,

xorg.conf: EmulateWheel stopped working on libinput update

I didn’t spot it in the Debian changelog, but apparently the latest libinput10 update on Debian/stretch (unstable) broke my EmulateWheel option. Because the scroll ring on my trackball is broken, it’s all I’ve got. It’s also rather nice on trackballs without any kind of scrolling functionality at all, such as the Logitech Trackman Marble.

Let’s start by examining my current xorg.conf:

$ cat /etc/X11/xorg.conf 
Section "InputClass"
	Identifier	"Kensington Trackball"
	MatchProduct	"Kensington Expert Mouse"
	Option		"SendCoreEvents" "True"
	Option		"ButtonMapping" "0 1 2 4 5 6 7 3"
	Option		"EmulateWheel" "True"
	Option		"EmulateWheelButton" "1"
EndSection

Scanning man xinput doesn’t list any entries for those options anymore, but it does contain the following:

Option "ScrollButton" "int"
Designates a button as scroll button. If the ScrollMethod is button and the button is logically held down, x/y axis movement is converted into scroll events.
Option "ScrollMethod" "string"
Enables a scroll method. Permitted values are none, twofinger, edge, button. Not all devices support all options. If an option is unsupported, the default scroll option for this device is used.

Note how this would allow you to disable two-finger scroll on e.g. our Wacom drawing tablet if you don’t like it. (But I do!) In any case, adjusting my xorg.conf accordingly:

Section "InputClass"
        Identifier      "Kensington Trackball"
        MatchProduct    "Kensington Expert Mouse"
        Option          "SendCoreEvents" "True"
        Option          "ButtonMapping" "0 1 2 4 5 6 7 3"
        Option          "ScrollMethod" "button"
        Option          "ScrollButton" "1"
EndSection

Works like a charm. Better yet, it now also scrolls horizontally. Which can be disabled with Option "HorizontalScrolling" "false" if you so desire. All’s well that ends well.

CommentsTags: , ,

Troubleshooting Your Network Connection: Power Off!

A few months ago the network connection on my desktop computer stopped working. I tried what I considered to be the obvious troubleshooting methods: a different network cable, connecting the network cable to my laptop to see if it worked, forwarding the wireless Internet from my laptop to my desktop… all of which pointed to one unavoidable conclusion: the network port in my desktop had to be busted. As a last resort, completely expecting it to do nothing, I turned it off for about ten minutes. Subsequently, everything was working the way it should.

Of course I’m familiar with the 30-30-30 rule for routers, but I didn’t realize some variety of the process might be helpful on desktops as well. Just to clarify, I hadn’t changed anything about my networking setup as it had been for years. I can only imagine some kind of static charge snuck in somehow.

Comments

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 pull
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

A little debugging showed the following:

$ ssh -vT git@github.com
OpenSSH_7.1p2 Debian-2, OpenSSL 1.0.2f  28 Jan 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /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 to 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

Comments

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
\newfontfamily\palladio{Palladio Uralic}
\DeclareTextFontCommand{\textpalladio}{\palladio}

Comments

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.

Comments

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: <alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor>
		device.string = "1"
	name: <alsa_input.usb-046d_0990_E1C9E823-02-Q9000.analog-mono>
		device.string = "hw:2"
	name: <alsa_output.pci-0000_00_14.2.iec958-ac3-surround-51.monitor>
		device.string = "0"
	name: <alsa_output.usb-Creative_Technology_Ltd._Creative_HS-720_Headset-00-Headset.analog-stereo.monitor>
		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).

Comments

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;Primary&gt;Escape" type="string" value="xfdesktop --menu"/>
      <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;Primary&gt;Escape" type="string" value="xfdesktop --menu"/>
      <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.

Comments

LaTeX: combining added margins with hanging indents

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

\begin{addmargin}[1cm]{0cm}
	Yada.
\end{addmargin}

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.

Comments

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.

Comments

« Newer EntriesOlder Entries »