mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +00:00
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.
This commit is contained in:
parent
5d379fcfb4
commit
7b7cbcecdf
1 changed files with 31 additions and 20 deletions
|
@ -244,25 +244,32 @@ int main(int argc, char** argv)
|
||||||
return pid_index.data().to_i32();
|
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&) {
|
auto kill_action = GUI::Action::create(
|
||||||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
"Kill process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::load_from_file("/res/icons/16x16/kill.png"), [&](const GUI::Action&) {
|
||||||
if (pid != -1)
|
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||||
kill(pid, SIGKILL);
|
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&) {
|
auto stop_action = GUI::Action::create(
|
||||||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
"Stop process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/stop-hand.png"), [&](const GUI::Action&) {
|
||||||
if (pid != -1)
|
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||||
kill(pid, SIGSTOP);
|
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&) {
|
auto continue_action = GUI::Action::create(
|
||||||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
"Continue process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/continue.png"), [&](const GUI::Action&) {
|
||||||
if (pid != -1)
|
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||||
kill(pid, SIGCONT);
|
if (pid != -1)
|
||||||
});
|
kill(pid, SIGCONT);
|
||||||
|
},
|
||||||
|
&process_table_view);
|
||||||
|
|
||||||
auto profile_action = GUI::Action::create("Profile process", { Mod_Ctrl, Key_P },
|
auto profile_action = GUI::Action::create(
|
||||||
|
"Profile process", { Mod_Ctrl, Key_P },
|
||||||
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"), [&](auto&) {
|
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"), [&](auto&) {
|
||||||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||||
if (pid != -1) {
|
if (pid != -1) {
|
||||||
|
@ -276,9 +283,11 @@ int main(int argc, char** argv)
|
||||||
perror("disown");
|
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&) {
|
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-inspector.png"), [&](auto&) {
|
||||||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||||
if (pid != -1) {
|
if (pid != -1) {
|
||||||
|
@ -292,7 +301,8 @@ int main(int argc, char** argv)
|
||||||
perror("disown");
|
perror("disown");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
&process_table_view);
|
||||||
|
|
||||||
HashMap<pid_t, NonnullRefPtr<GUI::Window>> process_windows;
|
HashMap<pid_t, NonnullRefPtr<GUI::Window>> process_windows;
|
||||||
|
|
||||||
|
@ -314,7 +324,8 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
process_window->show();
|
process_window->show();
|
||||||
process_window->move_to_front();
|
process_window->move_to_front();
|
||||||
});
|
},
|
||||||
|
&process_table_view);
|
||||||
|
|
||||||
auto menubar = GUI::MenuBar::construct();
|
auto menubar = GUI::MenuBar::construct();
|
||||||
auto& app_menu = menubar->add_menu("File");
|
auto& app_menu = menubar->add_menu("File");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue