Pi66

pino-rs
Rust notification daemon.
git clone https://git.pi66.xyz/pino-rs

← back to log

fix x-y placment

author: pixel
date: 2025-04-15 17:17
hash: cf21c3e19ed8361f99c2e7cb97f15338cdfad0f2

Diffstat:

M

src/config.rs
32 +++++++++++++++---------------

M

src/main.rs
20 ++++++++++---------

M

src/screen.rs
2 +-
  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
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,