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.

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.