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
1 change: 1 addition & 0 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const PrefsFields = {
TOPBAR_PREVIEW_SIZE : 'topbar-preview-size',
TOPBAR_DISPLAY_MODE_ID : 'display-mode',
DISABLE_DOWN_ARROW : 'disable-down-arrow',
BLINK_ICON_ON_COPY : 'blink-icon-on-copy',
STRIP_TEXT : 'strip-text',
KEEP_SELECTED_ON_CLEAR : 'keep-selected-on-clear',
PASTE_BUTTON : 'paste-button',
Expand Down
19 changes: 19 additions & 0 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ let TOPBAR_DISPLAY_MODE = 1; //0 - only icon, 1 - only clipboard content,
let CLEAR_ON_BOOT = false;
let PASTE_ON_SELECT = false;
let DISABLE_DOWN_ARROW = false;
let BLINK_ICON_ON_COPY = false;
let STRIP_TEXT = false;
let KEEP_SELECTED_ON_CLEAR = false;
let PASTE_BUTTON = true;
Expand Down Expand Up @@ -166,6 +167,22 @@ const ClipboardIndicator = GObject.registerClass({
}
}

_blinkIcon () {
if (!BLINK_ICON_ON_COPY || !this.icon) {
return;
}

// Set inverted colors
this.set_style('background-color: rgba(255, 255, 255, 0.9);');
this.icon.set_style('color: rgba(0, 0, 0, 0.9);');

// Revert back to normal after delay
setTimeout(() => {
this.set_style(null);
this.icon.set_style(null);
}, 200);
}

async _buildMenu () {
let that = this;
const clipHistory = await this._getCache();
Expand Down Expand Up @@ -801,6 +818,7 @@ const ClipboardIndicator = GObject.registerClass({
notif.addAction(_('Cancel'), this._cancelNotification);
});
}
this._blinkIcon();
}
}
catch (e) {
Expand Down Expand Up @@ -1124,6 +1142,7 @@ const ClipboardIndicator = GObject.registerClass({
CLEAR_ON_BOOT = settings.get_boolean(PrefsFields.CLEAR_ON_BOOT);
PASTE_ON_SELECT = settings.get_boolean(PrefsFields.PASTE_ON_SELECT);
DISABLE_DOWN_ARROW = settings.get_boolean(PrefsFields.DISABLE_DOWN_ARROW);
BLINK_ICON_ON_COPY = settings.get_boolean(PrefsFields.BLINK_ICON_ON_COPY);
STRIP_TEXT = settings.get_boolean(PrefsFields.STRIP_TEXT);
KEEP_SELECTED_ON_CLEAR = settings.get_boolean(PrefsFields.KEEP_SELECTED_ON_CLEAR);
PASTE_BUTTON = settings.get_boolean(PrefsFields.PASTE_BUTTON);
Expand Down
6 changes: 6 additions & 0 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class Settings {
title: _("Remove down arrow in top bar")
});

this.field_blink_icon_on_copy = new Adw.SwitchRow({
title: _("Blink icon on copy")
});

this.field_cache_disable = new Adw.SwitchRow({
title: _("Cache only pinned items")
});
Expand Down Expand Up @@ -201,6 +205,7 @@ class Settings {
this.topbar.add(this.field_display_mode);
this.topbar.add(this.field_topbar_preview_size);
this.topbar.add(this.field_disable_down_arrow);
this.topbar.add(this.field_blink_icon_on_copy);

this.notifications.add(this.field_clear_notification_toggle);
this.notifications.add(this.field_cycle_notification_toggle)
Expand All @@ -222,6 +227,7 @@ class Settings {
this.schema.bind(PrefsFields.KEEP_SELECTED_ON_CLEAR, this.field_keep_selected_on_clear, 'active', Gio.SettingsBindFlags.DEFAULT);
this.schema.bind(PrefsFields.TOPBAR_DISPLAY_MODE_ID, this.field_display_mode, 'selected', Gio.SettingsBindFlags.DEFAULT);
this.schema.bind(PrefsFields.DISABLE_DOWN_ARROW, this.field_disable_down_arrow, 'active', Gio.SettingsBindFlags.DEFAULT);
this.schema.bind(PrefsFields.BLINK_ICON_ON_COPY, this.field_blink_icon_on_copy, 'active', Gio.SettingsBindFlags.DEFAULT);
this.schema.bind(PrefsFields.TOPBAR_PREVIEW_SIZE, this.field_topbar_preview_size, 'value', Gio.SettingsBindFlags.DEFAULT);
this.schema.bind(PrefsFields.STRIP_TEXT, this.field_strip_text, 'active', Gio.SettingsBindFlags.DEFAULT);
this.schema.bind(PrefsFields.PASTE_BUTTON, this.field_paste_button, 'active', Gio.SettingsBindFlags.DEFAULT);
Expand Down
Binary file modified schemas/gschemas.compiled
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
<summary>Remove down arrow in top bar</summary>
</key>

<key name="blink-icon-on-copy" type="b">
<default>false</default>
<summary>Blink icon on copy</summary>
<description>
If true, the topbar icon will blink when content is copied to clipboard.
</description>
</key>

<key name="clear-on-boot" type="b">
<default>false</default>
<summary>Clear clipboard history on every system reboot.</summary>
Expand Down
8 changes: 8 additions & 0 deletions stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,11 @@
height:1em;
margin-right:.25em;
}

.clipboard-indicator-hbox {
transition: background-color 150ms ease-in-out;
}

.clipboard-indicator-hbox .clipboard-indicator-icon {
transition: color 150ms ease-in-out;
}