The prompt-and-run functionality used to be in xrun. Unfortunately,
that runs programs from the context of the window manager (assuming you
started it from M5-F9 or whatever). We can do better, and start the
program from the context of the xinitrc script, which we can change more
readily. It seems easiest to simply scrap xrun and embed the
functionality directly into the xinitrc.
As a bonus, I've also added (and bound to M5-F10) a popup for submitting
commands to the xinitrc itself, and provided a script xinitcmd for doing
the same from the command line (though this is less useful).
KeyDown S5 Left area move -1 0
KeyDown S5 Right area move 1 0
KeyDown 5 F8 exec xatom set XINIT_COMMAND :terminal
-KeyDown 5 F9 exec xrun
+KeyDown 5 F9 exec xatom set XINIT_COMMAND :ask-run
+KeyDown 5 F10 exec xatom set XINIT_COMMAND :ask-command
KeyDown 5 F12 exec xshutdown
KeyDown 5 Tab focus next
KeyDown C5 Up wop * raise
svnwrap
hyperspec"
[ "$xstuff" ] && scripts="$scripts
- xrun
+ xinitcmd
xshutdown"
echo "Installing scripts..."
mkdir -p $HOME$sub/bin
--- /dev/null
+#! /bin/sh
+exec xatom set XINIT_COMMAND "$*"
done
}
+###--------------------------------------------------------------------------
+### Requesters.
+
+req () {
+ declare title=$1 hist=$2; shift 2
+ cmd=$(xgetline -t "$title" -p "Command:" -Hl "$HOME/$hist") &&
+ exec "$@" "$cmd"
+}
+
###--------------------------------------------------------------------------
### Final waiting.
xmsg -I -t "xinitrc help" -d "xinitrc commands" - <<EOF &
:help
:emacs :xterms :window-manager :clients
+:ask-run :ask-command
:init
:terminal
! SHELL-COMMAND
info "restarting xinitrc"
exec "$0" wait nostart
;;
+ :ask-run)
+ req "Shell command" .cmd.hist xcatch -FMiscFixed6x13 -- sh -c&
+ ;;
+ :ask-command)
+ req "xinit command" .xinit.hist xatom set XINIT_COMMAND$atomtag&
+ ;;
:*)
xmsg -E -t "xinitrc error" "Unknown command \`$line'" &
;;
+++ /dev/null
-#! /bin/sh
-cmd=`xgetline -t "Shell command" -p "Command:" -Hl $HOME/.cmd.hist` &&
- exec xcatch -- sh -c "$cmd"