mirror of https://github.com/logseq/logseq
enhance: add hotkeys for open file in directory / default app
parent
5bcc7aca38
commit
5221eb0572
|
@ -91,12 +91,6 @@
|
|||
:page-presentation
|
||||
{:page page}))}}
|
||||
|
||||
(when-let [file-path (and (util/electron?) (page-handler/get-page-file-path))]
|
||||
[{:title (t :page/open-in-finder)
|
||||
:options {:on-click #(js/window.apis.showItemInFolder file-path)}}
|
||||
{:title (t :page/open-with-default-app)
|
||||
:options {:on-click #(js/window.apis.openPath file-path)}}])
|
||||
|
||||
(when-not contents?
|
||||
{:title (t :page/delete)
|
||||
:options {:on-click #(state/set-modal! (delete-page-dialog page-name))}})
|
||||
|
|
|
@ -690,3 +690,11 @@
|
|||
(:db/id page)
|
||||
:page
|
||||
page)))
|
||||
|
||||
(defn open-file-in-default-app []
|
||||
(when-let [file-path (and (util/electron?) (get-page-file-path))]
|
||||
(js/window.apis.openPath file-path)))
|
||||
|
||||
(defn open-file-in-directory []
|
||||
(when-let [file-path (and (util/electron?) (get-page-file-path))]
|
||||
(js/window.apis.showItemInFolder file-path)))
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
[frontend.util :refer [mac?] :as util]
|
||||
[frontend.commands :as commands]))
|
||||
|
||||
;; Note – when you change this file, you will need to do a hard reset.
|
||||
;; The commands are registered when the Clojurescript code runs for the first time.
|
||||
|
||||
;; TODO: how to extend this for plugins usage? An atom?
|
||||
(def default-config
|
||||
{:shortcut.handler/date-picker
|
||||
|
@ -376,6 +379,14 @@
|
|||
{:desc "Toggle Favorites in sidebar"
|
||||
:binding "t f"
|
||||
:fn ui-handler/toggle-contents!}
|
||||
:editor/open-file-in-default-app
|
||||
{:desc "Open file in default app"
|
||||
:binding "o f"
|
||||
:fn page-handler/open-file-in-default-app}
|
||||
:editor/open-file-in-directory
|
||||
{:desc "Open file in parent directory"
|
||||
:binding "o d"
|
||||
:fn page-handler/open-file-in-directory}
|
||||
:ui/toggle-wide-mode
|
||||
{:desc "Toggle wide mode"
|
||||
:binding "t w"
|
||||
|
|
Loading…
Reference in New Issue