Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

[<img src="https://github.com/GittyMac/PanelNote/assets/28932047/e4bec66e-ee85-40d6-b7e5-95cbdc781e27" height="100">](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.
98 changes: 58 additions & 40 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
}
}
}
Binary file removed images/screen1.png
Binary file not shown.
Binary file removed images/screen2.png
Binary file not shown.
16 changes: 8 additions & 8 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
Binary file added panelnote-reloaded@hes01.github.io.zip
Binary file not shown.
Binary file modified schemas/gschemas.compiled
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>

<schema id="org.gnome.shell.extensions.panelnote" path="/org/gnome/shell/extensions/panelnote/">

<!-- See also: https://developer.gnome.org/glib/stable/gvariant-format-strings.html -->

<schema id="org.gnome.shell.extensions.panelnote-reloaded" path="/org/gnome/shell/extensions/panelnote-reloaded/">
<key type="s" name="note">
<default>"Change my Panel Note!"</default>
<summary>The note that is showing on the panel.</summary>
</key>
</schema>
</schemalist>
</schemalist>
12 changes: 10 additions & 2 deletions stylesheet.css
Original file line number Diff line number Diff line change
@@ -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;
}