summaryrefslogtreecommitdiffstats
path: root/herbstluftwm/usr/bin/hrunorraise
blob: ac449e4c2a5e7a50141dd043845a80e446ec3a05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# hrunorraise --- Raise a window or start a new process
#
# Tries to find a window ID for a window with a given class value. If
# no such window can be found treat the rest of the command line as
# the command to start.
#
# This script depends on both herbstluftwm and wmctrl.

WINID=$(wmctrl -lx | grep "\.$1" | awk '{ print $1 }')

if [ -n "${WINID}" ]; then
    herbstclient jumpto "${WINID}"
else
    shift
    exec "$@"
fi