diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py
index 3f36605f0b..98034c91f4 100644
--- a/src/calibre/gui2/__init__.py
+++ b/src/calibre/gui2/__init__.py
@@ -115,6 +115,7 @@ defs['auto_add_auto_convert'] = True
defs['auto_add_everything'] = False
defs['ui_style'] = 'calibre' if iswindows or isosx else 'system'
defs['tag_browser_old_look'] = False
+defs['tag_browser_hide_empty_categories'] = False
defs['book_list_tooltips'] = True
defs['bd_show_cover'] = True
defs['bd_overlay_cover_size'] = False
diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py
index 0afd1afb7f..3317d966dc 100644
--- a/src/calibre/gui2/preferences/look_feel.py
+++ b/src/calibre/gui2/preferences/look_feel.py
@@ -159,6 +159,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
'calibre')])
r('book_list_tooltips', gprefs)
r('tag_browser_old_look', gprefs, restart_required=True)
+ r('tag_browser_hide_empty_categories', gprefs)
r('bd_show_cover', gprefs)
r('bd_overlay_cover_size', gprefs)
r('cover_grid_width', gprefs)
diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui
index 4b85ace8c7..f4abcc1476 100644
--- a/src/calibre/gui2/preferences/look_feel.ui
+++ b/src/calibre/gui2/preferences/look_feel.ui
@@ -898,6 +898,19 @@ then the tags will be displayed each on their own line.
+ -
+
+
+ Hi&de empty categories (columns) in the tag browser
+
+
+ When checked, calibre will automatically hide any category
+ (a column, custom or standard) that has no items to show. For example, some
+ categories might not have values when using virtual libraries. Checking this
+ box will cause these empty categories to be hidden.
+
+
+
-
diff --git a/src/calibre/gui2/tag_browser/model.py b/src/calibre/gui2/tag_browser/model.py
index b3f93b68bd..4db0aab15d 100644
--- a/src/calibre/gui2/tag_browser/model.py
+++ b/src/calibre/gui2/tag_browser/model.py
@@ -665,6 +665,8 @@ class TagsModel(QAbstractItemModel): # {{{
for node in self.root_item.children:
key = node.category_key
if key in self.row_map:
+ if self.prefs['tag_browser_hide_empty_categories'] and len(node.child_tags()) == 0:
+ continue;
if self.hidden_categories:
if key in self.hidden_categories:
continue