Skip to content

Commit

Permalink
feat: can drag window
Browse files Browse the repository at this point in the history
  • Loading branch information
0xzion committed May 15, 2024
1 parent 08ecf47 commit 944a6f8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 11 deletions.
13 changes: 13 additions & 0 deletions apps/desktop/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ serde_json = "1.0"
actix-web = "4"
rusqlite = { version = "0.31.0", features = ["bundled"] }
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.6", features = [
tauri = { version = "1.6", features = [ "window-start-dragging",
"shell-open",
"fs-all",
"http-all",
Expand All @@ -37,6 +37,7 @@ tauri = { version = "1.6", features = [
"devtools",
] }
tauri-plugin-clipboard = "0.6.10"
window-shadows = "0.2.2"


[features]
Expand Down
7 changes: 6 additions & 1 deletion apps/desktop/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ use actix_web::{
App, HttpResponse, HttpServer, Responder,
};

use window_shadows::set_shadow;

use serde::{Deserialize, Serialize};
use serde_json::json;

Expand Down Expand Up @@ -153,7 +155,7 @@ fn main() {
window.center().unwrap();
}
"Editor" => {
let window = app.get_window("editor").unwrap();
let window = app.get_window("dev_editor").unwrap();
window.emit("MenuEditorClicked", Some("Yes")).unwrap();
window.show().unwrap();
window.center().unwrap();
Expand All @@ -180,6 +182,9 @@ fn main() {

thread::spawn(move || start_server(*boxed_handle, *boxed_conn).unwrap());

let window = app.get_window("main").unwrap();
set_shadow(&window, true).expect("Unsupported platform!");

Ok(())
})
.run(tauri::generate_context!())
Expand Down
9 changes: 5 additions & 4 deletions apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"setFocus": true,
"setSize": true,
"center": true,
"setSkipTaskbar": true
"setSkipTaskbar": true,
"startDragging": true
},
"protocol": {
"asset": true,
Expand Down Expand Up @@ -98,7 +99,7 @@
"width": 750,
"height": 470,
"alwaysOnTop": true,
"decorations": true,
"decorations": false,
"transparent": true,
"center": true,
"skipTaskbar": true
Expand All @@ -114,7 +115,7 @@
"decorations": true,
"visible": false,
"center": true,
"url": "http://localhost:3000/editor.html"
"url": "editor.html"
},
{
"label": "dev_editor",
Expand All @@ -127,7 +128,7 @@
"decorations": true,
"visible": false,
"center": true,
"url": "http://localhost:3000/editor.html"
"url": "http://localhost:3000/editor"
}
],
"macOSPrivateApi": true
Expand Down
22 changes: 17 additions & 5 deletions apps/desktop/src/components/CmdkRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const CmdkRoot = () => {
<StyledCommand
label="Command Menu"
className="command-panel"
shadow="0 16px 70px rgba(0,0,0,.2)"
// shadow="0 16px 70px rgba(0,0,0,.2)"
w={['100%']}
column
absolute
Expand All @@ -156,9 +156,11 @@ export const CmdkRoot = () => {
zIndex-10000
// bgNeutral100
bgWhite
style={{
backdropFilter: 'blur(200px)',
}}
style={
{
// backdropFilter: 'blur(200px)',
}
}
loop
filter={(value, search) => {
// console.log('value:', value, 'search:', search)
Expand All @@ -168,6 +170,7 @@ export const CmdkRoot = () => {
<CommandInput
ref={ref as any}
id="searchBarInput"
selectNone
toCenterY
bgTransparent
w-100p
Expand Down Expand Up @@ -253,7 +256,16 @@ export const CmdkRoot = () => {
</CommandList>
</Box>

<Box h-48 borderTop borderNeutral200 toCenterY px4 toBetween>
<Box
data-tauri-drag-region
selectNone
h-48
borderTop
borderNeutral200
toCenterY
px4
toBetween
>
<Image
src="/logo/128x128.png"
alt=""
Expand Down

0 comments on commit 944a6f8

Please sign in to comment.