Giter Site home page Giter Site logo

fflewddur / tophat Goto Github PK

View Code? Open in Web Editor NEW
305.0 6.0 22.0 1.44 MB

View CPU, memory, disk, and network activity in the GNOME top bar.

Home Page: https://extensions.gnome.org/extension/5219/tophat/

License: GNU General Public License v3.0

JavaScript 97.41% CSS 2.22% Shell 0.36%
gnome gnome-shell gnome-shell-extension resource-monitor gjs

tophat's Introduction

TopHat

TopHat aims to be an elegant system resource monitor for the GNOME shell. It displays CPU, memory, disk, and network activity in the GNOME top bar.

Screenshot of
TopHat

Release notes

See RELEASES.md for the list of fixes and new functionality included in each release.

Installation

Install TopHat from the GNOME Shell extensions page.

Most Debian-based systems (including Ubuntu and Pop!_OS) will also need 'gir1.2-gtop-2.0' to be installed. Usually this means running the command sudo apt install gir1.2-gtop-2.0 followed by a system restart.

Requirements

  • GNOME 45 or newer (older releases of TopHat are available for GNOME 3.32 - 44 in the legacy branch at https://github.com/fflewddur/tophat/tree/legacy)
  • The gtop system monitoring library (e.g., 'libgtop' on Debian-based systems, likely already installed as part of GNOME)
  • GIRepository (gir) bindings for the gtop system monitoring library (e.g., 'gir1.2-gtop-2.0' on Debian-based systems)

Compatibility

The latest release of TopHat has been tested on the following systems:

  • Arch Linux
  • Fedora 39
  • Ubuntu 23.10 (first install gir1.2-gtop-2.0 package)

Even if your system is not in this list, as long as it meets the requirements mentioned above, you should be able to run TopHat. If not, please file a bug report on the issue tracker.

Manual installation

If you prefer not to use https://extensions.gnome.org to install and update GNOME Shell extensions, you can manually install TopHat by following these steps. You may need to install the unzip and gnome-extensions-app utilities first.

  1. Download the latest TopHat release from https://github.com/fflewddur/tophat/releases.
  2. Ensure your local extension directory exists by running the command mkdir -p ~/.local/share/gnome-shell/extensions/[email protected].
  3. Extract the TopHat ZIP file into your local extension directory with the command unzip [path-to-tophat.zip] -d ~/.local/share/gnome-shell/extensions/[email protected]
  4. Log out of your computer and log back in (or restart your system).
  5. Enable TopHat in the gnome-extensions-app.

Contributing

Contributions to improve TopHat are welcome! To avoid duplicate work, check the issue tracker first. If an issue doesn't already exist for your idea, please create one.

To keep the code format consistent, please use eslint before submitting a PR. You can install eslint by running the command npm install eslint from the TopHat repo directory. To run the linter, use the command ./node_modules/eslint/bin/eslint.js . --ext .js; alternatively, the ESLint plugin for VS Code will automatically run the linter for you.

Useful development commands

To view logs for GNOME Shell: journalctl -f /usr/bin/gnome-shell

To view logs for extension preferences: journalctl -f /usr/bin/gjs

To simulate heavy system load, use the stress-ng tool, e.g. stress-ng --timeout 10s --cpu 8 or stress-ng --vm-bytes 80% --vm-populate -t 30 -vm 4.

To test the development version:

mkdir -p ~/.local/share/gnome-shell/extensions/
ln -s [path to tophat repository]/[email protected] ~/.local/share/gnome-shell/extensions/[email protected]

License

TopHat is distributed under the terms of the GNU General Public License, version 3 or later. See the license file for details.

Credits

TopHat was designed and written by Todd Kulesza, with much inspiration from the GNOME system-monitor extension and iStat Menus.

Icons

The images in the 'icons' directory are derived works from thenounproject.com and used under the Creative Commons Attribution license. The authors of each original work are:

icons/cpu.svg: jai
icons/disk.svg: guntur cahya
icons/logo.svg: Sergey Krivoy icons/mem.svg: Loudoun Design Co.
icons/net.svg: Pixel Bazaar

All icons were edited to make them more legible at small sizes.

tophat's People

Contributors

amereyeu avatar esalvati avatar fflewddur avatar flozz avatar hrqmonteiro avatar mrnugget avatar noirbizarre avatar nxjosephofficial avatar preknowledgeweb avatar swyknox avatar theizzer avatar txelu avatar vistaus avatar wunsz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tophat's Issues

Add a setting to change the position in the panel

Thanks for the great extension.

It is common for extensions to allow users to decide where to display the widget in the panel.
Adding a setting to choose to display "far left", "left", "center", "right", "far right" would allow user to better use the screen space.

For instance I would like to put the monitors on the left, as right contains status icons and that area gets visually cluttered like this.

App icons (VLC, Remmina etc) in top panel split CPU and Memory display

Everything looks fine after startup (see below).
image

If you now run an app that uses the Gnome top panel, the app icon splits the Tophat CPU and Memory display (see below). At least VLC and Remmina have this effect on the display.
image

Expected behaviour is that the Tophat usage displays remaining together. If you subsequently disable/enable a Gnome extension (seems like doesn't matter which one), the icon and display order is corrected (see below).
image

This bug can be reproduced every time on this system.
image

Fix network stacking with Dash to Panel

The vbox that's used to stack the network indicators doesn't seem to work as expected with the Dash to Panel extension. Instead of the 'send' indicator stacking on top of the 'receive' indicator, they are horizontally next to each other.

[enhancement] glanceable representation of network traffic

Currently network traffic is shown numerically, with 12K/s for example. The other items (memory, CPU) give a nice glanceable way to see what's happening, as we know a-priori what "100%" is. We don't know this for network (other than potentially being able to determine the maximum speed of the interface). Perhaps if the maximum measured up/down rate were recorded for each 10-minute period, and saved to local state, you could show a bar relative to the 99th percentile over the prior 2000 10-minute logged periods (roughly a month of home PC use, or 2 weeks of always-on PC use). The user can always hover to see the actual numbers.

Disk activity is not currently logged (I see others have requested this feature, I would second that). I imagine the same issue will arise here, though possibly even worse in that peak write speed is often a cache artefact, so what you may wish to record for "100%" bar height is the maximum sustained read/write speed that was sustained for more than say 5sec (to get you beyond RAM caches) or 30sec (this would probably get you beyond the pSLC cache in SSDs, but that's pretty dependent on the exact model and config).

Optimize network interface detection

Currently TopHat needs to rescan the list of network devices with each refresh, to avoid querying temporary interfaces such as VPNs after they've disconnected. It'd be better to find a signal to listen to for these changes, so that we can safely cache the list of active network interfaces.

Add y-axis scale to charts

The charts in the drop-down menus should have meaningful scales for the y-axix.

  • Processor: 0 - 100%
  • Memory: 0 - 100%
  • Network: 0 - [max network up/down speed seen during prior N minutes]; this will also need to be doubled and inverted because we use the top of this chart for upload activity and the bottom for download activity.
  • Power: 0 - [max power consumption seen during the prior N minutes]

Figure out why some processes have no command line

GTop.glibtop_get_proc_arg() fails to return arg values for many processes. Currently TopHat ignores these processes, since we can't map them to specific commands that are running. Investigate using /proc/[pid]/status to retrieve this information when it's missing.

System log is spammed by non-existant interfaces

I don't exactly know if this is because the extension, but after my VPN is shut down, the logs show gnome-shell trying to access that device constantly.

Example:

sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/vpn/statistics/tx_packets": No such file or directory
sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/vpn/statistics/rx_bytes": No such file or directory
sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/vpn/statistics/tx_bytes": No such file or directory
sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/vpn/statistics/rx_errors": No such file or directory
sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/vpn/statistics/tx_errors": No such file or directory
sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/vpn/statistics/collisions": No such file or directory
sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/virtual0/statistics/rx_packets": No such file or directory
sep 06 14:14:25 ubuntu gnome-shell[4160]: glibtop(c=4160): [WARNING] Failed to open "/sys/class/net/virtual0/statistics/tx_packets": No such file or directory

Both vpn and virtual0 are temporary devices and it looks like they are not removed from the watch list of the extension once they are deleted??

[update] Can confirm it's the extension, once I disable it, the spam ends.

Support transparent theme

Hi. Is it possible to make it work with transparent shell theme. My top bar and dock are transparent and it looks like this:

image

Thanks.

Button changes to error when I reinstall from Gnome Extensions website

I had a previous version op TopHat and I was prompted for an upgrade today. So I went to the Gnome Extensions page which did not provide an option for an upgrade. So I clicked on remove extension and then I installed it again.

Now the button turned to ERROR without any clue of what happened. I tried removing once again and installing it, but ended up in the same situation.

I am on Debian GNU/Linux 11 (bullseye)

Improve dependency handling

Instead of crashing if a dependency is missing, load a UI that makes it clear there is an error and explains which dependencies are missing.

Add option to hide icons

Thanks for this great extension.

It would be very nice if there was an option to hide icons, for those who prefer a more simple and minimal look.

image

won't work on Ubuntu 22.04.1 LTS

already tried sudo apt install gir1.2-gtop-2.0

but still no...

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

its a fresh installation of 22.04

image

Update panel icons

Look for better panel icons, especially for the network indicator. If sticking with Noun Project icons, validate that they can be used/distributed like this.

Update the UI immediately when settings are modified

Currently TopHat updates most UI elements when a monitor refreshes resource usage/activity. This creates up to a 5 second delay for UI elements such as meter color, disk usage, etc., to reflect the new setting. Instead we should listen for the property change signal and refresh the UI immediately, so the user knows their setting change was successful.

TopHat won't work in openSUSE

As gir1.2-gtop-2.0 is not an available package on the openSUSE repositories or OBS, TopHat will always complain that the gtop bindings for GIRepository are unavailable. I've tried installing the dependency by converting a deb package to rpm using alien, but this didn't work either.

Show additional CPU information

The menu for the CPU monitor should include additional information (if available), including:

  • Current speed
  • Make and model
  • Temperature

Add Different Visualizations in the Top Bar

Nice to finally have an extension with a nice UI.

One thing I'm missing that other plugins (and the great iStats Menu for macOS) have is the option to switch between different Visualisations. I can think of the following

  • Bar(s) (currently used for cpu and memory)
  • Graph (cpu, network)
  • Pie/Donut Chart (memory)
  • Percentage (all)
  • Absolute Numbers (currently used for network, also interesting for memory)

It might make sense to allow using both a graphical and a numerical representation at the same time, e.g. by having two dropdowns that allow to select one option for graphical, and one for textual representation with the option to select nothing for either.

I would personally use a graph for CPU, a pie chart for memory and numbers (or a graph) for network.

CPU temperature shown as n/a

Just switched to a Mini PC (Minis Forum UM690) with an AMD Ryzen 6900hx mobile processor. Just wondering why the CPU temperature is shown as n/a.

image

As far I was able to read the code, it should find the temperature from /sys/class/hwmon/hwmon3/temp1_input

image

Add ability to change meter/chart color

Create a user preferences pane and add a control for the user to select a different color for meters/charts.

Should also support a different secondary color (currently needed for the network upload chart).

Consider changing meter color when resource consumption passes a given threshold

It might be useful to use a separate meter color when a resource is dangerously low (e.g., almost out of memory or disk space, or all CPU cores are at 100%). Arguably the meter already presents this information by showing that the resource is (or nearly is) full, and changing colors, especially for a non-exhaustible resource such as CPU, could be very distracting.

If we were to do this, it would also likely need a user-configurable threshold for each resource type. This would crowd the current preferences window, so that would likely need to be re-designed as well.

[enhancement] no network at a glance

I think would be a good enhancement to better handle the case with no network;

currently,

  • if there is no network activity, speeds are zero, as it should be;
  • but if there is no network at all, speeds are even now zero;

even if it is true because no network means no network activity,
it bring us to err: you see 0KB/s and you think "there is no network activity",
but in that moment could be no network at all;

We can change the behaviour when there is no network at all (common issue with laptops, i.e. weak WiFi signal...) from showing 0KB/s to ---KB/s, or no network icon, or different network icon, or something else

icon and font sizes appear too small

Screenshot from 2022-11-08 17-49-06

starting from the screenshot above, I'd like to share with you three enhancements:

  1. shrink unused space at right
  2. avoid trimming data at right e.g. (unit of measurement, here MB)
  3. increase font size for network speeds in the top bar

Turn off monitoring of /proc and /sys files if they are not readable

As reported by nekohayo, TopHat may continue to try to read /proc or /sys files after encountering errors, e.g.:

gnome-shell[832185]: [TopHat] Error reading /sys/class/hwmon/hwmon2/temp1_input: Error opening file /sys/class/hwmon/hwmon2/temp1_input: No such file or directory

In this case, we should probably disable additional probing and disable 'n/a' for the sensor reading in the UI. Probing for these sensors should only happen when TopHat is started.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.