Skip to content

fix: GNOME 49 compatibility - Replace DoNotDisturbSwitch and fix bugs#231

Open
sfnemis wants to merge 3 commits intoqwreey:devfrom
sfnemis:gnome49-support
Open

fix: GNOME 49 compatibility - Replace DoNotDisturbSwitch and fix bugs#231
sfnemis wants to merge 3 commits intoqwreey:devfrom
sfnemis:gnome49-support

Conversation

@sfnemis
Copy link

@sfnemis sfnemis commented Dec 6, 2025

Summary

This PR adds GNOME 49 compatibility by replacing deprecated APIs and fixing bugs.

Changes

GNOME 49 Compatibility

  • Replace deprecated DoNotDisturbSwitch from ui/calendar.js with custom implementation
  • Use St.Button with toggle_mode instead of non-existent St.Switch
  • Use direct Gio.Settings access for org.gnome.desktop.notifications schema
  • Add proper cleanup on destroy to prevent memory leaks

Bug Fixes

  • overlayMenu.ts: Fix negative offsetY when "bottom" anchor is used with oversized menu
  • media.ts: Enable addEventStop functionality (was commented out/no-op)

Testing

  • Tested on GNOME 49 (openSUSE Tumbleweed)
  • Extension loads without errors
  • DND toggle works correctly

Reference

…lity

GNOME 49 removed DoNotDisturbSwitch from ui/calendar.js. This commit:
- Replaces the deprecated DoNotDisturbSwitch usage with direct GSettings access
- Uses org.gnome.desktop.notifications schema with show-banners key
- Creates a custom St.Switch that syncs with GSettings
- Adds proper cleanup on destroy to prevent memory leaks

This change maintains backward compatibility with GNOME 48 as well.

Ref: https://gjs.guide/extensions/upgrading/gnome-shell-49.html
- overlayMenu.ts: Prevent negative offsetY when bottom anchor is used
  and menu is taller than Quick Settings box by using Math.max(0, ...)

- media.ts: Enable addEventStop functionality by uncommenting the
  button-press-event handler and adding button-release-event handler
  to properly stop event propagation on media controls
St.Switch does not exist in GNOME Shell's St (Shell Toolkit).
The DND control now uses:
- St.Button with toggle_mode for the clickable toggle
- St.Icon for the visual indicator
- St.BoxLayout to combine icon and label

This fixes the 'Switch is not a constructor' error on GNOME 49.
@yrifl yrifl mentioned this pull request Dec 27, 2025
@Benjamin-Connelly
Copy link

It would be great to get this PR tested and merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants