diff --git a/composables/useAppControl.ts b/composables/useAppControl.ts new file mode 100644 index 0000000..028f881 --- /dev/null +++ b/composables/useAppControl.ts @@ -0,0 +1,12 @@ +import { app, window } from "@tauri-apps/api"; + +export function useAppControl() { + const hideApp = async (): Promise => { + await app.hide(); + await window.getCurrentWindow().hide(); + }; + + return { + hideApp + }; +} \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index 60eb990..4290ba8 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -10,7 +10,7 @@ + @setRef="(el: HTMLElement | null) => (selectedElement = el)" /> @@ -62,7 +62,6 @@ import { ref, computed, onMounted, watch, nextTick, shallowRef } from "vue"; import { OverlayScrollbarsComponent } from "overlayscrollbars-vue"; import "overlayscrollbars/overlayscrollbars.css"; -import { app, window } from "@tauri-apps/api"; import { platform } from "@tauri-apps/plugin-os"; import { listen } from "@tauri-apps/api/event"; import { useNuxtApp } from "#app"; @@ -76,9 +75,10 @@ import type { InfoColor, InfoCode, } from "~/types/types"; -import IconsEnter from "~/components/Icons/Enter.vue"; -import IconsKey from "~/components/Icons/Key.vue"; +import IconsEnter from "~/components/Keys/Enter.vue"; +import IconsKey from "~/components/Keys/Key.vue"; import ActionsMenu from "~/components/ActionsMenu.vue"; +import { useAppControl } from "~/composables/useAppControl"; interface GroupedHistory { label: string; @@ -583,10 +583,7 @@ const setupEventListeners = async (): Promise => { $keyboard.enableContext('main'); }; -const hideApp = async (): Promise => { - await app.hide(); - await window.getCurrentWindow().hide(); -}; +const { hideApp } = useAppControl(); const focusSearchInput = (): void => { nextTick(() => {