You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-utils-1/install/patches/x11-misc/slim-1.3.1-slimd.patch

73 lines
2.0 KiB

diff --git a/Makefile b/Makefile
index e77003d..22943c3 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,7 @@ slim: $(OBJECTS)
install: slim install-theme
install -D -m 755 slim $(DESTDIR)$(PREFIX)/bin/slim
+ install -D -m 755 slimd $(DESTDIR)$(PREFIX)/bin/slimd
install -D -m 644 slim.1 $(DESTDIR)$(MANDIR)/man1/slim.1
test -e $(DESTDIR)$(CFGDIR)/slim.conf || \
install -D -m 644 slim.conf $(DESTDIR)$(CFGDIR)/slim.conf
diff --git a/slimd b/slimd
new file mode 100755
index 0000000..590e01d
--- /dev/null
+++ b/slimd
@@ -0,0 +1,54 @@
+#!/bin/bash
+#------------------------------------------------------------------------------
+# slimd
+# Copyright ©2009 Mir Calculate Ltd.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#------------------------------------------------------------------------------
+
+stopslim() {
+ killall X &>/dev/null
+ killall -9 slim &>/dev/null
+ rm -f /var/run/slim.lock
+ exit
+}
+
+waitrun() {
+ while ! ps axo pid,cmd | grep $1 | grep -v grep &>/dev/null
+ do
+ sleep 1
+ done
+}
+
+workloop() {
+ trap stopslim TERM
+ sleep 3
+ waitrun /usr/bin/X
+ while true
+ do
+ # check is working X
+ if ! ps axo pid,cmd | grep /usr/bin/X | grep -v grep &>/dev/null
+ then
+ kill -9 `cat /var/run/slim.lock` &>/dev/null
+ rm -f /var/run/slim.lock
+ /usr/bin/slim
+ # waiting for run X
+ waitrun /usr/bin/X
+ fi
+ sleep 1
+ done
+}
+
+/usr/bin/slim && workloop &
+