From 08c2a3fa0b14536898d05262d1d2c7491cf3028e Mon Sep 17 00:00:00 2001 From: Josh Sherman Date: Sun, 6 May 2018 14:57:16 -0500 Subject: [PATCH] Disable hot corners and move clock --- gnome/extension/extension.js | 61 ++++++++++++++++++++++++++++++++--- gnome/extension/metadata.json | 4 +-- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/gnome/extension/extension.js b/gnome/extension/extension.js index f3808c7..0003041 100644 --- a/gnome/extension/extension.js +++ b/gnome/extension/extension.js @@ -1,14 +1,67 @@ +const Config = imports.misc.config; +const ExtensionUtils = imports.misc.extensionUtils; const Main = imports.ui.main; -let activities = Main.panel.statusArea['activities']; +const SessionMode = imports.ui.sessionMode; + +const disableHotCorners = function () { + Main.layoutManager.hotCorners.forEach(function (hotCorner) { + if (!hotCorner) return; + hotCorner._toggleOverview = function () {}; + hotCorner._pressureBarrier._trigger = function () {}; + }); +}; + +let activities; +let centerBox; +let children; +let dateMenu; +let hotCornerCallback; +let rightBox; function enable() { + // Hides the activities button + activities = Main.panel.statusArea['activities']; activities.container.hide(); + + // Disables the activities hot corner + disableHotCorners(); + hotCornerCallback = Main.layoutManager.connect('hot-corners-changed', disableHotCorners); + + // Moves the clock to the right + if (Main.sessionMode.panel.center.indexOf('dateMenu') > -1) { + centerBox = Main.panel._centerBox; + rightBox = Main.panel._rightBox; + dateMenu = Main.panel.statusArea.dateMenu; + children = centerBox.get_children(); + + if (children.indexOf(dateMenu.container) > -1) { + centerBox.remove_actor(dateMenu.container); + children = rightBox.get_children(); + rightBox.insert_child_at_index(dateMenu.container, children.length - 1); + } + } } function disable() { + // Shows the activities button activities.container.show(); + + // Enables the activities hot corner + Main.layoutManager.disconnect(hotCornerCallback); + Main.layoutManager._updateHotCorners(); + + // Moves the clock to the center + if (Main.sessionMode.panel.center.indexOf('dateMenu') > -1) { + centerBox = Main.panel._centerBox; + rightBox = Main.panel._rightBox; + dateMenu = Main.panel.statusArea.dateMenu; + children = rightBox.get_children(); + + if (children.indexOf(dateMenu.container) > -1) { + rightBox.remove_actor(dateMenu.container); + centerBox.add_actor(dateMenu.container); + } + } } -function init(metadata) { - -} +function init() { } diff --git a/gnome/extension/metadata.json b/gnome/extension/metadata.json index ca1acb9..67f727b 100644 --- a/gnome/extension/metadata.json +++ b/gnome/extension/metadata.json @@ -1,7 +1,7 @@ { "uuid": "custom@gnome-shell-extensions.joshtronic.com", - "name": "My Customizations", - "description": "Hide activities button, disable hot corner, move clock to right.", + "name": "Customizations", + "description": "Moves clock to the right, hides activities button and disables the activities hot corner.", "url": "https://github.com/joshtronic/dotfiles", "shell-version": [ "3.22",