Go Back   Champions of Regnum > English > Technical Support > Linux

Linux Technical issues under Linux platform

Reply
 
Thread Tools Display Modes
Old 04-03-2013, 12:14 PM   #1
Nekoko
Master
 
Nekoko's Avatar
 
Join Date: Oct 2007
Posts: 334
Nekoko is on a distinguished road
Default [HOW TO] Fullscreen Script

This was in an old thread but I run out of space to edit the post so here is my latest version instructions are in the comments of the script though I will explain it here anyway. Basically my DE does not like the way a lot of programs do fullscreen (including regnum), so I made this script:

Instuctions:
1. Save the code in a file with your text editor of choice placing the script in the same directory as rolauncher. (eg regnum-fullscreen.sh)
2. In the launcher set your resolution to match the screen you play regnum on (eg you have a 1024x768 monitor select that resolution in the launcher)
3. Unselect fullscreen (doesn't work for me anyway) in the launcher
4. From now on run the script and it will execute the launcher for you, do everything you normally would

Note: I've only tested this on my DE so I do not know how it will behave on other DEs it should work leave me a note if you need help with bugs.

Note: If you want the old versions for some reason PM me and I'll send them via PM I can't keep posting new threads and posts have a size limit.

V1.7
Code:
#!/bin/bash
# excutes rolauncher then waits for the right conditions to make Regnum
# fullscreen. Ideas from the orginal script I found at
# http://www.championsofregnum.com/forum/showthread.php?t=48175
# this scirpt is licensed under GPLv3

# set your resolution to the native res of your screen for best operation
# otherwise it'll probably be a stretched window (though some of you might
# like that)

# Please leave suggestions/problems to my forum account or in the thread at
# http://www.championsofregnum.com/forum/showthread.php?t=97543

# V1.7
# As long as there are no problems this will be the final version
# I feel I have worked out all the bugs
# V1.6
# Still trying to figure out problems this release is just something
# that will work most of the time for now (curse you kde) 1.5 was
# pretty broken too sorry all
# V1.5
# The annoying pain of a problem of fullscreen not working sometimes
# persists I've made it so the command will be done more than once
# if this doesn't work I give up ._.
# V1.4
# Make the wmctrl command only set the fullscreen attribute and do not
# touch the gravity position or size of the window, resolves issues
# in KDE please inform me if this causes issues for you
# V1.3
# Store the wmctrl result instead of getting it for each comparassion
# fixes script failing sometimes, I hope
# V1.2
# Spam the fullscreen setting a few times cause sometimes regnum just
# doesn't want to go fullscreen
# V1.1
# Remove the reliance on the python code to manage fullscreen
# Add support for "Champions of Regnum"
# V1.0
# Initial release

############
# Defaults #
############
script_name="$(basename "$0")"
script_pid="$$"
script_path="$(cd "$(dirname "$0")" && pwd)"
if [ ! -d "$script_path" ]; then
	exit "1"
fi
start_path="$(pwd)"
if [ ! -d "$start_path" ]; then
	exit "1"
fi

# change to the script's directory
cd "$script_path"

# check for missing programs
if [ -z "$(command -v wmctrl)" ]; then
	xmessage_responce="$(xmessage -print -buttons Okay "Regnum Fullscreen: \
You do not have wmctrl installed please install it")" && exit 1
fi
if [ -z "$(command -v grep)" ]; then
	xmessage_responce="$(xmessage -print -buttons Okay "Regnum Fullscreen: \
You do not have grep installed please install it")" && exit 1
fi
if [ -z "$(command -v awk)" ]; then
	xmessage_responce="$(xmessage -print -buttons Okay "Regnum Fullscreen: \
You do not have awk installed please install it")" && exit 1
fi

# make sure rolauncher is in the same directory
if [ ! -e "$script_path/rolauncher" ]; then
	xmessage_responce="$(xmessage -print -buttons Okay "Regnum Fullscreen: \
You don't seem to have me in the same directory as rolauncher, please put \
me there")" && exit 1
fi

# launch the launcher to start the game
"$script_path/rolauncher" &>/dev/null &

# init counter
game_or_launcher_failed_count="0"

# grep string
win_title="N\/A Regnum Online|N\/A Realms Online|N\/A Champions of Regnum"

while [ "1" ]; do
	# store the wmctrl result for multiple comparassions
	wmctrl_string="$(wmctrl -l -G | grep -E "($win_title)" | head -n 1)"
	if [ -n "$(echo "$wmctrl_string" | awk '{ print $5 }')" ] \
	&& [ -n "$(echo "$wmctrl_string" | awk '{ print $6 }')" ]; then
		# run the fullscreen python code after we make sure the regnum
		# window is larger than 400 400 this works around a bug that
		# makes the checking firewall dialog going full screen
		# and then causing the whole game to have black graphics
		if [ "$(echo "$wmctrl_string" | awk '{ print $5 }')" -gt "400" ] \
		&& [ "$(echo "$wmctrl_string" | awk '{ print $6 }')" -gt "400" ]; then
				# get window id
				window_id="$(echo "$wmctrl_string" | awk '{ print $1 }')"
				# full screen
				wmctrl -i -r "$window_id" -b add,fullscreen
				# get the window title
				window_title="$(echo "$wmctrl_string" | awk '{out=$8; for(i=9;i<=NF;i++){out=out" "$i}; print out}')"
				# change the title to stop further processing on the same window
				wmctrl -i -r "$window_id" -T "Fullscreen - $window_title"
				# exit after changing window
				exit
		fi
	fi

	# set ternary values
	if [ -n "$(pidof rolauncher)" ]; then
		rolauncher_ternary=1
	else
		rolauncher_ternary=0
	fi
	if [ -n "$(pidof game)" ]; then
		game_ternary=1
	else
		game_ternary=0
	fi

	# this increments a counter if either the launcher or the game is
	# not currently running
	if [[ "$rolauncher_ternary" == 0 ]] && [[ "$game_ternary" == 0 ]]; then
		let "game_or_launcher_failed_count += 1"
	fi

	# this will cause the script to exit after x amount checks
	#for either the rolauncher or game fail
	if [ "$game_or_launcher_failed_count" -eq "30" ]; then
		exit
	fi

	# slow our loop
	sleep 1
done
Hope this helps some peeps out.
__________________
A Dream.

Last edited by Nekoko; 04-28-2013 at 11:14 AM.
Nekoko no ha iniciado sesión   Reply With Quote
Old 04-03-2013, 01:56 PM   #2
Hayir
Master
 
Hayir's Avatar
 
Join Date: Jun 2007
Posts: 375
Hayir is on a distinguished road
Default

Works for me. Thanks alot!
Hayir no ha iniciado sesión   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:48 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
NGD Studios 2002-2024 © All rights reserved