From f1f171fdaad3821cc69eff63efb338484e31b503 Mon Sep 17 00:00:00 2001 From: mohsen waheed elsisi Date: Tue, 7 Oct 2025 22:04:28 +0300 Subject: [PATCH 1/3] Added Ctrl+D as shortcut for deleting note. --- src/application.ts | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/application.ts b/src/application.ts index 85e283e..2dc96e4 100644 --- a/src/application.ts +++ b/src/application.ts @@ -97,7 +97,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Show all notes", - null, + null ); this.add_main_option( @@ -106,7 +106,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Print version information and exit", - null, + null ); this.add_main_option( @@ -115,7 +115,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Open a new note", - null, + null ); this.add_main_option( @@ -124,7 +124,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Only show the app if there is atleast one open note", - null, + null ); this.connect("handle-local-options", (_app, options: GLib.VariantDict) => { @@ -147,7 +147,7 @@ export class Application extends Adw.Application { if (open == false) { console.log( - "Sticky Notes not opening because the `-i` flag was passed and there are no open notes", + "Sticky Notes not opening because the `-i` flag was passed and there are no open notes" ); this.quit(); } @@ -194,8 +194,9 @@ export class Application extends Adw.Application { }); if (!has_one_open) { - const last_open_note = this.notes_array() - .sort((a, b) => b.modified.compare(a.modified))[0]; + const last_open_note = this.notes_array().sort((a, b) => + b.modified.compare(a.modified) + )[0]; if (has_one_open) { this.show_note(last_open_note.uuid); @@ -273,11 +274,7 @@ export class Application extends Adw.Application { const [uri] = parameter.get_string(); if (uri === "null") return; - Gtk.show_uri( - this.get_active_window(), - uri, - Gdk.CURRENT_TIME, - ); + Gtk.show_uri(this.get_active_window(), uri, Gdk.CURRENT_TIME); }); this.add_action(open_link); @@ -305,6 +302,7 @@ export class Application extends Adw.Application { this.set_accels_for_action("win.open-primary-menu", ["F10"]); this.set_accels_for_action("win.show-help-overlay", ["question"]); this.set_accels_for_action("window.close", ["w"]); + this.set_accels_for_action("win.delete", ["d"]); this.set_accels_for_action("win.bold", ["b"]); this.set_accels_for_action("win.italic", ["i"]); @@ -328,16 +326,15 @@ export class Application extends Adw.Application { const notes = Gtk.FilterListModel.new( this.notes_list, - filter, + filter ) as Gtk.FilterListModel; const presented = this.active_window; if (presented instanceof StickyNotes) { this.get_note_window( - notes.get_item(reverse ? notes.n_items - 1 : 0)!.uuid, - ) - ?.present(); + notes.get_item(reverse ? notes.n_items - 1 : 0)!.uuid + )?.present(); } else if (presented instanceof Window) { let id; @@ -378,9 +375,7 @@ export class Application extends Adw.Application { "Angelo Verlain ", "Christopher Davis ", ], - designers: [ - "David Lapshin", - ], + designers: ["David Lapshin"], // TRANSLATORS: eg. 'Translator Name ' or 'Translator Name https://website.example' translator_credits: _("translator-credits"), copyright: "© 2023 Angelo Verlain, Christopher Davis", @@ -427,7 +422,7 @@ export class Application extends Adw.Application { } find_open_note(uuid: string) { - return this.find_open_window(uuid)?.note as Note ?? undefined; + return (this.find_open_window(uuid)?.note as Note) ?? undefined; } changed_note(uuid: string) { @@ -498,8 +493,8 @@ export class Application extends Adw.Application { if (!note) return; - const note_window = this.note_windows.find((window) => - window.note.uuid === uuid + const note_window = this.note_windows.find( + (window) => window.note.uuid === uuid ); if (note_window) { From 17394b5caa0d43e4c7c920d0dc61c3617f67e569 Mon Sep 17 00:00:00 2001 From: mohsen waheed elsisi Date: Tue, 7 Oct 2025 22:14:04 +0300 Subject: [PATCH 2/3] Undid altered formatting --- src/application.ts | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/application.ts b/src/application.ts index 2dc96e4..40801ce 100644 --- a/src/application.ts +++ b/src/application.ts @@ -97,7 +97,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Show all notes", - null + null, ); this.add_main_option( @@ -106,7 +106,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Print version information and exit", - null + null, ); this.add_main_option( @@ -115,7 +115,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Open a new note", - null + null, ); this.add_main_option( @@ -124,7 +124,7 @@ export class Application extends Adw.Application { GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Only show the app if there is atleast one open note", - null + null, ); this.connect("handle-local-options", (_app, options: GLib.VariantDict) => { @@ -147,7 +147,7 @@ export class Application extends Adw.Application { if (open == false) { console.log( - "Sticky Notes not opening because the `-i` flag was passed and there are no open notes" + "Sticky Notes not opening because the `-i` flag was passed and there are no open notes", ); this.quit(); } @@ -194,9 +194,8 @@ export class Application extends Adw.Application { }); if (!has_one_open) { - const last_open_note = this.notes_array().sort((a, b) => - b.modified.compare(a.modified) - )[0]; + const last_open_note = this.notes_array() + .sort((a, b) => b.modified.compare(a.modified))[0]; if (has_one_open) { this.show_note(last_open_note.uuid); @@ -274,7 +273,11 @@ export class Application extends Adw.Application { const [uri] = parameter.get_string(); if (uri === "null") return; - Gtk.show_uri(this.get_active_window(), uri, Gdk.CURRENT_TIME); + Gtk.show_uri( + this.get_active_window(), + uri, + Gdk.CURRENT_TIME, + ); }); this.add_action(open_link); @@ -298,11 +301,12 @@ export class Application extends Adw.Application { // this.set_accels_for_action("app.cycle", ["a"]); // this.set_accels_for_action("app.cycle-reverse", ["b"]); this.set_accels_for_action("app.save", ["s"]); + this.set_accels_for_action("win.delete", ["d"]); + this.set_accels_for_action("win.open-primary-menu", ["F10"]); this.set_accels_for_action("win.show-help-overlay", ["question"]); this.set_accels_for_action("window.close", ["w"]); - this.set_accels_for_action("win.delete", ["d"]); this.set_accels_for_action("win.bold", ["b"]); this.set_accels_for_action("win.italic", ["i"]); @@ -326,15 +330,16 @@ export class Application extends Adw.Application { const notes = Gtk.FilterListModel.new( this.notes_list, - filter + filter, ) as Gtk.FilterListModel; const presented = this.active_window; if (presented instanceof StickyNotes) { this.get_note_window( - notes.get_item(reverse ? notes.n_items - 1 : 0)!.uuid - )?.present(); + notes.get_item(reverse ? notes.n_items - 1 : 0)!.uuid, + ) + ?.present(); } else if (presented instanceof Window) { let id; @@ -375,7 +380,9 @@ export class Application extends Adw.Application { "Angelo Verlain ", "Christopher Davis ", ], - designers: ["David Lapshin"], + designers: [ + "David Lapshin", + ], // TRANSLATORS: eg. 'Translator Name ' or 'Translator Name https://website.example' translator_credits: _("translator-credits"), copyright: "© 2023 Angelo Verlain, Christopher Davis", @@ -422,7 +429,7 @@ export class Application extends Adw.Application { } find_open_note(uuid: string) { - return (this.find_open_window(uuid)?.note as Note) ?? undefined; + return this.find_open_window(uuid)?.note as Note ?? undefined; } changed_note(uuid: string) { @@ -493,8 +500,8 @@ export class Application extends Adw.Application { if (!note) return; - const note_window = this.note_windows.find( - (window) => window.note.uuid === uuid + const note_window = this.note_windows.find((window) => + window.note.uuid === uuid ); if (note_window) { From f81e57b88c2e169dc9ff0de0cd1f153fe1a3b51a Mon Sep 17 00:00:00 2001 From: mohsen waheed elsisi Date: Tue, 7 Oct 2025 22:21:30 +0300 Subject: [PATCH 3/3] Removed extra empty line after win.delete shortcut definition. --- src/application.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/application.ts b/src/application.ts index 40801ce..8d29ddc 100644 --- a/src/application.ts +++ b/src/application.ts @@ -303,7 +303,6 @@ export class Application extends Adw.Application { this.set_accels_for_action("app.save", ["s"]); this.set_accels_for_action("win.delete", ["d"]); - this.set_accels_for_action("win.open-primary-menu", ["F10"]); this.set_accels_for_action("win.show-help-overlay", ["question"]); this.set_accels_for_action("window.close", ["w"]);