-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from geksilla/feature/pane-focus-keybindings
Added pane focus specific keybindings. refs #65
- Loading branch information
Showing
3 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
|
||
|
||
.proton-which-key { | ||
font-size: 15px; | ||
font-size: 13px; | ||
font-family: Courier New; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(ns proton.lib.pane_manager) | ||
|
||
(defn get-panes [] | ||
"Returns list of panes." | ||
(.getPanes js/atom.workspace)) | ||
|
||
(defn get-panels | ||
"Returns list of panels by location. | ||
Possible locations: left, right, top, bottom, modal" | ||
[location] | ||
(seq (.getPanels js/atom.workspace location))) | ||
|
||
(defn focus-on-panel [panel] | ||
(if-let [item (.getItem panel)] | ||
(.focus item))) | ||
|
||
(defn focus-on-pane [pane] | ||
(when-not (nil? pane) | ||
(.activate pane))) | ||
|
||
(defn focus-on-item [n] | ||
(let [panels-left (get-panels "left") | ||
panels-left-count (count panels-left) | ||
panels-right (get-panels "right") | ||
panels-right-count (count panels-right) | ||
panes (get-panes) | ||
panes-count (count panes)] | ||
(cond (> panels-left-count n) (focus-on-panel (nth panels-left n)) | ||
(> (+ panels-left-count panes-count) n) (focus-on-pane (nth panes (- n panels-left-count))) | ||
(> (+ panels-right-count panels-left-count panes-count) n) (focus-on-panel (nth panels-right (- n (+ panes-count panels-left-count))))))) |