Skip to content

A simple terminal-based taskmanager and process visualizer

Notifications You must be signed in to change notification settings

etrian-dev/summer-taskmgr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summer task manager

A simple terminal-based task manager written in C, with a TUI interface written in ncurses Required libraries:

  • glib
  • ncurses
  • pthreads
  • libjansson
  • linux-specific headers, such as unistd.h
  • POSIX timers (librt)

Compiling

The project uses the meson build system, so a build directory needs to be created somewhere. Then, from the base directory of the project run
meson setup [builddir] src && meson compile -C [builddir]

Execution

The task manager has a main screen containing memory and cpu usage statistics and a scrollable process list. A simple menu (hidden at startup) allows the user to perform a few actions, such as quitting the program and sorting processes; the menu visibility is toggled (shown/hidden) by pressing the 'm' key. The operation to find a pattern in processes'command lines, activated by pressing 'f', can be used without entering the menu. Be aware that, while keybindings that trigger an operation are received even then the menu is not visible, most of them are not designed to be used that way (such as 's' to sort processes).

Menu options

The menus are loaded at runtime from the file menus.json in the repository's base directory The default file lists the following options for the main menu:

  • Quit (q): Quit the program
  • Help (h): Shows the help screen (unimplemented)
  • Sort (s): Change the process sorting mode (this opens a new submenu)
  • Freeze (i): Freeze the screen (unimplemented)
  • Find (f): Find a pattern in the process list
  • Menu (m): Show/Hide the menu
  • Raw (r): Display raw values read from /proc instead of scaled ones The submenu opened by selecting 's' contains the implemented sorting modes for processes:
  • Command (0): Sorts processes in lexicographical order of their command line
  • Username (1): Sorts processes in lexicographical order of their owner's username
  • PID incr (2): Sorts processes in increasing order of their PID
  • PID decr (3): Sorts processes in decreasing order of their PID
  • thread incr (3): Sorts processes in increasing order of their thread count
  • thread decr (3): Sorts processes in decreasing order of their thread count

Usage

To access the menu type 'm'. You will be presented with the set of options described above. Finding patterns works properly (and it's probably more useful) without entering the menu.
A search is performed by typing 'f' and then a search pattern up to a newline (sent by ). The pattern provided is searched as a substring of any process command line currently in the task list. Any process whose command line matches pattern is then highlighted until 'f' is pressed to exit the search mode. The number of matching processes is printed on the same line as the search prompt. No other types of filtering or refined searches is currently implemented.
To navigate the process list use the up/down arrow keys, page up/down to scroll one page (puts the cursor on the entry past the last visible process) and the home/end keys to jump to the first/last process in the list.
The window refresh rate is variable, meaning that it increases as soon as two consecutive scrolling keys are pressed to enable smooth scrolling, but falls back to normal (1s) when a key other than a scolling key is pressed. This tradeoff between smoothness and cpu usage seems reasonable to me.

About

A simple terminal-based taskmanager and process visualizer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published