Quick Tip: Fix Scroll Lock

I found on my desktop that the scroll lock key doesn’t work. I’m using Ubuntu 17.04 (recently upgraded from 16.10, on which the problem also existed) with the i3 window manager and using a Logitech K120 keyboard (which seems to have this problem somewhat commonly).

All of the event signals were there, as tested by xev and other tools, but it wouldn’t actually turn on the scroll lock functionality or change the keyboard LED state.

The problem was that the key was not actually bound to that function, which is fixed by this command:

xmodmap -e 'add mod3 = Scroll_Lock'

This can be run in any number of places, including in a regular terminal for testing or temporary use. I put it in my i3 config file to run at startup each time and it works beautifully.

Cheers!

ThinkPad T440s Battery Warning Script for Ubuntu 16.04

Since I started with a stripped-down Ubuntu install that doesn’t include much in the way of power management I made a tool to warn me when my battery is low and to suspend the system when it is low enough. I borrowed some content and structure from this script, adding features to meet my own needs, in particular support for a second battery, notifications, and auto-suspend.

This script assumes you’ve got two batteries and will warn when both batteries are discharging or discharged (status = “unknown”) and both have remaining power below a certain threshold.

Continue reading “ThinkPad T440s Battery Warning Script for Ubuntu 16.04”

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.

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.