Sponsored Post Learn from the experts: Create a successful blog with our brand new courseThe WordPress.com Blog

WordPress.com is excited to announce our newest offering: a course just for beginning bloggers where you’ll learn everything you need to know about blogging from the most trusted experts in the industry. We have helped millions of blogs get up and running, we know what works, and we want you to to know everything we know. This course provides all the fundamental skills and inspiration you need to get your blog started, an interactive community forum, and content updated annually.

Getting Window Properties when your Mouse is Unavailable

Or, floating the menu in xfce

I’m currently using XMonad in Xubuntu, which has been really lovely. However, I got very tired of the xfce4’s menu also being tiled. The XMonad.ManageHook package provides tools for dealing with your windows (floating, ignoring, whatever) provided you have some information about them, like the title.

-- signatures from XMonad.ManageHook

title :: Query String
-- Returns the window title.

doIgnore :: ManageHook
-- Map the window and remove it from the WindowSet.

We can get the window’s title by checking the value of _NET_WM_NAME(UTF8_STRING), which can be done through xprop. But using xprop to get the title of xfce4’s menu by clicking on the open menu doesn’t quite work out

$ xprop
xprop: error: Can't grab the mouse.

We need a way to get information about all the windows we have open. Enter xwininfo!

$ xwininfo -children -root
# lots of stuff here

Unfortunately at this point you have to manually scan the output for what you’re looking for, if you have no idea what it might be called.

At this point we can utilize xprop to get more info about our window, if we choose..

$ xprop -name "Whisker Menu"

…but in this instance there was no need. The following snippet added to your ManageHook, will ignore the xfce4 whisker menu.

title =? "Whisker Menu" --> doIgnore

XMonad + XFCE

After 5 years or so, I have switched from Arch Linux to Xubuntu. Whether or not this change is permanent remains to be seen. I do miss pacman quite a bit.

Currently running XMonad as my window manager. I’m using xmonad-log-applet to send info (xmonad layout, focused window title, etc) to xfce4-panel.

Here’s a relatively bare-bones xmonad.hs that makes XMonad in XFCE4 a little more comfortable. Actually the most important part here is replace; without it, I was running into all kinds of funky issues with xfce4-panel.

import XMonad
import XMonad.Config.Xfce
import XMonad.Hooks.EwmhDesktops
import XMonad.Util.Replace(replace)
main = do
xmonad $ ewmh xfceConfig
{ terminal = "xfce4-terminal –hide-menubar"
, manageHook = myManageHook <+> manageHook xfceConfig
myManageHook = composeAll [ className =? "Xfce4-notifyd" –> doIgnore ]

view raw
hosted with ❤ by GitHub

A Palindrome Encounter

On May 24, 2016 I looked at the time in the evening and it was 5:45. Ah, a palindrome! I thought. (Looking at it as a number/sequence of digits rather than a sequence of characters.) The next time I looked at the time it was 6:56. Also, you’ll notice, a palindrome.

A connection between these two palindromes: the absolute difference between the unique digits of both these palindromes is 1 (|5-4|=|6-5|). One just so happens to be the unique digit(s) making up the palindrome 11, which is also the sum of the unique digits of the latter palindrome (6+5). The sum of the unique digits of the first palindrome is 9 (5+4), which is also a palindrome, if trivial.

Ahhhh, life!

p.s. I remembered the date as being May 24 because, where I live, we write that date as 5/24 (month/day). Perhaps it would have been fitting to have this observation on 5/25, thereby bagging another palindrome. However, May 24th is one day away from May 25, which is even more fitting. (In that same sense, May 26th would have pleased me too.)

p.p.s. I suppose this breaks down a little if you live your life on a 24hr clock… which seems to be quite common.

the cat is not away

In a true test of my ability to navigate via keystrokes, my mouse has disappeared. (Not the physical one, but the pixelated one.)

It’s going great so far. Until, you know, I encounter a flash video…

Chrome/Chromium is sound-greedy

I was having an issue where chromium (and chrome) would… grab onto my sound device? Basically it would not play sound if another application (eg firefox) was. When chromium was able to play sound, then these other applications could not.

Installing the pulseaudio-alsa package on Archlinux fixed this. It did require a restart.

emacs: Indirect Buffers

Say you have buffers A and B both visiting the same file. Sure, you can view different parts of this file in A and B, but once you narrow in one buffer, the same section is narrowed in the other.

When this is not the behaviour you want (when would you actually want this behaviour, is the real question imho), use indirect buffers!

An indirect buffer shares the text of some other buffer, which is called the base buffer of the indirect buffer. In some ways it is a buffer analogue of a symbolic link between files.


The text of the indirect buffer is always identical to the text of its base buffer; changes made by editing either one are visible immediately in the other. But in all other respects, the indirect buffer and its base buffer are completely separate. They can have different names, different values of point, different narrowing, different markers, different major modes, and different local variables.

Handy-dandy key chord C-x 4 c (clone-indirect-buffer-other-window): analogous to C-x 4 f, this binding creates an indirect buffer of the current buffer in another window. (Remember that c by remembering clone.)

Adding tap0 on ArchLinux

MirageOS networking examples tend to use ifconfig for this. On ArchLinux, ifconfig is (allegedly) deprecated, and we tend to use ip for things.

# ip tuntap add tap0 mode tap
# ip addr add dev tap0
$ ping # browse to if applicable