detect OS

in order to remove/add sidebar padding on the Sidebar
This commit is contained in:
Pavel Laptev 2024-02-27 22:58:31 +01:00 committed by Mattias Granlund
parent 7b1499e797
commit e58356bd14
4 changed files with 54 additions and 3 deletions

39
Cargo.lock generated
View File

@ -5192,6 +5192,19 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "sys-locale"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8a11bd9c338fdba09f7881ab41551932ad42e405f61d01e8406baea71c07aee"
dependencies = [
"js-sys",
"libc",
"wasm-bindgen",
"web-sys",
"windows-sys 0.45.0",
]
[[package]]
name = "sysctl"
version = "0.5.5"
@ -5356,6 +5369,7 @@ dependencies = [
"objc",
"once_cell",
"open",
"os_info",
"percent-encoding",
"rand 0.8.5",
"raw-window-handle",
@ -5367,6 +5381,7 @@ dependencies = [
"serde_repr",
"serialize-to-javascript",
"state",
"sys-locale",
"tar",
"tauri-macros",
"tauri-runtime",
@ -6483,6 +6498,15 @@ dependencies = [
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
@ -6501,6 +6525,21 @@ dependencies = [
"windows-targets 0.52.0",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]]
name = "windows-targets"
version = "0.48.5"

View File

@ -64,7 +64,7 @@ similar = { version = "2.4.0", features = ["unicode"] }
slug = "0.1.5"
ssh-key = { version = "0.6.4", features = [ "alloc", "ed25519" ] }
ssh2 = { version = "0.9.4", features = ["vendored-openssl"] }
tauri = { version = "1.5.4", features = ["dialog-open", "fs-read-file", "path-all", "process-relaunch", "protocol-asset", "shell-open", "window-maximize", "window-start-dragging", "window-unmaximize"] }
tauri = { version = "1.5.4", features = [ "os-all", "dialog-open", "fs-read-file", "path-all", "process-relaunch", "protocol-asset", "shell-open", "window-maximize", "window-start-dragging", "window-unmaximize"] }
tauri-plugin-context-menu = { git = "https://github.com/c2r0b/tauri-plugin-context-menu", branch = "main" }
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }

View File

@ -21,6 +21,9 @@
"dialog": {
"open": true
},
"os": {
"all": true
},
"protocol": {
"asset": true,
"assetScope": ["$APPCACHE/images/*"]

View File

@ -9,6 +9,7 @@
import { navCollapsed } from '$lib/config/config';
import { persisted } from '$lib/persisted/persisted';
import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings';
import { type Platform, platform } from '@tauri-apps/api/os';
import { getContext } from 'svelte';
import type { User } from '$lib/backend/cloud';
import type { Project, ProjectService } from '$lib/backend/projects';
@ -40,6 +41,13 @@
$: isNavCollapsedPersist = navCollapsed();
let isNavCollapsed = $isNavCollapsedPersist;
// Detect is the platform is Mac
let isMacos = false;
platform().then((name) => {
isMacos = name === 'darwin';
});
</script>
{#if isNavCollapsed}
@ -78,7 +86,9 @@
role="menu"
tabindex="0"
>
<div class="drag-region" data-tauri-drag-region></div>
{#if isMacos}
<div class="drag-region" data-tauri-drag-region />
{/if}
<div class="hide-nav-button">
<Button
icon="fold-lane"
@ -122,7 +132,6 @@
display: flex;
flex-direction: column;
position: relative;
/* border-right: 1px solid var(--clr-theme-container-outline-light); */
background: var(--clr-theme-container-light);
max-height: 100%;
user-select: none;