Skip to content

Commit

Permalink
feat: semi transparent window background effect, but incompatible wit…
Browse files Browse the repository at this point in the history
…h current UI lib
  • Loading branch information
HuakunShen committed Oct 26, 2024
1 parent b212b22 commit 59c83bb
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 20 deletions.
4 changes: 4 additions & 0 deletions apps/desktop/assets/css/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
html.dark {
color-scheme: dark;
}

body {
background-color: transparent;
}
2 changes: 1 addition & 1 deletion apps/desktop/components/cmd-palette/Command.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
:resetSearchTermOnBlur="false"
:class="
cn(
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
'text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
props.class
)
"
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ onMounted(async () => {
</script>

<template>
<main class="z-10 flex h-screen flex-col">
<main class="z-10 flex h-screen flex-col rounded-md">
<Toaster :rich-colors="true" :expand="true" />
<Toaster2 />
<slot />
Expand Down
29 changes: 15 additions & 14 deletions apps/desktop/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { useRemoteCmdStore } from "~/stores/remoteCmds"
import { useSystemCmdsStore } from "~/stores/systemCmds"
import { useAppUiStore } from "~/stores/ui"
import { ComboboxInput } from "radix-vue"
import { Button } from "@kksh/vue/button"
import { Command } from "tauri-plugin-shellx-api"
import type { EventEmitter, IOPayload, OutputEvents } from "tauri-plugin-shellx-api"
import { flatten, parse, safeParse } from "valibot"
Expand Down Expand Up @@ -63,18 +64,18 @@ const appWindow = getCurrentWindow()
const runtimeConfig = useRuntimeConfig()
const cmdInputRef = ref<InstanceType<typeof ComboboxInput> | null>(null)
appConfig.$subscribe((mutation, state) => {
const mutEvts = Array.isArray(mutation.events) ? mutation.events : [mutation.events]
mutEvts.forEach((evt) => {
if (evt.key === "devExtensionPath") {
if (evt.oldValue !== evt.newValue) {
// extsObj.devExt = new Extension("Dev Extensions", state.devExtensionPath, true)
// extsObj.devExt.load()
// TODO
}
}
})
})
// appConfig.$subscribe((mutation, state) => {
// const mutEvts = Array.isArray(mutation.events) ? mutation.events : [mutation.events]
// mutEvts.forEach((evt) => {
// if (evt.key === "devExtensionPath") {
// if (evt.oldValue !== evt.newValue) {
// // extsObj.devExt = new Extension("Dev Extensions", state.devExtensionPath, true)
// // extsObj.devExt.load()
// // TODO
// }
// }
// })
// })
useListenToWindowBlur(() => {
const win = getCurrentWebviewWindow()
Expand All @@ -94,8 +95,8 @@ useListenToWindowFocus(() => {
})
onMounted(async () => {
console.log("session", session.value);
console.log("session", session.value)
appUiStore.setDefaultAction("Open")
if (appWindow.label !== "main") {
setTimeout(() => {
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ fn main() {
// }
})
.setup(|app| {
setup::window::setup_window(app.handle());
// setup::window::setup_window(app.handle());
setup::tray::create_tray(app.handle())?;
#[cfg(debug_assertions)] // only include this code on debug builds
#[cfg(all(not(target_os = "macos"), debug_assertions))]
{
app.deep_link().register("kunkun")?;
}
Expand Down
8 changes: 6 additions & 2 deletions apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
"resizable": true,
"fullscreen": false,
"titleBarStyle": "Transparent",
"transparent": false,
"transparent": true,
"hiddenTitle": true,
"visible": false
"visible": false,
"windowEffects": {
"effects": ["sidebar"],
"state": "active"
}
}
],
"security": {
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/stores/builtinCmdLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ if (rtConfig.public.isDev) {
iconifyIcon: "fa6-brands:dev",
description: "Open Dev Page",
function: async () => {
navigateTo("/dev")
return
const windows = await getAllWebviewWindows()
const found = windows.find((w) => w.label === DevWindowLabel)
if (found) {
Expand Down

0 comments on commit 59c83bb

Please sign in to comment.