53 lines
1.6 KiB
Bash
Executable File
53 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# Copyright 2022 Sxmo Contributors
|
|
|
|
# include common definitions
|
|
# shellcheck source=scripts/core/sxmo_common.sh
|
|
. sxmo_common.sh
|
|
|
|
if [ -e /tmp/dwm_plugin_dmenu.active ] && [ -p /tmp/dwm_plugin_dmenu.fifo ]; then
|
|
printf "CLOSE\n" > /tmp/dwm_plugin_dmenu.fifo 2>/dev/null || true
|
|
sleep 0.04
|
|
fi
|
|
|
|
for _pair in \
|
|
"xdrawer.pid:/tmp/dwm_plugin_xdrawer.fifo" \
|
|
"xdialer.pid:/tmp/dwm_plugin_dialer.fifo" \
|
|
"xcalllog.pid:/tmp/dwm_plugin_calllog.fifo" \
|
|
"xcontacts.pid:/tmp/dwm_plugin_contacts.fifo" \
|
|
"xsms.pid:/tmp/dwm_plugin_sms.fifo" \
|
|
"xfiles.pid:/tmp/dwm_plugin_files.fifo" \
|
|
"xcamera.pid:/tmp/dwm_plugin_camera.fifo" \
|
|
"xthemes.pid:/tmp/dwm_plugin_themes.fifo" \
|
|
"xmodem.pid:/tmp/dwm_plugin_modem.fifo" \
|
|
"xnetworks.pid:/tmp/dwm_plugin_networks.fifo" \
|
|
"xringtones.pid:/tmp/dwm_plugin_ringtones.fifo" \
|
|
"xwallpapers.pid:/tmp/dwm_plugin_wallpapers.fifo" \
|
|
"xmusic.pid:/tmp/dwm_plugin_music.fifo"; do
|
|
_pf="${_pair%%:*}"
|
|
_ff="${_pair#*:}"
|
|
if [ -f "${XDG_RUNTIME_DIR:-/run/user/10000}/$_pf" ] || [ -f "/tmp/$_pf" ]; then
|
|
if [ -p "$_ff" ]; then
|
|
printf "CLOSE\n" > "$_ff" 2>/dev/null || true
|
|
exit 0
|
|
fi
|
|
fi
|
|
done
|
|
|
|
case "${SXMO_WM:-dwm}" in
|
|
i3) i3-msg kill ;;
|
|
sway) swaymsg kill ;;
|
|
river) riverctl close ;;
|
|
dwm|*)
|
|
_wid="$(xdotool getactivewindow 2>/dev/null || true)"
|
|
xdotool key --clearmodifiers Super+Shift+c 2>/dev/null || true
|
|
if [ -n "$_wid" ]; then
|
|
sleep 0.1
|
|
if xprop -id "$_wid" WM_STATE >/dev/null 2>&1; then
|
|
xdotool windowkill "$_wid" 2>/dev/null || true
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|