openbsd-ports/x11/ratpoison/patches/patch-contrib_rpws
2004-09-30 21:39:58 +00:00

107 lines
2.2 KiB
Plaintext

$OpenBSD: patch-contrib_rpws,v 1.2 2004/09/30 21:39:58 jcs Exp $
--- contrib/rpws.orig Sat Aug 23 02:01:51 2003
+++ contrib/rpws Thu Sep 30 16:38:48 2004
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Workspaces for ratpoison
# Copyright (C) 2003 Shawn Betts
@@ -22,16 +22,13 @@
# You want more workspaces? Edit this script.
#
-# FIXME: Currently this depends on bash because I can't figure out how
-# to pass argument to these functions. In bash $1 ... $n are bound to
-# them, not so in plain bourne.
#
# Code:
#
# This allows outside scripts to tell this script where to find
# ratpoison.
-if [ -z $RATPOISON ]; then
+if [ -z "$RATPOISON" ]; then
RATPOISON=ratpoison
fi
@@ -50,6 +47,9 @@
{
# Backup the frames
FS=`rp_call fdump`
+ if [ -z "$FS" ]; then
+ exit
+ fi
rp_call select -
rp_call only
@@ -64,7 +64,11 @@
# Workspace 1 uses the 'default' group.
# Start in workspace 1.
rp_call gselect default
- rp_call setenv fs1 `rp_call fdump`
+ FDUMP=`rp_call fdump`
+ if [ -z "$FDUMP" ]; then
+ exit
+ fi
+ rp_call setenv fs1 $FDUMP
rp_call setenv ws 1
# restore the frames
@@ -74,19 +78,31 @@
ws_save ()
{
WS=`rp_call getenv ws`
- rp_call setenv fs$WS `rp_call fdump`
+ if [ -z "$WS" ]; then
+ exit
+ fi
+ FDUMP=`rp_call fdump`
+ if [ -z "$FDUMP" ]; then
+ exit
+ fi
+ rp_call setenv fs$WS $FDUMP
}
ws_restore ()
{
ws_save
- if [ $1 == 1 ]; then
+ if [ "X${1}" = X"1" ]; then
rp_call gselect default
else
rp_call gselect ws$1
fi
+
+ FS=`rp_call getenv fs$1`
+ if [ -z "$FS" ]; then
+ exit
+ fi
rp_call echo Workspace $1
- rp_call frestore `rp_call getenv fs$1`
+ rp_call frestore $FS
rp_call setenv ws $1
}
@@ -102,17 +118,15 @@
rp_call bind M-7 exec $0 7
}
-echo boom >/tmp/boom
-
-if [ -z $@ ]; then
+if [ -z "$@" ]; then
echo "Usage:"
echo "$0 -i -- initialize the workspaces"
echo "$0 -b -- setup some key bindings"
echo "$0 <n> -- Switch to workspace n"
else
- if [ $1 == -i ]; then
+ if [ "X${1}" = X"-i" ]; then
ws_init
- elif [ $1 == -b ]; then
+ elif [ "X$1" = X"-b" ]; then
ws_bindings
else
ws_restore $1