notify_error/
notify_error.rs1use hyprrust::{
2 arguments::{ColorArgument, NotifyIconArgument, WindowArgument},
3 commands::*,
4 data::Window,
5 HyprlandConnection,
6};
7
8fn main() {
9 let conn = HyprlandConnection::current().unwrap();
10
11 let args = std::env::args().collect::<Vec<_>>();
12 if args.len() < 2 {
13 eprintln!("Not enough arguments!");
14 return;
15 }
16 let fav_window: String = args[1].to_string();
17
18 conn.send_command_sync(&focus_window(WindowArgument::Class(fav_window.clone())))
19 .unwrap();
20
21 if conn.get_sync::<Window>().unwrap().class != fav_window {
22 conn.send_command_sync(&set_error(
23 ColorArgument::new(255, 40, 40, 255),
24 "Could not focus your favourite window.".to_string(),
25 ))
26 .unwrap();
27 } else {
28 conn.send_command_sync(¬ify(
29 NotifyIconArgument::Ok,
30 10000,
31 ColorArgument::new(40, 200, 120, 255),
32 "Everything went well!".to_string(),
33 ))
34 .unwrap();
35 }
36}