Advanced Uses and Special Set Ups - felixfung/skippy-xd GitHub Wiki

Skippy-xd is easy to use, but there is depth in plenty of advanced uses and customizations, including invocation method, scripting, dashboard set up, multimonitor set up, config file options.

Config file

Most default values in the config file works well. For full details of the skippy-xd config file, see https://github.com/felixfung/skippy-xd/wiki/Config.

skippy-xd invocation ideas

Invoking skippy-xd activation consists simply of launching skippy-xd with different parameters. With all the great tools in the Linux world, this allows myriad possibilities to use skippy-xd.

Skippy-xd operations always allow both keyboard and mouse. Here are some ideas how to activate skippy-xd with either keyboard or mouse:

For simplest set up, simply use your favourite hot key app for these bindings:

hot key metaphor command
Alt Tab switch skippy-xd --switch --next
Shift Alt Tab switch skippy-xd --switch --prev
F11 expose skippy-xd --expose
F12 paging skippy-xd --paging

There are plenty of apps to set up hot keys in Linux. See for example https://wiki.archlinux.org/title/keyboard_shortcuts#Customization.

Of these, xbindkeys (https://wiki.archlinux.org/title/Xbindkeys) allows lisp/guile programming, and hence unlimited flexibility in skippy-xd invocation. A simple .xbindkeysrc would be

"skippy-xd --switch --next"
  Alt + Tab

"skippy-xd --switch --prev"
  Alt + Shift + Tab

"skippy-xd --expose"
  F11

"skippy-xd --paging"
  F12

Further ideas include key combinations and key double tapping to invoke skippy-xd.

Mouse invocation

If you are heavy on mouse operation, you may find efficiency in activating skippy-xd expose and paging modes with mouse:

Pivot mode

Skippy-xd is activated in one of two modes: toggle mode or pivot mode.

In toggle mode, skippy-xd is simply activated. A subsequent invocation of skippy-xd leads de-activation without window selection. Hence, invocations toggle skippy-xd on/off.

To invoke with toggle mode, use the --toggle command line argument. For example:

skippy-xd --expose --toggle
skippy-xd --paging --toggle

In pivot mode, a pivot key has to be held for skippy-xd to remain activated. For example, during Alt-Tab, Alt is the pivot key, and when it is released, skippy-xd selects the currently highlighted window.

To specify pivot mode, add --pivot command line argument and specify the pivot key. Hence:

skippy-xd --switch --pivot Alt_L --next
skippy-xd --switch --pivot Alt_L --prev

When pivot or toggle modes are not specified, switch defaults to pivot with Alt_L pivot key, while expose and paging defaults to toggle mode. Hence these shortened commands are identical to those above:

skippy-xd --switch --next
skippy-xd --switch --prev
skippy-xd --expose
skippy-xd --paging

Pivot mode for expose and paging

Expose and paging can be invoked in pivot mode, and thus behave similar to Alt-Tab. For example with xbindkeys and .xbindkeysrc:

"skippy-xd --expose --pivot Super_L --next"
  Mod4 + Tab

"skippy-xd --paging --pivot Control_L --next"
  Control + Tab

The feeling of this usage is very different from the toggling usage. Try it out!

Single key pivot mode

You can also invoke expose and paging with a single key, so that pressing and holding the key keeps skippy-xd activated.

For this, you will need this patched version of xbindkeys at https://github.com/felixfung/xbindkeys, which has xbind-skippy in place of xbindkey, and skippy-runner in place of run-command. Then in .xbindkeys.scm, do:

(xbindkey
    '(Alt Tab)
    "skippy-xd --switch --next")

(xbindkey
    '(Shift Alt Tab)
    "skippy-xd --switch --prev")

(xbind-skippy
    '(Super_L)
    "skippy-xd --expose \
         --pivot Super_L")

(xbind-skippy
    '(Super_R)
    "skippy-xd --paging \
         --pivot Super_R")

If your pivot key is not a modifier (Shift, Control, etc), then it will fire continuously leading to 100% CPU usage. Use xset -r keycode to disable key repetition; the keycode can be found from xev.

This set up has quickly become my personal favourite. Try it out!

Mouse pivoting

Hot corner (e.g. with xdotool) is a good way to use skippy-xd with the mouse. There is another way if your mouse has additional buttons (e.g. thumb buttons).

Map your mouse button to a keyboard key, and set the keyboard key as pivot key as above. There are many tools to achieve this mouse-to-keyboard mapping: https://wiki.archlinux.org/title/Input_remap_utilities

Now, you can get a quick expose and paging overview of your desktop with the hold of your mouse button, hover your mouse on the window you want to select, and release the mouse button to select. Click at the desktop to cancel. In the whole operation, your hand needs minimal movement!

Window class filtering

Starting version 0.9.0, skippy-xd allows showing only certain window classes!

Trigger skippy-xd with the --wm-class command line option. For example, this would show only XTerm windows, filtering away all other windows:

skippy-xd --expose --wm-class XTerm

The filtering follows POSIX regex rules, which allow many possibilities, including shortcuts like this one:

skippy-xd --expose --wm-class XT

One simple use is to use xdotool to filter for currently highlighted window class:

skippy-xd --expose --wm-class $(xdotool getwindowclassname $(xdotool getactivewindow))

Another use is to couple with yad or similar to achieve a window filter and selector:

skippy-xd --expose --wm-class $(yad --entry)

You may want to search over all virtual desktops by first reloading the config file with filter/exposeShowAllDesktops = true

By default, the filtering is reversed after each invocation. To keep the filter persistent, enable the filter/persistentFiltering config option.

XScreen

Starting version 0.10.0, skippy-xd supports XScreen!

For each screen, launch a separate skippy-xd daemon.

For the client skipp-xd app, it needs to read the DISPLAY variable to connect to the right daemon. This script by nPHYN1T3 automate this:

#!/bin/bash

xdotool keyup 0xffeb
xdotool keyup 0xffe3
xdotool keyup 0xffe9
xdotool click --clearmodifiers 1

SCREEN=`xdotool getmouselocation | awk '{print $3}'`
SCREEN=${SCREEN#screen:}

DISPLAY=:0.${SCREEN} skippy-xd --expose

Config option filter/showOnlyCurrentScreen controls whether to filter to the current XScreen.

Scripting

Skippy-xd is script-able!

Skippy-xd is script-able by design, with these important characteristics:

  1. Invoking skippy-xd is always through the simple skippy-xd command.
  2. If the skippy-xd command activated skippy-xd, it is guaranteed to return after the completion of skippy-xd selection, with the window ID (in case of switch and expose) or virtual desktop ID (in case of paging).
  3. If the skippy-xd command did not activate skippy-xd, e.g. with toggling off of expose, or --next invocations of switch, then the command will return immediately with -1.
  • In addition, there is multi select mode. See below section for more detail.

Below are some ideas and scripts for your skippy-xd use. These are by no means the limitations of what scripts of skippy-xd can do, rather these are ideas and building blocks of what skippy-xd can do for YOU.

Dashboard

You can set up skippy-xd with your choice of panels and windows to create your own dashboard! Then, during skippy-xd activation, your choice of informational windows will be displayed as well.

A simple example of dashboard setup consisting of wallpaper and conky:

#!/bin/bash
conky &
load-wallpaper dashboard.jpg
sleep 0.05 # add small time delay for conky to load
skippy-xd --expose # you can even add --config path for invoke with special config option
killall conky
load-wallpaper wallpaper.jpg

This deceptively simple looking script works because skippy-xd --expose returns only after skippy-xd selection is complete, so that cleaning up (in this case killing conky and reloading wallpaper) is not performed prematurely.

You can show/hide windows as part of your dashboard before/after skippy-xd invocation in your script.

There are panel windows, and desktop windows, of type _NET_WM_WINDOW_TYPE_DOCK and _NET_WM_WINDOW_TYPE_DESKTOP, respectively. Display them by setting in the skippy-xd config file, panel/show = true and display/showDesktop = true, respectively.

Set panel/reserveSpace = true. Then, the panel windows will reduce the active screen space during skippy-xd invocation. Desktop windows do not have this option.

To set a class of windows as panel window, do:

xprop -id $(xdotool search --class window_class) -f _NET_WM_WINDOW_TYPE 32a -set _NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE_DOCK

To set a class of windows as desktop window, do:

xprop -id $(xdotool search --class window_class) -f _NET_WM_WINDOW_TYPE 32a -set _NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE_DESKTOP

To show conky as a panel window, set in .conkyrc

own_window = true,
own_window_type = 'dock'

To show conky in the desktop window, set in .conkyrc

own_window = true,
own_window_type = 'desktop'

Unfortunately, it is technically impossible to click or send events to the panels.

Test for skippy-xd activation state

#!/bin/bash
skippycount=`ps aux | grep skippy-xd | grep -v defunct | wc -l`
if [ $skippycount -eq 2 ]; then
    echo skippy not active
else
    echo skippy activating
fi

Increment/decrement virtual desktop while skippy-xd is already activated

This one liner increment the virtual desktop with xdotool:

xdotool set_desktop $(( $((`xdotool get_desktop` + `xdotool get_num_desktops` + 1)) % `xdotool get_num_desktops`))

This one liner decrement the virtual desktop with xdotool:

xdotool set_desktop $(( $((`xdotool get_desktop` + `xdotool get_num_desktops` - 1)) % `xdotool get_num_desktops`))

Combine these with the skippy-xd activation test to achieve switching virtual desktop while skippy-xd is already activated:

#!/bin/bash
skippycount=`ps aux | grep skippy-xd | grep -v defunct | wc -l`
if [ $skippycount -eq 2 ]; then
    activating=0
else
    activating=1
fi

if [ $activating -eq 1 ]; then
    skippy-xd --expose
fi

xdotool set_desktop $(( $((`xdotool get_desktop` + `xdotool get_num_desktops` + 1)) % `xdotool get_num_desktops`))

if [ $activating -eq 1 ]; then
    skippy-xd --expose
fi

As a bonus, when skippy-xd is activated via pivot mode, this script has no effect ;)

Get window ID via skippy-xd without focusing

#!/bin/bash
wid0=`xdotool getactivewindow`
wid1=`skippy-xd --expose`
xdotool windowfocus $wid0
echo $wid1

Window action with skippy-xd

By modifying the above script, we can perform window action on the window selected by skippy-xd.For example, the following toggles the selected window fullscreen:

#!/bin/bash
wid0=`xdotool getactivewindow`
wid1=`skippy-xd --expose`
xdotool windowfocus $wid0
xdotool windowstate -toggle FULLSCREEN $wid1

Other possibilities include silencing the selected window, or resizing/maximizing it.

This is my personal favourite: use paging to transfer current window to a new virtual desktop:

#!/bin/bash
wid0=`xdotool getactivewindow`
did=`skippy-xd --paging`
xdotool set_desktop_for_window $wid0 $did
xdotool windowfocus $wid0

For advanced use, send key events or clicks to the selected window.

Multi-select mode

Starting version 0.10.2, there is multi-select mode!

Invoke skippy-xd with --multi-select parameter. Then, you see that the highlight tint is different (default smart blue, controlled by multiselect section in the config file).

From here, toggle window selection status with the usual mouse click or enter/space. Terminate skippy-xd activation by pressing escape or clicking on a non-window area.

Then, skippy-xd returns all the selected window or virtual desktop IDs, which can be parsed for scripting.

This is a script to use multi-select to take a bunch of windows to a selected virtual desktop:

#!/bin/bash
wids=`skippy-xd --expose --multi-select`
did=`skippy-xd --paging`
for wid in $wids; do
    xdotool set_desktop_for_window $wid $did
    xdotool windowfocus $wid
done