Skip to content

Commit

Permalink
Merge pull request #1 from moalhaddar/feature/fix-clipboard-and-stay
Browse files Browse the repository at this point in the history
- Paste and stay now actually stays - Fixed `this` to refer to the class context
  • Loading branch information
moalhaddar authored Jul 3, 2024
2 parents 082c919 + 31f47cb commit b4ca897
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
12 changes: 2 additions & 10 deletions emoji-copy@felipeftn/emojiButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class EmojiButton {
can_focus: true,
label: this.baseCharacter,
});

// Copy the emoji to the clipboard with adequate tags and behavior
this.super_btn.connect("button-press-event", this.onButtonPress.bind(this));
this.super_btn.connect("key-press-event", this.onKeyPress.bind(this));
Expand Down Expand Up @@ -162,25 +162,17 @@ export class EmojiButton {
emojiToCopy,
);

if (this._settings.get_boolean("paste-on-select")) {
this.triggerPasteHack();
}

return Clutter.EVENT_STOP;
}

addToClipboardAndStay(emojiToCopy) {
this.clipboard.get_text(CLIPBOARD_TYPE, function (_, text) {
this.clipboard.get_text(CLIPBOARD_TYPE, (_, text) => {
this.clipboard.set_text(
CLIPBOARD_TYPE,
text + emojiToCopy,
);
});

if (this._settings.get_boolean("paste-on-select")) {
this.triggerPasteHack();
}

return Clutter.EVENT_STOP;
}

Expand Down
8 changes: 4 additions & 4 deletions emoji-copy@felipeftn/handlers/sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export class SQLite {
}

increment_selection(unicode) {
this.query(
`UPDATE emojis SET clicked_times = clicked_times + 1 WHERE unicode = '${unicode}'`
)
return this.query(`
UPDATE emojis SET clicked_times = clicked_times + 1 WHERE unicode = '${unicode}'
`);
}

search_description(search_text, skin_tone = 0) {
Expand Down Expand Up @@ -93,7 +93,7 @@ export class SQLite {
item.description = data[1];
item.skin_tone = data[2];
item.group = data[3];
item.clicked_times = data[4]
item.clicked_times = data[4];
return item;
});
return result;
Expand Down
2 changes: 1 addition & 1 deletion emoji-copy@felipeftn/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"url": "https://github.com/felipeftn/emoji-copy",
"settings-schema": "org.gnome.shell.extensions.emoji-copy",
"gettext-domain": "emoji-copy",
"version": 22
"version": 23
}

0 comments on commit b4ca897

Please sign in to comment.