Simple Quake-Terminal alike script

Window managers, icon programs, widgets, etc.
Post Reply
Message
Author
User avatar
lithpr
Posts: 86
Joined: Thu 10 Mar 2011, 06:33

Simple Quake-Terminal alike script

#1 Post by lithpr »

Here's a quake-terminal script for Puppy, using the standard urxvt console. The only dependency that isn't common on Puppy is wmctrl, which can be found here: http://www.murga-linux.com/puppy/viewtopic.php?t=67987

Image

Resolution Independent
Transparency used if available, urxvt psuedo-transparency used if not

Name this script "quake-terminal", and put it somewhere in your path, like /usr/local/bin . Needs to be made executable. Do not name the script rexquakeurxvt, that name needs to be unique to the console that this script opens.

Code: Select all

#!/bin/sh
quakewindow=rexquakeurxvt

if [ "$(wmctrl -l | grep $quakewindow)" == "" ] ; then
  if [ "$(pidof xcompmgr)" != "" ] ; then
    exec urxvt -depth 32  +sb -fg White -bg rgba:0000/0000/0000/9999 -name $quakewindow &
  else
    exec urxvt -tr +sb -fg White -bg Black -sh 40 -name $quakewindow &
  fi
  
  dataline=$(wmctrl -d | grep '*')
  originX=$(echo "$dataline" | cut -d ' ' -f 11 | cut -d \, -f 1)
  originY=$(echo "$dataline" | cut -d ' ' -f 11 | cut -d \, -f 2)
  width=$(echo "$dataline" | cut -d ' ' -f 12 | cut -d \x -f 1)
  height=$(echo "$dataline" | cut -d ' ' -f 12 | cut -d \x -f 2)
	
  originXFramed=$((width/8))	
  targetWidthFramed=$(( width - $(( width/8*2)) ))
  targetHeight=$((height/2))	
	
  wmctrl -F -r $quakewindow -b add,hidden
  wmctrl -F -r $quakewindow -e 0,$originXFramed,$originY,$targetWidthFramed,$targetHeight
  wmctrl -F -r $quakewindow -b remove,hidden
  wmctrl -F -R $quakewindow
elif [ "$(xwininfo -name $quakewindow | grep IsViewable)" == "" ] ; then
  wmctrl -F -r $quakewindow -b remove,hidden
  wmctrl -F -R $quakewindow
else 
  wmctrl -F -r $quakewindow -b add,hidden
fi
In ~/.config/openbox/rc.xml, add this to <applications> section for a better experience:

Code: Select all

	<application name="rexquakeurxvt">
		<decor>no</decor>
		<skip_pager>yes</skip_pager>
		<skip_taskbar>yes</skip_taskbar>
		<iconic>yes</iconic>
		<desktop>all</desktop>
		<layer>above</layer>
	</application> 
These are the keybindings i use, also found in rc.xml

Code: Select all

    <keybind key="Pause">
      <action name="Execute">
        <command>quake-terminal</command>
      </action>
    </keybind>
    <keybind key="F11">
      <action name="Execute">
        <command>quake-terminal</command>
      </action>
    </keybind>

User avatar
harii4
Posts: 448
Joined: Fri 30 Jan 2009, 04:08
Location: La Porte City, IA , U.S.A.
Contact:

#2 Post by harii4 »

too bad it didn't use Xdotool instead of wmctrl.
Its great that it uses standard urxvt console. 8)
3.01 Fat Free / Fire Hydrant featherweight/ TXZ_pup / 431JP2012
----------------------------------------------------------------------------------------
Peace and Justice are two sides of the same coin.

Post Reply