blob: f32084f086e59d543aa7ed34df174803191efc99 (
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
|
#!/bin/sh
# File: fix-alttab-daemon
# Location: /usr/bin
# Author: bgstack15
# Startdate: 2023-07-10-2 08:55
# SPDX-License-Identifier: GPL-3.0
# Title: fix-alttab-daemon
# Project: fix-alttab
# Purpose: Detect changes to connected HDMI monitors
# History:
# Usage:
# run in ~/.fluxbox/startup in the background
# Reference:
# Improve:
# Dependencies:
# dep-devuan: bgscripts-core
# Documentation: README.md
# load settings
test -z "${DEFAULTSDIR}" && DEFAULTSDIR=/etc/sysconfig
grep -qiE 'de(vu|bi)an|ubuntu|mint' /etc/os-release 1>/dev/null 2>&1 && DEFAULTSDIR=/etc/default
test -f "${DEFAULTSDIR}/fix-alttab" && . "${DEFAULTSDIR}/fix-alttab"
test -f "${XDG_CONFIG_HOME:-~/.config}/fix-alttab" && . "${XDG_CONFIG_HOME:-~/.config}/fix-alttab"
test -z "${FIX_ALTTAB_BIN}" && FIX_ALTTAB_BIN=/usr/libexec/fix-alttab
command -v plecho 1>/dev/null && _use_plecho=1
unset _laststatus
while ! test -f /tmp/stop-fix-alttab-daemon ;
do
sleep "${ALTTAB_DAEMON_LOOP:-3}"
_status="$( APPLY= "${FIX_ALTTAB_BIN}" )"
test "${_status}" != "${_laststatus}" && {
APPLY=1 "${FIX_ALTTAB_BIN}" | \
{
if test "${_use_plecho}" = "1" ;
then
timeout 2 plecho
else
timeout 2 cat
fi
}
} | tee -a "${ALTTAB_DAEMON_LOGFILE:-fix-alttab-daemon.log}"
_laststatus="${_status}"
done
|