hackjutsu / Lepton

💻 Democratizing Snippet Management (macOS/Win/Linux)
https://hackjutsu.com/Lepton
MIT License
10.14k stars 475 forks source link

configure shortcuts via .leptonrc #404

Closed moia-sven-ole closed 4 years ago

moia-sven-ole commented 4 years ago

Hey I really like the project! Great work! From my point, configuring the shortcuts were missing - so here we go.

I have added the possibility to override the shortcuts in the main.js by setting them in .leptonrc file. This would also work for partial overrides.

e.g. in your < homeDir >/.leptonrc

partial

{
    "theme": "dark",
    ...
    "shortcuts": {
        "keyNewGist": "CMD+C",
        "keyDashboard": "CommandOrControl+D",
        "keyEditorExit": "CommandOrControl+Escape",
        "keySyncGists": "CommandOrControl+R"
    }
}

full

{
    "theme": "dark",
    ...
    "shortcuts": {
        "keyShortcutForSearch": "CMD+F",
        "keyNewGist": "CommandOrControl+N",
        "keyEditGist": "CommandOrControl+E",
        "keySubmitGist": "CommandOrControl+S",
        "keyImmersiveMode": "CommandOrControl+I",
        "keyAboutPage": "CommandOrControl+,",
        "keyDashboard": "CommandOrControl+D",
        "keyEditorExit": "CommandOrControl+Escape",
        "keySyncGists": "CommandOrControl+R"
    }
}
kjellski commented 4 years ago

Awesome PR - love me some configuration options! :) @hackjutsu can we help to make this happen?

hackjutsu commented 4 years ago

Yes, let's merge it. Thanks!

anthonyattard commented 4 years ago

Loving this addition! Thanks @moia-sven-ole