diff --git a/man/waybar-wwan.5.scd b/man/waybar-wwan.5.scd index 6f5168cd..0169de07 100644 --- a/man/waybar-wwan.5.scd +++ b/man/waybar-wwan.5.scd @@ -113,20 +113,10 @@ libmm-glib lives in: typeof: string ++ Select only the modem with the corresponding hardware path. -*hide-failed*: ++ +*hide-disconnected*: ++ typeof: bool ++ default: true ++ - Defines if the module should be hidden if the modem cannot start. - -*hide-disabled*: ++ - typeof: bool ++ - default: false ++ - Defines if the module should be hidden if the modem is disabled. - -*hide-not-registered*: ++ - typeof: bool ++ - default: false ++ - Defines if the module should be hidden if the modem isn't registered with any carrier network. + Defines if the module should be hidden while the modem does not have an active data connection. # FORMAT REPLACEMENTS diff --git a/meson.build b/meson.build index 737a4199..f1b9cb75 100644 --- a/meson.build +++ b/meson.build @@ -561,7 +561,7 @@ endif if libmm_glib.found() add_project_arguments('-DHAVE_LIBMM_GLIB', language: 'cpp') src_files += files('src/modules/wwan.cpp') - #man_files += files('man/waybar-wwan.5.scd') + man_files += files('man/waybar-wwan.5.scd') endif subdir('protocol') diff --git a/src/modules/wwan.cpp b/src/modules/wwan.cpp index 8cd3aefe..86e68624 100644 --- a/src/modules/wwan.cpp +++ b/src/modules/wwan.cpp @@ -69,7 +69,9 @@ void waybar::modules::Wwan::updateCurrentModem() { if (config_["path"].isString()) { std::string path = config_["path"].asString(); - std::string other = mm_modem_dup_physdev(modem); + gchar* physdev = mm_modem_dup_physdev(modem); + std::string other = physdev ? physdev : ""; + g_free(physdev); if (path != other) { g_object_unref(modem); @@ -80,7 +82,9 @@ void waybar::modules::Wwan::updateCurrentModem() { if (config_["imei"].isString()) { std::string imei = config_["imei"].asString(); - std::string other = mm_modem_dup_equipment_identifier(modem); + gchar* equipment_id = mm_modem_dup_equipment_identifier(modem); + std::string other = equipment_id ? equipment_id : ""; + g_free(equipment_id); if (imei != other) { g_object_unref(modem); @@ -210,7 +214,9 @@ std::string getOperatorNameString(MMModem* modem) { return "No SIM"; } - std::string name = mm_sim_dup_operator_name(sim); + gchar* operator_name = mm_sim_dup_operator_name(sim); + std::string name = operator_name ? operator_name : ""; + g_free(operator_name); g_object_unref(sim); return name; } @@ -222,7 +228,7 @@ auto waybar::modules::Wwan::update() -> void { return; } - if (hideDisconnected) { + if (hideDisconnected && mm_modem_get_state(current_modem) != MM_MODEM_STATE_CONNECTED) { event_box_.set_visible(false); return; @@ -268,7 +274,10 @@ auto waybar::modules::Wwan::update() -> void { store.push_back(fmt::arg("icon", getIcon(percentage))); store.push_back(fmt::arg("power_state", getPowerStateString(current_modem))); - store.push_back(fmt::arg("imei", mm_modem_dup_equipment_identifier(current_modem))); + gchar* imei_raw = mm_modem_dup_equipment_identifier(current_modem); + std::string imei = imei_raw ? imei_raw : ""; + g_free(imei_raw); + store.push_back(fmt::arg("imei", imei)); store.push_back(fmt::arg("operator_name", getOperatorNameString(current_modem))); diff --git a/subprojects/.wraplock b/subprojects/.wraplock deleted file mode 100644 index e69de29b..00000000