forked from RomaniukVadim/hack_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslopspawn
More file actions
36 lines (30 loc) · 802 Bytes
/
Copy pathslopspawn
File metadata and controls
36 lines (30 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# depends: dmenu slop xdotool
# assumes next spawned window will be floating/moveable by xdotool.
# get program name to launch using dmenu cache:
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
cache=$cachedir/dmenu_run
else
cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
fi
program=$(
IFS=:
if stest -dqr -n "$cache" $PATH; then
stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@"
else
dmenu "$@" < "$cache"
fi
)
# Set dimension vars with slop
eval `slop`
# Get current window
win=`xdotool getactivewindow`
$program &
# Wait for window to spawn and move with xdotool.
newwin=$win
while [ "$newwin" = "$win" ]; do
newwin=`xdotool getactivewindow`
done
xdotool windowmove $newwin $X $Y
xdotool windowsize $newwin $W $H