mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
add keyboard shortcut ctrl/cmd+alt+arrow to switch tabs
This commit is contained in:
parent
158ecd4ab1
commit
1c9b6c3eef
1 changed files with 15 additions and 0 deletions
|
@ -327,6 +327,8 @@ public class AppController implements Initializable {
|
|||
EventManager.get().post(new OpenWalletsEvent(tabs.getScene().getWindow(), Collections.emptyList()));
|
||||
});
|
||||
|
||||
registerShortcuts();
|
||||
|
||||
BitcoinUnit unit = Config.get().getBitcoinUnit();
|
||||
if(unit == null) {
|
||||
unit = BitcoinUnit.AUTO;
|
||||
|
@ -408,6 +410,19 @@ public class AppController implements Initializable {
|
|||
setNetworkLabel();
|
||||
}
|
||||
|
||||
private void registerShortcuts() {
|
||||
tabs.getScene().addEventFilter(KeyEvent.KEY_PRESSED, event -> {
|
||||
if(event.isShortcutDown() && event.isAltDown()) {
|
||||
int currentIndex = tabs.getSelectionModel().getSelectedIndex();
|
||||
if(event.getCode() == KeyCode.LEFT && currentIndex > 0) {
|
||||
tabs.getSelectionModel().select(currentIndex - 1);
|
||||
} else if(event.getCode() == KeyCode.RIGHT && currentIndex < tabs.getTabs().size() - 1) {
|
||||
tabs.getSelectionModel().select(currentIndex + 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setPlatformApplicationMenu() {
|
||||
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent();
|
||||
if(platform == org.controlsfx.tools.Platform.OSX) {
|
||||
|
|
Loading…
Reference in a new issue