Tag Archives: ux305

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: 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.

I’m Going Full Linux

Running Linux on my machines is my own personal hobby. One of the first things I did with my first laptop was dualboot Ubuntu and Windows. Ever since then, I have installed Linux on every machine I’ve had. Usually, I install Linux thinking that I have no need for any other operating system. Then, a need comes along, and I end up dual-booting Windows and Linux. Currently, my ASUS K55N-DS81 laptop holds the record with about a year running only Linux. However, this streak was ended when I went out of town with only my laptop and needed to do some serious .NET editing in Visual Studio.

Needless to say, the dream still continues. I still want to have atleast a single machine that runs only Linux. One of the main problems I have with my current laptop is its abysmal battery life. I get about 2.5 hours per charge, which is not enough to make it through the day. Thus, I’ve been looking for a replacement laptop. Something powerful enough, but also lightweight and not lacking in the battery department. What I found was the ASUS UX305.

ux305After browsing several Arch Linux forums and webpages, it seems that this laptop is perfect for Linux. Everything works out of the box. This is more than I could ask for given its astonishingly low price of $699.

Laptop selection aside, the struggle comes when installing Linux. The problem isn’t getting everything to work, but rather finding alternatives to all the Windows software that I use on a daily basis. Time and time again, the troublesome piece of software proves to be Visual Studio. I do a lot of development for work in Visual Studio, so it is a relatively mandatory piece of software. Recently, however, I stumbled upon MonoDevelop and its fantastic GTK# Window Designer. After trying it out for a few hours, I have determined that it is a worthy alternative to Visual Studio’s Form Designer. I look forward to seeing how it compares when using it on a daily basis.

That being said, the laptop is arriving in two days. I plan to heavily document my Linux installation process and all other things in order to create a sort-of ongoing guide for anyone who wishes to pickup this laptop and install Linux on it. I will not give up on this Laptop. I will not dual-boot. I am going full Linux.