diff --git a/www/assets/app.js b/www/assets/app.js
index c4d939f..8378a73 100644
--- a/www/assets/app.js
+++ b/www/assets/app.js
@@ -11,7 +11,7 @@
}, 500);
}]);
- app.controller('PlayController', ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$window', function($scope, $log, $http, $location, $timeout, $mdDialog, $window) {
+ app.controller('PlayController', ['$scope', '$log', '$http', '$location', '$timeout', '$mdDialog', '$window', 'KeyboardShortcutService', function($scope, $log, $http, $location, $timeout, $mdDialog, $window, KeyboardShortcutService) {
$scope.sessionId = window.location.pathname.replace('/p/', '');
$scope.instances = [];
$scope.idx = {};
@@ -23,6 +23,8 @@
$scope.newInstanceBtnText = '+ Add new instance';
$scope.deleteInstanceBtnText = 'Delete';
$scope.isInstanceBeingDeleted = false;
+
+ var selectedKeyboardShortcuts = KeyboardShortcutService.getCurrentShortcuts();
angular.element($window).bind('resize', function() {
if ($scope.selectedInstance) {
@@ -30,6 +32,10 @@
}
});
+ $scope.$on("settings:shortcutsSelected", function(e, preset) {
+ selectedKeyboardShortcuts = preset;
+ });
+
$scope.showAlert = function(title, content, parent) {
$mdDialog.show(
@@ -245,6 +251,17 @@
}
});
+ term.attachCustomKeydownHandler(function(e) {
+ if (selectedKeyboardShortcuts == null)
+ return;
+ var presets = selectedKeyboardShortcuts.presets
+ .filter(function(preset) { return preset.keyCode == e.keyCode })
+ .filter(function(preset) { return (preset.metaKey == undefined && !e.metaKey) || preset.metaKey == e.metaKey })
+ .filter(function(preset) { return (preset.ctrlKey == undefined && !e.ctrlKey) || preset.ctrlKey == e.ctrlKey })
+ .filter(function(preset) { return (preset.altKey == undefined && !e.altKey) || preset.altKey == e.altKey })
+ .forEach(function(preset) { preset.action({ terminal : term })});
+ });
+
term.open(terminalContainer);
// Set geometry during the next tick, to avoid race conditions.
@@ -291,5 +308,89 @@
.config(['$mdIconProvider', '$locationProvider', function($mdIconProvider, $locationProvider) {
$locationProvider.html5Mode({enabled: true, requireBase: false});
$mdIconProvider.defaultIconSet('../assets/social-icons.svg', 24);
- }]);
+ }])
+ .component('settingsIcon', {
+ template : "