From 3bdada4962d3362d915917eaf3675aeff509c3c5 Mon Sep 17 00:00:00 2001 Message-Id: <3bdada4962d3362d915917eaf3675aeff509c3c5.1718409982.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 14 Dec 2008 18:42:25 +0000 Subject: [PATCH] xinitrc and friends: Embed prompt-and-run functionality in xinitrc. Organization: Straylight/Edgeware From: Mark Wooding 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). --- e16-bindings | 3 ++- setup | 2 +- xinitcmd | 2 ++ xinitrc | 16 ++++++++++++++++ xrun | 3 --- 5 files changed, 21 insertions(+), 5 deletions(-) create mode 100755 xinitcmd delete mode 100755 xrun diff --git a/e16-bindings b/e16-bindings index b4c221b..afd2fc8 100644 --- a/e16-bindings +++ b/e16-bindings @@ -34,7 +34,8 @@ KeyDown S5 Up area move 0 -1 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 diff --git a/setup b/setup index e2ef334..8331ea1 100755 --- a/setup +++ b/setup @@ -195,7 +195,7 @@ scripts=" svnwrap hyperspec" [ "$xstuff" ] && scripts="$scripts - xrun + xinitcmd xshutdown" echo "Installing scripts..." mkdir -p $HOME$sub/bin diff --git a/xinitcmd b/xinitcmd new file mode 100755 index 0000000..2bac08e --- /dev/null +++ b/xinitcmd @@ -0,0 +1,2 @@ +#! /bin/sh +exec xatom set XINIT_COMMAND "$*" diff --git a/xinitrc b/xinitrc index 1d3a83c..1de812b 100755 --- a/xinitrc +++ b/xinitrc @@ -241,6 +241,15 @@ start-xterms () { done } +###-------------------------------------------------------------------------- +### Requesters. + +req () { + declare title=$1 hist=$2; shift 2 + cmd=$(xgetline -t "$title" -p "Command:" -Hl "$HOME/$hist") && + exec "$@" "$cmd" +} + ###-------------------------------------------------------------------------- ### Final waiting. @@ -258,6 +267,7 @@ xwait () { xmsg -I -t "xinitrc help" -d "xinitrc commands" - <