Skip to content

Commit

Permalink
Small Window plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ckoates committed Aug 31, 2024
1 parent 476fb6e commit 583f5ce
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ Kicks the Tidal cdn if the current playback stalls to make it stop so you never

![image](https://github.com/Inrixia/neptune-plugins/assets/6373693/8378a9a3-2d3f-4cd7-af04-ceeac350b9e6)

## Small Window
<b>

Install Url:
```
https://inrixia.github.io/neptune-plugins/SmallWindow
```
</b>

Removes the minimum width and height limits on the window. Causes some UI bugs but can be useful if you want a smaller window.

![image](https://github.com/user-attachments/assets/cb1eb26f-fb12-480e-99b2-76f9da5787f4)

## Downloader
<b>

Expand Down
6 changes: 6 additions & 0 deletions plugins/SmallWindow/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"displayName": "Small Window",
"description": "Removes the minimum width and height limits on the window.",
"author": "Nick Oates",
"main": "./src/index.js"
}
7 changes: 7 additions & 0 deletions plugins/SmallWindow/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import "./size.native";

window.electron.ipcRenderer.invoke("REMOVE_SIZE_LIMIT");

export const onUnload = () => {
window.electron.ipcRenderer.invoke("RESTORE_SIZE_LIMIT");
};
19 changes: 19 additions & 0 deletions plugins/SmallWindow/src/size.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import electron from "electron";

let initialLimits: number[] | undefined;

function removeLimits() {
const win = electron.BrowserWindow.getAllWindows()[0];
if (!initialLimits) initialLimits = win.getMinimumSize();
win.setMinimumSize(0, 0);
}

function restoreLimits() {
const win = electron.BrowserWindow.getAllWindows()[0];
if (initialLimits) win.setMinimumSize(initialLimits[0], initialLimits[1]);
}

electron.ipcMain.removeHandler("REMOVE_SIZE_LIMIT");
electron.ipcMain.removeHandler("RESTORE_SIZE_LIMIT");
electron.ipcMain.handle("REMOVE_SIZE_LIMIT", removeLimits);
electron.ipcMain.handle("RESTORE_SIZE_LIMIT", restoreLimits);

0 comments on commit 583f5ce

Please sign in to comment.