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 #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
  • Loading branch information
aecreations committed Jun 23, 2024
1 parent 901ac99 commit f71b381
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
13 changes: 13 additions & 0 deletions 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 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 src/pages/clippingsMgr.css
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/pages/clippingsMgr.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,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
23 changes: 21 additions & 2 deletions src/pages/clippingsMgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit f71b381

Please sign in to comment.