summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-04-04 22:45:45 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-04 22:45:45 +0200
commit7b7cbcecdf34e926068ab1ee59cb3ec0e40e6b9d (patch)
tree9933393d7178faf01b96a1c6033752731e2db5d1 /Userland/Applications
parent5d379fcfb4c4cfd933e30f21703361ef2fab53f1 (diff)
downloadserenity-7b7cbcecdf34e926068ab1ee59cb3ec0e40e6b9d.zip
SystemMonitor: Scope the process-specific actions to the process list
We don't want the process-specific actions to activate via keyboard shortcuts when we're not focusing the process list.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp57
1 files changed, 34 insertions, 23 deletions
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index cbaa8b2514..6dcc253580 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -244,25 +244,32 @@ int main(int argc, char** argv)
return pid_index.data().to_i32();
};
- auto kill_action = GUI::Action::create("Kill process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::load_from_file("/res/icons/16x16/kill.png"), [&](const GUI::Action&) {
- pid_t pid = selected_id(ProcessModel::Column::PID);
- if (pid != -1)
- kill(pid, SIGKILL);
- });
-
- auto stop_action = GUI::Action::create("Stop process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/stop-hand.png"), [&](const GUI::Action&) {
- pid_t pid = selected_id(ProcessModel::Column::PID);
- if (pid != -1)
- kill(pid, SIGSTOP);
- });
-
- auto continue_action = GUI::Action::create("Continue process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/continue.png"), [&](const GUI::Action&) {
- pid_t pid = selected_id(ProcessModel::Column::PID);
- if (pid != -1)
- kill(pid, SIGCONT);
- });
-
- auto profile_action = GUI::Action::create("Profile process", { Mod_Ctrl, Key_P },
+ auto kill_action = GUI::Action::create(
+ "Kill process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::load_from_file("/res/icons/16x16/kill.png"), [&](const GUI::Action&) {
+ pid_t pid = selected_id(ProcessModel::Column::PID);
+ if (pid != -1)
+ kill(pid, SIGKILL);
+ },
+ &process_table_view);
+
+ auto stop_action = GUI::Action::create(
+ "Stop process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/stop-hand.png"), [&](const GUI::Action&) {
+ pid_t pid = selected_id(ProcessModel::Column::PID);
+ if (pid != -1)
+ kill(pid, SIGSTOP);
+ },
+ &process_table_view);
+
+ auto continue_action = GUI::Action::create(
+ "Continue process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/continue.png"), [&](const GUI::Action&) {
+ pid_t pid = selected_id(ProcessModel::Column::PID);
+ if (pid != -1)
+ kill(pid, SIGCONT);
+ },
+ &process_table_view);
+
+ auto profile_action = GUI::Action::create(
+ "Profile process", { Mod_Ctrl, Key_P },
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"), [&](auto&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1) {
@@ -276,9 +283,11 @@ int main(int argc, char** argv)
perror("disown");
}
}
- });
+ },
+ &process_table_view);
- auto inspect_action = GUI::Action::create("Inspect process", { Mod_Ctrl, Key_I },
+ auto inspect_action = GUI::Action::create(
+ "Inspect process", { Mod_Ctrl, Key_I },
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-inspector.png"), [&](auto&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1) {
@@ -292,7 +301,8 @@ int main(int argc, char** argv)
perror("disown");
}
}
- });
+ },
+ &process_table_view);
HashMap<pid_t, NonnullRefPtr<GUI::Window>> process_windows;
@@ -314,7 +324,8 @@ int main(int argc, char** argv)
}
process_window->show();
process_window->move_to_front();
- });
+ },
+ &process_table_view);
auto menubar = GUI::MenuBar::construct();
auto& app_menu = menubar->add_menu("File");