Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul dependencies and features #208

Merged
merged 58 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e9c8047
Remove lazy_static dependency, add once_cell
REALERvolker1 Apr 9, 2024
c42b405
Remove unused tokio features
REALERvolker1 Apr 9, 2024
ea88f72
Group dependencies
REALERvolker1 Apr 9, 2024
d15e45e
Remove strum dependency
REALERvolker1 Apr 9, 2024
d3223db
Minimize derive_more required features
REALERvolker1 Apr 9, 2024
b8ca184
remove dependency on futures, use std::future
REALERvolker1 Apr 9, 2024
0c867a4
Rename feature async-net to async-lite
REALERvolker1 Apr 9, 2024
7ece9af
Add missing docs
REALERvolker1 Apr 9, 2024
70ac716
remove async_trait dependency
REALERvolker1 Apr 9, 2024
a0bd1b6
Dependency cleaning
REALERvolker1 Apr 9, 2024
fc6f1e5
Change default release opt level to 3
REALERvolker1 Apr 9, 2024
bf653f6
Add ahash as a potential hashmap perf improvement
REALERvolker1 Apr 9, 2024
a4b5f8c
More dependency shenanigans
REALERvolker1 Apr 9, 2024
c1269dd
Switch to fixed versions
REALERvolker1 Apr 9, 2024
0401161
Refactor "stupid hack"
REALERvolker1 Apr 9, 2024
e016579
Change event set to a vec for cheaper iteration
REALERvolker1 Apr 9, 2024
2985bdf
Refactor event parser logic
REALERvolker1 Apr 9, 2024
33dd3f3
Remove ahash dependency
REALERvolker1 Apr 9, 2024
e2bb5a0
Use a Boxed slice rather than a Vec for events
REALERvolker1 Apr 9, 2024
b35f39b
Remove strum
REALERvolker1 Apr 9, 2024
94b1dd5
Refactor Address formatting
REALERvolker1 Apr 9, 2024
2b76a2f
replace std::fmt::Display impl with derive_more
REALERvolker1 Apr 10, 2024
8389d4c
replace boxed slice with array for events
REALERvolker1 Apr 10, 2024
3077f71
remove doc comment dependency (#61)
REALERvolker1 Apr 10, 2024
a6b72ef
impl derive_more::Display on HyprError
REALERvolker1 Apr 10, 2024
bc24c6c
impl TryFrom<i32> for WorkspaceType to fix panic
REALERvolker1 Apr 10, 2024
ef0227a
reorganize Address methods, derive Display
REALERvolker1 Apr 10, 2024
eadcf09
Clean up wording of panics
REALERvolker1 Apr 10, 2024
e9c4e3b
Add convenience traits to public structs for API
REALERvolker1 Apr 10, 2024
9d969f0
Add try_from impls for integer types
REALERvolker1 Apr 10, 2024
b03e08f
Remove, or revise descriptions of several panics
REALERvolker1 Apr 10, 2024
1d8db10
Refactor socket path function to only run once
REALERvolker1 Apr 10, 2024
c07052d
Remove dependency on hex
REALERvolker1 Apr 10, 2024
77fa63d
Box the events slice, remove unused imports
REALERvolker1 Apr 10, 2024
aadd360
Switch to event parser v2
REALERvolker1 Apr 10, 2024
e02fb2b
Modify socket path code to address perf penalties
REALERvolker1 Apr 10, 2024
3376c67
Tweak error handling
REALERvolker1 Apr 11, 2024
1318937
Replace BTreeSet with HashSet, potential perf gain
REALERvolker1 Apr 11, 2024
fa4c28e
Add ahash again -- noticeable perf difference
REALERvolker1 Apr 11, 2024
8cb0b4f
Remove more panics
REALERvolker1 Apr 11, 2024
a070f3e
Create hypr_err macro
REALERvolker1 Apr 11, 2024
582461b
Update MSRV
REALERvolker1 Apr 11, 2024
e83cae3
Move examples into separate subdirectories
REALERvolker1 Apr 11, 2024
4c74895
Revise potential dual imports
REALERvolker1 Apr 11, 2024
d03102c
Remove event parser v1
REALERvolker1 Apr 11, 2024
fad2afe
look at dispatch function, remove HashSetExt
REALERvolker1 Apr 11, 2024
7fc16ef
Remove deprecated dispatchers
REALERvolker1 Apr 11, 2024
bf0b92d
Switch to derive_more::Display for more things
REALERvolker1 Apr 11, 2024
5d0b65c
Update Cargo.lock
REALERvolker1 Apr 13, 2024
53c62a9
Remove unsafe send+sync impls
REALERvolker1 Apr 13, 2024
845eb3d
Remove unnecessary lifetime declaration
REALERvolker1 Apr 13, 2024
e3d7417
Replace env queries with thread-local storage
REALERvolker1 Apr 13, 2024
8c9ce21
very minor tweaks
REALERvolker1 Apr 13, 2024
a17d658
Add unsafe impls again, under a feature flag
REALERvolker1 Apr 16, 2024
08f02c7
only check socket paths once
REALERvolker1 Apr 16, 2024
c7a27e2
Update deps, fix merge conflict
REALERvolker1 Apr 20, 2024
6aa7d96
Merge branch 'master' into master
yavko Apr 20, 2024
12e7025
Fix terminology in unreachables, remove dead code
REALERvolker1 Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
346 changes: 129 additions & 217 deletions Cargo.lock

Large diffs are not rendered by default.

54 changes: 37 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ categories.workspace = true
build = true

[profile.release]
opt-level = "z"
opt-level = 3
strip = true
lto = true

Expand All @@ -33,27 +33,41 @@ authors = ["yavko <[email protected]>"]

[dependencies]
hyprland-macros = { path = "hyprland-macros", version = "0.3.4" }
serde = {version = "1", features = ["derive"]}
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_repr = "0.1"
hex = "0.4"
tokio = { version = "1", features = ["full"], optional = true }
async-net = { version = "2", optional = true }
async-std = { version = "1", optional = true }
futures-lite = { version = "2", optional = true }
lazy_static = "1.4"
regex = "1.10"
async-trait = "0.1"
num-traits = "0.2"
doc-comment = "0.3"
paste = "1"
strum = { version = "0.26", features = ["derive"] }
derive_more = "0.99"
futures = "0.3"
hex = "0.4.3"
yavko marked this conversation as resolved.
Show resolved Hide resolved
tokio = { version = "1", features = [
"io-std",
"io-util",
"net",
], optional = true }
async-net = { version = "2.0", optional = true }
async-std = { version = "1.12", optional = true }
futures-lite = { version = "2.3", optional = true, default-features = false }
regex = { version = "1.10", default-features = false, features = [
"std",
"perf",
"unicode",
] }
num-traits = "0.2.18"
doc-comment = "0.3.3"
yavko marked this conversation as resolved.
Show resolved Hide resolved
paste = "1.0.14"
derive_more = { version = "0.99", default-features = false, features = [
"display",
"constructor",
] }
once_cell = "1.19"
ahash = { version = "0.8", features = [
"std",
"serde",
"no-rng",
], default-features = false, optional = true }
parking_lot = { version = "0.12.1", optional = true }

[features]
default = ["listener", "dispatch", "data", "keyword", "config", "ctl", "tokio"]
async-net = ["dep:async-net", "dep:futures-lite"]
async-lite = ["dep:async-net", "dep:futures-lite"]
async-std = ["dep:async-std", "dep:futures-lite"]
tokio = ["dep:tokio"]
dispatch = []
Expand All @@ -63,3 +77,9 @@ keyword = []
config = ["dispatch", "keyword"]
listener = ["data", "dispatch"]
silent = []
parking_lot = ["dep:parking_lot", "once_cell/parking_lot", "tokio?/parking_lot"]
ahash = ["dep:ahash"]

# for examples
[dev-dependencies]
tokio = { version = "1", features = ["macros", "io-std", "rt-multi-thread"] }
21 changes: 14 additions & 7 deletions src/ctl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use derive_more::{Constructor, Display as MDisplay};
use std::fmt::Display as FDisplay;
use strum::{Display as SDisplay, EnumProperty};
// use strum::{Display as SDisplay, EnumProperty};
yavko marked this conversation as resolved.
Show resolved Hide resolved

use crate::shared::*;

Expand Down Expand Up @@ -73,21 +73,28 @@ pub mod set_cursor {
pub mod output {
use super::*;
/// Output backend types
#[derive(SDisplay)]
#[derive(Debug)]
pub enum OutputBackends {
/// The wayland output backend
#[strum(serialize = "wayland")]
Wayland,
/// The x11 output backend
#[strum(serialize = "x11")]
X11,
/// The headless output backend
#[strum(serialize = "headless")]
Headless,
/// Let Hyprland decide the backend type
#[strum(serialize = "auto")]
Auto,
}
impl std::fmt::Display for OutputBackends {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Wayland => "wayland",
Self::X11 => "x11",
Self::Headless => "headless",
Self::Auto => "auto",
}
.fmt(f)
}
}
yavko marked this conversation as resolved.
Show resolved Hide resolved

/// Create virtual displays
pub fn create(backend: OutputBackends) -> crate::Result<()> {
Expand Down Expand Up @@ -237,7 +244,7 @@ pub mod set_prop {
}

/// Type that represents a prop
#[derive(EnumProperty, MDisplay)]
#[derive(MDisplay)]
pub enum PropType {
/// The animation style
#[display(fmt = "animationstyle {}", "_0")]
Expand Down
1 change: 0 additions & 1 deletion src/data/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub struct FullscreenState(
pub bool,
);

#[async_trait]
impl HyprData for FullscreenState {
fn get() -> crate::Result<Self> {
Ok(Self(Workspace::get_active()?.fullscreen))
Expand Down
3 changes: 0 additions & 3 deletions src/data/macros.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
macro_rules! impl_on {
($name:ident) => {
#[async_trait]
impl HyprData for $name {
fn get() -> $crate::Result<Self> {
let data = call_hyprctl_data_cmd(DataCommands::$name)?;
Expand Down Expand Up @@ -145,7 +144,6 @@ macro_rules! create_data_struct {
holding_type: $holding_type,
);

#[async_trait]
impl HyprData for $name {
fn get() -> $crate::Result<Self> {
let data = call_hyprctl_data_cmd($cmd_kind)?;
Expand Down Expand Up @@ -186,7 +184,6 @@ macro_rules! create_data_struct {
value: $value,
);

#[async_trait]
impl HyprData for $name {
fn get() -> $crate::Result<Self> {
let data = call_hyprctl_data_cmd($cmd_kind)?;
Expand Down
4 changes: 4 additions & 0 deletions src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
mod macros;

use crate::shared::*;

#[cfg(feature = "ahash")]
use ahash::HashMap;
yavko marked this conversation as resolved.
Show resolved Hide resolved
#[cfg(not(feature = "ahash"))]
use std::collections::HashMap;

mod regular;
Expand Down
7 changes: 3 additions & 4 deletions src/data/regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ pub struct Monitor {
pub vrr: bool,
}

#[async_trait]
impl HyprDataActive for Monitor {
fn get_active() -> crate::Result<Self> {
let all = Monitors::get()?;
Expand Down Expand Up @@ -177,7 +176,6 @@ pub struct Workspace {
pub last_window_title: String,
}

#[async_trait]
impl HyprDataActive for Workspace {
fn get_active() -> crate::Result<Self> {
let data = call_hyprctl_data_cmd(DataCommands::ActiveWorkspace)?;
Expand Down Expand Up @@ -250,7 +248,6 @@ pub struct Client {
#[serde(deny_unknown_fields)]
struct Empty {}

#[async_trait]
impl HyprDataActiveOptional for Client {
fn get_active() -> crate::Result<Option<Self>> {
let data = call_hyprctl_data_cmd(DataCommands::ActiveWindow)?;
Expand Down Expand Up @@ -473,7 +470,9 @@ pub enum AnimationStyle {
Slide,
/// Vertical slide animation
SlideVert,
/// Fading slide animation
SlideFade,
/// Fading slide animation in a vertical direction
SlideFadeVert,
/// Popin animation (with percentage)
PopIn(u8),
Expand Down Expand Up @@ -600,7 +599,6 @@ struct AnimationsRaw(Vec<AnimationRaw>, Vec<RawBezierIdent>);
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Animations(pub Vec<Animation>, pub Vec<BezierIdent>);

#[async_trait]
impl HyprData for Animations {
fn get() -> crate::Result<Self>
where
Expand Down Expand Up @@ -648,6 +646,7 @@ impl HyprData for Animations {

// HACK: shadow and decorate are actually missing from the hyprctl json output for some reason
// HACK: gaps_in and gaps_out are returned as arrays with 4 integers, even though Hyprland doesn't support per-side gaps
/// The rules of an individual workspace, as returned by hyprctl json.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WorkspaceRuleset {
/// The name of the workspace
Expand Down
1 change: 0 additions & 1 deletion src/event_listener/async_im.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ impl Default for AsyncEventListener {
}
}

#[async_trait]
impl HasAsyncExecutor for AsyncEventListener {
async fn event_executor_async(&mut self, event: Event) -> crate::Result<()> {
match event {
Expand Down
Loading
Loading