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.
This issue drove me insane. The answer was crazy simple so I figured I’d throw it out there.
I found that I could copy and paste anywhere in X without an issue (this uses the clipboard buffer). I could also select text and middle click to paste without issue (this uses the primary buffer. I could also select and paste with the mouse in URXVT. Within Vim, I could also copy by selecting and paste (when in insert mode) with a middle click. What I couldn’t do was select text in Vim and middle click to paste it anywhere else.
Further, I could confirm that the data wasn’t hitting the primary buffer upon selection using
xsel -op to dump the primary buffer.
After a good while of searching (which came after more time than should have been spent diagnosing the exact issue) I found this thread, which described my issue and the solution.
The answer is that the mouse=a directive in my vimrc that makes visual mode work with the mouse is also keeping it from selecting text in the way that’s needed to drop it into the primary buffer (to copy it). Disabling this setting fixes the copy issue, but also turns off visual mode with the mouse, which I’d like to keep.
The workaround was to hold shift while selecting text I want to copy, which keeps it from entering visual mode and allows the copy to happen.
I’ve been using the i3 window manager for roughly a couple of years now and have enjoyed playing with all the ways I’ve found to extend it through startup scripts, keybindings, etc. This little hack for enabling or disabling the launch of a group of applications at login is one of my favorites and I thought I’d share.
I’ve got a script in my i3 configuration directory called launch.sh that fires up a number of persistent applications and launches things I normally use.
The first thing it does is load a saved layout and launch terminals with htop, dmesg –follow, and tail -f /var/log/syslog . I use this as a general system monitor workspace, a dedicated place I can go to see what’s happening on my system.
Next, it switches to a workspace I use as a dedicated terminal and launches urxvt, then switches to the workspace I use for my browser, switches the layout to tabbed, then launches my browser.
Then it loads up the scratchpad text app I use (Fromscratch), udiskie for managing removable media, the mpd daemon, and after some delay to make sure everything else is finished loading, dropbox.
I’ve been happy with this arrangement, but really wanted to find a way to keep it from launching some of those items on startup in case I wanted to do something more system intensive and didn’t need those things right away or want to do some kind of benchmarking and want fewer things tying up RAM.
Continue reading “Startup script for i3 with Conditional Execution”
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”
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.
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.
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.
Continue reading “Synaptics Clickpad Configuration for ThinkPad T440s”
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
This needed to be changed to
Saving that change and rebooting fixed the issue – it’s possible that restarting network services might have done the same as the reboot.
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.
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.
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”