mirror of
https://github.com/imgfloat/client.git
synced 2026-02-05 03:59:26 +00:00
Add dev console button
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
:root {
|
:root {
|
||||||
--window-frame-height: 36px;
|
--window-frame-height: 36px;
|
||||||
|
--window-control-size: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
@@ -64,15 +65,17 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.window-control {
|
.window-control {
|
||||||
width: 30px;
|
width: var(--window-control-size);
|
||||||
height: 24px;
|
height: var(--window-control-size);
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: rgba(148, 163, 184, 0.2);
|
background: rgba(148, 163, 184, 0.2);
|
||||||
border: 1px solid rgba(148, 163, 184, 0.25);
|
border: 1px solid rgba(148, 163, 184, 0.25);
|
||||||
color: #e2e8f0;
|
color: #e2e8f0;
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
<button class="window-control" type="button" data-window-action="minimize" aria-label="Minimize">
|
<button class="window-control" type="button" data-window-action="minimize" aria-label="Minimize">
|
||||||
−
|
−
|
||||||
</button>
|
</button>
|
||||||
|
<button class="window-control" type="button" data-window-action="devtools" aria-label="Toggle dev tools">
|
||||||
|
⚙
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
class="window-control window-control-close"
|
class="window-control window-control-close"
|
||||||
type="button"
|
type="button"
|
||||||
@@ -113,6 +116,9 @@
|
|||||||
if (action === "minimize") {
|
if (action === "minimize") {
|
||||||
window.store.minimizeWindow();
|
window.store.minimizeWindow();
|
||||||
}
|
}
|
||||||
|
if (action === "devtools") {
|
||||||
|
window.store.toggleDevTools();
|
||||||
|
}
|
||||||
if (action === "close") {
|
if (action === "close") {
|
||||||
window.store.closeWindow();
|
window.store.closeWindow();
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/main.js
10
src/main.js
@@ -70,6 +70,16 @@ ipcMain.handle("close-window", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle("toggle-devtools", () => {
|
||||||
|
if (ELECTRON_WINDOW && !ELECTRON_WINDOW.isDestroyed()) {
|
||||||
|
if (ELECTRON_WINDOW.webContents.isDevToolsOpened()) {
|
||||||
|
ELECTRON_WINDOW.webContents.closeDevTools();
|
||||||
|
} else {
|
||||||
|
ELECTRON_WINDOW.webContents.openDevTools({ mode: "detach" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.handle("save-broadcaster", (_, broadcaster) => {
|
ipcMain.handle("save-broadcaster", (_, broadcaster) => {
|
||||||
const store = readStore(STORE_PATH);
|
const store = readStore(STORE_PATH);
|
||||||
store.lastBroadcaster = broadcaster;
|
store.lastBroadcaster = broadcaster;
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ contextBridge.exposeInMainWorld("store", {
|
|||||||
setWindowSize: (width, height) => ipcRenderer.invoke("set-window-size", width, height),
|
setWindowSize: (width, height) => ipcRenderer.invoke("set-window-size", width, height),
|
||||||
minimizeWindow: () => ipcRenderer.invoke("minimize-window"),
|
minimizeWindow: () => ipcRenderer.invoke("minimize-window"),
|
||||||
closeWindow: () => ipcRenderer.invoke("close-window"),
|
closeWindow: () => ipcRenderer.invoke("close-window"),
|
||||||
|
toggleDevTools: () => ipcRenderer.invoke("toggle-devtools"),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user