You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
'use strict';
|
|
|
|
const Lang = imports.lang;
|
|
const St = imports.gi.St;
|
|
const Main = imports.ui.main;
|
|
const PanelMenu = imports.ui.panelMenu;
|
|
|
|
const IndicatorName = "Tor";
|
|
const DisabledIcon = 'my-caffeine-off-symbolic';
|
|
const EnabledIcon = 'my-caffeine-on-symbolic';
|
|
const TorIcon = 'tor';
|
|
|
|
let torButton;
|
|
|
|
const TorButton = new Lang.Class({
|
|
Name: IndicatorName,
|
|
Extends: PanelMenu.Button,
|
|
|
|
_init: function(metadata, params) {
|
|
this.parent(null, IndicatorName);
|
|
|
|
this._icon = new St.Icon({
|
|
icon_name: TorIcon,
|
|
style_class: 'system-status-icon'
|
|
});
|
|
|
|
this.actor.add_child(this._icon);
|
|
this.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
|
|
if (event.get_click_count() >= 2) {
|
|
log('TOR DOUBLE CLICK!!!');
|
|
}
|
|
}));
|
|
}
|
|
});
|
|
|
|
function init(extensionMeta) {
|
|
let theme = imports.gi.Gtk.IconTheme.get_default();
|
|
theme.append_search_path(extensionMeta.path + "/icons");
|
|
}
|
|
|
|
function enable() {
|
|
torButton = new TorButton();
|
|
Main.panel.addToStatusArea(IndicatorName, torButton);
|
|
}
|
|
|
|
function disable() {
|
|
torButton.destroy();
|
|
torButton = null;
|
|
}
|