-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add standard menu keybinding for "Escape" * fix pipeline
- Loading branch information
1 parent
c866ca8
commit afb3934
Showing
5 changed files
with
71 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Ref } from "vue"; | ||
import { useRouter } from "vue-router"; | ||
import { onKeyDown } from "@vueuse/core"; | ||
import { settingsStore } from "@renderer/store/settings.store"; | ||
|
||
type KeybindingProps = { exitOpen: Ref<boolean, boolean> }; | ||
|
||
export function useGlobalKeybindings({ exitOpen }: KeybindingProps) { | ||
const router = useRouter(); | ||
|
||
onKeyDown("F11", (e) => { | ||
e.preventDefault(); | ||
settingsStore.fullscreen = !settingsStore.fullscreen; | ||
}); | ||
|
||
onKeyDown("Escape", (e) => { | ||
e.preventDefault(); | ||
if (router.currentRoute.value.path.startsWith("/login") || router.currentRoute.value.path.startsWith("/home")) { | ||
exitOpen.value = !exitOpen.value; | ||
} else { | ||
const routeSegments = router.currentRoute.value.path.split("/"); | ||
// "/primary/secondary" => ["", "primary", "secondary", ...] | ||
if (routeSegments.length <= 3) { | ||
router.push("/home"); | ||
} else { | ||
router.back(); | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters