I've searched a lot but I can't find a way to show nethogs in conky. nethogs prints to terminal and there seems to be no way to capture output in real time. This is one thing I have been wanting for conky FOR AGES.
I don't think so.
nethogs is an interactive process using the ncurses library. It expects to launch in a terminal window and get input from the user.
Conky can run programs using the exec/execi/execp/execpi directives, but these are supposed to be "run once" programs which output text then exit. Conky takes that text and displays it.
Try writing to the nethogs developer and see if he'll add "batched" mode, like the batched mode of the
top command. If you could get nethogs to run for a second then display its text and exit, you could use that text output in Conky.
I've tried to do the same with conky on Ubuntu 12.10. But then i had a better idea:
- create a new profile for gnome-terminal (transparent, small font size, whatever you like)
- install package
devilspie(you can also try the GTK version
- create a new config file for
devilspiewhich will help to get rid of the window frame border and menu
(if (is (window_role) "borderless") (begin (undecorate) (geometry "-0-0") (below) (skip_tasklist) ) )
(geometry "-0-0") will place the window at the bottom right
When the configuration file
gnome-terminal.ds has not been written/changed you have to create it and stop/restart the devilspie deamon to see any changes. Dont forget to add the daemon to your startup scripts (XFCE: Setting > Session and Startup).
Now we need a startup bash script which you can add to your autostart just like devilspie. Something like this:
#!/bin/bash if [ $# -lt 1 ] then echo "Usage: `basename $0` <iface>" exit 1 fi killall -9 nethogs 2>/dev/null sleep 5 `sudo -H -u <username> gnome-terminal -e "/usr/bin/nethogs -d 4 $1" --profile=<profile-name> --role=borderless` exit 0
You must pass an argument to the script to specify the target device. Notice that there is a
sleep command within the script, just to make sure that previous nethogs processes are not running.