Add short key '2' (or --disable-left-sidebar option) to hide the left sidebar

This commit is contained in:
Nicolas Hennion 2014-10-10 15:27:57 +02:00
parent 2b471481e1
commit 3b2d6eb21c
5 changed files with 31 additions and 13 deletions

View File

@ -133,6 +133,8 @@ Command-Line Options
--disable-fs disable filesystem module --disable-fs disable filesystem module
--disable-network disable network module --disable-network disable network module
--disable-sensors disable sensors module --disable-sensors disable sensors module
--disable-left-sidebar
disable left sidebar
--disable-process disable process module --disable-process disable process module
--disable-process-extended --disable-process-extended
disable extended stats on top process disable extended stats on top process
@ -229,6 +231,8 @@ The following commands (key pressed) are supported while in Glances:
Show/hide processes stats Show/hide processes stats
``1`` ``1``
Switch between global CPU and per-CPU stats Switch between global CPU and per-CPU stats
``2``
Enable/disable left sidebar
``/`` ``/``
Switch between short name / command line (processes name) Switch between short name / command line (processes name)

View File

@ -65,15 +65,17 @@ class GlancesMain(object):
dest='enable_history', help=_('enable the history mode')) dest='enable_history', help=_('enable the history mode'))
parser.add_argument('--disable-bold', action='store_false', default=True, parser.add_argument('--disable-bold', action='store_false', default=True,
dest='disable_bold', help=_('disable bold mode in the terminal')) dest='disable_bold', help=_('disable bold mode in the terminal'))
parser.add_argument('--disable-network', action='store_true', default=False,
dest='disable_network', help=_('disable network module'))
parser.add_argument('--disable-diskio', action='store_true', default=False, parser.add_argument('--disable-diskio', action='store_true', default=False,
dest='disable_diskio', help=_('disable disk I/O module')) dest='disable_diskio', help=_('disable disk I/O module'))
parser.add_argument('--disable-fs', action='store_true', default=False, parser.add_argument('--disable-fs', action='store_true', default=False,
dest='disable_fs', help=_('disable filesystem module')) dest='disable_fs', help=_('disable filesystem module'))
parser.add_argument('--disable-network', action='store_true', default=False,
dest='disable_network', help=_('disable network module'))
parser.add_argument('--disable-sensors', action='store_true', default=False, parser.add_argument('--disable-sensors', action='store_true', default=False,
dest='disable_sensors', help=_('disable sensors module')) dest='disable_sensors', help=_('disable sensors module'))
parser.add_argument('--disable-process', action='store_true', default=False, parser.add_argument('--disable-left-sidebar', action='store_true', default=False,
dest='disable_left_sidebar', help=_('disable network, disk io, FS and sensors modules'))
parser.add_argument('--disable_left_sidebar', action='store_true', default=False,
dest='disable_process', help=_('disable process module')) dest='disable_process', help=_('disable process module'))
parser.add_argument('--disable-process-extended', action='store_true', default=False, parser.add_argument('--disable-process-extended', action='store_true', default=False,
dest='disable_process_extended', help=_('disable extended stats on top process')) dest='disable_process_extended', help=_('disable extended stats on top process'))

View File

@ -232,6 +232,9 @@ class GlancesCurses(object):
elif self.pressedkey == ord('1'): elif self.pressedkey == ord('1'):
# '1' > Switch between CPU and PerCPU information # '1' > Switch between CPU and PerCPU information
self.args.percpu = not self.args.percpu self.args.percpu = not self.args.percpu
elif self.pressedkey == ord('2'):
# '2' > Enable/disable left sidebar
self.args.disable_left_sidebar = not self.args.disable_left_sidebar
elif self.pressedkey == ord('/'): elif self.pressedkey == ord('/'):
# '/' > Switch between short/long name for processes # '/' > Switch between short/long name for processes
self.args.process_short_name = not self.args.process_short_name self.args.process_short_name = not self.args.process_short_name
@ -468,6 +471,9 @@ class GlancesCurses(object):
# Display left sidebar (NETWORK+DISKIO+FS+SENSORS+Current time) # Display left sidebar (NETWORK+DISKIO+FS+SENSORS+Current time)
self.init_column() self.init_column()
if (not (self.args.disable_network and self.args.disable_diskio \
and self.args.disable_fs and self.args.disable_sensors)) \
and not self.args.disable_left_sidebar:
self.new_line() self.new_line()
self.display_plugin(stats_network) self.display_plugin(stats_network)
self.new_line() self.new_line()

View File

@ -116,6 +116,9 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_new_line()) ret.append(self.curse_new_line())
msg = msg_col.format("s", _("Show/hide sensors stats")) msg = msg_col.format("s", _("Show/hide sensors stats"))
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
ret.append(self.curse_new_line())
msg = msg_col.format("2", _("Show/hide left sidebar"))
ret.append(self.curse_add_line(msg))
msg = msg_col2.format("g", _("Generate graphs for current history")) msg = msg_col2.format("g", _("Generate graphs for current history"))
ret.append(self.curse_add_line(msg)) ret.append(self.curse_add_line(msg))
ret.append(self.curse_new_line()) ret.append(self.curse_new_line())

View File

@ -55,6 +55,9 @@ disable network module
.B \-\-disable-sensors .B \-\-disable-sensors
disable sensors module disable sensors module
.TP .TP
.B \-\-disable-left-sidebar
disable network, disk IO, FS and sensors modules
.TP
.B \-\-disable-process .B \-\-disable-process
disable process module disable process module
.TP .TP