mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-20 03:31:27 +00:00
Experimenting with ⌘W shortcuts on windows (TODO: we should find some better way to do this)
This commit is contained in:
@@ -4,6 +4,9 @@ import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
@@ -35,6 +38,9 @@ public class PreferencesController implements FxController {
|
||||
if (updateAvailable.get()) {
|
||||
tabPane.getSelectionModel().select(updatesTab);
|
||||
}
|
||||
|
||||
KeyCombination cmdW = new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN);
|
||||
window.getScene().getAccelerators().put(cmdW, window::close);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package org.cryptomator.ui.vaultoptions;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyCodeCombination;
|
||||
import javafx.scene.input.KeyCombination;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -7,7 +13,21 @@ import javax.inject.Inject;
|
||||
@VaultOptionsScoped
|
||||
public class VaultOptionsController implements FxController {
|
||||
|
||||
private final Stage window;
|
||||
|
||||
@Inject
|
||||
VaultOptionsController(){}
|
||||
VaultOptionsController(@VaultOptionsWindow Stage window) {
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
window.setOnShowing(this::windowWillAppear);
|
||||
}
|
||||
|
||||
private void windowWillAppear(WindowEvent windowEvent) {
|
||||
KeyCombination cmdW = new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN);
|
||||
window.getScene().getAccelerators().put(cmdW, window::close);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user