mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 10:41:03 +02:00
build: update deps
This commit is contained in:
parent
1ed3220733
commit
ad97550583
4 changed files with 96 additions and 17 deletions
|
@ -164,8 +164,6 @@ impl EventClient {
|
|||
let active = HWorkspace::get_active().expect("Failed to get active workspace");
|
||||
let new_workspaces = Workspaces::get()
|
||||
.expect("Failed to get workspaces")
|
||||
.collect()
|
||||
.into_iter()
|
||||
.map(|workspace| Workspace::from((workspace.id == active.id, workspace)));
|
||||
|
||||
workspaces.clear();
|
||||
|
@ -232,8 +230,7 @@ pub fn get_client() -> &'static EventClient {
|
|||
|
||||
fn id_to_string(id: WorkspaceType) -> String {
|
||||
match id {
|
||||
WorkspaceType::Unnamed(id) => id.to_string(),
|
||||
WorkspaceType::Named(name) => name,
|
||||
WorkspaceType::Regular(name) => name,
|
||||
WorkspaceType::Special(name) => name.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
@ -241,7 +238,7 @@ fn id_to_string(id: WorkspaceType) -> String {
|
|||
impl From<(bool, hyprland::data::Workspace)> for Workspace {
|
||||
fn from((focused, workspace): (bool, hyprland::data::Workspace)) -> Self {
|
||||
Self {
|
||||
id: id_to_string(workspace.id),
|
||||
id: workspace.id.to_string(),
|
||||
name: workspace.name,
|
||||
monitor: workspace.monitor,
|
||||
focused,
|
||||
|
|
|
@ -123,6 +123,9 @@ impl Config {
|
|||
/// and parses it into `Self` based on its extension.
|
||||
fn load_file(path: &Path) -> Result<Self> {
|
||||
let file = fs::read(path).wrap_err("Failed to read config file")?;
|
||||
|
||||
let str = std::str::from_utf8(&file)?;
|
||||
|
||||
let extension = path
|
||||
.extension()
|
||||
.unwrap_or_default()
|
||||
|
@ -130,10 +133,10 @@ impl Config {
|
|||
.unwrap_or_default();
|
||||
|
||||
match extension {
|
||||
"json" => serde_json::from_slice(&file).wrap_err("Invalid JSON config"),
|
||||
"toml" => toml::from_slice(&file).wrap_err("Invalid TOML config"),
|
||||
"yaml" | "yml" => serde_yaml::from_slice(&file).wrap_err("Invalid YAML config"),
|
||||
"corn" => libcorn::from_slice(&file).wrap_err("Invalid Corn config"),
|
||||
"json" => serde_json::from_str(str).wrap_err("Invalid JSON config"),
|
||||
"toml" => toml::from_str(str).wrap_err("Invalid TOML config"),
|
||||
"yaml" | "yml" => serde_yaml::from_str(str).wrap_err("Invalid YAML config"),
|
||||
"corn" => libcorn::from_str(str).wrap_err("Invalid Corn config"),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue