front end enhancements

This commit is contained in:
pandadev 2024-07-05 01:33:58 +02:00
parent 81bd998a2e
commit c66cbc673a
No known key found for this signature in database
GPG key ID: C39629DACB8E762F
55 changed files with 49 additions and 36 deletions

55
app.vue
View file

@ -33,9 +33,9 @@
{{ truncateContent(item.content) }} {{ truncateContent(item.content) }}
</div> </div>
</OverlayScrollbarsComponent> </OverlayScrollbarsComponent>
<div class="content"> <OverlayScrollbarsComponent class="content">
{{ filteredHistory[selectedIndex]?.content || '' }} {{ filteredHistory[selectedIndex]?.content || '' }}
</div> </OverlayScrollbarsComponent>
<Noise /> <Noise />
</div> </div>
</template> </template>
@ -44,18 +44,19 @@
import { ref, computed, onMounted, watch, nextTick } from 'vue'; import { ref, computed, onMounted, watch, nextTick } from 'vue';
import Database from '@tauri-apps/plugin-sql'; import Database from '@tauri-apps/plugin-sql';
import { register, unregister, isRegistered } from '@tauri-apps/plugin-global-shortcut'; import { register, unregister, isRegistered } from '@tauri-apps/plugin-global-shortcut';
import { writeText } from '@tauri-apps/plugin-clipboard-manager'; import { writeText, paste } from '@tauri-apps/plugin-clipboard-manager';
import { OverlayScrollbarsComponent } from "overlayscrollbars-vue"; import { OverlayScrollbarsComponent } from "overlayscrollbars-vue";
import 'overlayscrollbars/overlayscrollbars.css'; import 'overlayscrollbars/overlayscrollbars.css';
import { app, window } from '@tauri-apps/api'; import { app, window } from '@tauri-apps/api';
import { platform } from '@tauri-apps/plugin-os'; import { platform } from '@tauri-apps/plugin-os';
import { invoke } from '@tauri-apps/api/core'; import { invoke } from '@tauri-apps/api/core';
import { enable, isEnabled } from "@tauri-apps/plugin-autostart"; import { enable, isEnabled } from "@tauri-apps/plugin-autostart";
import { listen } from '@tauri-apps/api/event';
const db = ref(null);
const history = ref([]); const history = ref([]);
const searchQuery = ref(''); const searchQuery = ref('');
const selectedIndex = ref(0); const selectedIndex = ref(0);
const isVisible = ref(false);
const resultsContainer = ref(null); const resultsContainer = ref(null);
const selectedElement = ref(null); const selectedElement = ref(null);
const os = platform(); const os = platform();
@ -127,11 +128,8 @@ const pasteSelectedItem = async () => {
const selectedItem = filteredHistory.value[selectedIndex.value]; const selectedItem = filteredHistory.value[selectedIndex.value];
if (selectedItem) { if (selectedItem) {
await writeText(selectedItem.content); await writeText(selectedItem.content);
isVisible.value = false; await hideApp();
await app.hide(); await invoke("simulate_paste");
await window.getCurrent().hide();
await window.getCurrent().setFocus();
await invoke('simulate_paste');
} }
}; };
@ -143,31 +141,32 @@ const truncateContent = (content) => {
}; };
onMounted(async () => { onMounted(async () => {
const db = await Database.load('sqlite:data.db'); db.value = await Database.load('sqlite:data.db');
history.value = await db.select('SELECT * FROM history ORDER BY timestamp DESC'); await refreshHistory();
if (await isRegistered("MetaLeft+V")) {
await unregister("MetaLeft+V")
}
await register('MetaLeft+V', (event) => {
if (event.state === "MetaLeft+V") {
if (isVisible.value == true) {
app.hide()
isVisible.value = false;
} else {
app.show()
isVisible.value = true;
selectedIndex.value = 0;
}
}
});
if (!await isEnabled()) { if (!await isEnabled()) {
await enable() await enable()
} }
await listen('tauri://blur', hideApp);
}); });
const refreshHistory = async () => {
history.value = await db.value.select('SELECT * FROM history ORDER BY timestamp DESC');
};
const hideApp = async () => {
await app.hide();
await window.getCurrent().hide();
};
const showApp = async () => {
await refreshHistory();
await app.show();
await window.getCurrent().show();
selectedIndex.value = 0;
};
watch(selectedIndex, scrollToSelectedItem); watch(selectedIndex, scrollToSelectedItem);
</script> </script>

View file

@ -90,7 +90,7 @@ body,
flex-direction: column; flex-direction: column;
padding-inline: 8px; padding-inline: 8px;
padding-top: 14px; padding-top: 14px;
padding-bottom: 8px; padding-bottom: 49px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
@ -115,17 +115,27 @@ body,
} }
.content { .content {
position: fixed; position: absolute;
top: 53px; top: 53px;
left: 284px; left: 284px;
padding: 10px; padding: 10px;
height: calc(100vh - 96px);
padding-inline: 14px; padding-inline: 14px;
font-family: SFMonoRegular; font-family: SFMonoRegular !important;
font-size: 12px; font-size: 12px;
border-radius: 10px;
width: calc(100vw - 286px);
white-space: pre-wrap;
word-wrap: break-word;
div {
border-radius: 10px;
font-family: SFMonoRegular !important;
}
} }
.bottom-bar { .bottom-bar {
height: 40px; height: 41px;
width: calc(100vw - 2px); width: calc(100vw - 2px);
backdrop-filter: blur(18px); backdrop-filter: blur(18px);
background-color: rgba(46, 45, 43, 0.8); background-color: rgba(46, 45, 43, 0.8);
@ -140,6 +150,7 @@ body,
padding-inline: 12px; padding-inline: 12px;
align-items: center; align-items: center;
font-size: 14px; font-size: 14px;
border-top: 1px solid $divider;
p { p {
color: $text2; color: $text2;

1
src-tauri/Cargo.lock generated
View file

@ -4078,6 +4078,7 @@ dependencies = [
"gtk", "gtk",
"heck 0.5.0", "heck 0.5.0",
"http", "http",
"image 0.24.9",
"jni", "jni",
"libc", "libc",
"log", "log",

View file

@ -18,16 +18,16 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2.0.0-beta.18", features = [] } tauri-build = { version = "2.0.0-beta.18", features = [] }
[dependencies] [dependencies]
tauri = { version = "2.0.0-beta.23", features = ["unstable"] } tauri = { version = "2.0.0-beta.23", features = ["unstable", "tray-icon", "image-png"] }
tauri-plugin-clipboard-manager = "2.1.0-beta.5" tauri-plugin-clipboard-manager = "2.1.0-beta.5"
tauri-plugin-window-state = "2.0.0-beta.10" tauri-plugin-window-state = "2.0.0-beta.10"
tauri-plugin-sql = {version = "2.0.0-beta.8", features = ["sqlite"] } tauri-plugin-sql = {version = "2.0.0-beta.8", features = ["sqlite"] }
tauri-plugin-global-shortcut = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-global-shortcut = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-autostart = "2.0.0-beta.8" tauri-plugin-autostart = "2.0.0-beta.8"
tauri-plugin-os = "2.0.0-beta.7"
sqlx = { version = "0.7.4", features = ["runtime-tokio-native-tls", "sqlite"] } sqlx = { version = "0.7.4", features = ["runtime-tokio-native-tls", "sqlite"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.0", features = ["full"] } tokio = { version = "1.0", features = ["full"] }
serde_json = "1.0" serde_json = "1.0"
rdev = "0.5.3" rdev = "0.5.3"
rand = "0.8" rand = "0.8"
tauri-plugin-os = "2.0.0-beta.7"

View file

@ -37,6 +37,8 @@
"app:allow-app-show", "app:allow-app-show",
"window:allow-hide", "window:allow-hide",
"window:allow-show", "window:allow-show",
"window:allow-set-focus" "window:allow-set-focus",
"window:allow-is-focused",
"window:allow-is-visible"
] ]
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

@ -25,7 +25,7 @@
"center": true, "center": true,
"shadow": false, "shadow": false,
"transparent": true, "transparent": true,
"visible": false "skipTaskbar": true
} }
], ],
"security": { "security": {