]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Added custom hotkey support
authorRobin Schneider <robin-schneider@outlook.de>
Sat, 11 Sep 2021 10:42:57 +0000 (12:42 +0200)
committerRobin Schneider <robin-schneider@outlook.de>
Sat, 11 Sep 2021 10:42:57 +0000 (12:42 +0200)
docs/configuration.md
src/App.vue
src/components/SearchInput.vue

index a472b416d7ed707946b8d615975d96aa64200355..93abadbc4608eef1e03952dba161a060c9f580de 100644 (file)
@@ -19,6 +19,8 @@ logo: "assets/logo.png"
 # icon: "fas fa-skull-crossbones"
 
 header: true # Set to false to hide the header
+# Optional: Different hotkey for search, defaults to "/"
+# hotkey: "Shift"
 footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it.
 
 columns: "3" # "auto" or number (must be a factor of 12: 1, 2, 3, 4, 6, 12)
index 1f4f5099625a26583174a504bf862d0497e32661..9b4803f2d04005e1092c3846ee9baa68998f8acf 100644 (file)
@@ -41,6 +41,7 @@
 
         <SearchInput
           class="navbar-item is-inline-block-mobile"
+          :hotkey="config.hotkey"
           @input="filterServices"
           @search-focus="showMenu = true"
           @search-open="navigateToFirstService"
index 40c5a1de1e02981705ca763e50234c9130f34e64..c4c11a2dc723695d4cbb3fdf2039480a3bca394a 100644 (file)
 <script>
 export default {
   name: "SearchInput",
-  props: ["value"],
+  props: {
+    value: String,
+    hotkey: {
+      type: String,
+      default: "/"
+    }
+  },
   mounted() {
     this._keyListener = function (event) {
-      if (event.key === "/") {
+      if (event.key === this.hotkey) {
         event.preventDefault();
         this.focus();
       }