Author Archives: brandonio21

I write not because I wish for others to read what I might say, but rather because I do not wish for my thoughts to vanish with time, as I will.

I say this as if I am a writer.

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.

Late Night Ramblings About the Asus UX305

As I lie in bed messing around with my ux305, there are a few things that I have noticed that are driving me a little crazy. Since I am too tired to formulate my thoughts in a formal way, I shall simply use bullets to express them.

  • There seems to be a fair amount of light-bleed coming from the right side and the bottom of this laptop’s gorgeous screen. If I press on the bezel of either of these sides, I notice that the lightbleed grows towards the center of the screen. This does not happen on the left or the top and I don’t have much experience with lightbleed, so I don’t know how bad or normal this actually is.
  • Binding the brightness keys has proven to be a challenge in Arch Linux. Running `xev`, I have determined that the keys assigned XF86MonBrightnessUp and XF86MonBrightnessDown are actually the keys located to the left of the brightness keys (The keys without any indication of what they are.. the blank keys). This is truly problematic and I will look into a solution. As far as my knowledge goes, this is a Linux problem.

Anyway, I digress.

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.

 

The Switch to Linux: Day 1

This post is not only going to be brief, but also rather uninformative. My brand new ASUS ux305 arrived in the mail today and I spent a majority of the day playing with it. The laptop is beautiful. It has a very high quality build and feels extremely similar to the Macbook Air. One of the things I loved about the two months I spent with a macbook air was the keyboard. Well, I must admit, ASUS has done a great job at matching the quality of that keyboard. The size, the battery life, the weight.. everything about this laptop is perfect.

The first thing I did was go ahead and install Linux on this machine. My distro of choice is Arch Linux, so naturally I decided to put the Arch install .iso onto a flashdrive using Rufus. I then stuck the USB drive in and rebooted into the BIOS (Which is the del key for the ux305). Once in the BIOS, I noticed that it did not immediately detect the flashdrive as a boot device. No worries, I added an entry to the BIOS boot menu and pointed it at launch.efi on the flash drive. Everything went smoothly from there.

I simply followed the beginner’s guide, noting that I was setting up things for a UEFI system. This meant that I needed to do a few special things such as use GPT for my partition tables instead of the MBR I used on all of my other machines to allow for dual-booting.

Everything went great until I was required to install a bootloader. For some reason, the first time I installed gummiboot, I could not boot into Arch Linux because I was missing the file varlinuz-linux. I then tried to install GRUB. Same issue. I went ahead and cleared the partitioning scheme and formatted the drive and started all over again. It worked after that. I’m not entirely sure what happened, but if you encounter the issue, it can be solved by clearning the drive and recreating the partitions.

Now that ArchLinux was installed, I had to choose my software. I decided to go with Xorg for my display (Using the open-source intel video drivers). I also tried lightDM as my display manager; however, I did not like the look/feel of it, so I decided to resort to SLiM and its archlinux-simplyblack theme. I also tried to use bspwm and awesome window managers; however, I failed to find them as suitable replacements for i3 and went ahead with my tried and true i3 setup. After that, everything has been going smoothly. I will post more details later about the specifics of my setup. I am too tired to post it now.

The major problem I encountered during this install was connecting to the internet. For whatever reason, during the install process, I could not connect to the university WiFi. I used the wpa-configsection example for netctl, but couldn’t get anything to work for my wireless adapter. I ended up just using the USB to Ethernet adapter that came with the laptop in order to get a stable wired connection to complete the install. Maybe this is what contributed to the missing linux kernel file during the first boot-manager install. After I finished installing, however, the netctl profile I created worked no-problem. I guess there were just issues while using the install USB. Again, I’m not really sure why.

So far, it looks like I will for sure be sticking with Linux this time. I hope.