From f71b3817175abf73c069a3b7b73223058d97c68c Mon Sep 17 00:00:00 2001 From: AE Creations Date: Sun, 23 Jun 2024 10:24:29 -0700 Subject: [PATCH] In Clippings Manager, Linux-specific option to minimize when inactive should be turned OFF by default (issue #176) - Ported from Clippings 7.0 - On first run, turn on status bar with mode icon in Clippings Manager - Allow click on status bar mode icon to quickly toggle Minimize When Inactive --- src/background.js | 5 +++++ src/img/auto-minimize-off.svg | 13 +++++++++++++ src/img/auto-minimize-on.svg | 13 +++++++++++++ src/pages/clippingsMgr.css | 19 +++++++++++++++++++ src/pages/clippingsMgr.html | 1 + src/pages/clippingsMgr.js | 23 +++++++++++++++++++++-- 6 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 src/img/auto-minimize-off.svg create mode 100644 src/img/auto-minimize-on.svg diff --git a/src/background.js b/src/background.js index 5033f03..1762bf0 100644 --- a/src/background.js +++ b/src/background.js @@ -335,6 +335,11 @@ messenger.runtime.onInstalled.addListener(async (aInstall) => { log("Initializing 7.0 user preferences."); await aePrefs.setSanFranciscoPrefs(gPrefs); + let platform = await browser.runtime.getPlatformInfo(); + if (platform.os == "linux") { + aePrefs.setPrefs({clippingsMgrAutoShowStatusBar: true}); + } + // Enable post-update notifications which users can click on to open the // What's New page. await aePrefs.setPrefs({ diff --git a/src/img/auto-minimize-off.svg b/src/img/auto-minimize-off.svg new file mode 100644 index 0000000..aa66735 --- /dev/null +++ b/src/img/auto-minimize-off.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/img/auto-minimize-on.svg b/src/img/auto-minimize-on.svg new file mode 100644 index 0000000..b104d8e --- /dev/null +++ b/src/img/auto-minimize-on.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/pages/clippingsMgr.css b/src/pages/clippingsMgr.css index 08fbd48..369e071 100644 --- a/src/pages/clippingsMgr.css +++ b/src/pages/clippingsMgr.css @@ -832,6 +832,25 @@ ul.fancytree-container { text-align: left; } +#minz-when-inactv-mode { + display: none; + + border-left: 1px solid silver; + margin-right: 8px; + text-align: right; + + background-image: url("../img/auto-minimize-on.svg"); + background-position: center; + background-repeat: no-repeat; + background-size: 12px 12px; + width: 24px; + height: 16px; +} + +#minz-when-inactv-mode[data-checked="false"] { + background-image: url("../img/auto-minimize-off.svg"); +} + /* * Dialog boxes diff --git a/src/pages/clippingsMgr.html b/src/pages/clippingsMgr.html index 20a2535..fd6e257 100644 --- a/src/pages/clippingsMgr.html +++ b/src/pages/clippingsMgr.html @@ -123,6 +123,7 @@

+
diff --git a/src/pages/clippingsMgr.js b/src/pages/clippingsMgr.js index 1c2b07b..8306d54 100644 --- a/src/pages/clippingsMgr.js +++ b/src/pages/clippingsMgr.js @@ -2674,10 +2674,11 @@ let gCmd = { gIsMaximized = updWnd.state == "maximized"; }, - toggleMinimizeWhenInactive: function () + toggleMinimizeWhenInactive() { let currSetting = gPrefs.clippingsMgrMinzWhenInactv; - aePrefs.setPrefs({ clippingsMgrMinzWhenInactv: !currSetting }); + aePrefs.setPrefs({clippingsMgrMinzWhenInactv: !currSetting}); + $("#minz-when-inactv-mode").attr("data-checked", !currSetting); }, openExtensionPrefs: function () @@ -3204,6 +3205,19 @@ $(async () => { if (gEnvInfo.os == "mac") { $("#status-bar").css({backgroundImage: "none"}); } + else if (gEnvInfo.os == "linux") { + if (gPrefs.clippingsMgrAutoShowStatusBar) { + $("#status-bar").show(); + aePrefs.setPrefs({ + clippingsMgrAutoShowStatusBar: false, + clippingsMgrStatusBar: true, + }); + } + + $("#minz-when-inactv-mode").show(); + $("#minz-when-inactv-mode").attr("data-checked", !!gPrefs.clippingsMgrMinzWhenInactv) + .attr("title", browser.i18n.getMessage("mnuMinimizeWhenInactive")); + } let lang = messenger.i18n.getUILanguage(); document.body.dataset.locale = lang; @@ -3445,6 +3459,11 @@ $(window).on("blur", aEvent => { }); +$("#minz-when-inactv-mode").on("click", aEvent => { + gCmd.toggleMinimizeWhenInactive(); +}); + + messenger.storage.onChanged.addListener((aChanges, aAreaName) => { let changedPrefs = Object.keys(aChanges);