@@ -62,6 +62,7 @@ class SettingData(NamedTuple):
62
62
"autohide" : ("autohide" , "no_autohide" ),
63
63
"notify" : ("enabled" , "disabled" ),
64
64
"exit_confirmation" : ("enabled" , "disabled" ),
65
+ "transparency" : ("enabled" , "disabled" ),
65
66
}
66
67
67
68
COLOR_DEPTH_ARGS_TO_DEPTHS : Dict [str , int ] = {
@@ -80,13 +81,15 @@ class SettingData(NamedTuple):
80
81
"color-depth" : "256" ,
81
82
"maximum-footlinks" : "3" ,
82
83
"exit_confirmation" : "enabled" ,
84
+ "transparency" : "disabled" ,
83
85
}
84
86
assert DEFAULT_SETTINGS ["autohide" ] in VALID_BOOLEAN_SETTINGS ["autohide" ]
85
87
assert DEFAULT_SETTINGS ["notify" ] in VALID_BOOLEAN_SETTINGS ["notify" ]
86
88
assert DEFAULT_SETTINGS ["color-depth" ] in COLOR_DEPTH_ARGS_TO_DEPTHS
87
89
assert (
88
90
DEFAULT_SETTINGS ["exit_confirmation" ] in VALID_BOOLEAN_SETTINGS ["exit_confirmation" ]
89
91
)
92
+ assert DEFAULT_SETTINGS ["transparency" ] in VALID_BOOLEAN_SETTINGS ["transparency" ]
90
93
91
94
92
95
def in_color (color : str , text : str ) -> str :
@@ -155,6 +158,22 @@ def parse_args(argv: List[str]) -> argparse.Namespace:
155
158
help = "do not mark messages as read in the session" ,
156
159
)
157
160
161
+ transparency_group = parser .add_mutually_exclusive_group ()
162
+ transparency_group .add_argument (
163
+ "--transparency" ,
164
+ dest = "transparency" ,
165
+ action = "store_const" ,
166
+ const = "enabled" ,
167
+ help = "enable transparent background (if supported by theme and terminal)" ,
168
+ )
169
+ transparency_group .add_argument (
170
+ "--no-transparency" ,
171
+ dest = "transparency" ,
172
+ action = "store_const" ,
173
+ const = "disabled" ,
174
+ help = "disable transparent background" ,
175
+ )
176
+
158
177
notify_group = parser .add_mutually_exclusive_group ()
159
178
notify_group .add_argument (
160
179
"--notify" ,
@@ -496,6 +515,11 @@ def main(options: Optional[List[str]] = None) -> None:
496
515
theme_to_use = SettingData (real_theme_name , theme_to_use .source )
497
516
498
517
### Load overrides & validate remaining settings
518
+ if args .transparency :
519
+ zterm ["transparency" ] = SettingData (
520
+ args .transparency , ConfigSource .COMMANDLINE
521
+ )
522
+
499
523
if args .autohide :
500
524
zterm ["autohide" ] = SettingData (args .autohide , ConfigSource .COMMANDLINE )
501
525
@@ -553,22 +577,27 @@ def print_setting(setting: str, data: SettingData, suffix: str = "") -> None:
553
577
print_setting ("maximum footlinks value" , zterm ["maximum-footlinks" ])
554
578
print_setting ("color depth setting" , zterm ["color-depth" ])
555
579
print_setting ("notify setting" , zterm ["notify" ])
580
+ print_setting ("transparency setting" , zterm ["transparency" ])
556
581
557
582
### Generate data not output to user, but into Controller
583
+ # Translate valid strings for boolean values into True/False
584
+ boolean_settings : Dict [str , bool ] = dict ()
585
+ for setting , valid_values in VALID_BOOLEAN_SETTINGS .items ():
586
+ boolean_settings [setting ] = zterm [setting ].value == valid_values [0 ]
587
+
558
588
# Generate urwid palette
559
589
color_depth_str = zterm ["color-depth" ].value
560
590
color_depth = COLOR_DEPTH_ARGS_TO_DEPTHS [color_depth_str ]
591
+ transparency_enabled = boolean_settings ["transparency" ]
561
592
562
593
theme_data = generate_theme (
563
594
theme_to_use .value ,
564
595
color_depth = color_depth ,
565
- transparent_background = False ,
596
+ transparent_background = transparency_enabled ,
566
597
)
567
598
568
- # Translate valid strings for boolean values into True/False
569
- boolean_settings : Dict [str , bool ] = dict ()
570
- for setting , valid_boolean_values in VALID_BOOLEAN_SETTINGS .items ():
571
- boolean_settings [setting ] = zterm [setting ].value == valid_boolean_values [0 ]
599
+ # Avoid passing this to the Controller
600
+ boolean_settings .pop ("transparency" )
572
601
573
602
Controller (
574
603
config_file = zuliprc_path ,
0 commit comments