mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-22 05:34:04 +02:00
feat: implement useAppControl composable for app hiding functionality and refactor index.vue to utilize it
This commit is contained in:
parent
409e10a8fd
commit
b828daff08
2 changed files with 17 additions and 8 deletions
12
composables/useAppControl.ts
Normal file
12
composables/useAppControl.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { app, window } from "@tauri-apps/api";
|
||||||
|
|
||||||
|
export function useAppControl() {
|
||||||
|
const hideApp = async (): Promise<void> => {
|
||||||
|
await app.hide();
|
||||||
|
await window.getCurrentWindow().hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
hideApp
|
||||||
|
};
|
||||||
|
}
|
|
@ -10,7 +10,7 @@
|
||||||
<Result v-for="(item, index) in group.items" :key="item.id" :item="item"
|
<Result v-for="(item, index) in group.items" :key="item.id" :item="item"
|
||||||
:selected="isSelected(groupIndex, index)" :image-url="imageUrls[item.id]"
|
:selected="isSelected(groupIndex, index)" :image-url="imageUrls[item.id]"
|
||||||
:dimensions="imageDimensions[item.id]" @select="selectItem(groupIndex, index)" @image-error="onImageError"
|
:dimensions="imageDimensions[item.id]" @select="selectItem(groupIndex, index)" @image-error="onImageError"
|
||||||
@setRef="(el) => (selectedElement = el)" />
|
@setRef="(el: HTMLElement | null) => (selectedElement = el)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</OverlayScrollbarsComponent>
|
</OverlayScrollbarsComponent>
|
||||||
|
@ -62,7 +62,6 @@
|
||||||
import { ref, computed, onMounted, watch, nextTick, shallowRef } from "vue";
|
import { ref, computed, onMounted, watch, nextTick, shallowRef } from "vue";
|
||||||
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 { platform } from "@tauri-apps/plugin-os";
|
import { platform } from "@tauri-apps/plugin-os";
|
||||||
import { listen } from "@tauri-apps/api/event";
|
import { listen } from "@tauri-apps/api/event";
|
||||||
import { useNuxtApp } from "#app";
|
import { useNuxtApp } from "#app";
|
||||||
|
@ -76,9 +75,10 @@ import type {
|
||||||
InfoColor,
|
InfoColor,
|
||||||
InfoCode,
|
InfoCode,
|
||||||
} from "~/types/types";
|
} from "~/types/types";
|
||||||
import IconsEnter from "~/components/Icons/Enter.vue";
|
import IconsEnter from "~/components/Keys/Enter.vue";
|
||||||
import IconsKey from "~/components/Icons/Key.vue";
|
import IconsKey from "~/components/Keys/Key.vue";
|
||||||
import ActionsMenu from "~/components/ActionsMenu.vue";
|
import ActionsMenu from "~/components/ActionsMenu.vue";
|
||||||
|
import { useAppControl } from "~/composables/useAppControl";
|
||||||
|
|
||||||
interface GroupedHistory {
|
interface GroupedHistory {
|
||||||
label: string;
|
label: string;
|
||||||
|
@ -583,10 +583,7 @@ const setupEventListeners = async (): Promise<void> => {
|
||||||
$keyboard.enableContext('main');
|
$keyboard.enableContext('main');
|
||||||
};
|
};
|
||||||
|
|
||||||
const hideApp = async (): Promise<void> => {
|
const { hideApp } = useAppControl();
|
||||||
await app.hide();
|
|
||||||
await window.getCurrentWindow().hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
const focusSearchInput = (): void => {
|
const focusSearchInput = (): void => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue