2222 <CollectiveSettings
2323 v-if =" showCollectiveSettings "
2424 :collective =" settingsCollective " />
25+ <CommandPalette />
2526 </NcContent >
2627</template >
2728
2829<script >
2930import { NcContent } from ' @nextcloud/vue'
3031import { mapActions , mapState } from ' pinia'
3132import CollectiveSettings from ' ./components/Nav/CollectiveSettings.vue'
33+ import CommandPalette from ' ./components/CommandPalette.vue'
3234import NavigationBar from ' ./components/NavigationBar.vue'
3335import PageSidebar from ' ./components/PageSidebar.vue'
3436import { useNetworkState } from ' ./composables/useNetworkState.js'
3537import { useCollectivesStore } from ' ./stores/collectives.js'
38+ import { useCommandPaletteStore } from ' ./stores/commandPalette.js'
3639import { usePagesStore } from ' ./stores/pages.js'
3740import { useRootStore } from ' ./stores/root.js'
3841import { useSettingsStore } from ' ./stores/settings.js'
@@ -43,6 +46,7 @@ export default {
4346
4447 components: {
4548 CollectiveSettings,
49+ CommandPalette,
4650 NcContent,
4751 NavigationBar,
4852 PageSidebar,
@@ -102,6 +106,11 @@ export default {
102106
103107 mounted () {
104108 this .getCollectivesAndSettings ()
109+ this .setupKeyboardShortcuts ()
110+ },
111+
112+ beforeDestroy () {
113+ this .removeKeyboardShortcuts ()
105114 },
106115
107116 methods: {
@@ -110,6 +119,7 @@ export default {
110119 ' getCollectives' ,
111120 ' getTrashCollectives' ,
112121 ]),
122+ ... mapActions (useCommandPaletteStore, { toggleCommandPalette: ' toggle' }),
113123
114124 async getCollectivesAndSettings () {
115125 this .loadPending = true
@@ -137,6 +147,22 @@ export default {
137147
138148 this .loadPending = false
139149 },
150+
151+ setupKeyboardShortcuts () {
152+ document .addEventListener (' keydown' , this .handleGlobalKeyDown )
153+ },
154+
155+ removeKeyboardShortcuts () {
156+ document .removeEventListener (' keydown' , this .handleGlobalKeyDown )
157+ },
158+
159+ handleGlobalKeyDown (event ) {
160+ // Check for Cmd+K (Mac) or Ctrl+K (Windows/Linux)
161+ if ((event .metaKey || event .ctrlKey ) && event .key === ' k' ) {
162+ event .preventDefault ()
163+ this .toggleCommandPalette ()
164+ }
165+ },
140166 },
141167
142168}
0 commit comments