Preventing Kupfer switching to existing windows

I am enjoying using Kupfer but I don’t like the way it switches to an existing window of an application, instead of launching a new instance.

I should write a patch for a config option or similar, but for now, here are my notes on how I disabled the behaviour in the source code:

sudo sensible-editor /usr/share/kupfer/kupfer/launch.py

I just commented out 3 lines inside the launch_application method (lines 70-72 for me):

#       if activate and svc.application_is_running(app_id):
#               svc.application_to_front(app_id)
#               return True

This prevents Kupfer looking for open windows before launching.

Using Kupfer on MATE

I am trying out MATE desktop and really liking it.

I like to use a (GNOME-Do style) keyboard-driven application launcher, and have found Kupfer really good.

Kupfer as packaged for Ubuntu MATE does not support MATE desktop, so the file manager (“Caja”) does not show up by default, along with other things like the preferences dialogs, and there is no support for actions like Log Out or Shut Down.

To get MATE applications to show up in Kupfer, all I had to do was make up a config value that is not presented in the preferences, by editing the config file:

pluma ~/.config/kupfer/kupfer.cfg

I found the line that started “desktop_type = ” and changed it to say:

desktop_type = MATE

To get MATE session commands in Kupfer, I copied the GNOME session management plugin and made a similar one for MATE.

cd /usr/share/kupfer/kupfer/plugin
sudo cp session_gnome.py session_mate.py
sudo pluma session_mate.py

I just changed the 3 lines after “# sequences of argument lists”, and made them look like this:

LOGOUT_CMD = (["mate-session-save", "--logout-dialog"],)
SHUTDOWN_CMD = (["mate-session-save", "--shutdown-dialog"],)
LOCKSCREEN_CMD = (["mate-screensaver-command", "--lock"],)

When I restarted Kupfer I was able to open MATE applications and control the MATE session using Kupfer.

There is an open pull request from 2013 for Kupfer to add MATE session management: github.com/engla/kupfer/pull/15 – thanks to its author labero, since this showed me what I needed to do for that part.

Rabbit Escape 0.3.1 – now with zoom!

I’ve just release the latest version of Rabbit Escape, which makes things look a lot nicer because you can zoom in, getting you much closer to your rabbits:

rabbitescape-android-zoomed

There are still 60 levels of Lemmings and Pingus -like gameplay, all downloadable for free artificialworlds.net/rabbit-escape/.

I’ve also improved performance significantly, so you should notice things get smoother on older devices.

All those zoomed images increase the download size to 9MB, which is a pity, but that’s still pretty small.

Treat warnings as errors in a (Gnu) Makefile

I got hit again last night by a bug in my Makefile that meant I effectively ran rm -rf /*, which was not fun.

Today I have been looking for how to make Make stop if a variable is undefined.

Here’s my solution. This Makefile contains a bug (“SRCS” instead of “SRC”):

# Turn on the warning we want
MAKEFLAGS += --warn-undefined-variables

# Make sure MAKECMDGOALS is defined, so it doesn't cause an error itself
ifndef MAKECMDGOALS
MAKECMDGOALS = all
endif

SRC=hello.c

all: compile

# Fails if the Makefile contains any warnings.
# Run this Makefile with the same goals, but with the -n flag.
# Grep for warnings, and fail if any are found.
no-make-warnings:
    ! make -n $(MAKECMDGOALS) 2>&1 >/dev/null | grep warning

# Targets you want to check must depend on no-make-warnings
compile: no-make-warnings
    gcc -o hello $(SRCS)

When I run it I get:

$ make
! make -n all 2>&1 >/dev/null | grep warning
Makefile:17: warning: undefined variable `SRCS'
make: *** [no-make-warnings] Error 1

When I correct the bug I get:

$ make
! make -n all 2>&1 >/dev/null | grep warning
gcc -o hello hello.c

As expected.

To make a target warnings-resistant, you have to make it depend on the target no-make-warnings. If anyone has suggestions for how to avoid needing this, please comment.

I also posted this as a StackOverflow answer: How to treat a warning as an error in a Makefile?.