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

Linux Technical issues under Linux platform

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


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 04:14 AM.


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