Skip to content

Commit

Permalink
[CassiaWindowList@klangman] Version 2.3.4 (#6427)
Browse files Browse the repository at this point in the history
* Save scroll-wheel adjusted thumbnail sizes in the JSON
* Apply scroll-wheel adjusted default thumbnail sizes to other workspaces
* Further improvements to setting icon geometry
  • Loading branch information
klangman authored Sep 15, 2024
1 parent b05f957 commit 6829b6e
Show file tree
Hide file tree
Showing 15 changed files with 836 additions and 737 deletions.
7 changes: 7 additions & 0 deletions CassiaWindowList@klangman/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2.3.4

* Saves new default thumbnail window sizes (adjusted using the mouse scroll-wheel) across cinnamon restarts
* Now uses application specific thumbnail windows sizes across all workspaces
* Changing the "Default thumbnail window size" setting will now reset all scroll-wheel set thumbnail sizes
* Fix the icon geometry so that it is set correctly in more (all?) cases

## 2.3.3

* Improve the window icon geometry update logic for more accurate minimize/unminimize animations. It's still not perfect, but this fixes most of the issues.
Expand Down
7 changes: 5 additions & 2 deletions CassiaWindowList@klangman/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
This is a Cinnamon window list and panel launcher applet based on CobiWindowList with a number of additional features designed to give you more control over how your window-list operates.

Recent new features (Aug 2023 - July 2024):
Recent new features (Aug 2023 - Sept 2024):

* Saves new default thumbnail window sizes (adjusted using the mouse scroll-wheel) across cinnamon restarts
* Now uses application specific thumbnail windows sizes across all workspaces
* Changing the "Default thumbnail window size" setting will now reset all scroll-wheel set thumbnail sizes
* Add "Always on top" item to the button context menu as well as "Always on top" mouse actions (Cinnamon 5.4+)
* Allow rearranging Thumbnail menu items using drag-and-drop, also allow dropping on the desktop
* Add options for hiding button labels when the windows workspace/monitor is not the current workspace/monitor
Expand Down Expand Up @@ -35,7 +38,7 @@ The design goals are to:
1. Allow you to declutter your window list when running many windows without having to do without button labels
2. Keyboard hot-keys to switch to specific windows so you don't have to reach for the mouse so often
3. Allow you to make full use of your mouse buttons to interact with the window list
4. A panel launcher that will activate existing windows rather then unconditionally launching new ones
4. A panel launcher that can activate existing windows rather then unconditionally launching new ones

## Requirements
This applet requires at least Cinnamon 4.0 but Cinnamon 6.0 is recommended
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ function resizeActor(actor, time, toWidth, text, button) {
this._minLabelSize = curWidth;
}
}
// Update all the icon geometry info since any change in the actor size can move all buttons when the applet is located in the centre of a panel.
let currentWs = global.screen.get_active_workspace_index();
if (button._workspace._wsNum === currentWs) {
button._workspace.updateIconGeometry();
}
},
onCompleteScope: button
});
Expand Down Expand Up @@ -404,11 +409,21 @@ function animatedRemoveAppButton(workspace, time, button) {
transition: "easeInOutQuad",
onComplete() {
this._removeAppButton(button);
// Update all the icon geometry info since any change in the actor size can move all buttons when the applet is located in the centre of a panel.
let currentWs = global.screen.get_active_workspace_index();
if (button._workspace._wsNum === currentWs) {
button._workspace.updateIconGeometry();
}
},
onCompleteScope: workspace
});
} else {
workspace._removeAppButton(button);
// Update all the icon geometry info since any change in the actor size can move all buttons when the applet is located in the centre of a panel.
let currentWs = global.screen.get_active_workspace_index();
if (button._workspace._wsNum === currentWs) {
button._workspace.updateIconGeometry();
}
}
}

Expand Down Expand Up @@ -1231,9 +1246,19 @@ class ThumbnailMenu extends PopupMenu.PopupMenu {
let window = windows[i];
this.addWindow(window);
}
this.numThumbs = this._settings.getValue("number-of-unshrunk-previews");
let wheelSetting = this._settings.getValue("wheel-adjusts-preview-size");
if (wheelSetting===ScrollWheelAction.OnGlobal)
if (wheelSetting===ScrollWheelAction.OnGlobal) {
this.numThumbs = this._appButton._workspace.thumbnailSize;
} else if (wheelSetting===ScrollWheelAction.OnApplication) {
let appThumbSizes = this._settings.getValue("app-preview-size");
for ( let i=0 ; i < appThumbSizes.length ; i++ ) {
if (appThumbSizes[i].app == this._appButton._app.get_id()) {
this.numThumbs = appThumbSizes[i].size;
break;
}
}
}
this.updateUrgentState();
this.recalcItemSizes();

Expand Down Expand Up @@ -1477,7 +1502,7 @@ class WindowListButton {
this._signalManager.connect(this.actor, "button-press-event", this._onButtonPress, this);
this._signalManager.connect(this.actor, "button-release-event", this._onButtonRelease, this);
this._signalManager.connect(this.actor, "scroll-event", this._onScrollEvent, this);
this._signalManager.connect(this.actor, "notify::allocation", this._allocationChanged, this);
//this._signalManager.connect(this.actor, "notify::allocation", this._allocationChanged, this);
this._signalManager.connect(this._settings, "changed::caption-type", this._updateLabel, this);
this._signalManager.connect(this._settings, "changed::display-caption-for-pined", this._updateLabel, this);
this._signalManager.connect(this._settings, "changed::hide-caption-for-minimized", this._updateLabel, this);
Expand Down Expand Up @@ -1514,20 +1539,9 @@ class WindowListButton {
this._updateSpacing();
}

_allocationChanged() {
// Update the icon location so Cinnamon's minimize/restore animation can work correctly
let curWS = global.screen.get_active_workspace_index();
if (this._windows.length>0 && curWS === this._workspace._wsNum && this._settings.getValue("group-windows")!==GroupType.Launcher) {
let rect = new Meta.Rectangle();
[rect.x, rect.y] = this._iconBin.get_transformed_position();
[rect.width, rect.height] = this._iconBin.get_transformed_size();
this._windows.forEach((window) => {
if (window.is_on_all_workspaces() || window.get_workspace().index() === curWS ) {
window.set_icon_geometry(rect);
}
});
}
}
//_allocationChanged() {
// this.updateIconGeometry();
//}

// Sort this._windows by workspace and monitor
_sortWindows() {
Expand Down Expand Up @@ -2664,11 +2678,43 @@ class WindowListButton {
this.menu.numThumbs = numThumbs;
this.menu.recalcItemSizes();
if (wheelSetting===ScrollWheelAction.OnGlobal) {
this._workspace.thumbnailSize = numThumbs;
for (let i = 0; i < this._applet._workspaces.length; i++) {
let ws = this._applet._workspaces[i];
ws.thumbnailSize = numThumbs;
}
this._settings.setValue("global-preview-size", numThumbs);
} else if (wheelSetting===ScrollWheelAction.OnApplication) {
let btns = this._workspace._lookupAllAppButtonsForApp(this._app);
for (let idx=0 ; idx < btns.length ; idx++ ) {
btns[idx].menu.numThumbs = numThumbs;
// Apply this new preview size to all buttons on all workspaces for this app
for (let i = 0; i < this._applet._workspaces.length; i++) {
let ws = this._applet._workspaces[i];
let btns = ws._lookupAllAppButtonsForApp(this._app);
for (let idx=0 ; idx < btns.length ; idx++ ) {
btns[idx].menu.numThumbs = numThumbs;
}
}

let appThumbSizes = this._settings.getValue("app-preview-size");
let appThumbSize = null;
let i=0
for ( ; i < appThumbSizes.length ; i++ ) {
if (appThumbSizes[i].app == this._app.get_id()) {
appThumbSize = appThumbSizes[i];
break;
}
}
// Save/delete this new per-app preview size into the config json
if (numThumbs === this._settings.getValue("number-of-unshrunk-previews")) {
if (appThumbSize) {
appThumbSizes.splice(i, 1);
this._settings.setValue("app-preview-size", appThumbSizes);
}
} else {
if (appThumbSize) {
appThumbSizes[i].size = numThumbs;
} else {
appThumbSizes.push( { app: this._app.get_id(), size: numThumbs } );
}
this._settings.setValue("app-preview-size", appThumbSizes);
}
}
}
Expand Down Expand Up @@ -3792,7 +3838,18 @@ class WindowListButton {
}

updateIconGeometry() {
this._allocationChanged();
// Update the icon location so Cinnamon's minimize/restore animation can work correctly
let curWS = global.screen.get_active_workspace_index();
if (this._windows.length>0 && curWS === this._workspace._wsNum && this._settings.getValue("group-windows")!==GroupType.Launcher) {
let rect = new Meta.Rectangle();
[rect.x, rect.y] = this._iconBin.get_transformed_position();
[rect.width, rect.height] = this._iconBin.get_transformed_size();
this._windows.forEach((window) => {
if (window.is_on_all_workspaces() || window.get_workspace().index() === curWS ) {
window.set_icon_geometry(rect);
}
});
}
}
}

Expand Down Expand Up @@ -3820,7 +3877,10 @@ class Workspace {

this.menuManager = new ThumbnailMenuManager(this);
this.currentMenu = undefined; // The currently open Thumbnail menu
this.thumbnailSize = this._settings.getValue("number-of-unshrunk-previews");
if (this._settings.getValue("wheel-adjusts-preview-size")===ScrollWheelAction.OnGlobal)
this.thumbnailSize = this._settings.getValue("global-preview-size");
else
this.thumbnailSize = this._settings.getValue("number-of-unshrunk-previews");

this._appButtons = [];
this._settings = this._applet._settings;
Expand Down Expand Up @@ -5307,6 +5367,7 @@ class WindowList extends Applet.Applet {
this._signalManager.connect(this._settings, "changed::display-pinned", this._onDisplayPinnedChanged, this);
this._signalManager.connect(this._settings, "changed::synchronize-pinned", this._onSynchronizePinnedChanged, this);
this._signalManager.connect(this._settings, "changed::show-windows-for-all-workspaces", this._onShowOnAllWorkspacesChanged, this);
this._signalManager.connect(this._settings, "changed::number-of-unshrunk-previews", this._updateGlobalPreviewSize, this);
this._signalManager.connect(this._settings, "settings-changed", this._onSettingsChanged, this);

if (this._settings.getValue("runWizard")===1) {
Expand All @@ -5315,6 +5376,18 @@ class WindowList extends Applet.Applet {
}
}

_updateGlobalPreviewSize() {
// Set the new thumbnail sizes. Only set the size used when the ScrollWheel setting is "On (global default)"
// Under the other ScrollWheel settings we don't use the ws.thumbnailSize variable
let numThumbs = this._settings.getValue("number-of-unshrunk-previews");
this._settings.setValue("global-preview-size", numThumbs);
for (let i = 0; i < this._workspaces.length; i++) {
let ws = this._workspaces[i];
ws.thumbnailSize = numThumbs;
}
this._settings.setValue("app-preview-size", []);
}

_onShowOnAllWorkspacesChanged() {
if (this._settings.getValue("show-windows-for-all-workspaces")) {
this._workspaces.forEach( (ws) => {ws._updateAllWindowsForMonitor();} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,14 @@
"type": "generic",
"default": [1, 1, 1]
},
"app-preview-size": {
"type": "generic",
"default": []
},
"global-preview-size": {
"type": "generic",
"default": 7
},

"runWizard": {
"type": "generic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,14 @@
"type": "generic",
"default": [1, 1, 1]
},
"app-preview-size": {
"type": "generic",
"default": []
},
"global-preview-size": {
"type": "generic",
"default": 7
},

"runWizard": {
"type": "generic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"max-instances": -1,
"multiversion": true,
"role": "panellauncher",
"version": "2.3.3",
"version": "2.3.4",
"author": "klangman"
}
Loading

0 comments on commit 6829b6e

Please sign in to comment.