added some keybinds
ctrl+r - reload prompt ctrl+shift+r force reload ctrl+e queue ctrl+h home ctrl+shift+h history
This commit is contained in:
parent
7e78583682
commit
44aff83e91
1 changed files with 44 additions and 23 deletions
|
@ -1,34 +1,12 @@
|
||||||
const Events = {
|
const Events = {
|
||||||
InitEvents() {
|
InitEvents() {
|
||||||
const app = window.app
|
const app = window.app
|
||||||
// Key binds
|
|
||||||
document.addEventListener('keydown', function (e) {
|
|
||||||
if (e.keyCode === 70 && e.ctrlKey) {
|
|
||||||
app.$refs.searchInput.focus()
|
|
||||||
app.$refs.searchInput.select()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// add event listener for when window.location.hash changes
|
// add event listener for when window.location.hash changes
|
||||||
window.addEventListener("hashchange", function () {
|
window.addEventListener("hashchange", function () {
|
||||||
app.appRoute(window.location.hash)
|
app.appRoute(window.location.hash)
|
||||||
});
|
});
|
||||||
|
|
||||||
// Key bind to unjam MusicKit in case it fails: CTRL+F10
|
|
||||||
|
|
||||||
document.addEventListener('keydown', function (event) {
|
|
||||||
if (event.ctrlKey && event.keyCode == 121) {
|
|
||||||
try {
|
|
||||||
app.mk._services.mediaItemPlayback._currentPlayer.stop()
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
app.mk._services.mediaItemPlayback._currentPlayer.destroy()
|
|
||||||
} catch (e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener("mouseup", (e) => {
|
window.addEventListener("mouseup", (e) => {
|
||||||
if (e.button === 3) {
|
if (e.button === 3) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
@ -39,7 +17,50 @@ const Events = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('keydown', function (event) {
|
document.addEventListener('keydown', async function (event) {
|
||||||
|
if (event.keyCode === 70 && event.ctrlKey) {
|
||||||
|
app.$refs.searchInput.focus()
|
||||||
|
app.$refs.searchInput.select()
|
||||||
|
}
|
||||||
|
// CTRL + R
|
||||||
|
if (event.keyCode === 82 && event.ctrlKey) {
|
||||||
|
event.preventDefault()
|
||||||
|
bootbox.confirm("Reload Cider?", (res)=>{
|
||||||
|
if(res) {
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// CTRL + SHIFT + R
|
||||||
|
if (event.keyCode === 82 && event.ctrlKey && event.shiftKey) {
|
||||||
|
event.preventDefault()
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
|
// CTRL + E
|
||||||
|
if (event.keyCode === 69 && event.ctrlKey) {
|
||||||
|
app.invokeDrawer('queue')
|
||||||
|
}
|
||||||
|
// CTRL+H
|
||||||
|
if (event.keyCode === 72 && event.ctrlKey) {
|
||||||
|
app.appRoute("home")
|
||||||
|
}
|
||||||
|
// CTRL+SHIFT+H
|
||||||
|
if (event.ctrlKey && event.shiftKey && event.keyCode == 72) {
|
||||||
|
let hist = await app.mk.api.v3.music(`/v1/me/recent/played/tracks`, {
|
||||||
|
l: app.mklang
|
||||||
|
})
|
||||||
|
app.showCollection(hist.data, app.getLz('term.history'))
|
||||||
|
}
|
||||||
|
if (event.ctrlKey && event.keyCode == 121) {
|
||||||
|
try {
|
||||||
|
app.mk._services.mediaItemPlayback._currentPlayer.stop()
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
app.mk._services.mediaItemPlayback._currentPlayer.destroy()
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
if (event.ctrlKey && event.keyCode == 122) {
|
if (event.ctrlKey && event.keyCode == 122) {
|
||||||
try {
|
try {
|
||||||
ipcRenderer.send('detachDT', '')
|
ipcRenderer.send('detachDT', '')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue