diff --git a/README.md b/README.md index d945fbe..e91d22d 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,12 @@ -# Panel Note -![screenshot](./images/screen1.png) +# Panel Note Reloaded -Add a small note to your GNOME panel. +> **Note:** This is a fork of the original [Panel Note](https://extensions.gnome.org/extension/6718/panel-note/) extension. -[](https://extensions.gnome.org/extension/6718/panel-note/) +Add a small note to your GNOME panel. - -> [!NOTE] > This extension is inspired by the macOS app "One Thing." ## Usage -![screenshot](./images/screen2.png) -When you enable the extension, the default note will appear on your panel. To edit the note, simply click on the note and type in your new note. +When you enable the extension, the default note will appear on your panel. +To edit the note, simply click on the note and type in your new note. \ No newline at end of file diff --git a/extension.js b/extension.js index 8f127f8..69d42d7 100644 --- a/extension.js +++ b/extension.js @@ -26,62 +26,80 @@ import Clutter from 'gi://Clutter'; import { Extension, gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js'; import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js'; import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js'; - import * as Main from 'resource:///org/gnome/shell/ui/main.js'; const Indicator = GObject.registerClass( - class Indicator extends PanelMenu.Button { - _init(settings) { - super._init(0.0, _('Panel Note')); - - /* ------------------------------- Panel Note ------------------------------- */ - let noteInPanel = new St.Label({ - text: settings.get_string('note'), - y_expand: true, - y_align: Clutter.ActorAlign.CENTER, - }); - this.add_child(noteInPanel); +class Indicator extends PanelMenu.Button { + _init(settings) { + super._init(0.0, _('Panel Note')); + + // Configuración del contenedor principal + this.set_style('padding: 0px 8px;'); + /* ------------------------------- Panel Note ------------------------------- */ + let noteInPanel = new St.Label({ + text: settings.get_string('note'), + y_align: Clutter.ActorAlign.CENTER, + x_align: Clutter.ActorAlign.CENTER, + style_class: 'panel-note-label' // Clase CSS para controlar tamaño + }); + this.add_child(noteInPanel); - /* ----------------------------- Note Entry Box ----------------------------- */ - this.entry = new St.Entry({ - text: settings.get_string('note'), - can_focus: true, - track_hover: true - }); + /* ----------------------------- Note Entry Box ----------------------------- */ + this.entry = new St.Entry({ + text: settings.get_string('note'), + can_focus: true, + track_hover: true, + style_class: 'panel-note-entry' // Clase CSS adicional + }); - this.entry.set_primary_icon(new St.Icon({ - icon_name: 'document-edit-symbolic', - style_class: 'popup-menu-icon', - })); + this.entry.set_primary_icon(new St.Icon({ + icon_name: 'document-edit-symbolic', + style_class: 'popup-menu-icon', + })); - this.entry.clutter_text.connect('text-changed', () => { - let text = this.entry.get_text(); - if (text == "") - text = "No Note"; - settings.set_string('note', text); - noteInPanel.text = text; - }); + // Conexión segura de señal + this._textChangedId = this.entry.clutter_text.connect('text-changed', () => { + let text = this.entry.get_text(); + settings.set_string('note', text || "No Note"); + noteInPanel.text = text || "No Note"; + }); - let popupEdit = new PopupMenu.PopupMenuSection(); - popupEdit.actor.add_child(this.entry); + let popupEdit = new PopupMenu.PopupMenuSection(); + popupEdit.actor.add_child(this.entry); + this.menu.addMenuItem(popupEdit); + this.menu.actor.add_style_class_name('note-entry'); + } - this.menu.addMenuItem(popupEdit); - this.menu.actor.add_style_class_name('note-entry'); + // Limpieza segura + destroy() { + if (this._textChangedId) { + this.entry.clutter_text.disconnect(this._textChangedId); + this._textChangedId = null; } - }); + super.destroy(); + } -export default class IndicatorExampleExtension extends Extension { +}); + +export default class PanelNoteExtension extends Extension { enable() { this._settings = this.getSettings(); this._indicator = new Indicator(this._settings); - Main.panel.addToStatusArea(this.uuid, this._indicator); + + // Añadir al panel con posición explícita (GNOME 48+) + Main.panel.addToStatusArea(this.uuid, this._indicator, 1, 'right'); } disable() { - this._indicator.entry.disconnect(); - this._indicator.destroy(); - this._indicator = null; + if (this._indicator) { + // Llama a la limpieza interna + if (this._indicator) { + this._indicator.destroy(); + this._indicator = null; + } this._settings = null; + + } } -} +} \ No newline at end of file diff --git a/images/screen1.png b/images/screen1.png deleted file mode 100644 index d23c8b7..0000000 Binary files a/images/screen1.png and /dev/null differ diff --git a/images/screen2.png b/images/screen2.png deleted file mode 100644 index 23ed6fb..0000000 Binary files a/images/screen2.png and /dev/null differ diff --git a/metadata.json b/metadata.json index 8aacc36..1930a7e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,11 +1,11 @@ { - "name": "Panel Note", - "description": "Add a small note to your GNOME panel", - "uuid": "panelnote@gittymac.github.io", - "settings-schema": "org.gnome.shell.extensions.panelnote", - "url": "https://github.com/GittyMac/PanelNote", - "version": 1, + "name": "Panel Note Reloaded", + "description": "Add a small note to your GNOME panel. This is a fork of the original Panel Note extension.", + "uuid": "panelnote-reloaded@hes01.github.io", +"settings-schema": "org.gnome.shell.extensions.panelnote-reloaded", + "url": "https://github.com/Hes01/PanelNote-Reloaded", + "version": 3, "shell-version": [ - "45", "46", "47" + "45", "46", "47", "48" ] -} +} \ No newline at end of file diff --git a/panelnote-reloaded@hes01.github.io.zip b/panelnote-reloaded@hes01.github.io.zip new file mode 100644 index 0000000..a02f00c Binary files /dev/null and b/panelnote-reloaded@hes01.github.io.zip differ diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled index 538e96e..1591fa8 100644 Binary files a/schemas/gschemas.compiled and b/schemas/gschemas.compiled differ diff --git a/schemas/org.gnome.shell.extensions.panelnote.gschema.xml b/schemas/org.gnome.shell.extensions.panelnote-reloaded.gschema.xml similarity index 51% rename from schemas/org.gnome.shell.extensions.panelnote.gschema.xml rename to schemas/org.gnome.shell.extensions.panelnote-reloaded.gschema.xml index 8e22ba0..a255d3c 100644 --- a/schemas/org.gnome.shell.extensions.panelnote.gschema.xml +++ b/schemas/org.gnome.shell.extensions.panelnote-reloaded.gschema.xml @@ -1,13 +1,9 @@ - - - - - + "Change my Panel Note!" The note that is showing on the panel. - + \ No newline at end of file diff --git a/stylesheet.css b/stylesheet.css index dd211b6..f6382d3 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -1,4 +1,12 @@ -/* Add your custom extension styling here */ +.panel-note-label { + min-width: 100px; + font-size: 12px; +} + +.panel-note-entry { + min-width: 200px; +} + .note-entry { - min-width: 20em; + padding: 12px; } \ No newline at end of file