Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@

A Linux Task Manager alternative built with Qt6, inspired by the Windows Task Manager but designed to go further - providing deep visibility into system processes, performance metrics, users, and services.

## Memory view
![Screenshot](screenshots/readme.png)
## CPU view
![Screenshot](screenshots/cpu.png)
## GPU view
![Screenshot](screenshots/gpu.png)
[Open full-size screenshots](screenshots/screenshots.md)

## Screenshots (Dark Theme)

| CPU | Memory | GPU |
| --- | --- | --- |
| <img src="screenshots/cpu.png" alt="CPU view" width="280"> | <img src="screenshots/readme.png" alt="Memory view" width="280"> | <img src="screenshots/gpu.png" alt="GPU view" width="280"> |

## Screenshots (Light Theme)

| CPU | Memory |
| --- | --- |
| <img src="screenshots/ubuntu/cpu.png" alt="CPU view" width="420"> | <img src="screenshots/ubuntu/mem.png" alt="Memory view" width="420"> |
| Disk | Swap |
| <img src="screenshots/ubuntu/disk.png" alt="Disk view" width="420"> | <img src="screenshots/ubuntu/swap.png" alt="Swap view" width="420"> |
| Processes | Process tree |
| <img src="screenshots/ubuntu/process.png" alt="Processes view" width="420"> | <img src="screenshots/ubuntu/process_tree.png" alt="Process tree view" width="420"> |
| Users | Services |
| <img src="screenshots/ubuntu/user.png" alt="Users view" width="420"> | <img src="screenshots/ubuntu/systemctl.png" alt="Services view" width="420"> |

## Installing

Expand Down
37 changes: 37 additions & 0 deletions screenshots/screenshots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Dark Theme (Debian 13 / KDE)

## CPU View
![CPU view](cpu.png)

## Memory View
![Memory view](readme.png)

## GPU View
![GPU view](gpu.png)

# Light Theme (Ubuntu / KDE)

## CPU View
![CPU view](ubuntu/cpu.png)

## Memory View
![Memory view](ubuntu/mem.png)

## Disk View
![Disk view](ubuntu/disk.png)

## Swap View
![Swap view](ubuntu/swap.png)

## Processes View
![Processes view](ubuntu/process.png)

## Process Tree View
![Process tree view](ubuntu/process_tree.png)

## Users View
![Users view](ubuntu/user.png)

## Services View
![Services view](ubuntu/systemctl.png)
Binary file added screenshots/ubuntu/cpu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ubuntu/disk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ubuntu/mem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ubuntu/process.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ubuntu/process_tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ubuntu/swap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ubuntu/systemctl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/ubuntu/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 76 additions & 3 deletions src/userswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,22 @@ UsersWidget::UsersWidget(QWidget *parent) : QWidget(parent), ui(new Ui::UsersWid
this->ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);

QHeaderView *hv = this->ui->treeWidget->header();
hv->setSectionsClickable(true);
hv->setSortIndicatorShown(true);
hv->setSectionResizeMode(0, QHeaderView::Stretch);
hv->setSectionResizeMode(1, QHeaderView::ResizeToContents);
hv->setSectionResizeMode(2, QHeaderView::ResizeToContents);
hv->setSortIndicator(this->m_sortColumn, this->m_sortOrder);

connect(this->m_refreshTimer, &QTimer::timeout, this, &UsersWidget::onTimerTick);
connect(this->ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &UsersWidget::onContextMenu);
connect(hv, &QHeaderView::sortIndicatorChanged, this, [this](int column, Qt::SortOrder order)
{
this->m_sortColumn = column;
this->m_sortOrder = order;
if (this->m_active && !CFG->RefreshPaused)
this->onTimerTick();
});
}

UsersWidget::~UsersWidget()
Expand Down Expand Up @@ -222,7 +232,39 @@ void UsersWidget::rebuildTree(const QList<OS::Process> &allProcs)
QList<uid_t> uids = agg.keys();
std::sort(uids.begin(), uids.end(), [&](uid_t a, uid_t b)
{
return agg.value(a).cpuPct > agg.value(b).cpuPct;
const UserAgg &left = agg[a];
const UserAgg &right = agg[b];

auto compare = [&](auto lhs, auto rhs)
{
if (lhs == rhs)
return false;
return (this->m_sortOrder == Qt::AscendingOrder) ? (lhs < rhs) : (lhs > rhs);
};

switch (this->m_sortColumn)
{
case 0:
if (left.name != right.name)
return compare(left.name, right.name);
break;
case 1:
if (!qFuzzyCompare(left.cpuPct + 1.0, right.cpuPct + 1.0))
return compare(left.cpuPct, right.cpuPct);
break;
case 2:
if (left.memKb != right.memKb)
return compare(left.memKb, right.memKb);
break;
default:
break;
}

if (!qFuzzyCompare(left.cpuPct + 1.0, right.cpuPct + 1.0))
return left.cpuPct > right.cpuPct;
if (left.memKb != right.memKb)
return left.memKb > right.memKb;
return left.name.localeAwareCompare(right.name) < 0;
});

for (int userIndex = 0; userIndex < uids.size(); ++userIndex)
Expand Down Expand Up @@ -256,9 +298,40 @@ void UsersWidget::rebuildTree(const QList<OS::Process> &allProcs)
}

QList<OS::Process> procs = a.procs;
std::sort(procs.begin(), procs.end(), [](const OS::Process &x, const OS::Process &y)
std::sort(procs.begin(), procs.end(), [&](const OS::Process &x, const OS::Process &y)
{
return x.CPUPercent > y.CPUPercent;
auto compare = [&](auto lhs, auto rhs)
{
if (lhs == rhs)
return false;
return (this->m_sortOrder == Qt::AscendingOrder) ? (lhs < rhs) : (lhs > rhs);
};

switch (this->m_sortColumn)
{
case 0:
if (x.Name != y.Name)
return compare(x.Name, y.Name);
break;
case 1:
if (!qFuzzyCompare(x.CPUPercent + 1.0, y.CPUPercent + 1.0))
return compare(x.CPUPercent, y.CPUPercent);
break;
case 2:
if (x.VMRssKb != y.VMRssKb)
return compare(x.VMRssKb, y.VMRssKb);
break;
default:
break;
}

if (!qFuzzyCompare(x.CPUPercent + 1.0, y.CPUPercent + 1.0))
return x.CPUPercent > y.CPUPercent;
if (x.VMRssKb != y.VMRssKb)
return x.VMRssKb > y.VMRssKb;
if (x.Name != y.Name)
return x.Name.localeAwareCompare(y.Name) < 0;
return x.PID < y.PID;
});

for (int processIndex = 0; processIndex < procs.size(); ++processIndex)
Expand Down
3 changes: 3 additions & 0 deletions src/userswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "os/process.h"

#include <QHash>
#include <Qt>
#include <QTimer>
#include <QWidget>

Expand Down Expand Up @@ -56,6 +57,8 @@ class UsersWidget : public QWidget
QHash<pid_t, quint64> m_prevTicks;
quint64 m_prevCpuTotalTicks { 0 };
int m_numCpus { 1 };
int m_sortColumn { 1 };
Qt::SortOrder m_sortOrder { Qt::DescendingOrder };

void rebuildTree(const QList<OS::Process> &allProcs);
};
Expand Down
Loading