From 2418a213c1cc099e9b2b00fe73ece6d7f606d3e7 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Mon, 21 Nov 2022 16:09:02 -0500 Subject: add command firestartx; and cleanup Makefile --- Makefile | 8 +++++--- firestartx | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100755 firestartx diff --git a/Makefile b/Makefile index 7cb92ae..443b88a 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,14 @@ BINDIR = /usr/local/bin -BINARIES = sliceweasel sliceweasel.lib.sh sliceuser fireslay ioslay-firefox cgroup-show-each-new-process ioslay-mgr.sh firestart +BINARIES = sliceweasel.lib.sh ioslay-mgr.sh firestart firestartx ioslay-firefox SUDO != [ "$$(id -u)" = 0 ] || echo sudo .PHONY: install install-bin install: install-bin - sh your-fired.sh install - make run-ioslay + # sh your-fired.sh install + +uninstall: + systemctl --user disable firefixer run-ioslay: if systemctl --user is-active ioslay; \ diff --git a/firestartx b/firestartx new file mode 100755 index 0000000..748b9dd --- /dev/null +++ b/firestartx @@ -0,0 +1,50 @@ +#!/bin/bash + +get_new_display() +{ + for ((n=1; n<99; ++n)) + do + if [ ! -e /tmp/.X$n-lock ] + then + NEW_DISPLAY=:$n + return + fi + done + false +} + +get_new_display || exit + +if [ $# = 0 ] +then + set -- firestart +fi + +# TITLE=$* # lol, startx doesn't support arguments with spaces +TITLE=$1 + +if [ "$1" != firestart ] +then + USE_XINIT=y +fi + +if [ "$USE_XINIT" ] +then + set -x + case "$1" in + /*) ;; + *) f1=$(which "$1") || exit + shift + set -- "$f1" "$@" + ;; + esac + xinit "$@" -- $(which Xephyr) "$NEW_DISPLAY" -resizeable -p 0 -terminate ${TITLE:+ -title "$TITLE"} +else + set -x + startx -- $(which Xephyr) "$NEW_DISPLAY" -resizeable -p 0 -terminate ${TITLE:+ -title "$TITLE"} & + if [ $# -gt 0 ] + then + DISPLAY=$NEW_DISPLAY "$@" & + fi + wait +fi -- cgit v1.2.3