1

I've just installed Compiz reloaded on my XFCE rig and have mapped the corners and clicks on top of screen for window switching Compiz plugins like Scale. It's great 90 percent of the time, except when I game where it would get triggered by accident all the time. Question is how do I disable Compiz hot-corners and binding for button clicks (I beleive the compiz term for this is edge and button bindings) when I'm gaming.

1

Note: This is the system I've developed for my own use and I just thought I'd share it with you guys Q&A style. If someone's come up with a different system, please by all means post your answer.

In addition to all the Compiz stuff, you'll need xdotools, it's kind of like the Autohotkey of Linux. It will allow you to send hotkey combos from the shell scripts to launch Compiz plugins.

If you're interested in getting Compiz to show the minimized windows during scale, see this question and answer I posted


The Strategy


For plugins like Scale, instead of mapping the hotcorners (edge and button mapping) within the scale plugin itself, you map only the key combos. You then make shell scripts that send these key-combos via xdotools and you map these shell scripts to the edge and button binding you desire in the commands sections. You then make a script that will rename these scripts to something else when you don't want edge and button binding to activate and restores there original names when you want that functionality back.


Advantages


The advantage of using this method over something like completely disabling Compiz by temporarily replacing it with metacity or xfwm during gaming is that it gives you flexibility of simply and instantaneously disabling the minority of Compiz functions that are disruptive to gaming while leaving the rest intact. So, in this case you can disable hotcorners for window switching but keep the ability to switch windows with hotkeys along with all of Compiz's other perks like desktop cube, show desktop or expo. You'll also not loose all your compiz keybinding or have to make two set for each window manager. Toggling a couple of rename scripts is instantaneous and stable whereas switching window managers every time you want to launch a game and get out of it will take 5 to 10 seconds and I personally have to logout and log back in after switching window managers to get a bit of stability.


Here's an Example


You want the top right and top left corners to activate "Initiate Window Picker" in the scale plugin when you pass a mouse over these corners. You also want to "Initiate Window Picker for All Windows" when you left click on the top of the screen. You've set the hotkey for the former as "Alt Tab" and "Win Tab" for the latter.


Step 1: make your shell scripts. Place them in your home directory:


Initiate_Window_Picker_on.sh

xdotool keydown Alt key Tab keyup Alt

Initiate_Window_Picker_AllWindows_on.sh

xdotool keydown Super key Tab keyup Super

gamemode-toggle.sh

~/./gamemode-on.sh

gamemode-on.sh

mv -T ~/Initiate_Window_Picker_on.sh ~/Initiate_Window_Picker_off.sh
mv -T ~/Initiate_Window_Picker_AllWindows_on.sh ~/Initiate_Window_Picker_AllWindows_off.sh

echo ~/./gamemode-off > ~/gamemode-toggle.sh
chmod +x ~/gamemode-toggle.sh

gamemode-off.sh

mv -T ~/Initiate_Window_Picker_off.sh ~/Initiate_Window_Picker_on.sh
mv -T ~/Initiate_Window_Picker_AllWindows_off.sh ~/Initiate_Window_Picker_AllWindows_on.sh

echo ~/./gamemode-on > ~/gamemode-toggle.sh
chmod +x ~/gamemode-toggle.sh

In terminal, give execution permission to all scripts:

chmod +x ~/*.sh

Step 2: Unmap any edge and button binding within the scale plugin itself while leaving hotkey intact.


Step 3: In Compiz Settings Manager, go to Commands (be sure to activate the plugin if it's not already) and bind the edges and buttons to the shell scripts. You can also map the hotkeys for the gamemode-toggle.sh script that you can toggle edge and button bindings even from within a game.


Eg.

Under Commands (the ~ character doesn't work here)

Command line 0:

/home/your_username/./Initiate_Window_Picker_on.sh

Command line 1:

/home/your_username/./Initiate_Window_Picker_AllWindows_on.sh

Command line 2:

/home/your_username/./gamemode-toggle.sh   

Under Key Bindings:

Run command 0:

Run command 1:

Run command 2:

<Super>F12

Under Button Bindings

Run command 0:

Run command 1:

<TopEdge>Button1

Run command 2:


Under Edge Binding

Run command 0:

TopLeft|TopRight

Run command 1:

Run command 2:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.