View Single Post
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#29
Originally Posted by BrentDC View Post
Benson,

I don't know if you are familiar with PokerTH, but someone on ITT recently ported it to Hildon.

There is one major problem with it though, and that is everytime the turn comes to you, the keyboard pops up. Very frustrating.

So, the most elegant way I found to stop this from happening was to kill hildon-input-method via "/etc/osso-a-init/keyboard.sh stop" while using the game. Originally, I wrote a simple "script" that would see if hildon-input-method was running, and if it was kill it, else start it.

This was still a bit of a pain because you'd have to run this script everytime you were done with the game to restart your keyboard (you could automatically run it when PokerTH started to kill your keyboard).

So today, I spent an hour seeing if I could automate the whole process. And after a bit and trial and error, I came up with this:

Code:
#!/bin/sh

KEYBOARD=`pidof hildon-input-method`
POKERTH=`pidof pokerth`

if [ "$POKERTH" ]
then
	echo "PokerTH is already started, exiting..."
	exit 0
else

	if [ "$KEYBOARD" ] 
	then
		/etc/osso-af-init/keyboard.sh stop
		echo "Starting PokerTH..."
		/usr/local/games/PokerTH-0.6.2/pokerth.sh

		while [ "$POKERTH" ]
			do
			echo "Debugger: If you see this text, there is a problem"
			sleep 300
		done

		/etc/osso-af-init/keyboard.sh start
	else
		echo "hildon-input-method is stopped."

		if [ "$POKERTH" ]
			then
			echo "Killing PokerTH..."
			kill $POKERTH
		fi
		echo "Starting hildon-input-method..."
		/etc/osso-af-init/keyboard.sh start
	fi
fi

exit 0
Please disregard the while loop, I put it in there before I knew what I was doing

As you can probably see, my script calles PokerTH on line 15, and when PokerTH is killed control "returns" to my script and hildon-input-method is started back up. Ok, this is the second script I've ever written, be easy

Couldn't this exact same philosophy be applied to killing hildon-desktop, starting fvwm, then when fvwm quits, restarting hildon-desktop?

Please point out where my logic is flawed
Yeah, that could work. The only possible downside would be if you had more than two window managers...