Customize Clock on Lock Screen.
Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.
Version | Status |
---|---|
17 | Active |
16 | Rejected |
15 | Active |
14 | Rejected |
13 | Active |
12 | Rejected |
11 | Inactive |
10 | Rejected |
9 | Active |
8 | Inactive |
7 | Active |
6 | Inactive |
5 | Active |
4 | Active |
3 | Inactive |
2 | Inactive |
1 | Inactive |
If you want to comment inside the disable function, move the disable comments to the top of the disable function.
Thanks for your quick reviews and knowledge sharing @justperfection. I have refactored this extensions code based on gnome discourse discussions on this extension. I would like to submit that code for this extension. I have small doubts on it. Can you have a look at below post please. https://discourse.gnome.org/t/unlockdialog-unlockdialogclock-prototype-is-undefined/16866/23 Thanks
What's the reason for having `disable-extension` in settings? and the original `this._dialog._clock` should be stored in a property and revert back on disable.
Hi @justperfection, thanks for your quick response. disable-extension is a setting in `prefs.js`. when user dont want this extension to tweak the things, he can turn on the switch and in `extension.js` there is a check `if(this._dialog._clock && !disable)`. This is where I am in doubt how to do the things. when I turn on this `disable-extension` in prefs, it works as the extension is disabled in unlock-dialog. I will try your second point `this._dialog._clock` should be stored in a property and revert back on disable. Thanks
I tried this way about the second point you mentioned. But I am getting logout, system detected some problem such kind of error. ```` import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import ModifiedClock from './ModifiedClock.js'; export default class IndicatorExampleExtension extends Extension { enable() { this._settings = this.getSettings(); this._dialog = Main.screenShield._dialog; this._originalClock = this._dialog._clock; const disable = this._settings.get_boolean('disable-extension'); if (this._dialog && !disable) { this._dialog._stack.remove_child(this._dialog._clock); this._dialog._clock = new ModifiedClock(this._settings); this._dialog._clock.set_pivot_point(0.5, 0.5); this._dialog._stack.add_child(this._dialog._clock); } } // unlock-dialog is used in session-modes because this extension purpose is // to tweak the clock on lock screen itself. disable() { this._dialog._stack.remove_child(this._dialog._clock) this._dialog._clock.destroy(); this._dialog._clock = null; this._dialog = null; this._settings = null; Main.screenShield._dialog._stack.add_child(this._originalClock); } } ````
Oh Ok I found my mistake in above code, this below code is working as expected. ```` import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; import * as Main from 'resource:///org/gnome/shell/ui/main.js'; import ModifiedClock from './ModifiedClock.js'; export default class IndicatorExampleExtension extends Extension { enable() { this._settings = this.getSettings(); this._dialog = Main.screenShield._dialog; this._originalClock = this._dialog._clock; const disable = this._settings.get_boolean('disable-extension'); if (this._dialog && !disable) { this._dialog._stack.remove_child(this._dialog._clock); this._dialog._clock = new ModifiedClock(this._settings); this._dialog._clock.set_pivot_point(0.5, 0.5); this._dialog._stack.add_child(this._dialog._clock); } } // unlock-dialog is used in session-modes because this extension purpose is // to tweak the clock on lock screen itself. disable() { this._dialog._stack.remove_child(this._dialog._clock) this._dialog._stack.add_child(this._originalClock); this._dialog._clock.destroy(); this._dialog._clock = null; this._dialog = null; this._settings = null; } } ````
> when user dont want this extension to tweak the things So why they enabled the extension in the first place?
Hi, Since its using `unlock-dialog` session mode only, user cant enable or disable this extension at all. If user wants to disable the extension there is no way. Only way is user has to remove the extension.
It should be fixed in the extension app not in your extension. If that's not reported before, please file a bug in : https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/