From a146d57efa6e9adcae7a2a7f482035f5347c820f Mon Sep 17 00:00:00 2001 From: Nathaniel van Diepen Date: Sun, 14 Jan 2024 04:35:55 -0700 Subject: [PATCH] alt-f4 --- applications/system-service/controller.h | 23 +++++++++++++++++++++++ applications/system-service/main.qml | 4 ++++ assets/opt/etc/keyd/oxide.conf | 3 +++ 3 files changed, 30 insertions(+) diff --git a/applications/system-service/controller.h b/applications/system-service/controller.h index 4e231bdfa..ca1dfb760 100644 --- a/applications/system-service/controller.h +++ b/applications/system-service/controller.h @@ -15,4 +15,27 @@ class Controller : public QObject{ Q_INVOKABLE void back(){ appsAPI->previousApplication(); } Q_INVOKABLE void lock(){ appsAPI->openLockScreen(); } Q_INVOKABLE void terminal(){ appsAPI->openTerminal(); } + Q_INVOKABLE void close(){ + auto path = appsAPI->currentApplicationNoSecurityCheck(); + if(path.path() == "/"){ + return; + } + if(path == appsAPI->lockscreenApplication()){ + return; + } + if(path == appsAPI->startupApplication()){ + return; + } + if(path == appsAPI->taskSwitcherApplication()){ + return; + } + auto currentApplication = appsAPI->getApplication(path); + if( + currentApplication == nullptr + || currentApplication->stateNoSecurityCheck() == Application::Inactive + ){ + return; + } + currentApplication->stop(); + } }; diff --git a/applications/system-service/main.qml b/applications/system-service/main.qml index 4fca6347a..2e7ba608f 100644 --- a/applications/system-service/main.qml +++ b/applications/system-service/main.qml @@ -32,4 +32,8 @@ Window{ sequences: [Qt.Key_Terminal, "Ctrl+Alt+T"] onActivated: controller.terminal() } + Shortcut{ + sequences: ["End+Alt+4", "Alt+F4"] + onActivated: controller.close() + } } diff --git a/assets/opt/etc/keyd/oxide.conf b/assets/opt/etc/keyd/oxide.conf index e7fab84f8..15726d8c1 100644 --- a/assets/opt/etc/keyd/oxide.conf +++ b/assets/opt/etc/keyd/oxide.conf @@ -24,6 +24,9 @@ down = pagedown backspace = macro(end+backspace) l = macro(end+l) +[meta+alt] +4 = macro(leftalt+f4) + [shift+meta] \ = | , = {