Skip to content

Commit

Permalink
In Clippings Manager, Linux-specific option to minimize when inactive…
Browse files Browse the repository at this point in the history
… should be turned OFF by default (issue #464)

- On first run, turn on status bar with mode icon in Clippings Manager
- Allow double-click on status bar mode icon to quickly toggle Minimize When Inactive
  • Loading branch information
aecreations committed Jun 22, 2024
1 parent 1114c15 commit 708839d
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 6 deletions.
5 changes: 5 additions & 0 deletions wx-src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ void async function ()
log("Initializing 7.0 user preferences and MV3 background script state persistence.");
await aePrefs.setSanFranciscoPrefs(prefs);
gIsMajorVerUpdate = true;

let platform = await browser.runtime.getPlatformInfo();
if (platform.os == "linux") {
aePrefs.setPrefs({clippingsMgrAutoShowStatusBar: true});
}
}

if (prefs.clippingsMgrDetailsPane) {
Expand Down
13 changes: 13 additions & 0 deletions wx-src/img/auto-minimize-off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions wx-src/img/auto-minimize-on.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions wx-src/pages/clippingsMgr.css
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,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
Expand Down
1 change: 1 addition & 0 deletions wx-src/pages/clippingsMgr.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ <h4 data-i18n="clipMgrIntroKeybHdg"></h4>

<div id="status-bar" class="hbox">
<span id="status-bar-msg"></span>
<span id="minz-when-inactv-mode" data-checked="false"></span>
</div>

<!-- Popup panels -->
Expand Down
31 changes: 25 additions & 6 deletions wx-src/pages/clippingsMgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2685,10 +2685,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 ()
Expand Down Expand Up @@ -3223,7 +3224,20 @@ $(async () => {

// Platform-specific initialization.
if (gEnvInfo.os == "mac") {
$("#status-bar").css({ backgroundImage: "none" });
$("#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 = browser.i18n.getUILanguage();
Expand All @@ -3237,7 +3251,7 @@ $(async () => {
gIsMaximized = false;

if (DEBUG_WND_ACTIONS && !gPrefs.clippingsMgrMinzWhenInactv) {
aePrefs.setPrefs({ clippingsMgrMinzWhenInactv: true });
aePrefs.setPrefs({clippingsMgrMinzWhenInactv: true});
}

initToolbar();
Expand All @@ -3252,7 +3266,7 @@ $(async () => {

if (gPrefs.clippingsMgrTreeWidth) {
let width = `${parseInt(gPrefs.clippingsMgrTreeWidth)}px`;
$("#clippings-tree").css({ width });
$("#clippings-tree").css({width});
}

if (gPrefs.clippingsMgrSaveWndGeom) {
Expand Down Expand Up @@ -3287,7 +3301,7 @@ $(async () => {

// Reloading or closing Clippings Manager window
$(window).on("beforeunload", () => {
browser.runtime.sendMessage({ msgID: "close-clippings-mgr-wnd" });
browser.runtime.sendMessage({msgID: "close-clippings-mgr-wnd"});

browser.runtime.sendMessage({
msgID: "purge-fldr-items",
Expand Down Expand Up @@ -3428,6 +3442,11 @@ $(window).on("focus", aEvent => {
});


$("#minz-when-inactv-mode").on("dblclick", aEvent => {
gCmd.toggleMinimizeWhenInactive();
});


browser.storage.onChanged.addListener((aChanges, aAreaName) => {
let changedPrefs = Object.keys(aChanges);

Expand Down
2 changes: 2 additions & 0 deletions wx-src/scripts/aePrefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ let aePrefs = {
defDlgBtnFollowsFocus: true,
compressSyncData: true,
isSyncReadOnly: false,
clippingsMgrAutoShowStatusBar: false,
},

getPrefKeys()
Expand Down Expand Up @@ -271,6 +272,7 @@ let aePrefs = {
compressSyncData: true,
isSyncReadOnly: false,
defDlgBtnFollowsFocus: true,
clippingsMgrAutoShowStatusBar: false,
};
await this._addPrefs(aPrefs, newPrefs);

Expand Down

0 comments on commit 708839d

Please sign in to comment.