Detecting mouse clicks anywhere on screen
- From: Kerrick Staley <mail kerrickstaley com>
- To: gnome-shell-list gnome org
- Subject: Detecting mouse clicks anywhere on screen
- Date: Wed, 8 Aug 2012 19:55:16 -0500
Hi,
I'm trying to write an extension that will toggle the overview
whenever mouse button 9 is clicked, but I can't figure out how to
detect clicks from arbitrary locations on the screen.
global.stage's button-press-event will fire when you click the mouse
anywhere within the overview, but when the overview is hidden, only
clicks on the panel will cause button-press-event to fire.
My current code follows:
const Main = imports.ui.main;
const Lang = imports.lang;
function init() { }
function enable() {
global.stage.connect('button-press-event', Lang.bind(this,
function(actor, event) {
if (event.get_button() == 9)
this._toggleOverview();
}));
}
function disable() { }
function _toggleOverview() {
if (Main.overview.visible)
Main.overview.hide();
else
Main.overview.show();
}
- Kerrick
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]