@@ -53,12 +53,8 @@ func (u *UIManager) ShowSettings(cfg *config.Config, onSave func(*config.Config)
5353 }
5454
5555 // ── API config ───────────────────────────────────────────────────────
56- providerSelect := widget .NewSelect ([]string {"OpenWeatherMap" , "Weather Underground" }, nil )
57- if cfg .APIConfig != nil && cfg .APIConfig .Provider == "weatherunderground" {
58- providerSelect .SetSelected ("Weather Underground" )
59- } else {
60- providerSelect .SetSelected ("OpenWeatherMap" )
61- }
56+ providerSelect := widget .NewSelect ([]string {"OpenWeatherMap" }, nil )
57+ providerSelect .SetSelected ("OpenWeatherMap" )
6258 apiKeyEntry := widget .NewEntry ()
6359 apiKeyEntry .SetPlaceHolder ("API Key" )
6460 if cfg .APIConfig != nil {
@@ -146,6 +142,21 @@ func (u *UIManager) ShowSettings(cfg *config.Config, onSave func(*config.Config)
146142 }
147143 positionRadio .OnChanged = func (_ string ) { customPosLabel .SetText ("" ) }
148144
145+ // ── Transparency ─────────────────────────────────────────────────────
146+ opacityRadio := widget .NewRadioGroup ([]string {"25%" , "50%" , "75%" , "100%" }, nil )
147+ opacityRadio .Horizontal = true
148+ opacityMap := map [string ]int {"25%" : 25 , "50%" : 50 , "75%" : 75 , "100%" : 100 }
149+ opacityLabelMap := map [int ]string {25 : "25%" , 50 : "50%" , 75 : "75%" , 100 : "100%" }
150+ currentOpacity := cfg .Opacity
151+ if currentOpacity == 0 {
152+ currentOpacity = 100
153+ }
154+ if label , ok := opacityLabelMap [currentOpacity ]; ok {
155+ opacityRadio .SetSelected (label )
156+ } else {
157+ opacityRadio .SetSelected ("100%" )
158+ }
159+
149160 // ── Refresh interval ─────────────────────────────────────────────────
150161 intervalSlider := widget .NewSlider (1 , 60 )
151162 intervalSlider .Step = 1
@@ -168,6 +179,9 @@ func (u *UIManager) ShowSettings(cfg *config.Config, onSave func(*config.Config)
168179 positionRadio ,
169180 customPosLabel ,
170181 widget .NewSeparator (),
182+ widget .NewLabel ("Background Transparency" ),
183+ opacityRadio ,
184+ widget .NewSeparator (),
171185 widget .NewLabel ("Refresh Interval" ),
172186 container .NewHBox (intervalSlider , intervalLabel ),
173187 )
@@ -302,7 +316,7 @@ func (u *UIManager) ShowSettings(cfg *config.Config, onSave func(*config.Config)
302316 newCfg := buildConfigFromUI (
303317 dataSourceRadio , providerSelect , apiKeyEntry ,
304318 dbHostEntry , dbPortEntry , dbNameEntry , dbUserEntry , dbPassEntry , dbQueryEntry ,
305- intervalSlider , state , positionValueMap , positionRadio ,
319+ intervalSlider , state , positionValueMap , positionRadio , opacityRadio , opacityMap , cfg ,
306320 )
307321 errs := config .Validate (newCfg )
308322 if len (errs ) > 0 {
@@ -347,15 +361,25 @@ func buildConfigFromUI(
347361 state * settingsState ,
348362 positionValueMap map [string ]string ,
349363 positionRadio * widget.RadioGroup ,
364+ opacityRadio * widget.RadioGroup ,
365+ opacityMap map [string ]int ,
366+ current * config.Config ,
350367) * config.Config {
351368 cornerPosition := positionValueMap [positionRadio .Selected ]
352369 if cornerPosition == "" {
353370 cornerPosition = "bottom-right"
354371 }
372+ opacity := opacityMap [opacityRadio .Selected ]
373+ if opacity == 0 {
374+ opacity = 100
375+ }
355376 cfg := & config.Config {
356377 Cities : copyCities (state .cities ),
357378 RefreshInterval : int (intervalSlider .Value ),
358379 CornerPosition : cornerPosition ,
380+ CustomX : current .CustomX ,
381+ CustomY : current .CustomY ,
382+ Opacity : opacity ,
359383 }
360384 if dataSourceRadio .Selected == "Local Database" {
361385 cfg .DataSource = config .DataSourceLocalDatabase
@@ -370,12 +394,8 @@ func buildConfigFromUI(
370394 }
371395 } else {
372396 cfg .DataSource = config .DataSourceRemoteAPI
373- provider := "openweathermap"
374- if providerSelect .Selected == "Weather Underground" {
375- provider = "weatherunderground"
376- }
377397 cfg .APIConfig = & config.APIConfig {
378- Provider : provider ,
398+ Provider : "openweathermap" ,
379399 APIKey : strings .TrimSpace (apiKeyEntry .Text ),
380400 }
381401 }
0 commit comments