feat(network): add rfkill setting
This setting makes it possible to have a configuration with two network modules where one of them displays the ethernet state (disconnected, linked, ethernet), and the other, the wifi state (disabled, disconnected, linked, wifi). Otherwise the ethernet state would show up as "disabled" (instead of "disconnected") when rfkill is active.
This commit is contained in:
@ -16,6 +16,11 @@ Addressed by *network*
|
|||||||
typeof: string ++
|
typeof: string ++
|
||||||
Use the defined interface instead of auto-detection. Accepts wildcard.
|
Use the defined interface instead of auto-detection. Accepts wildcard.
|
||||||
|
|
||||||
|
*rfkill*: ++
|
||||||
|
typeof: bool ++
|
||||||
|
default: true ++
|
||||||
|
If enabled, the *disabled* format will be used when rfkill is blocking wlan interfaces.
|
||||||
|
|
||||||
*interval*: ++
|
*interval*: ++
|
||||||
typeof: integer ++
|
typeof: integer ++
|
||||||
default: 60 ++
|
default: 60 ++
|
||||||
@ -49,7 +54,7 @@ Addressed by *network*
|
|||||||
|
|
||||||
*format-disabled*: ++
|
*format-disabled*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
This format is used when the displayed interface is disabled.
|
This format is used when rfkill is blocking wlan interfaces.
|
||||||
|
|
||||||
*format-icons*: ++
|
*format-icons*: ++
|
||||||
typeof: array/object ++
|
typeof: array/object ++
|
||||||
@ -127,7 +132,7 @@ Addressed by *network*
|
|||||||
|
|
||||||
*tooltip-format-disabled*: ++
|
*tooltip-format-disabled*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
This format is used when the displayed interface is disabled.
|
This format is used when rfkill is blocking wlan interfaces.
|
||||||
|
|
||||||
*menu*: ++
|
*menu*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
|
@ -273,7 +273,11 @@ void waybar::modules::Network::worker() {
|
|||||||
const std::string waybar::modules::Network::getNetworkState() const {
|
const std::string waybar::modules::Network::getNetworkState() const {
|
||||||
if (ifid_ == -1 || !carrier_) {
|
if (ifid_ == -1 || !carrier_) {
|
||||||
#ifdef WANT_RFKILL
|
#ifdef WANT_RFKILL
|
||||||
if (rfkill_.getState()) return "disabled";
|
bool display_rfkill = true;
|
||||||
|
if (config_["rfkill"].isBool()) {
|
||||||
|
display_rfkill = config_["rfkill"].asBool();
|
||||||
|
}
|
||||||
|
if (rfkill_.getState() && display_rfkill) return "disabled";
|
||||||
#endif
|
#endif
|
||||||
return "disconnected";
|
return "disconnected";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user