blob: 66ea64cded2b7fd213e32684cdfc1baf0e087322 (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/hint/bash
##
# Just like systemd-notify(1), but slower, which is a shitty
# workaround for a race condition in systemd.
##
systemd-notify() {
local args
args="$(getopt -n systemd-notify -o h -l help,version,ready,pid::,status:,booted -- "$@")"
ret=$?; [[ $ret == 0 ]] || return $ret
eval set -- "$args"
local arg_ready=false
local arg_pid=0
local arg_status=
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help) command systemd-notify --help; return $?;;
--version) command systemd-notify --version; return $?;;
--ready) arg_ready=true; shift 1;;
--pid) arg_pid=${2:-$$}; shift 2;;
--status) arg_status=$2; shift 2;;
--booted) command systemd-notify --booted; return $?;;
--) shift 1; break;;
esac
done
local our_env=()
if $arg_ready; then
our_env+=("READY=1")
fi
if [[ -n "$arg_status" ]]; then
our_env+=("STATUS=$arg_status")
fi
if [[ "$arg_pid" -gt 0 ]]; then
our_env+=("MAINPID=$arg_pid")
fi
our_env+=("$@")
local n
printf -v n '%s\n' "${our_env[@]}"
socat STDIO UNIX-SENDTO:"$NOTIFY_SOCKET" <<<"$n"
}
##
# Reposition Onboard in the correct location
#
# I think this is actually working around a
# WMII bug where it confuses the heights when
# there are multiple panels.
#
onboard-hack() {
local res=$(xdpyinfo|awk '/^\s*dimensions:/{print $2}')
[[ "$res" == *x* ]] || break
local file wid size
while read -r file; do
wid="${file%/props}"
wid="${wid##*/}"
size=$(xdotool getwindowgeometry 0x01000007|awk '/^\s*Geometry:/{print $2}')
[[ "$size" == *x* ]] || continue
xdotool windowmove "$wid" 0 "$(bc <<<"${res#*x}-${size#*x}")"
done < <(grep -l ^onboard: -- "$WMII_DIR"/client/*/props)
}
|