restructure lib

this makes imports better, as
they can now be written as
use worf:: instead worf_lib::
This commit is contained in:
Alexander Mohr 2025-06-01 01:39:48 +02:00
parent bf9cb00a45
commit 89b3f6f2d3
6 changed files with 12 additions and 7 deletions

0
IO
View file

View file

@ -7,7 +7,7 @@ use hyprland::{
}; };
use rayon::prelude::*; use rayon::prelude::*;
use sysinfo::{Pid, System}; use sysinfo::{Pid, System};
use worf_lib::{ use worf::{
config::{self, Config}, config::{self, Config},
desktop::EntryType, desktop::EntryType,
gui::{self, ItemProvider, MenuItem}, gui::{self, ItemProvider, MenuItem},
@ -23,7 +23,7 @@ impl WindowProvider {
let clients = hyprland::data::Clients::get().map_err(|e| e.to_string())?; let clients = hyprland::data::Clients::get().map_err(|e| e.to_string())?;
let clients: Vec<_> = clients.iter().cloned().collect(); let clients: Vec<_> = clients.iter().cloned().collect();
let desktop_files = Arc::new(worf_lib::desktop::find_desktop_files()); let desktop_files = Arc::new(worf::desktop::find_desktop_files());
let mut sys = System::new_all(); let mut sys = System::new_all();
sys.refresh_all(); sys.refresh_all();

View file

@ -1,6 +1,6 @@
use std::{collections::HashMap, env, process::Command, thread::sleep, time::Duration}; use std::{collections::HashMap, env, process::Command, thread::sleep, time::Duration};
use worf_lib::{ use worf::{
config::{self, Config, CustomKeyHintLocation}, config::{self, Config, CustomKeyHintLocation},
desktop::{copy_to_clipboard, spawn_fork}, desktop::{copy_to_clipboard, spawn_fork},
gui::{self, CustomKeyHint, CustomKeys, ItemProvider, Key, KeyBinding, MenuItem, Modifier}, gui::{self, CustomKeyHint, CustomKeys, ItemProvider, Key, KeyBinding, MenuItem, Modifier},

View file

@ -13,8 +13,8 @@ similar_names = "allow"
clone_on_ref_ptr = "warn" clone_on_ref_ptr = "warn"
[lib] [lib]
name = "worf_lib" name = "worf"
path = "src/lib/mod.rs" path = "src/mod.rs"
[[bin]] [[bin]]
name = "worf" name = "worf"

View file

@ -2,7 +2,7 @@ use std::env;
use anyhow::anyhow; use anyhow::anyhow;
use worf_lib::{Error, config, config::Mode, desktop::fork_if_configured, modes}; use worf::{Error, config, config::Mode, desktop::fork_if_configured, modes};
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
env_logger::Builder::new() env_logger::Builder::new()

View file

@ -1,14 +1,19 @@
use std::fmt; use std::fmt;
/// Configuration and command line parsing /// Configuration and command line parsing
#[path = "lib/config.rs"]
pub mod config; pub mod config;
/// Desktop action like parsing desktop files and launching programs /// Desktop action like parsing desktop files and launching programs
#[path = "lib/desktop.rs"]
pub mod desktop; pub mod desktop;
#[path = "lib/gui.rs"]
/// All things related to the user interface /// All things related to the user interface
pub mod gui; pub mod gui;
/// Out of the box supported modes, like drun, dmenu, etc... /// Out of the box supported modes, like drun, dmenu, etc...
#[path = "lib/modes/mod.rs"]
pub mod modes; pub mod modes;
/// Defines error the lib can encounter /// Defines error the lib can encounter
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum Error { pub enum Error {
@ -72,4 +77,4 @@ impl fmt::Display for Error {
} }
} }
} }
} }