Skip to content

Commit 394a726

Browse files
committed
Improve customazibility of gnome extension
1 parent efe228a commit 394a726

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed

gnome-extension/extension.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ const RabbitForexIndicator = GObject.registerClass(
436436
const clipboardText = this._getClipboardText(symbol, rawPrice, displayRate, primaryCurrency, category);
437437
const clipboard = St.Clipboard.get_default();
438438
clipboard.set_text(St.ClipboardType.CLIPBOARD, clipboardText);
439-
Main.notify("Copied to clipboard", clipboardText);
439+
if (this._settings.get_boolean("clipboard-notification")) {
440+
Main.notify("Copied to clipboard", clipboardText);
441+
}
440442
});
441443

442444
this._ratesSection.addMenuItem(rateItem);

gnome-extension/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Monitor exchange rates for fiat currencies, precious metals, cryptocurrencies and stocks.\nClick on any rate to copy it to clipboard.",
44
"uuid": "rabbitforex@rabbit-company.com",
55
"shell-version": ["47", "48", "49"],
6-
"version-name": "1.2.0",
6+
"version-name": "1.3.0",
77
"settings-schema": "org.gnome.shell.extensions.rabbitforex",
88
"url": "https://github.com/Rabbit-Company/RabbitForexAPI",
99
"donations": {

gnome-extension/prefs.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,17 @@ export default class RabbitForexPreferences extends ExtensionPreferences {
262262
});
263263
generalPage.add(panelGroup);
264264

265+
// Show currency in panel toggle
266+
const showCurrencyInPanelRow = new Adw.SwitchRow({
267+
title: "Show Currency in Panel",
268+
subtitle: "Display currency symbol/code alongside rates in the panel",
269+
});
270+
showCurrencyInPanelRow.active = settings.get_boolean("show-currency-in-panel");
271+
showCurrencyInPanelRow.connect("notify::active", () => {
272+
settings.set_boolean("show-currency-in-panel", showCurrencyInPanelRow.active);
273+
});
274+
panelGroup.add(showCurrencyInPanelRow);
275+
265276
// Max panel items
266277
const maxPanelRow = new Adw.SpinRow({
267278
title: "Max Panel Items",
@@ -299,17 +310,6 @@ export default class RabbitForexPreferences extends ExtensionPreferences {
299310
});
300311
panelGroup.add(templateRow);
301312

302-
// Show currency in panel toggle
303-
const showCurrencyInPanelRow = new Adw.SwitchRow({
304-
title: "Show Currency in Panel",
305-
subtitle: "Display currency symbol/code alongside rates in the panel",
306-
});
307-
showCurrencyInPanelRow.active = settings.get_boolean("show-currency-in-panel");
308-
showCurrencyInPanelRow.connect("notify::active", () => {
309-
settings.set_boolean("show-currency-in-panel", showCurrencyInPanelRow.active);
310-
});
311-
panelGroup.add(showCurrencyInPanelRow);
312-
313313
// Panel template help text
314314
const panelTemplateHelpRow = new Adw.ActionRow({
315315
title: "Template Placeholders",
@@ -448,6 +448,17 @@ export default class RabbitForexPreferences extends ExtensionPreferences {
448448
model: clipboardModel,
449449
});
450450

451+
// Clipboard notification toggle
452+
const clipboardNotificationRow = new Adw.SwitchRow({
453+
title: "Show Notification",
454+
subtitle: "Display a notification when a rate is copied to clipboard",
455+
});
456+
clipboardNotificationRow.active = settings.get_boolean("clipboard-notification");
457+
clipboardNotificationRow.connect("notify::active", () => {
458+
settings.set_boolean("clipboard-notification", clipboardNotificationRow.active);
459+
});
460+
clipboardGroup.add(clipboardNotificationRow);
461+
451462
const currentClipboard = settings.get_string("clipboard-format");
452463
const clipboardIndex = CLIPBOARD_FORMATS.findIndex((f) => f.id === currentClipboard);
453464
clipboardRow.selected = clipboardIndex >= 0 ? clipboardIndex : 0;

gnome-extension/schemas/org.gnome.shell.extensions.rabbitforex.gschema.xml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
</key>
2424

2525
<!-- Panel Settings -->
26+
<key name="show-currency-in-panel" type="b">
27+
<default>true</default>
28+
<summary>Show currency in panel</summary>
29+
<description>Display the currency symbol or code alongside rates in the panel</description>
30+
</key>
31+
2632
<key name="max-panel-items" type="i">
2733
<default>3</default>
2834
<summary>Maximum panel items</summary>
@@ -41,12 +47,6 @@
4147
<description>Template for displaying items in the panel. Use {symbol} and {rate} as placeholders.</description>
4248
</key>
4349

44-
<key name="show-currency-in-panel" type="b">
45-
<default>true</default>
46-
<summary>Show currency in panel</summary>
47-
<description>Display the currency symbol or code alongside rates in the panel</description>
48-
</key>
49-
5050
<!-- Menu Settings -->
5151
<key name="menu-item-template" type="s">
5252
<default>'{symbol}: {rate}'</default>
@@ -55,12 +55,24 @@
5555
</key>
5656

5757
<!-- Clipboard Settings -->
58+
<key name="clipboard-notification" type="b">
59+
<default>true</default>
60+
<summary>Show clipboard notification</summary>
61+
<description>Show a notification when a rate is copied to clipboard</description>
62+
</key>
63+
5864
<key name="clipboard-template" type="s">
5965
<default>'{symbol}: {rate}'</default>
6066
<summary>Clipboard template</summary>
6167
<description>Template for copying to clipboard when using display format. Use {symbol} and {rate} as placeholders.</description>
6268
</key>
6369

70+
<key name="clipboard-format" type="s">
71+
<default>'display-format'</default>
72+
<summary>Clipboard format</summary>
73+
<description>Format of copied text: display-format, formatted-price or price-only</description>
74+
</key>
75+
6476
<!-- Number Formatting Settings -->
6577
<key name="number-format" type="s">
6678
<default>'auto'</default>
@@ -87,13 +99,6 @@
8799
<description>Where to place the currency symbol: before or after the price</description>
88100
</key>
89101

90-
<!-- Clipboard Settings -->
91-
<key name="clipboard-format" type="s">
92-
<default>'display-format'</default>
93-
<summary>Clipboard format</summary>
94-
<description>Format of copied text: display-format, formatted-price or price-only</description>
95-
</key>
96-
97102
<!-- Fiat Currency Settings -->
98103
<key name="watched-fiat" type="as">
99104
<default>['EUR', 'GBP', 'JPY']</default>

0 commit comments

Comments
 (0)