-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
24 lines (20 loc) · 799 Bytes
/
background.js
File metadata and controls
24 lines (20 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// background.js
chrome.commands.onCommand.addListener(async (command) => {
if (command === "vertical-maximize") {
// Get the last focused window
const window = await chrome.windows.getLastFocused();
// Get display information to find screen height
const displays = await chrome.system.display.getInfo();
// Find the display that contains this window
const display = displays.find(d =>
window.left >= d.bounds.left &&
window.left < d.bounds.left + d.bounds.width
) || displays[0];
// Update window to span full height while keeping horizontal position/width
await chrome.windows.update(window.id, {
top: display.workArea.top,
height: display.workArea.height,
state: "normal"
});
}
});