perf: support border radius on Linux, Windows 7 and below

This commit is contained in:
tiny-craft 2023-09-05 14:43:43 +08:00
parent 8912971be0
commit 7e60eec701
7 changed files with 123 additions and 122 deletions

View File

@ -53,7 +53,7 @@ jobs:
- name: Build frontend assets - name: Build frontend assets
shell: bash shell: bash
run: | run: |
npm install -g npm@8 npm install -g npm@9
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json mv tmp.json wails.json
cd frontend cd frontend

View File

@ -59,7 +59,7 @@ jobs:
- name: Build frontend assets - name: Build frontend assets
shell: bash shell: bash
run: | run: |
npm install -g npm@8 npm install -g npm@9
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json mv tmp.json wails.json
cd frontend cd frontend

View File

@ -52,7 +52,7 @@ jobs:
- name: Build frontend assets - name: Build frontend assets
shell: bash shell: bash
run: | run: |
npm install -g npm@8 npm install -g npm@9
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json mv tmp.json wails.json
cd frontend cd frontend

View File

@ -26,7 +26,7 @@ hljs.registerLanguage('plaintext', plaintext)
const prefStore = usePreferencesStore() const prefStore = usePreferencesStore()
const connectionStore = useConnectionStore() const connectionStore = useConnectionStore()
const i18n = useI18n() const i18n = useI18n()
const initializing = ref(false) const initializing = ref(true)
onMounted(async () => { onMounted(async () => {
try { try {
initializing.value = true initializing.value = true
@ -61,12 +61,8 @@ watch(
:theme-overrides="themeOverrides" :theme-overrides="themeOverrides"
:locale="prefStore.themeLocale" :locale="prefStore.themeLocale"
class="fill-height"> class="fill-height">
<n-global-style />
<n-dialog-provider> <n-dialog-provider>
<n-spin v-show="initializing" :theme-overrides="{ opacitySpinning: 0 }" style="--wails-draggable: drag"> <app-content :loading="initializing" />
<div id="launch-container" />
</n-spin>
<app-content v-if="!initializing" class="flex-item-expand" />
<!-- top modal dialogs --> <!-- top modal dialogs -->
<connection-dialog /> <connection-dialog />
@ -82,16 +78,4 @@ watch(
</n-config-provider> </n-config-provider>
</template> </template>
<style lang="scss"> <style lang="scss"></style>
#launch-container {
width: 100vw;
height: 100vh;
}
#app-title {
text-align: center;
width: 100vw;
height: 30px;
line-height: 30px;
}
</style>

View File

@ -19,8 +19,11 @@ import iconUrl from '@/assets/images/icon.png'
const themeVars = useThemeVars() const themeVars = useThemeVars()
const props = defineProps({
loading: Boolean,
})
const data = reactive({ const data = reactive({
initializing: false,
navMenuWidth: 60, navMenuWidth: 60,
hoverResize: false, hoverResize: false,
resizing: false, resizing: false,
@ -75,7 +78,18 @@ watch(
<template> <template>
<!-- app content--> <!-- app content-->
<div id="app-content-wrapper" class="flex-box-v"> <n-spin
:show="props.loading"
:theme-overrides="{ opacitySpinning: 0 }"
style="--wails-draggable: drag; border-radius: 10px"
:style="{ backgroundColor: themeVars.bodyColor }">
<div
id="app-content-wrapper"
class="flex-box-v"
:style="{
backgroundColor: themeVars.bodyColor,
color: themeVars.textColorBase,
}">
<!-- title bar --> <!-- title bar -->
<div <div
id="app-toolbar" id="app-toolbar"
@ -165,13 +179,16 @@ watch(
</div> </div>
</div> </div>
</div> </div>
</n-spin>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
#app-content-wrapper { #app-content-wrapper {
height: 100%; width: 100vw;
height: 100vh;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
border-radius: 10px;
#app-toolbar { #app-toolbar {
background-color: v-bind('themeVars.tabColor'); background-color: v-bind('themeVars.tabColor');

View File

@ -18,17 +18,10 @@ html {
body { body {
margin: 0; margin: 0;
font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", padding: 0;
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", background-color: #0000;
sans-serif; line-height: 1.5;
} font-family: v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"
@font-face {
font-family: "Nunito";
font-style: normal;
font-weight: 400;
src: local(""),
url("../assets/fonts/nunito-v16-latin-regular.woff2") format("woff2");
} }
#app { #app {

13
main.go
View File

@ -9,6 +9,7 @@ import (
"github.com/wailsapp/wails/v2/pkg/options/assetserver" "github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/linux" "github.com/wailsapp/wails/v2/pkg/options/linux"
"github.com/wailsapp/wails/v2/pkg/options/mac" "github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
"runtime" "runtime"
"tinyrdm/backend/services" "tinyrdm/backend/services"
) )
@ -46,7 +47,7 @@ func main() {
AssetServer: &assetserver.Options{ AssetServer: &assetserver.Options{
Assets: assets, Assets: assets,
}, },
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1}, BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 0},
OnStartup: func(ctx context.Context) { OnStartup: func(ctx context.Context) {
app.startup(ctx) app.startup(ctx)
connSvc.Start(ctx) connSvc.Start(ctx)
@ -66,12 +67,18 @@ func main() {
Message: "A modern lightweight cross-platform Redis desktop client.\n\nCopyright © 2023", Message: "A modern lightweight cross-platform Redis desktop client.\n\nCopyright © 2023",
Icon: icon, Icon: icon,
}, },
//WebviewIsTransparent: true, WebviewIsTransparent: false,
//WindowIsTranslucent: true, WindowIsTranslucent: false,
},
Windows: &windows.Options{
WebviewIsTransparent: true,
WindowIsTranslucent: true,
DisableFramelessWindowDecorations: true,
}, },
Linux: &linux.Options{ Linux: &linux.Options{
Icon: icon, Icon: icon,
WebviewGpuPolicy: linux.WebviewGpuPolicyOnDemand, WebviewGpuPolicy: linux.WebviewGpuPolicyOnDemand,
WindowIsTranslucent: true,
}, },
}) })