File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Future
2+ * Improved context menu (copy, confirmations)
3+ * Show if running as root in title
4+
15# 1.0.1
26
37 * New color scheme dialog allowing users to override colors
Original file line number Diff line number Diff line change 2424#include < QSettings>
2525#include < QVariantList>
2626
27+ #include < unistd.h>
28+
2729Configuration *Configuration::s_instance = nullptr ;
2830
2931Configuration *Configuration::instance ()
@@ -49,6 +51,7 @@ void Configuration::Load()
4951 this ->RefreshRateMs = s.value (" General/RefreshRateMs" , this ->RefreshRateMs ).toInt ();
5052 this ->UseCustomColorScheme = s.value (" General/UseCustomColorScheme" , this ->UseCustomColorScheme ).toBool ();
5153 this ->CustomColorScheme = s.value (" General/CustomColorScheme" , this ->CustomColorScheme ).toMap ();
54+ this ->IsSuperuser = (::geteuid () == 0 );
5255
5356 // Processes
5457 this ->ShowKernelTasks = s.value (" Processes/ShowKernelTasks" , this ->ShowKernelTasks ).toBool ();
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class Configuration : public QObject
4949 int RefreshRateMs { 1000 }; // /< How often live data is refreshed (ms)
5050 bool UseCustomColorScheme { false };
5151 QVariantMap CustomColorScheme;
52+ bool IsSuperuser { false }; // /< True when effective UID is 0 (runtime-only).
5253 // ! Intervals (in ms) available in menus for refresh rate (250ms, 1s, 5s etc.)
5354 QVector<int > RefreshRateAvailableIntervals;
5455
Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
2929{
3030 this ->ui ->setupUi (this );
3131
32+ if (CFG ->IsSuperuser )
33+ {
34+ // Make user aware of this
35+ this ->setWindowTitle (this ->windowTitle () + " (superuser)" );
36+ }
37+
3238 this ->ui ->processesLayout ->addWidget (this ->m_processesWidget );
3339 this ->ui ->performanceLayout ->addWidget (this ->m_performanceWidget );
3440 this ->ui ->usersLayout ->addWidget (this ->m_usersWidget );
You can’t perform that action at this time.
0 commit comments