Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open settings when right clicking icon #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,20 @@ class Microphone extends Signals.EventEmitter {
const MicrophonePanelButton = GObject.registerClass(
{ GTypeName: "MicrophonePanelButton" },
class extends PanelMenu.Button {
_init(metadata) {
super._init(0.0, `${metadata.name} panel indicator`, false);
_init(extension) {
super._init(0.0, `${extension.metadata.name} panel indicator`, false);
this.icon = new St.Icon({
icon_name: get_icon_name(false),
style_class: "system-status-icon",
});
this.add_child(this.icon);
this.connect("button-press-event", () => {
on_activate({ give_feedback: false });
this.connect("button-press-event", (_, event) => {
if (event.get_button() === 3) {
// Right click.
extension.openPreferences();
} else {
on_activate({ give_feedback: false });
}
});
}
},
Expand Down Expand Up @@ -213,7 +218,7 @@ export default class extends Extension {
enable() {
settings = this.getSettings();
microphone = new Microphone(this.dir);
panel_button = new MicrophonePanelButton(this.metadata);
panel_button = new MicrophonePanelButton(this);
panel_button.visible = icon_should_be_visible(microphone.active);
const indicatorName = `${this.metadata.name} indicator`;
Main.panel.addToStatusArea(indicatorName, panel_button, 0, "right");
Expand Down