Add macOS-buttons GNOME Shell extension
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
const { Extension } = imports.extensions;
|
||||
|
||||
// macOS Window Buttons extension for GNOME Shell
|
||||
// This extension adds macOS-style traffic light buttons to the top panel
|
||||
|
||||
class macOSButtons extends Extension {
|
||||
enable() {
|
||||
this._onThemeChanged = this._onThemeChanged.bind(this);
|
||||
global.display.connect('window-enter-fullscreen', () => this._onThemeChanged());
|
||||
global.display.connect('window-leave-fullscreen', () => this._onThemeChanged());
|
||||
|
||||
// Apply styling
|
||||
this._applyStyling();
|
||||
}
|
||||
|
||||
disable() {
|
||||
// Remove styling when extension is disabled
|
||||
this._removeStyling();
|
||||
}
|
||||
|
||||
_applyStyling() {
|
||||
// The macOS window button styling is handled by the CSS
|
||||
// installed in ~/.config/gtk-3.0/gtk.css and gtk-4.0/gtk.css
|
||||
// This extension ensures the user-theme is set correctly
|
||||
// and monitors for changes.
|
||||
log('macOS Buttons extension enabled');
|
||||
}
|
||||
|
||||
_removeStyling() {
|
||||
log('macOS Buttons extension disabled');
|
||||
}
|
||||
|
||||
_onThemeChanged() {
|
||||
// Re-apply styling if needed
|
||||
this._applyStyling();
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
return new macOSButtons();
|
||||
}
|
||||
Reference in New Issue
Block a user