Skip to content

Create the ability to run arbitrary commands on keypress #506

@fasterit

Description

@fasterit

Generalization of #27. From there:

The htop-dev team would like to see implemented is the functionality to start a $XDG_CONFIG_HOME/htop/run_script on a key press (possibly r):
run_script would be called with "PID" "USER" "COMMAND" on the currently highlighted line.
Bonus points for providing a sequence of "PID" "USER" "COMMAND" on stdin if multiple processes are tagged (=marked).
Bonus points for making the script location configurable in /etc/htoprc so that system-wide defaults could be set (having a $XDG_CONFIG_HOME/htop/run_script present would override the global setting still). This would (automatically) also allow to override the script location for a user in their local htoprc (same config reader).

If run_script outputs on stdout and/or stderr this would go into the InfoScreen pager. Otherwise htop would just return to normal operations once the exec* returns. See OpenFilesScreen.c or TraceScreen.cfor inspiration.

Attaching a gdb could be a htop-supplied example of how to use such a script.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions