Launch/show/hide a scratchpad (ROXTerm terminal emulator) while using DWM with
F12
key and launch it while using PCManFM with
F4
key. Tested in Debian GNU/Linux 6.
-
additional packages required:
xdotool, x11-utils
-
show-roxterm script:
/usr/local/bin/show-roxterm
#!/bin/bash
wid=$(xdotool search --title MyROXTerm)
if [ -n "$wid" ]; then
if [ -z "$(xprop -id $wid | grep 'window state: Normal' 2>/dev/null)" ]; then
xdotool windowmap $wid
sleep 0.2s
fi
xdotool windowactivate $wid
fi
-
configure PCManFM F4 terminal launcher key:
~/.config/libfm/libfm.conf
[config]
terminal="pcmanfm-roxterm"
-
pcmanfm-roxterm script:
/usr/local/bin/pcmanfm-roxterm
#!/bin/bash
roxterm --tab --title=MyROXTerm
show-roxterm
xdotool key Super+Control+Shift+2
-
launch-roxterm script:
/usr/local/bin/launch-roxterm
#!/bin/bash
roxterm --tab --title=MyROXTerm
show-roxterm
-
toggle-roxterm script:
/usr/local/bin/toggle-roxterm
#!/bin/bash
wid=$(xdotool search --title MyROXTerm)
if [ -z "$wid" ]; then
roxterm --tab --title=MyROXTerm
wid=$(xdotool search --title MyROXTerm)
xdotool windowactivate $wid
else
if [ -z "$(xprop -id $wid | grep 'window state: Normal' 2>/dev/null)" ]; then
xdotool windowmap $wid
sleep 0.2s
xdotool windowactivate $wid
else
xdotool windowunmap $wid
fi
fi
-
configure DWM v6:
config.h
/* class instance title tags mask isfloating monitor */
{ "Pcmanfm", NULL, NULL, 1<<1, False, -1 },
{ "Roxterm", NULL, NULL, 0, True, -1 },
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
.
.
.
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* commands */
static const char *termcmd[] = { "launch-roxterm", NULL };
static const char *scratchpadcmd[] = { "toggle-roxterm", NULL };
/* modifier key function argument */
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ 0, XK_F12, spawn, {.v = scratchpadcmd } },
-
Reference:
https://wiki.archlinux.org/index.php/Rxvt-unicode#Scriptlets