Skip to content

Commit

Permalink
add a hotkey for settings (#991)
Browse files Browse the repository at this point in the history
* add a hotkey for settings

for #942

* playwright test for settings menu hotkey

* make hotkey intercompatible with both old and new UI
  • Loading branch information
mcmonkey4eva committed Sep 26, 2024
1 parent 05f9999 commit 81119ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions browser_tests/interaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,15 @@ test.describe('Load duplicate workflow', () => {
expect(await comfyPage.getGraphNodesCount()).toBe(1)
})
})

test.describe('Menu interactions', () => {
test('Can open settings with hotkey', async ({ comfyPage }) => {
await comfyPage.page.keyboard.down('ControlOrMeta')
await comfyPage.page.keyboard.press(',')
await comfyPage.page.keyboard.up('ControlOrMeta')
const settingsLocator = comfyPage.page.locator('.settings-container')
await expect(settingsLocator).toBeVisible()
await comfyPage.page.keyboard.press('Escape')
await expect(settingsLocator).not.toBeVisible()
})
})
1 change: 1 addition & 0 deletions src/components/sidebar/SidebarSettingsToggleIcon.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<SidebarIcon
icon="pi pi-cog"
class="comfy-settings-btn"
@click="showSetting"
:tooltip="$t('settings')"
/>
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/core/keybinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ app.registerExtension({
o: '#comfy-file-input',
Backspace: '#comfy-clear-button',
d: '#comfy-load-default-button',
g: '#comfy-group-selected-nodes-button'
g: '#comfy-group-selected-nodes-button',
',': '.comfy-settings-btn'
}

const modifierKeybindId = modifierKeyIdMap[event.key]
Expand Down

0 comments on commit 81119ac

Please sign in to comment.