Trying out dual-booting Linux again

| geek, linux

After a long, long time being on Windows because of Autodesk Sketchbook Pro – keeping sane with a mishmash of Cygwin and Linux virtual boxes so that I could get around the limits of Windows as a development platform, and grumbling about little things like the slow performance of git and the occasional problem with too-long file paths – I’m giving dual-booting to Linux a try again.

W-‘s good influence here: his new SSD arrived and he decided to allocate some space for dual-booting to Linux. Since we have the same hardware configuration for our laptops, I figured I’d see if the Wacom drivers Just Worked and if the sketching programs on Linux had improved since I last checked them out. Mypaint still didn’t have the selection tools I was looking for, but Krita looks like it might work for my sketches. The interface isn’t as pen-friendly as Autodesk Sketchbook Pro (which I couldn’t get going under WINE), but I might be able to get the hang of using the subset of features I actually rely on.

I had some setup issues in the beginning. The Kubuntu 15 install disk I tried crashed during setup due to a wireless-related issue. I tried ElementaryOS, but found it to be a hassle because the default Elementary theme caused Emacs to crash. (Priorities, priorities.) Frankensteining it back to a basic Ubuntu distribution by removing packages and editing files like /etc/lsb-release didn’t completely solve my problems, so I installed Kubuntu 14 instead. That seems to be working so far.

I ran into a few more issues with applications. Dropbox sync created directories but not the files within them. I’m not sure whether it was the fiddling we did with our network setup (including quite a few reboots of routers and modems) or whether Dropbox sync got fixed after I unlinked my laptop through the web interface and then reconfigured it, but at least my files are downloading now at a decent speed.

The version of Evernote I installed under WINE didn’t allow me to edit notes. Upgrading WINE to 1.7 and downgrading Evernote to 5.8.3 seems to have made Evernote work, though, so now it’s synchronizing the gazillions of notes I’ve accumulated throughout the years.

Postfix Gmail forwarding was straightforward to set up. I successfully sent a test message, and my Gnus config seems to be working fine with direct IMAP access to Gmail. I might give offlineimap a try, maybe with notmuch.

I have an old Truecrypt volume lying around, and the Linux binaries were able to mount it. Hooray!

Git was giving me problems, so I added the git-core repository.

I’ll still probably need to boot into Windows to do my business accounting in Quickbooks, which I use mainly because it imports into Turbotax and therefore saves me from having to figure out all the tax stuff by hand. I don’t do that frequently, though, so it should be okay.

I use a Python script to download Flickr metadata. Turns out the latest version of flickrapi is incompatible with it, so I downgraded flickrapi with:

sudo pip install flickrapi==1.4.5

and that worked.

It turns out it’s the little things you notice. I missed being able to use Win+number to start or switch to applications. Fortunately, the following script worked for me, once I figured out that KDE’s custom keyboard shortcuts wanted full path to the shell command: /home/sacha/bin/focus_or_launch emacs instead of using ~/bin/focus_or_launch emacs. I modified it slightly to only look at –class instead of –name.

#!/bin/bash

# NAME:         focus_or_launch
# VERSION:      0.4
# AUTHOR:       (c) 2014 Glutanimate <https://github.com/Glutanimate/>
#
# DESCRIPTION:  Focus existing app window or launch application if no
#               window found
#
#               Simplified version of a script by Henning Bekel
#               (https://bbs.archlinux.org/viewtopic.php?pid=625009#p625009)
#
# DEPENDENCIES: xdotool
#
# LICENSE:      GNU GPLv3 (http://www.gnu.de/documents/gpl-3.0.en.html)
#
# NOTICE:       THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 
#               EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 
#               PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR 
#               IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
#               AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 
#               PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
#               YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
#
#               IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY 
#               COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS 
#               PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 
#               INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE 
#               THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED 
#               INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE 
#               PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER 
#               PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
# USAGE:        focus_or_launch <command>
# EXAMPLE:      focus_or_launch google-chrome


############# GLOBVAR/PREP ###############

Executable="$1"
ExecutableBase="$(basename "$Executable")"
Usage="\
Usage: $(basename $0) command
E.g.:  $(basename $0) google-chrome\
"

############## USGCHECKS #################

if [[ $# -ne 1 || "$1" =~ ^(-h|--help)$ ]]; then
  echo "$Usage"
  exit 1
fi

################ MAIN ####################

MostRecentWID="$(xdotool search --class "$ExecutableBase" | tail -1 2> /dev/null)"

if [[ -z "$MostRecentWID" ]]; then
  echo "$ExecutableBase not found. Launching new window."
  "$Executable" > /dev/null 2>&1 &
  disown
else
  echo "Focusing existing instance of $ExecutableBase."
  # use brute-force approach if activating most recent WID doesn't work
  xdotool windowactivate "$MostRecentWID" 2>&1 | grep failed \
  && xdotool search --class "$ExecutableBase" windowactivate %@
fi

There are probably a few more things I’ll run into, but it’s a good start. =)

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.