-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxeph
executable file
·47 lines (40 loc) · 1.29 KB
/
xeph
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
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env fish
# xeph - Run a program in Xephyr, starting it if necessary.
argparse -n xeph 'h/help' 'k/kill' 'd/display=' 'n/no-wm' 'r/resolution=' -- $argv
if set -q _flag_h
echo "xeph - Run a program in Xephyr, starting it if necessary."
echo "Usage: xeph [arguments] [program]"
echo
echo " -h/--help - Print help and exit."
echo " -k/--kill - Kill the Xephyr process."
echo " -d/--display - Set the Xephyr \$DSIPLAY number to open the window on (default: 5)."
echo " -n/--no-wm - Don't run a window manager; just run the specified program and quit Xephyr when it ends."
echo " -r/--resolution - Set the resolution Xephyr should run at."
exit
end
if set -q _flag_k
pkill Xephyr
exit
end
if set -q _flag_d
set display $_flag_d
else
set display 5
end
if set -q _flag_r
set resolution "$_flag_r"
else
set resolution (xrandr | string match --regex --groups-only 'primary (\\d+x\\d+)')
end
if not set -q _flag_n; and not pgrep Xephyr
Xephyr :$display -ac -screen $resolution -no-host-grab &
sleep 1
DISPLAY=:$display.0 fluxbox &>/dev/null &
DISPLAY=:$display.0 xsetroot -cursor_name center_ptr &
end
if set -q _flag_n
DISPLAY=:$display.0 $argv
pkill Xephyr
else
DISPLAY=:$display.0 $argv &
end