Disable hot corners and move clock

This commit is contained in:
Josh Sherman 2018-05-06 14:57:16 -05:00
parent 9cdf78906d
commit 08c2a3fa0b
No known key found for this signature in database
GPG key ID: 55B058A80530EF22
2 changed files with 59 additions and 6 deletions

View file

@ -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() { }

View file

@ -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",