Wasteland 2 Director’s Cut

I’m playing Wasteland 2 Director’s Cut (WL2DC) on Arch Linux these days and enjoying it immensely. Wasteland 2 is a classic RPG with a strong story and loads of character customization. The new and improved graphics in the DC version are quite appealing and for the most the interface changes are beneficial with the notable exception of the trading screen.

One issue I was having though is with the game crashing or locking up. After checking the WL2 forums, it looks the issue may be related to the soft and hard ulimits. By default, in Arch Linux these are set to 1024 for the soft limit and 4096 for the hard limit. Unfortunately it looks like WL2 is reading a lot of files and requires a higher limit. I ended up setting the soft limit to 4096 and the hard limit to 8092 and the game seems much more stable.

Interestingly setting the limits in /etc/security/limits.conf had no effect at all, after exercising some google-foo I found bug #46490 in Arch open for this with the workaround to set the default nofile limit in the /etc/system/system.conf which worked for me but is mighty annoying.

Lavender Redux

A few months ago I posted a theme called Lavender for Gnome Shell and GTK, this theme took the excellent Numix theme and tweaked the colors to use the scheme as Sam Hewitt’s excellent but now unsupported Orchis theme. Unfortunately the Numix theme hasn’t been keeping up with newer versions of the GTK so with Gnome 3.18 I ended up re-basing Lavender on Adwaita instead.

Similar to the original Lavender theme the goals were as follows:

  1. Tweak the colors to match the Orchis theme in order to work well with Sam Hewitt’s excellent Moka icons
  2. Minimize customization to the base theme files in order to make it maintainable so as new versions of the base theme, Adwaita in this case, come out it’s easy to upgrade
  3. As a corollary to #2, any CSS changes should reside in an external file if at possible as I really don’t want to re-edit Adwaita everytime a new version comes out.

So in a nutshell, this is a slight tweaking of Adwaita. If you don’t like Adwaita you probably won’t like this as well. Here’s a screenshot of what it looks like:

Screenshot from 2015-10-13 10-09-16

While I miss the Dark titlebars from Numix, I’m happy with the results at this point. Hopefully once the Numix sass port is ready for primetime I’ll switch back to that as a base.

A couple of additional comments on this tweaked theme:

  1. I fixed the annoyling line in Chrome between the titlebar and the tabs, it’s also fixed in other apps like Firefox
  2. There is a chrome extension which is just a copy of the Adwaita scrollbar extension but the color is changed to match this theme
  3. Nautilus has been slightly tweaked with alternating row colors and sidebar color to match the original Orchis theme

You can download the Lavender theme here. Note this has only been tested with GTK 3.18, not sure how it will work with earlier versions.

Victor Vran on Linux

victorvranI’ve been playing Victor Vran lately on Arch Linux, it’s an excellent action RPG that works great on Linux. I’m playing it on my laptop using the discrete Nivdia GPU (860m) via Bumblebee with no issues at all. Visually the game is impressive with plenty of effects. Controller support is top notch, using my PS3 controller with bluetooth and no issues as all.

I like the way the game plays and character development is quite interesting, there are no skills rather the type of build you have is determined by what outfits, weapons, destiny cards and powers you have equipped. If you want to try a different build type then just swap items around, no worrying about making a mistake choosing the wrong skill.

Highly recommended, get it on Steam, currently 10% off.



Lavender GTK Theme

I really like the work that Sam Hewitt’s Moka Project has put together with their icons, Moka gnome shell and Orchis GTK themes. Unfortunately the Orchis theme isn’t fully compatible with GTK 3.14 and has a number of small issues that were annoying me. As much as I stuck with it due to the outstanding design of Orchis still those issues kept bugging me.

I initially ended up forking Orchis and fixing a few of the most egregious issues, at least to me, and submitted a pull request back to the project. As I was looking at fixing more things though it became apparent that this would take more time then I had available due to my general unfamiliarity with GTK theming and not understanding the nuances of the changes between 3.12 and 3.14 at the theme level. Also, while I’m comfortable with CSS having done Java development for web sites at various points in my career, I’m certainly not a designer nor a CSS guru.

So I ended up looking for alternatives and I came across the Numix theme. It was also well designed and supported 3.14 however the color palette was not to my taste. Having said, I had a look at how it was coded out of curiousity and noticed that it would be very easy to change it’s color palette. Rolling up the sleeves, I spent a couple of days playing with things and soon had a variant of Numix that used the Orchis color palette and assets and worked acceptably for my needs, thus was born Lavender.

Lavender Theme

Lavender Theme

Lavender is my first attempt at customizing a GTK theme. Lavender includes the GTK 2, GTK 3 and metacity themes from Numix with minor modifications, to the best of my ability, to support the Orchis color schemes. It also replaces the Numix assets for radio buttons, checkboxes, etc with the equivalent ones from Orchis. Lavender is not as attractive as Orchis, which is a superb design, but it gets the job done and works well with GTK 3.14 so it meets my needs.

Lavender also includes a slightly modified version of the Moka gnome shell theme. The primary change being a small purple bar shown to the left of running applications, similar to what Vertex does, to make them easier to pick out. As I get older I find I’m having trouble seeing contrast differences in blacks so this change was geared to my older eyes.

Finally let me clear that my effort pales in comparison to what the folks who originally built Numix and Moka/Orchis have put into their themes. Quite literally this work would not exist without those two giants, if you like this theme please, please donate to both these projects using the links below.

Moka Donation Page: mokaproject.com/donate/
Numix Donation Page: numixproject.org/

You can download Lavender at DeviantArt.

Create an UEFI Arch USB Rescue Stick

I’ve been running Arch for awhile now and one of the items on my todo list as been to create a USB rescue stick in case my installation ever gets borked with an upgraded. The process of creating a stick is really straight forward and I thought I would document the steps I used here. The first thing someone should review is the Arch Installation Guide and it will be referred to at various points. This guide assumes you are already running Arch Linux on your PC.

The first step is to partition and format the stick. I used GParted but any similar tool will do. In GParted I created a GPT table on the stick followed by two partitions. The first partition is FAT32 and only 384 MB in size, it will be the EFI boot partition. Remember to set the boot flag for the EFI partition. The second partition will contain the Arch Linux installation and it’s set to Ext 4. The screenshot below of GParted shows the final configuration.

GParted UEFI USB Stick

The next step is to get the Arch Linux install scripts on the PC you are going to use to create the USB rescue stick. This is simply done with the following command:

pacman -S arch-install-scripts

Next we need to mount the partitions on the stick, replace [x] in the commands below with the right letter for your USB stick.

mount /dev/sd[x]2 /mnt
mkdir -p /mnt/boot
mount /dev/sd[x]1 /mnt/boot

Once the stick is mounted we can install Arch Linux on it and generate an initial fstab:

pacstrap -i /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab

Next, follow the install guide as per the System Configuration (https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system) section and use arch-chroot to switch to the stick and do an initial configuration of the new install.

I chose to use rEFInd as the boot loader as it is very straight forward to install and configure. To install and do an initial configuration run the following from the change root shell (i.e. Within arch-chroot /mnt) remembering to once again replace the [x] with the letter for your device.

pacman -S refind-efi
refind-install --usedefault /dev/sd[x] --alldrivers

Once this is done, go into /etc/fstab and note the UUID for the second partition (the EXT4 partition) on the stick. edit the file /boot/EFI/BOOT/refind.conf and add the following at the end of the file, replace the UUID in the options line with your UUID that you noted from /etc/fstab.

menuentry "Linux Rescue" {
icon EFI/BOOT/icons/os_linux.png
loader /vmlinuz-linux
initrd /initramfs-linux.img
options "rw root=UUID=[YOUR UUID HERE]"

I would also recommend commenting out all of the other menuentry items besides this one but that’s optional.

Once done, exit arch-chroot and re-start your computer. Using the BIOS boot menu, select to boot from the stick and if everything went well it should boot to a text based login. At this point you can continue configuring Arch for your specific needs.

GNOME Boxes and Samba Shares

This is a followup to my earlier post about using GNOME Boxes to manage a Windows virtual machine. One of the comments I made was that I used Samba on the host (Arch Linux) to share the host file system with the Windows guest. I got a comment asking for further details about this as I mentioned it pretty superficially originally and thought it would make a good follow-up blog post.

This blog post is assuming Arch Linux as the host, if you are using a different variant of Linux check your distribution’s documentation on installing Samba. For Arch Linux, the Arch wiki does an excellent job of explaining how to install and configure Samba and this is what I followed with one exception.

That exception is that I opted to enable the smbd.socket service instead of smbd.service. Also, I didn’t bother enabling the nmbd.service which is used for Netbios since I only use the Samba service for my VM and not to share my local file system on the network at large.

Once you have followed the Arch install procedure, you need to create and modify smb.conf so that the host folders are available to the guest. As per the Arch wiki, this simply involves copying /etc/smb.default to /etc/smb.conf and adding an entry for each folder at the end of the file. Here is my entry for the Documents folder as an example:

    comment = Documents
    browseable = yes
    writeable = yes
    path = /home/[username]/Documents
    valid users = [username]
    public = no
    read only = no
    create mask = 0700
    directory mask = 0700

Make sure to replace [username] in the above with the name of the user you login into Linux with. I keep things simple by using the same username/password in the host and the guest, if you don’t you may need to do some tinkering to a to enter credentials in the guest to access the shares.

Once this is done, run the Windows Guest and open the File Explorer. I believe the default IP for the host in QEMU when using the slirp network stack is so in Windows File Explorer, try accessing the network share using \\\Documents. If everything is configured correctly you should see the host’s folders and files under Documents appear. If it works, you can opt to create permanent shares by creating mapped drives (right click Computer in Windows File Explorer and select Map Network Drive…).

So that’s it in a nutshell, pretty straight forward and hopefully it helps.

Learning Python, GNOME and GTK+3

While it’s a new year and I thought for my new years resolution that I would get back into doing a side project in my spare time. In my day job I do a lot of Java development but in the past I’ve typically taken on a side project doing something different from what I do for work to exercise the brain and keep my skills sharp. The last side project I did was an Android application called OnTrack Diabetes and it was a good experience that gave me some appreciation for mobile development.

I’ve been using Linux now for almost three years with the GNOME desktop environment so this time around I figured I’d get into writing a GTK+ 3 application and blog about the experience here. In terms of an application, I’m going to start with something relatively simple which is a Visual Grep tool. While I’m perfectly comfortable using grep from the command line, there are use cases for me where I like to have a GUI as I’m doing some analysis on code or other files that requires me to access the grep results in a random but persistent way.

So my first task was selecting a language for the development of this application. The two languages I considered are Python and Vala since they are both first class GNOME languages with excellent GTK+ 3 bindings. After doing some investigation, I decided to go with Python for this application for a couple of reasons. The first is that Python is more widely used then Vala which isn’t used anywhere outside of GNOME development as far as I can tell. This leads into the second reason which is that learning Python better actually benefits my day job as I’m often writing WebLogic scripts in Jython. The final reason is that Python has more mature tools then Vala.

Now that the language decision was made, the second order of business was to get an IDE setup. I opted for the PyCharm Community Edition from JetBrains. It appears to be a robust Python IDE with full support for code completion, re-factoring and debugging. Also, it didn’t hurt that I have heard nothing but good things about IntelliJ which is the JetBrains IDE for Java. Installing PyCharm in Arch is simple using the AUR package for it.

After installing PyCharm, I copied in my first GTK 3 program from a tutorial as follows:

from gi.repository import Gtk

win = Gtk.Window()
win.connect("delete-event", Gtk.main_nquit)


And this is where I ran into my first problem. The first line had a red underline for the Gtk import indicating PyCharm could not resolve it and code completion wasn’t working for any GTK classes. After doing some googling I could see that this was a common complaint. Apparently GTK 3 uses introspective bindings which are problematic for some IDEs. PyCharm was supposed to handle it by generating a skeleton (hit Alt-Enter after Gtk and select “Generate stubs for binary module”)  but it never worked for me.

Instead I ended up using a package called fakegir which generates skeleton source files for the GTK 3 API. To use fakegir, I first imported the python-lxml dependency fakegir requires and then executed the fakegir script using the following commands:

git clone https://github.com/strycore/fakegir
cd fakegir
python3 fakegir.py

And this is where I hit my next issue when I got the following error:

Parsing /usr/share/gir-1.0/Cogl-2.0.gir
Traceback (most recent call last):
  File "fakegir.py", line 234, in <module>
  File "fakegir.py", line 226, in generate_fakegir
    fakegir_content = parse_gir(gir_path)
  File "fakegir.py", line 195, in parse_gir
    namespace_content = extract_namespace(namespace)
  File "fakegir.py", line 165, in extract_namespace
    namespace_content += insert_enum(element)
  File "fakegir.py", line 88, in insert_enum
    if enum_name[0].isdigit():
IndexError: string index out of range

To work around this, I patched the fakegir.py to simply ignore this exception. Not sure if this is the best route to fixing the issue (Hey I just started learning Python!) but it worked for me:

def insert_enum(element):
    """Returns an enum (class with attributes only) as text"""
    enum_name = element.attrib['name']
    docstring = get_docstring(element)
    enum_content = "\n\nclass %s:\n    \"\"\"%s\"\"\"\n" % (enum_name, docstring)
    members = element.findall("{%s}member" % XMLNS)
    for member in members:
        enum_name = member.attrib['name']
            if enum_name[0].isdigit():
                enum_name = '_' + enum_name
        except IndexError:
            print("Enumeration failed " + enum_name)
        enum_value = member.attrib['value']
        enum_value = enum_value.replace('\\', '\\\\')
        enum_content += "    %s = '%s'\n" % (enum_name.upper(), enum_value)
    return enum_content

Notice the new try…except, apparently the XML element causing this issue does not have a ‘name’ attribute hence why it fails. Like I said my fix probably isn’t the greatest but it gets it going.

Once the fakegir cache is generated, you have to add it as a content root in PyCharm as per the screenshot below:

Screenshot from 2015-01-10 15:01:48

Once this is done, code completion works successfully:

Screenshot from 2015-01-10 15:02:34

However if you try to run the application within PyCharm it now fails because the fakegir files are supplanting the real GTK 3 implementation. To workaround this, I disabled the options in Run Configurations to “Add content roots to PYTHONPATH” and was able to run the code successfully within PyCharm.

PyCharm Run Configuration

So that’s my first entry on my foray into the world of Python, GNOME and GTK+ 3 development. As I work through this application I’ll update the blog with my progress, hope you’ll find it interesting.

PS4 Controller and PC

I do a lot of traveling for my job and one thing I enjoy doing on the road is gaming on my laptop. While the keyboard and mouse works great for many games sometimes nothing beats a controller. I also prefer a wireless controller so that I can connect the laptop to the hotel TV if so desired for some bigger screen gaming. So the question is, what is the best wireless controller out there for the road warrior who wants to do some PC gaming?

In my opinion the answer is the PS4 controller. It has a number of advantages over other controllers including that it is wireless (bluetooth) and uses the same standard micro USB connector as an Android phone thereby cutting down on cables. It has all the same buttons as the 360 controller and can mimic it flawlessly on Windows and Linux with third party help.

I previously tried the Logitech F710 wireless controller but it has batteries that needed constant replacing plus requires a dongle. The wireless 360 controller is excellent, but it has a non-standard charging connector and also requires a dongle.

On Windows, I use DS4Tool to get the PS4 controller to mimic the 360 controller. On Linux, I’m using the ds4drv for the odd time a game requires a 360 controller (looking at you Dead Island).

In short, I highly recommend the PS4 controller, give it a try and I’m sure you won’t be disappointed.

WPS Office (Kingsoft), Arch and Gnome Shell

I’ve used Libreoffice for quite awhile but mostly as a document viewer as I’ve found it’s compatibility with the various complex MS Office documents I have to deal with somewhat lacking. It’s also a large package and a bit slow for my tastes even though performance is much improved in later versions.

I’ve heard a lot of positive things about WPS Office (formerly Kingsoft) and I decided to give it a whirl. I haven’t used it long enough to post any kind of review, however I did want to comment on two minor issues I ran into and how to fix them.

The first issue I had is that the font selector in WPS Writer always reverted to Dejavu whenever I tried to use a Microsoft font like Arial or Times New Roman. After much head scratching, I realized that the infinaltiy font package (highly recommended for good looking fonts in Arch) had configured font substitution in /etc/fonts/conf.d. After reading the documentation here, I realized I needed to run the command sudo fc-presets set and select the ms option, after that the issue was resolved.

As an aside, dealing with Microsoft fonts in Linux is a bit of a pain. I had originally used the ttf-ms-win8 package but this required you to have the actual fonts on hand which was a pain to assemble. Also every time the package would be updated I would be missing new fonts added to it which I would have to track down, it was a complete pain. As part of sorting out my font issue in WPS Office, I also removed the ttf-ms-win8 package and simply copied over the fonts manually from my Windows partition as per the instructions here.

The second issue I had was that the Gnome Shell dock wasn’t displaying the right icon in the dock when running the WPS Office applications as per the picture below. Notice the ugly default Writer icon (the blue W) instead of the nice icon from the icon theme I am using.

Screenshot from 2014-11-12 13:43:36

Another issue I found was that the dock menu option “Add to Favorites” that appears when right clicking the icon in the dock was not showing and thus I could not pin the app to the dock.

After some investigation, I found out that the Gnome Shell dock expects the name of the desktop file to be the same as the binary. To get this working, I copied the wps desktop files to new ones as per the following table.

Application Existing New
Writer wps-office-wps.desktop wps.desktop
Spreadsheet wps-office-et.desktop et.desktop
Presentation wps-office-wpp.desktop wpp.desktop

Note that I could have opted to simply moved the existing files to the new names, but this means that whenever the package is upgraded the files will re-appear resulting in duplicate applications showing up in Shell. Instead, I simply copied the desktop files and then used menulibre to hide the old desktop files.

After these changes, the lovely icons from the icon theme starting appearing as per the picture below and the dock menu works as expected.

Screenshot from 2014-11-12 15:32:09

Moto 360 Charging Image Retention

There have been some reports on the web about issues with regards to the charging image the Moto 360 displays and image retention along with possible burn-in. In short, the Moto 360 displays a largely static image that shows the percent charged when placed in the charger. Since this image is displayed for several hours with minor changes there is the possibility of image retention occurring and in extreme cases burn-in.

Unfortunately Android Wear doesn’t have an option to turn off the screen while charging. While there are a few programs that purport to do this, what they really do is throw up a black image but the screen is still on. While this does eliminate the image retention issue, it’s by no means ideal.

The only way I have found to reliably disable the screen while charging is to use the following sequence of steps:

  1. Place watch on charger
  2. On your phone, open the Android Wear app, go into Settings and enable Ambient Screen by clicking the check box
  3. Wear 2 or 3 seconds then disable it
  4. Watch screen should now be off

While this solution works well, you do have to do these steps every time you place the watch on the Charger. Hopefully Google will add an options for this top Wear in a subsequent version.

Here’s a screen shot showing the Ambient Screen setting: