#!/bin/sh ## check if there is an open Emacs window ## ## dependencies: wname, lsw. . /tmp/wms_var TARGET=$(for wid in $(lsw); do printf '%s\n' "$wid $(atomx WM_CLASS $wid)" done | grep $XENAME | cut -d ' ' -f1) [ $TARGET ] && wms_mainrole.sh $TARGET \ || $XECMD