Skip to content
Edit this page

Settings

Saved values live in GSettings. The schema is data/io.github.amit9838.mousam.gschema.xml; code reads and writes them only through the settings singleton in services/settings.py, one property per key. Never create a new Gio.Settings(...).

Key Type Default Property Meaning
added-cities as [] added_cities saved locations, one JSON string each
selected-city s "" selected_city the selected one, as "lat,lon"
unit s metric unit metric or imperial
use-24h-clock b false is_using_24h_clock 12 or 24 hour clock
use-inch-for-prec b false is_using_inch_for_prec precipitation in inches
use-gradient-bg b true is_using_dynamic_bg dynamic weather backgrounds (also forces the dark colour scheme)
icon-theme s default icon_theme default or Material icons
show-overview b true show_overview the overview pill
show-notifications b true show_notifications the overview as a desktop notification
run-in-background b false run_in_background closing the window hides it
debug-mode b false debug_mode verbose logging
forecast-page s tomorrow forecast_page last forecast page shown
window-width / window-height i 1060 / 760 main window size
window-maximized b false launch maximized

Rules

  • Never rename or retype a key: users' saved values would be lost.
  • Adding one takes three things: the key in the gschema, a property on Settings, and (if the user can change it) a row in ui/dialogs/preferences.py. Run glib-compile-schemas --strict --dry-run data/.
  • Locations are stored as JSON strings in added-cities. Use JsonProcessor, LocationData and get_cords() from core/locations.py / services/selected_city.py, not your own parsing.
  • React with signals: settings.connect("changed::<key>", handler). Disconnect handlers connected from short-lived widgets.
  • The weather refreshes every 10 minutes by itself. That is a constant (AUTO_REFRESH_MINUTES), not a setting.
  • Preferences → Advanced → Reset to Default restores every setting and removes saved locations (Settings.reset_to_defaults).

Preferences dialog

WeatherPreferences in ui/dialogs/preferences.py is an Adw.PreferencesDialog with two pages, General and Advanced. Its groups include General, Appearance, Weather Overview, Logging and Debugging (debug mode, open logs folder, clear log file) and Data Management (reset to default). Each row writes through settings.