Category Archives: Desktop Computing

Anything involving using my desktop computer

Ditch SLiM, Replace it with SDDM

My laptop, which usually boasts a twelve hour battery life, was reporting that it would only last for a few hours on a fresh charge. Something was obviously wrong. Checking the output of htop, it became clear that journald was the culprit.

It seemed that journald was simply writing log messages over and over and over again, and running journalctl -xe revealed the culprit. I recently updated my system, which included new updates to Xrandr and many other packages. SLiM, my beloved simple and clean display manager, was no longer compatible.

Consulting the ArchWiki page for SLiM, it is made immediately clear that the display manager has been out of service for some time. Thus, in order to save battery life and keep my system up-to-date, I have chosen to replace it with SDDM. The transition is clean, simple, and SDDM is just as nice, so I urge anyone still using SLiM to do the same.

All that needs to be done is a SLiM disable, a SLiM uninstall, a SDDM install, a SDDM theming, and an SDDM enable, not necessarily in that order. Here is the raw list of commands:

sudo pacman -S sddm
sddm --example-config | sudo tee /etc/sddm.conf
sudo systemctl disable slim
sudo systemctl enable sddm
sudo systemctl stop slim
# You should now be logged out of your XSession. Log in to the tty and do the following:
sudo pacman -R slim
sudo systemctl start sddm

Everything should now be good! Of course, if you’d like to make your SDDM pretty, you’ll have to change the theme (There are two ArchLinux based themes in the AUR)

There are some caveats, however. For one, I was a heavy user of slimlock. Obviously, this is not available with SDDM. I remedied the situation by switching to i3lock.

Fixing ncurses5 to ncurses6 Dependency Issues on Arch Linux

This post is alternatively titled: “How to resolve error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory”.

While attempting to do a recent system update, I ran into two problems:

  1. pacman was not downloading any packages due to an out-of-date gnupg package.
  2. Trying to install the gnupg package manually resulted in the alternative title of this post.

All of this was because I decided to run sudo pacman -S libncurses in order to get my conky working properly. Turns out a lot more programs rely on libncurses than I previously realized.

The problem gave me more of a headache than thought it would, but I eventually solved the issue. Here’s how:

  1. Since I recently upgraded libncurses through pacman from version 5 to version 6, the old version was still saved in the cache in /var/cache/pacman/pkg
  2. I extracted the cached version of libncurses by using sudo mkdir tempNcurses && sudo tar -xvf ncurses-5.9-7-x86_64.pkg.tar.xz -C tempNcurses
  3. I then copied the resulting binary into the libraries folder with sudo cp tempNcurses/libncursesw.so.5.9 /usr/lib
  4. I then made a symbolic link with the file specified in the error messages with sudo ln -s /usr/lib/libncursesw.so.5.9 /usr/lib/libncursesw.so.5

After this, everything worked as expected! I was able to manually update GnuPG and then update everything else that had a dependence on ncurses

Building a Volume Popup using Dzen2

If you have been following my blog at all lately, you’ll know that I’ve been pretty obsessed with my brand new ASUS ux305. After browsing /r/unixporn for days without doing anything, I decided to take a stand against my bland i3 setup and get things rolling. One of the things that has always bothered me about my Linux machines is the fact that a lot of the hardware keys don’t work because I am too lazy to make them work.

This was changing. Now.

So far, for my volume keys, I had them hooked up to a small BASH script which called on alsamixer to raise or lower the volume by 5%. My volume level is also continuously displayed in a conky panel at the bottom of my screen; however, the conky panel only updates every second, and sometimes this second is a little too slow when the volume button is being pressed in rapid succession. Thus, I needed something to alert me in realtime when I was changing the volume.

The main thing I was interested in was making something like GNOME or OSX have – something that pops up and alerts you of the volume (Preferably without an annoying popping noise). Something like this:

volumetrickformacIn order to do so, I needed to find a tool that would display something on the screen. Some sort of notification/message platform that was extremely lightweight. I have heard of some of my friends using dzen2 to power their panels, so I decided to look into that. It was the perfect solution. Basically, now every time I call my volume changing scripts, I can display the current volume level in some sort of alert.

First, I had to create an alert script that would make my alert designs a little more portable and easily customizable. I went with something that allowed me to create alerts in both the middle and the top of the screen and with colors that matched my status bar. The result was this mess:

#!/bin/bash 
                                                                   WIDTH=300                                                                       
HEIGHT=50                                                                       
                                                                                
# This script shows an alert using dzen                                         
screenWidth=$(xdpyinfo | grep 'dimensions' | egrep -o "[0-9]+x[0-9]+ pixels" | sed "s/x.*//")
screenHeight=$(xdpyinfo | grep 'dimensions' | egrep -o "[0-9]+x[0-9]+ pixels" | egrep -o "x[0-9]*" | sed "s/x//")
let "middleY = $screenHeight / 2 - ($HEIGHT/2)"                                 
let "middleX = $screenWidth / 2 - ($WIDTH/2)"                                   
                                                                                
if [ "${2}" == "top" ]; then                                                    
        echo $1 | dzen2 -fn "DejaVu Sans Mono 8" -p $3 -h $HEIGHT               
else                                                                            
        echo $1 | dzen2 -fn "DejaVu Sans Mono 8" -p $3 -y $middleY -x $middleX -h $HEIGHT -w $WIDTH &
fi

Basically, this script takes 3 arguments – The message, the position, and the wait time. This is all of the information I am going to need to ever specify for my popups. Now all that is left is to get the volume buttons working with the script. My volume buttons are already linked to two scripts via my i3 config file, mainly the two lines:

bindsym XF86AudioRaiseVolume exec $HOME/.i3/bin/raiseVolume.sh
bindsym XF86AudioLowerVolume exec $HOME/.i3/bin/lowerVolume.sh

The final step is simply creating the lowerVolume.sh and raiseVolume.sh scripts. They are simple, now. They basically call amixer to handle the volume control, save the output, and display it in an alert. Here’s the code to lowerVolume.sh

#!/bin/bash                                                                     
                                                                                
volume=$(amixer -c 1 set Master 5%- | egrep -o "[0-9]+%")                       
`$HOME/.i3/bin/showAlert.sh "Volume: $volume" middle 1`                         

Note that this uses our alert script to display a message in the middle of the screen for 1 second. It’s perfect. The raiseVolume.sh script is exactly the same, but there is a “5%+” instead of a “5%-“.

The end result is beautiful.

rsz_2015-04-16-224403_1920x1080_scrot

This alert system will soon be implemented into the script I use to detect new emails and brightness keys, once I get them working.

The Switch to Linux: Week 1 Review

So far, I have been using my ASUS ux305 for exactly one week. Needless to say, given its great track record, the laptop itself has been treating me extremely well. I am continually impressed by the way the laptop feels, the keyboard, the screen, and the battery life. Let’s talk about all of those for just a moment.

The way the laptop feels is amazing. Whenever I pick it up, I am confident that it won’t bend or break on me, although it is very light. It’s metal body is nice and smooth and very sleek. I do have a couple very small complaints that are as follows:

  1.  The lid of the laptop has little notches in the back of them. Presumably, these notches are here so that when the laptop is opened, they serve as little “feet” that lift the rear of the keyboard up slightly. I will admit that this creates a more enjoyable experience, as a completely flat laptop keyboard often wears out my wrists from having them rest on the edge of the laptop body. These “feet” have one little drawback, however. Since they are attached to the back of the lid, they scrape along whatever surface the laptop is sitting on. If you’re working on glass, metal, or a hard surface, this is no problem as the “feet” just slide across the surface and into position. However, I did have the misfortune of working on some very soft wood, where the little “feet”, in the process of opening the laptop, actually scraped against the wood and scratched it. Although the idea of the “feet” was amazing, some other way of deploying them would have been great.
  2. The material of the laptop attracts fingerprints like crazy. You never know how much you actually touch odd spots on your laptop until they are clearly visible after you touch them. The lid and the area below the keyboard both seem to attract fingerprints that makes it look like you slathered a slice of peperoni pizza all over the surface. Of course, I may just have very oily hands, but I think the material of these surfaces also has something to do with it. These finger prints and smudges are also not very easy to remove. I have tried using paper towels, toilet paper, tissue, and the cloths used to clean glasses and computer screens, but to no avail. I just have to be very careful about where I touch.

Besides from those complaints, the laptop is amazing. My 7 hour battery life has not let me down, the 1080p IPS display is gorgeous and has a huge pixel density, and the keyboard feels very nice to type on.

And now to the other point of this post:

Linux

As I covered in the last post, I was able to install Arch Linux on this machine without a hitch. Everything worked properly out of the box, which made me very happy. I am still running SLiM, i3, Conky, and the usual software. Like I said, everything has worked out of the box and using a tiling window manager is a great way to take advantage of the small screen but great resolution. I will report on the exact software I am using a bit later.