pino-rs
Rust notification daemon.
git clone https://git.pi66.xyz/pino-rs
About | Files | Commits | Refs | License
fix x-y placment
Author: pixel
Date: 2025-04-15 17:17
commit: cf21c3e1
Stat
| M | src/config.rs | 32 | +16 | -16 |
| M | src/main.rs | 20 | +10 | -10 |
| M | src/screen.rs | 2 | +1 | -1 |
Diff
diff --git a/src/config.rs b/src/config.rs
index 95d3bb5..d78ba8c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -7,7 +7,7 @@ pub fn generate_config(config_path: PathBuf){
.join("config.toml");
create_dir_all(config.parent().unwrap())
- .expect("Failed to create directories for template");
+ .expect("Failed to create directories for template");
println!("Creating config file at: {}", config.display());
let mut template = OpenOptions::new()
.write(true)
@@ -19,30 +19,27 @@ pub fn generate_config(config_path: PathBuf){
template
.write_all(
b"[screen]
-# Set the monitor using index
-monitor = 0
+monitor = 0 # Set the monitor using index
...
Show all
Show less
diff --git a/src/config.rs b/src/config.rs
index 95d3bb5..d78ba8c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -7,7 +7,7 @@ pub fn generate_config(config_path: PathBuf){
.join("config.toml");
create_dir_all(config.parent().unwrap())
- .expect("Failed to create directories for template");
+ .expect("Failed to create directories for template");
println!("Creating config file at: {}", config.display());
let mut template = OpenOptions::new()
.write(true)
@@ -19,30 +19,27 @@ pub fn generate_config(config_path: PathBuf){
template
.write_all(
b"[screen]
-# Set the monitor using index
-monitor = 0
+monitor = 0 # Set the monitor using index
...
diff --git a/src/config.rs b/src/config.rs
index 95d3bb5..d78ba8c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -7,7 +7,7 @@ pub fn generate_config(config_path: PathBuf){
.join("config.toml");
create_dir_all(config.parent().unwrap())
- .expect("Failed to create directories for template");
+ .expect("Failed to create directories for template");
println!("Creating config file at: {}", config.display());
let mut template = OpenOptions::new()
.write(true)
@@ -19,30 +19,27 @@ pub fn generate_config(config_path: PathBuf){
template
.write_all(
b"[screen]
-# Set the monitor using index
-monitor = 0
+monitor = 0 # Set the monitor using index
-# App placement on the screen
-horizontal = "left"
-vertical = "top"
-x = 25
-y = 55
-# Width and height of the app
-width = 300
-height = 100
+horizontal = "left" #[right] | [left]
+vertical = "top" # [top] | [bottom]
+x = 25 # X access palcement
+y = 55 # Y access palcement
-# Time to display the app (in seconds)
-delay = 5
+width = 300 # Width of the app
+height = 100 # Height of the app
+
+delay = 5 # Time to display the app (in seconds)
[frame]
-fg_color = "#1a1e24"
+fg_color = "#1a1e24"
Run "pino -f" to show all available fonts
font_family = "Fira Code"
[border]
-weight = 4
+weight = 4
color = "#ffffff"
radius = 8
@@ -69,5 +66,8 @@ title_color = "fg"
message_color = "color8"
")
-.expect("Can't Create Template File !!!");
+ .expect("Can't Create Template File !!!");
}
+
+
+
diff --git a/src/main.rs b/src/main.rs
index fed5b66..44d2dea 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -58,13 +58,13 @@ struct Config {
#[derive(Debug, Deserialize)]
struct Screen {
- monitor: u8,
+ monitor: usize,
horizontal: String,
vertical: String,
- x: i8,
- y: i8,
- width: u16,
- height: u16,
+ x: i32,
+ y: i32,
+ width: i32,
+ height: i32,
delay: i32,
}
#[derive(Debug, Deserialize)]
@@ -160,13 +160,13 @@ fn main() {
// Get Screen Placment
let screen = screen::get_size(
- config.screen.monitor.into(),
+ config.screen.monitor,
config.screen.vertical.as_str(),
config.screen.horizontal.as_str(),
- config.screen.x.into(),
- config.screen.y.into(),
- config.screen.width.into(),
- config.screen.height.into(),
+ config.screen.x,
+ config.screen.y,
+ config.screen.width,
+ config.screen.height,
);
//UI
diff --git a/src/screen.rs b/src/screen.rs
index c47efcb..524e512 100644
--- a/src/screen.rs
+++ b/src/screen.rs
@@ -17,7 +17,7 @@ pub fn get_size(
if h.to_lowercase() == "left" {
if v.to_lowercase() == "top" {
- return (screens[monitor].0 + ax, ay + screens[monitor].1, aw, ah);
+ return (screens[monitor].0 + ax, ay + screens[monitor].1 , aw , ah);
} else if v.to_lowercase() == "bottom" {
return (
screens[monitor].0 + ax,