Refactor icons jammy (#108)

* chore: add icons and installation

* refactor: use the new battery icons

* refactor: use audio applet icons

* chore dependency cleanup

* chore: remove icons included in cosmic-icons package

* refactor: use icons for signal strength and fix handling of new connections

* fix: improve some logic for the networking applet

* chore: add cosmic-icons to Depends

* feat: use notifications icons

* chore: set bluetooth icon depending on state

* fix: set default font and text size

* feat (network): add airplane-mode message

* feat (battery): add display icons to the battery applet

* fix (battery): logic for selecting the battery icon & use new battery icons
This commit is contained in:
Ashley Wulber 2023-08-08 16:18:12 -04:00 committed by GitHub
parent 76ce8838b5
commit 3ad64df5f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 653 additions and 615 deletions

View file

@ -18,6 +18,7 @@ pub fn active_conns_subscription<I: 'static + Hash + Copy + Send + Sync + Debug>
async move {
loop {
state = start_listening(state, &mut output).await;
_ = tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
}
}
})

View file

@ -56,6 +56,7 @@ pub async fn active_connections(
rsn_flags: access_point.rsn_flags().await?,
wpa_flags: access_point.wpa_flags().await?,
state,
strength: access_point.strength().await.unwrap_or_default(),
});
}
}
@ -98,6 +99,7 @@ pub enum ActiveConnectionInfo {
rsn_flags: ApSecurityFlags,
wpa_flags: ApSecurityFlags,
state: ActiveConnectionState,
strength: u8,
},
Vpn {
name: String,

View file

@ -18,6 +18,7 @@ pub fn devices_subscription<I: 'static + Hash + Copy + Send + Sync + Debug>(
async move {
loop {
state = start_listening(state, &mut output).await;
_ = tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
}
}
})

View file

@ -140,20 +140,31 @@ async fn start_listening(
.output()
.await
.is_ok();
let mut state = NetworkManagerState::new(&conn).await.unwrap_or_default();
state.airplane_mode = if success {
airplane_mode
} else {
!airplane_mode
};
if state.airplane_mode {
state.wifi_enabled = false;
}
_ = output
.send(NetworkManagerEvent::RequestResponse {
req: NetworkManagerRequest::SetAirplaneMode(airplane_mode),
success,
state: NetworkManagerState::new(&conn).await.unwrap_or_default(),
state,
})
.await;
}
Some(NetworkManagerRequest::SetWiFi(enabled)) => {
let success = network_manager.set_wireless_enabled(enabled).await.is_ok();
let mut state = NetworkManagerState::new(&conn).await.unwrap_or_default();
state.wifi_enabled = if success { enabled } else { !enabled };
let response = NetworkManagerEvent::RequestResponse {
req: NetworkManagerRequest::SetWiFi(enabled),
success,
state: NetworkManagerState::new(&conn).await.unwrap_or_default(),
state,
};
_ = output.send(response).await;
}
@ -198,7 +209,6 @@ async fn start_listening(
};
if let Some(s) = secrets.get_mut("802-11-wireless-security") {
s.insert("psk".into(), Value::Str(password.clone().into()).to_owned());
drop(s);
settings.extend(secrets.into_iter());
let settings: HashMap<_, _> = settings
.iter()
@ -519,14 +529,8 @@ impl NetworkManagerState {
.output()
.await?;
let airplane_mode = std::str::from_utf8(&airplaine_mode.stdout).unwrap_or_default();
let bluetooth_disabled = airplane_mode.contains("Soft blocked: yes");
if !network_manager.wireless_enabled().await.unwrap_or_default() {
_self.airplane_mode = bluetooth_disabled;
return Ok(_self);
} else {
_self.wifi_enabled = true;
};
_self.wifi_enabled = network_manager.wireless_enabled().await.unwrap_or_default();
_self.airplane_mode = airplane_mode.contains("Soft blocked: yes") && !_self.wifi_enabled;
let s = NetworkManagerSettings::new(&conn).await?;
_ = s.load_connections(&[]).await;

View file

@ -18,6 +18,7 @@ pub fn wireless_enabled_subscription<I: 'static + Hash + Copy + Send + Sync + De
async move {
loop {
state = start_listening(state, &mut output).await;
_ = tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
}
}
})