1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164 | diff --git a/Cargo.lock b/Cargo.lock
index 2f8ca7b..89424ab 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -117,7 +117,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pino"
-version = "1.1.0"
+version = "1.1.1"
dependencies = [
"argh",
"fltk",
diff --git a/Cargo.toml b/Cargo.toml
index 85008a2..66a737a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pino"
-version = "1.1.0"
+version = "1.1.1"
edition = "2024"
[dependencies]
diff --git a/README.md b/README.md
index 80270da..830725d 100644
--- a/README.md
+++ b/README.md
@@ -137,6 +137,6 @@ sound = false
## Hardware Usage
-Pino is lightweight and efficient. The graphical notification window typically uses approximately **15-20MB of RAM** when active, ensuring minimal system resource consumption.
+Pino is lightweight and efficient. The graphical notification window typically uses approximately **5-20MB of RAM** when active, ensuring minimal system resource consumption.
diff --git a/src/main.rs b/src/main.rs
index 44d2dea..73d5f1d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -34,7 +34,7 @@ struct Arg {
#[argh(option,short = 'c', description = "set a custom configuration file")]
config:Option<String> ,
-
+
#[argh(switch,short = 'v', description = "set a custom configuration file")]
version:bool ,
}
@@ -108,7 +108,7 @@ fn main() {
let args:Arg = argh::from_env();
if args.version {
- println!("v1.1.0");
+ println!("v1.1.1");
return ;
}
@@ -189,3 +189,5 @@ fn main() {
);
}
}
+
+
diff --git a/src/ui.rs b/src/ui.rs
index 033b8b8..50fb33c 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -7,22 +7,16 @@ use fltk::{
window::Window,
};
use std::{
- fs,
- sync::mpsc,
- thread,
- time::{Duration, Instant},
+ fs::{self, metadata}, sync::mpsc, thread, time::{Duration, Instant}
};
pub fn print_fonts() {
for font in get_font_names() {
- println!("{}", font);
+ println!("{font}");
}
}
-
-
-
pub fn ui(
screen_info: (i32, i32, i32, i32),
font_family: String,
@@ -32,7 +26,7 @@ pub fn ui(
colors: (String, String, String, String),
) {
let app = app::App::default();
-
+
let mut wind1 = Window::new(
screen_info.0,
screen_info.1,
@@ -42,7 +36,7 @@ pub fn ui(
);
wind1.set_color(Color::from_hex_str(colors.1.as_str()).unwrap());
-
+
let mut wind2 = Window::new(
border.0 + border.1 / 2,
border.0 + border.1 / 2,
@@ -85,24 +79,29 @@ pub fn ui(
let (tx, rx) = mpsc::channel::<(String, String, Option<u64>)>();
thread::spawn(move || {
let filename = "/tmp/pino-check";
- let mut current_title = String::new();
- let mut current_message = String::new();
- let mut current_delay = None;
+
+ let (mut current_title,mut current_message,mut current_delay) = (String::new(),String::new(),None);
+ let mut modified = metadata(filename).unwrap().modified().unwrap();
+ let mut batata = true;
loop {
- let content = fs::read_to_string(filename).unwrap_or_default();
- let lines: Vec<&str> = content.lines().collect();
- let new_title = lines.first().unwrap_or(&"").to_string();
- let new_message = lines.get(1).unwrap_or(&"").to_string();
- let new_delay = lines.get(2).and_then(|s| s.parse::<u64>().ok());
- if new_title != current_title || new_message != current_message || new_delay != current_delay {
- tx.send((new_title.clone(), new_message.clone(), new_delay)).unwrap();
- current_title = new_title;
- current_message = new_message;
- current_delay = new_delay;
- }
-
- thread::sleep(Duration::from_millis(200));
+ if modified != metadata(filename).unwrap().modified().unwrap() || batata{
+ batata = false;
+ modified = metadata(filename).unwrap().modified().unwrap();
+
+ let content = fs::read_to_string(filename).unwrap();
+ let lines: Vec<&str> = content.lines().collect();
+ let new_title = lines.first().unwrap_or(&"").to_string();
+ let new_message = lines.get(1).unwrap_or(&"").to_string();
+ let new_delay = lines.get(2).and_then(|s| s.parse::<u64>().ok());
+ if new_title != current_title || new_message != current_message || new_delay != current_delay {
+ tx.send((new_title.clone(), new_message.clone(), new_delay)).unwrap();
+ current_title = new_title;
+ current_message = new_message;
+ current_delay = new_delay;
+ }
+ };
+ thread::sleep(Duration::from_millis(600));
}
});
@@ -136,3 +135,5 @@ pub fn ui(
}
}
}
+
+
|