Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 41bf5cf

Browse files
myan9starpit
authored andcommitted
feat: resize the popup window
Fixes #4161
1 parent 97172c6 commit 41bf5cf

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

bin/kubectl-kui

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ process.argv.shift()
1515
// insert 'kubectl' into argv
1616
process.argv.splice(1, 0, 'kubectl')
1717

18+
process.env.KUI_POPUP_WINDOW_RESIZE = true
19+
1820
require('@kui-shell/core').main(process.argv)

packages/builder/dist/electron/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ function mac {
209209

210210
(cd "$BUILDDIR/${CLIENT_NAME}-darwin-x64" && touch kubectl-kui && chmod +x kubectl-kui \
211211
&& echo '#!/usr/bin/env sh
212+
export KUI_POPUP_WINDOW_RESIZE=true
212213
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
213214
"$SCRIPTDIR"/Kui.app/Contents/MacOS/Kui kubectl $@ &' >> kubectl-kui)
214215

@@ -261,6 +262,7 @@ function linux {
261262

262263
(cd "$BUILDDIR/${CLIENT_NAME}-linux-x64" && touch kubectl-kui && chmod +x kubectl-kui \
263264
&& echo '#!/usr/bin/env sh
265+
export KUI_POPUP_WINDOW_RESIZE=true
264266
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
265267
"$SCRIPTDIR"/Kui kubectl $@ &' >> kubectl-kui)
266268

packages/core/src/main/spawn-electron.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ debug('loading')
2020

2121
import { IpcMainEvent, Rectangle } from 'electron'
2222

23-
import windowDefaults from '../webapp/defaults'
23+
import windowDefaults, { popupWindowDefaults } from '../webapp/defaults'
2424
import ISubwindowPrefs from '../models/SubwindowPrefs'
2525

2626
/**
@@ -427,6 +427,14 @@ export const getCommand = (argv: string[]): Command => {
427427
argv = JSON.parse(process.env.KUI_POPUP)
428428
}
429429

430+
if (process.env.KUI_POPUP_WINDOW_RESIZE) {
431+
subwindowPrefs = {
432+
fullscreen: true,
433+
width: popupWindowDefaults.width,
434+
height: popupWindowDefaults.height
435+
}
436+
}
437+
430438
debug('using args', argv, subwindowPrefs)
431439
return { argv, subwindowPlease, subwindowPrefs }
432440
}

packages/core/src/webapp/defaults.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ export default {
2222
width: 1200,
2323
height: 800
2424
}
25+
26+
export const popupWindowDefaults = {
27+
width: 672,
28+
height: 730
29+
}

packages/test/src/api/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const prepareElectron = (popup: string[]) => {
191191
if (popup) {
192192
// used in spawn-electron.ts
193193
opts.env['KUI_POPUP'] = JSON.stringify(popup)
194+
opts.env['KUI_POPUP_WINDOW_RESIZE'] = 'true'
194195
}
195196

196197
return new Application(opts)

0 commit comments

Comments
 (0)