-
Notifications
You must be signed in to change notification settings - Fork 5
/
extension.js
43 lines (36 loc) · 1.04 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const Lang = imports.lang;
const St = imports.gi.St;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const Util = imports.misc.util;
const GLib = imports.gi.GLib;
function ForceQuit() {
this._init();
}
ForceQuit.prototype = {
__proto__: PanelMenu.SystemStatusButton.prototype,
_init: function() {
PanelMenu.SystemStatusButton.prototype._init.call(this, 'start-here');
this._button = new St.Button();
this._button.set_child(new St.Icon({
icon_name: 'window-close',
icon_size: 17
}));
this._button.connect('clicked', Lang.bind(this, function () {
Util.spawn(['xkill']);
}));
}
};
let forceQuit;
function enable() {
forceQuit = new ForceQuit();
let _children = Main.panel._leftBox.get_children();
Main.panel._leftBox.insert_child_at_index(forceQuit._button, _children.length - 1);
}
function disable() {
Main.panel._leftBox.remove_actor(forceQuit._button);
forceQuit.destroy();
}
function init() {
// do nothing
}