Skip to content

Open settings when right clicking icon #77

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

Merged
merged 2 commits into from
Apr 20, 2025
Merged
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
17 changes: 11 additions & 6 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,20 @@ class AudioPlayer {
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 @@ -193,9 +198,9 @@ function toggle_mute(mute, give_feedback) {
export default class extends Extension {
enable() {
settings = this.getSettings();
microphone = new Microphone();
microphone = new Microphone(this.dir);
audio_player = new AudioPlayer(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