summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-02-10 19:33:44 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-02-11 13:59:25 -0700
commit9f253ccc6f8d589ed9bbbf840fcba339c6b1531c (patch)
tree24e8aa7f9de178a3b8c25b0a23b932e3a29b86d9
parent2308a35508b09bb9573b0222adfaccf8e19589e7 (diff)
downloaddotfiles-9f253ccc6f8d589ed9bbbf840fcba339c6b1531c.tar.gz
gnome-shell-extension-stealmyfocus
-rw-r--r--.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/extension.js44
-rw-r--r--.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/metadata.json20
2 files changed, 64 insertions, 0 deletions
diff --git a/.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/extension.js b/.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/extension.js
new file mode 100644
index 00000000..1127b3a0
--- /dev/null
+++ b/.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/extension.js
@@ -0,0 +1,44 @@
+const Main = imports.ui.main;
+const WindowAttentionHandler = imports.ui.windowAttentionHandler;
+const Shell = imports.gi.Shell;
+const Lang = imports.lang;
+
+function StealMyFocus() {
+ this._init();
+ this.blacklist = ["Skype"];
+}
+
+StealMyFocus.prototype = {
+ _init : function() {
+ this._tracker = Shell.WindowTracker.get_default();
+ this._handlerid = global.display.connect('window-demands-attention', Lang.bind(this, this._onWindowDemandsAttention));
+ },
+
+ _onWindowDemandsAttention: function(display, window) {
+ for (var i = 0; i < this.blacklist.length; i++) {
+ var name = this.blacklist[i].toLowerCase();
+ if (window.title.toLowerCase().indexOf(name) != -1) {
+ // app in blacklist, return and do nothing
+ return;
+ }
+ }
+ Main.activateWindow(window);
+ },
+
+ destroy: function () {
+ global.display.disconnect(this._handlerid);
+ }
+}
+
+let stealmyfocus;
+
+function init() {
+}
+
+function enable() {
+ stealmyfocus = new StealMyFocus();
+}
+
+function disable() {
+ stealmyfocus.destroy();
+}
diff --git a/.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/metadata.json b/.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/metadata.json
new file mode 100644
index 00000000..b45a0ac1
--- /dev/null
+++ b/.local/share/gnome-shell/extensions/steal-my-focus@kagesenshi.org/metadata.json
@@ -0,0 +1,20 @@
+{
+ "_generated": "Generated by SweetTooth, do not edit",
+ "description": "Let windows steal focus. Removes the annoying 'Window is ready' notification and focus window immediately",
+ "name": "Steal My Focus",
+ "original-authors": [
+ "kagesenshi.87@gmail.com"
+ ],
+ "shell-version": [
+ "3.2",
+ "3.4",
+ "3.5.2",
+ "3.6",
+ "3.8",
+ "3.10",
+ "3.10.*"
+ ],
+ "url": "https://github.com/kagesenshi/gnome-shell-extension-stealmyfocus",
+ "uuid": "steal-my-focus@kagesenshi.org",
+ "version": 1
+}