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

Linux Technical issues under Linux platform

Reply
 
Thread Tools Display Modes
Old 09-08-2009, 11:47 AM   #1
onemyndseye
Master
 
onemyndseye's Avatar
 
Join Date: Jul 2008
Location: South Central USA
Posts: 260
onemyndseye is on a distinguished road
Default [HOWTO] Alt Fullscreen Mode

Here is a method for a alternate fullscreen mode for RO.

Here is my "use case" for why I wanted this for aid of explaination:

I have a new laptop with a widescreen display and a native resolution of 1280x800. On my laptop I generally play RO in windowed mode for a number of reasons, most of which being: Multitasking, and ACPI hotkeys (volume, etc etc). However RO doesnt offer me a resolution that is acceptable for this as all are either too small of a window - or too large, cutting off my spell bars, etc etc.

Miraculix offered us a great howto here of how to accomplish this using Devilspie. However I had issues with this method as currently Gnome seems to ignore devilspie's commands 1 out of 5 times...

So thats where this comes in... I made a small Python/Bash hybrid (Probably could be done in 100% Python but I couldnt work it out) to produce a "simulated fullscreen" mode when RO is set to my native resolution of 1280x800. This screen toggles in and out of "fullscreen" by removing the window decorations, and centering the window on your screen so it appears to be fullscreen. Yet, Just being a window, all ACPI hotkeys work as expected, Gnome notifty (i.e. libnotify/send-notify) appears correctly over the top of RO and you can still switch desktops with the press of a button (i.e. CRTL+ALT+Left/Right)... toggle again and decorations are readded and the window remanaged

So here we go:

~/regnum/ro-winctrl.sh
Code:
#!/bin/bash
# Simple bash/python hybrid to toggle a simulated fullscreen mode on/off depending
# only on wmctrl and python-gtk2

py_toggle_fullscreen() {
/usr/bin/python <<'EOF'
from gtk.gdk import *

w=window_foreign_new((get_default_root_window().property_get("_NET_ACTIVE_WINDOW")[2][0]))
state = w.property_get("_NET_WM_STATE")[2]
maximized='_NET_WM_STATE_MAXIMIZED_HORZ' in state and '_NET_WM_STATE_MAXIMIZED_VERT' in state
if maximized: w.unmaximize() 
 
if w.get_decorations() == 0 :
    w.set_decorations(DECOR_ALL)
    w.unfullscreen()
else:
    w.set_decorations(0)
    w.fullscreen()

if maximized: w.maximize()
window_process_all_updates()
EOF
}

# Check to see if RO video mode matches desktop
DESKTOP_VIDMODE=$(xrandr |grep "Screen 0" | awk '{print $8 $9 $10}' |sed '{s|,||}')
REGNUM_VIDMODE=$(wmctrl -l -G |grep "N/A Regnum Online"  |awk '{print $5 "x" $6}')
if [ "$DESKTOP_VIDMODE" = "$REGNUM_VIDMODE" ]; then
  # Switch to the desktop RO is on and activate it
  wmctrl -i -a "$(wmctrl -l |grep "N/A Regnum Online" |grep -v "$(hostname)" |awk '{print $1}')"
  # Call embeded python to finish the job. Remove Decorations, center, and fullscreen
  py_toggle_fullscreen
fi

Create that script then bind it to ALT+Enter in gnome-keybinding-properties... This will cause gnome to override RO's default behavior to a ALT+Enter keypress and enable you to toggle in and out of "Fullscreen" just as you always have...

You can auto-enable the hotkey by working out a shell script launches RO(I've posted plenty of such examples in the past) then waits it to close...and add the following commands to it:

Code:
## To Enable new ALT+Enter Hotkey (Edit the path to ro-winctrl.sh)
gconftool-2 -t string -s /apps/metacity/global_keybindings/run_command_1 '<Alt>Return'
gconftool-2 -t string -s /apps/metacity/keybinding_commands/command_1 "/home/onemyndseye/regnum/ro-winctrl.sh"

<This part of the script would launch RO then wait for close>

## Disable new ALT+Enter Hotkey
gconftool-2 --unset /apps/metacity/global_keybindings/run_command_1
gconftool-2 --unset /apps/metacity/keybinding_commands/command_1

This solution works great for me and I hope that it helps someone here as well. After some more tweaking and testing users of the Debian Package can expect to see to option to use this intergrated by the next update.

take care,
-onemyndseye
__________________
RA/Syrtis Hunter LVL50: Elusis
RA/Syrtis Barba LVL50: Artemisia
RA/Syrtis Conju Lvl45: Nellas Miriel

Last edited by onemyndseye; 09-09-2009 at 05:40 AM. Reason: The forum ate my posting
onemyndseye no ha iniciado sesión   Reply With Quote
Old 09-09-2009, 05:37 AM   #2
onemyndseye
Master
 
onemyndseye's Avatar
 
Join Date: Jul 2008
Location: South Central USA
Posts: 260
onemyndseye is on a distinguished road
Default

Reposted - The forum ate my posting
__________________
RA/Syrtis Hunter LVL50: Elusis
RA/Syrtis Barba LVL50: Artemisia
RA/Syrtis Conju Lvl45: Nellas Miriel
onemyndseye no ha iniciado sesión   Reply With Quote
Old 09-09-2009, 11:17 AM   #3
Znurre
Marquis
 
Join Date: Jan 2007
Location: RA
Posts: 1,897
Znurre will become famous soon enoughZnurre will become famous soon enough
Default

First of all, a small tip to all KDE users: We can (as always) use the Fullscreen option when rightclicking a window, which removes the need for this script.



Second, let me suggest that instead of using GNOME to bind the keys you could use a great application called evrouter which allows you to do the same thing, but you can tell it to only bind Alt+ENTER to the script if the Regnum window is focused.

A small example of an evrouter config file could look like this:

Code:
Window "Regnum Online": # Window title
"Logitech USB Gaming Mouse" "/dev/input/event11" none key/276 "XKey/0"
"Logitech USB Gaming Mouse" "/dev/input/event11" none key/275 "XKey/9"
This is my config which I use to quickly switch between weapons using my mouse.
It binds my back/forward buttons to key 0 and 9, but only in Regnum.

You can read more in its man page how to also bind it to commands instead of other keys.

Nice job as always making the life a bit easier for all Regnum players!
__________________
Winning a fight is not what makes you a good player, it's how you do it.
http://home.znur.re/screenshot%20201...2011_39_37.jpg
Znurre no ha iniciado sesión   Reply With Quote
Old 10-14-2009, 07:22 AM   #4
onemyndseye
Master
 
onemyndseye's Avatar
 
Join Date: Jul 2008
Location: South Central USA
Posts: 260
onemyndseye is on a distinguished road
Default

Thanks Z,


evrouter is a great suggestion and I've started fiddling with it for atleast my own benefit. .. One problem I see with Alt+Enter is that for whatever reason evrouter fails capture keyboard events for the normal user. i.e. must sudo .

This could be worked around by chmod'ing the correct /dev/input to 777 but I dont really like this as a shipped solution.. I'll keep checking though.

At any rate - Thanks for a great find!!! Its already greatly appearent that I will find this little app QUITE usefull.
__________________
RA/Syrtis Hunter LVL50: Elusis
RA/Syrtis Barba LVL50: Artemisia
RA/Syrtis Conju Lvl45: Nellas Miriel
onemyndseye 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 08:34 PM.


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