Preivew OpenOffice/LibreOffice .odt documents in Ranger File Manager

Quick tip for those that use the Ranger file manager (which is awesome, by the way).

Ranger file previews are defined in the scope.sh configuration file. You can add your own preview mechanisms here.

To preview .odt documents in Ranger, you’ll need to install the odt2txt tool. On Ubuntu (and presumably other debian-based distros) install it using the following command:

sudo apt install odt2txt

The odt2txt command converts a .odt document into a text file and outputs it to standard output (prints it to the terminal or makes it available to be piped).

In your scopes.sh file add the following within the case “$extension” block.

odt)

odt2txt “$path” && fmt -s -w $width; exit 0;

Save the file and fire up a new instance of Ranger, then select a .odt file and you should get a text preview in the right pane.

Synaptics Clickpad Configuration for ThinkPad T440s

I briefly tried an Arch Linux install on my laptop. It wasn’t my favorite for my daily use, would probably be great for a lightweight computer or a server. In any case, the default configuration (non-) settings for the clickpad were utterly unusable, and the examples I was finding didn’t have all of the features I wanted. I dug into the man pages for the driver and put together a configuration I’m happy with, and have since rolled out to my Ubuntu 16.04 install on the same machine.

These settings enable the soft-buttons at the top of the clickpad to use with the trackpoint, creates another soft-button on the right half of the bottom of the pad for right click, disables edge scrolling, enables two-finger scrolling (horizontal and vertical), and single/double/triple-finger clicking.

This file lives (in a 16.04 Ubuntu system) in /usr/share/X11/xorg.conf.d/ . I replaced the default 50-synaptics.conf file with the following contents:

Section "InputClass"
 Identifier "touchpad"
 Driver "synaptics"
 MatchIsTouchpad "on"
 MatchDevicePath "/dev/input/event*"

 Option "ClickPad" "1"

 Option "PalmDetect" "1"
 
 #soft buttons at top of pad
 Option "SoftButtonAreas" "60% 0 0 2400 40% 60% 0 2400"
 Option "AreaTopEdge" "2400"

 #soft buttons at bottom of pad
 Option "HasSecondarySoftButtons" "1"
 Option "SecondarySoftBUttonAreas" "50% 0 85% 0 0 0 0 0"

 Option "HorizHysteresis" "30"
 Option "VertHysteresis" "30"
 Option "FingerLow" "30"
 Option "FingerHigh" "50"
 Option "MinSpeed" "1"
 Option "MaxSpeed" "1"
 Option "AccelerationProfile" "2"
 Option "ConstantDeceleration" "4"

 Option "VertEdgeScroll" "0"
 Option "HorizEdgeScroll" "0"
 Option "TapAndDragGesture" "0"
 Option "CircularScrolling" "0"

 Option "TapButton1" "1"
 Option "TapButton2" "3"
 Option "TapButton3" "2"
 Option "ClickFinger1" "1"
 Option "ClickFinger2" "3"
 Option "ClickFinger3" "2"

 Option "VertTwoFingerScroll" "1"
 Option "HorizTwoFingerScroll" "1"
 Option "CoastingSpeed" "0"
 Option "MaxTapTime" "125"
EndSection

Tray Icons Not Appearing in i3 on Ubuntu

On my laptop install of Ubuntu Server 16.04, when I first installed i3 I found that tray icons weren’t working. I tested with volti, the network manager applet, and dropbox – nothing, and no errors from the applications.

The problem was with the following line in the i3 configuration file (located at ~/.config/i3/config, formerly .i3/config in prior versions [or packages]):

tray_output primary

I suspect this would work fine if there were a primary display configured in my xorg settings, but that isn’t the case. Commenting out this line did the trick (removal would also work) after restarting i3 (shift+mod+r).

5Ghz Wifi Networks Not Available on Ubuntu Server Install

I needed a fresh start on my laptop (a ThinkPad T440S) and thought I would try starting with Ubuntu Server 16.04, so I can install what I want without as much Ubuntu Desktop bloat.

For networking I installed network manager and it’s corresponding tray applet control application (the network-manager and network-manager-gnome packages, respectively). Everything worked great, except that 5Ghz networks weren’t showing up to connect to.

I don’t recall where I found this solution, but the answer was to edit the file /etc/default/crda, which had this line

REGDOMAIN=

This needed to be changed to

REGDOMAIN=US

Saving that change and rebooting fixed the issue – it’s possible that restarting network services might have done the same as the reboot.

Detecting Caps Lock from the Linux Command Line

A while back I got a new laptop, a Thinkpad T440s. It has been a wonderful machine, but does have a few small shortcomings – one of which is the lack of a hardware indicator for caps lock status – there are other keys with indicator lights – the mute, mic mute, and function shift keys, but not caps lock – What the heck?

I wanted to fix this to some degree by setting up an on-screen indicator to let me know if caps lock is on. Here’s the script I wound up using to get that data.

#!/bin/bash
v=`xset -q | grep Caps`

echo ${v:7:17}

Save this to a file ending in .sh, apply chmod +x <filename> to make it executable, and you’re good to go. Running this script will generate output that plainly tells you if caps lock is on or not. Next step – integrate it into my status bar.

Fixing Missing Menu Bars in Openbox on Ubuntu

With a recent update (I don’t know which one), menu bars in several apps disappeared. The fix was removing the appmenu-qt5 package using the following in a terminal:

sudo apt-get remove appmenu-qt5

If you’re running stock Ubuntu (with the Unity interface) this may cause problems, but appears to work beautifully with Openbox.

Threading the Belts During Assembly of BuildSpark Linear Actuator Kits

I’ve now assembled two BuildSpark Linear Actuator Kits. I have lots of good things to say about them  – they’re well conceived and designed, compact, and the 3D printed parts are better than most of the printed parts I’ve gotten from printer companies. The only part of the assembly I found cumbersome was getting the belt threaded through the holes in the carriage.

The method shown in the BuildSpark official assembly demonstration video really didn’t work well for me. Neither of my kits had belts with the natural bend to help it up into the hole, and I had great difficulty grabbing hold of the belt with any sort of tool to pull it up through.

Continue reading “Threading the Belts During Assembly of BuildSpark Linear Actuator Kits”

libudev.so.0 not found on Ubuntu 14.04

I recently had an application that would throw this error when invoked:

error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory

The workaround is a symbolic link to libudev.so.1 .

In my case, this was the command that resolved the issue:

sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.1

Your paths may be different, but hopefully this can get you on the right track.

Volti Under Ubuntu 14.04 on a ThinkPad T440s

I’ve recently been using Openbox on Ubuntu on my Thinkpad T440s and wanted to use Volti as my volume control with a Tint2 panel.  I had trouble though, I was getting this error:

[alsactrl.py:__init__:41] can’t open Master control for card HDMI, trying to select first available mixer channel

[alsactrl.py:__init__:49] can’t open first available control for card HDMI
error: list index out of range
Traceback (most recent call last):
File “/usr/bin/volti”, line 53, in <module>
volti = main.VolumeTray()
File “/usr/lib/volti/volti/main.py”, line 124, in __init__
self.watchid = gobject.io_add_watch(fd, eventmask, self.update)
TypeError: an integer is required

The solution lies in the Volti configuration file.  It is located at ~/.config/volti/config.

In my case, the issue was with the third line under [global], the card index value.  My default card_index was 0.  Changing this to 1 and saving the file fixed the issue.

 

Concatenating MP3 Files in Linux

I’ve run into an issue with a little portable music player I have – it doesn’t make reasonable assumptions about the order in which to play the tracks of an audio book.  Even when the files are named sequentially with numbers, when the timestamps are in the order they should be played back, when there are valid and correct track numbers in the ID3 tags, and regardless of the order in which they are copied to the device (corresponding to the order of their entries in the filesystem lookup table), they always play in what seems like random order (this doesn’t happen with music, which works as one would expect).  I’ve found that the easiest solution to this is to just wrap them up into a single large MP3 that contains the whole book.  There are many ways to accomplish this, and here I’ll show a tool called mp3wrap that worked simply and reliably for me.

Continue reading “Concatenating MP3 Files in Linux”