diff --git a/frontend/src/assets/icon.png b/frontend/src/assets/icon.png new file mode 100644 index 00000000..b504b3c6 Binary files /dev/null and b/frontend/src/assets/icon.png differ diff --git a/frontend/src/assets/logo.png b/frontend/src/assets/logo.png deleted file mode 100644 index f3d2503f..00000000 Binary files a/frontend/src/assets/logo.png and /dev/null differ diff --git a/frontend/src/assets/window-close.svg b/frontend/src/assets/window-close.svg new file mode 100644 index 00000000..3b02b087 --- /dev/null +++ b/frontend/src/assets/window-close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/assets/window-maximize.svg b/frontend/src/assets/window-maximize.svg new file mode 100644 index 00000000..6f76d581 --- /dev/null +++ b/frontend/src/assets/window-maximize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/assets/window-minimize.svg b/frontend/src/assets/window-minimize.svg new file mode 100644 index 00000000..869a1c1f --- /dev/null +++ b/frontend/src/assets/window-minimize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/assets/window-unmaximize.svg b/frontend/src/assets/window-unmaximize.svg new file mode 100644 index 00000000..0ac7922d --- /dev/null +++ b/frontend/src/assets/window-unmaximize.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/components/TitleBar.vue b/frontend/src/components/TitleBar.vue index 8ea7bd80..4ce29b7a 100644 --- a/frontend/src/components/TitleBar.vue +++ b/frontend/src/components/TitleBar.vue @@ -1,28 +1,73 @@ @@ -82,10 +152,82 @@ export default { display: flex; align-items: center; justify-content: center; + -webkit-user-select: none; + -webkit-app-region: drag; } .title { margin: 0; text-align: center; + height: 100%; + display: flex; + align-items: center; +} + +.logo { + height: 60%; + margin: 0 5px; + -webkit-app-region: no-drag; +} + +.action { + display: flex; + flex-grow: 0; + flex-shrink: 0; + text-align: center; + position: relative; + z-index: 3000; + -webkit-app-region: no-drag; + height: 100%; + width: 138px; + margin-left: auto; +} + +.action .btn { + display: inline-block; + -webkit-app-region: no-drag; + height: 100%; + width: 33.34%; +} + +.action .icon { + background-color: #cccccc; + height: 100%; + width: 100%; + mask-size: 23.1%; +} + +.action .icon.unmaximize { + mask: url(~@/assets/window-unmaximize.svg) no-repeat 50% 50%; +} + +.action .icon.maximize { + mask: url(~@/assets/window-maximize.svg) no-repeat 50% 50%; +} + +.action .icon.minimize { + mask: url(~@/assets/window-minimize.svg) no-repeat 50% 50%; +} + +.action .icon.close { + mask: url(~@/assets/window-close.svg) no-repeat 50% 50%; +} + +.action .btn:hover { + background-color: hsla(0, 0%, 100%, .1) +} + +.action .btn.pin { + display: flex; + align-items: center; + justify-content: center; +} + +.action .btn.pin.ontop { + background-color: hsla(0, 0%, 100%, .3) +} + +.action .btn.pin .pin-icon { + fill: hsla(0, 0%, 100%, .5) } diff --git a/src/app.ts b/src/app.ts index 85197d04..12a39abb 100644 --- a/src/app.ts +++ b/src/app.ts @@ -32,8 +32,9 @@ const createWindow = () => { win = new BrowserWindow({ maximizable: true, show: false, - minWidth: 700, + minWidth: 800, minHeight: 500, + frame: false, backgroundColor: '#282a2b', webPreferences: { webSecurity: false, @@ -41,7 +42,7 @@ const createWindow = () => { }, }) - win.maximize() + // win.maximize() win.show() win.setMenu(null) @@ -90,7 +91,7 @@ const showWindow = () => { win.setSkipTaskbar(false) win.show() } - if (win.isFocused() && win.isVisible()) { + if (win.isVisible()) { hide() } else { // 先隐藏再显示,以便在 windows 10 当前虚拟窗口展示