Skip to content

Commit

Permalink
fix: Settings display
Browse files Browse the repository at this point in the history
This is a little hacky way to fix the issue with the preferences pane
not displaying with GNOME45. Please note in the prefs case the
assignment is not cleared on close. This can be done but requires a
bigger rewrite to the prefs code.

Closes #1663
  • Loading branch information
maru-sama authored and jacobgkau committed Oct 30, 2023
1 parent 5b7afc6 commit dc8e589
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2664,8 +2664,13 @@ export class Ext extends Ecs.System<ExtEvent> {
let ext: Ext | null = null;
let indicator: Indicator | null = null;

declare global {
var popShellExtension: any;
}

export default class PopShellExtension extends Extension {
enable() {
globalThis.popShellExtension = this;
log.info('enable');

if (!ext) {
Expand Down Expand Up @@ -2714,6 +2719,7 @@ export default class PopShellExtension extends Extension {
return;
}

delete globalThis.popShellExtension;
ext.injections_remove();
ext.signals_remove();
ext.exit_modes();
Expand Down
4 changes: 1 addition & 3 deletions src/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js';

// simplified log4j levels
export enum LOG_LEVELS {
OFF,
Expand All @@ -16,7 +14,7 @@ export function log_level() {
// log.js is at the level of prefs.js where the popshell Ext instance
// is not yet available or visible, so we have to use the built in
// ExtensionUtils to get the current settings
let settings = Extension.lookupByURL(import.meta.url).getSettings();
let settings = globalThis.popShellExtension.getSettings();
let log_level = settings.get_uint('log-level');

return log_level;
Expand Down
1 change: 1 addition & 0 deletions src/prefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface AppWidgets {

export default class PopShellPreferences extends ExtensionPreferences {
getPreferencesWidget() {
globalThis.popShellExtension = this;
let dialog = settings_dialog_new();
if (dialog.show_all) {
dialog.show_all();
Expand Down

0 comments on commit dc8e589

Please sign in to comment.