4545tooltip_overview = """<b>Overview</b>"""
4646
4747
48+ def build_caption (i : int ):
49+ """Build the label for a given workspace number"""
50+ label = data .BAR_WORKSPACE_ICONS .get (str (i )) or data .BAR_WORKSPACE_ICONS .get ('default' )
51+ if label is None :
52+ return (
53+ CHINESE_NUMERALS [i - 1 ]
54+ if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS
55+ and 1 <= i <= len (CHINESE_NUMERALS )
56+ else str (i )
57+ )
58+ else :
59+ return label
60+
61+
4862class Bar (Window ):
4963 def __init__ (self , ** kwargs ):
5064 super ().__init__ (
@@ -135,12 +149,7 @@ def __init__(self, **kwargs):
135149 h_align = "center" ,
136150 v_align = "center" ,
137151 id = i ,
138- label = (
139- CHINESE_NUMERALS [i - 1 ]
140- if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS
141- and 1 <= i <= len (CHINESE_NUMERALS )
142- else str (i )
143- ),
152+ label = build_caption (i ),
144153 )
145154 for i in range (1 , 11 )
146155 ],
@@ -155,7 +164,7 @@ def __init__(self, **kwargs):
155164 name = "workspaces-container" ,
156165 children = (
157166 self .workspaces
158- if not data .BAR_WORKSPACE_SHOW_NUMBER
167+ if not ( data .BAR_WORKSPACE_SHOW_NUMBER or data . BAR_WORKSPACE_ICONS )
159168 else self .workspaces_num
160169 ),
161170 )
@@ -603,7 +612,7 @@ def toggle_hidden(self):
603612 self .bar_inner .remove_style_class ("hidden" )
604613
605614 def chinese_numbers (self ):
606- if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS :
615+ if data .BAR_WORKSPACE_USE_CHINESE_NUMERALS or data . BAR_WORKSPACE_ICONS :
607616 self .workspaces_num .add_style_class ("chinese" )
608617 else :
609618 self .workspaces_num .remove_style_class ("chinese" )
0 commit comments