diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 5f316daf..5fd6ebc3 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -411,16 +411,30 @@ public class AppController implements Initializable { } 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); + org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent(); + if(platform == org.controlsfx.tools.Platform.OSX) { + 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); + } } - } - }); + }); + } else { + tabs.getScene().addEventFilter(KeyEvent.KEY_PRESSED, event -> { + if(event.isShortcutDown()) { + int currentIndex = tabs.getSelectionModel().getSelectedIndex(); + if(event.getCode() == KeyCode.PAGE_UP && currentIndex > 0) { + tabs.getSelectionModel().select(currentIndex - 1); + } else if(event.getCode() == KeyCode.PAGE_DOWN && currentIndex < tabs.getTabs().size() - 1) { + tabs.getSelectionModel().select(currentIndex + 1); + } + } + }); + } } private void setPlatformApplicationMenu() {