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

Fix some examples failing compilation #303

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use hyprland::keyword::Keyword;
fn main() -> hyprland::Result<()> {
Keyword::set("submap", "example")?;
hyprland::bind!(SUPER, Key, "I" => ToggleFloating, None)?;
hyprland::bind!(l | CTRL ALT, Key, "Delete" => Exec, "sudo reboot"); // Reboot including from lock screen
hyprland::bind!(e | SUPER, Key, "C" => KillActiveWindow); // Kill all your windows
hyprland::bind!(l | CTRL ALT, Key, "Delete" => Exec, "sudo reboot")?; // Reboot including from lock screen
hyprland::bind!(e | SUPER, Key, "C" => KillActiveWindow)?; // Kill all your windows
Keyword::set("submap", "reset")?;

dispatch!(Custom, "submap", "example")?;
Expand Down
8 changes: 4 additions & 4 deletions examples/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ fn main() -> hyprland::Result<()> {
// Create a event listener
let mut event_listener = EventListener::new();

event_listener.add_active_window_change_handler(|data| println!("{data:#?}"));
event_listener.add_fullscreen_state_change_handler(
event_listener.add_active_window_changed_handler(|data| println!("{data:#?}"));
event_listener.add_fullscreen_state_changed_handler(
|fstate| println!("Window {} fullscreen", if fstate { "is" } else { "is not" })
);
event_listener.add_active_monitor_change_handler(|state| println!("Monitor state: {state:#?}"));
event_listener.add_workspace_change_handler(|id| println!("workspace changed to {id:?}"));
event_listener.add_active_monitor_changed_handler(|state| println!("Monitor state: {state:#?}"));
event_listener.add_workspace_changed_handler(|id| println!("workspace changed to {id:?}"));

// and execute the function
// here we are using the blocking variant
Expand Down
8 changes: 4 additions & 4 deletions examples/events_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ async fn main() -> hyprland::Result<()> {
// Create a event listener
let mut event_listener = AsyncEventListener::new();

event_listener.add_active_window_change_handler(async_closure! {
event_listener.add_active_window_changed_handler(async_closure! {
|data| println!("{data:#?}")
});

event_listener.add_fullscreen_state_change_handler(async_closure! {
event_listener.add_fullscreen_state_changed_handler(async_closure! {
|fstate| println!("Window {} fullscreen", if fstate { "is" } else { "is not" })
});

event_listener.add_active_monitor_change_handler(async_closure! {
event_listener.add_active_monitor_changed_handler(async_closure! {
|state| println!("Monitor state: {state:#?}")
});

// add event, yes functions and closures both work!
event_listener.add_workspace_change_handler(async_closure! {
event_listener.add_workspace_changed_handler(async_closure! {
|id| println!("workspace changed to {id:?}")
});

Expand Down
6 changes: 3 additions & 3 deletions src/event_listener/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub(crate) trait HasExecutor {
}
}

pub(crate) fn event_primer_noexec<'a>(
pub(crate) fn event_primer_noexec(
event: Event,
abuf: &mut Vec<ActiveWindowState>,
) -> crate::Result<Vec<Event>> {
Expand Down Expand Up @@ -688,7 +688,7 @@ fn new_event_parser(
if let Some(event) = EVENTS.get(name) {
Either::Left((
event.1,
x.splitn(event.0 as usize, ",")
x.splitn(event.0, ",")
.map(|y| y.to_string())
.collect(),
))
Expand Down Expand Up @@ -879,7 +879,7 @@ pub(crate) fn event_parser(event: String) -> crate::Result<Vec<Event>> {
toggled: get![ref args;0] == "1",
window_addresses: get![ref args;1]
.split(",")
.map(|x| Address::new(x))
.map(Address::new)
.collect(),
})),
ParsedEventType::MoveIntoGroup => {
Expand Down
Loading