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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199 | diff --git a/src/create_templates.rs b/src/create_templates.rs
index ec9d8ae..1b1c475 100644
--- a/src/create_templates.rs
+++ b/src/create_templates.rs
@@ -5,19 +5,19 @@ fn change(template: &str, colors: (u8, u8, u8), alpha: u8) -> String {
let (r, g, b) = colors;
if template.contains(".strip") {
- format!("{:02X}{:02X}{:02X}", r, g, b)
+ format!("{:02x}{:02x}{:02x}", r, g, b)
} else if template.contains(".xrgba") {
- format!("{:02X}/{:02X}/{:02X}/{:02X}", r, g, b, alpha)
+ format!("{:02x}/{:02x}/{:02x}/{:02x}", r, g, b, alpha)
} else if template.contains(".rgba") {
format!("{},{},{},{}", r, g, b, alpha)
} else if template.contains(".rgb") {
format!("{},{},{}", r, g, b)
- } else if template.contains(".alpha_dec") {
- format!("{:.2}", alpha as f32 / 255.0)
+ } else if template.contains(".alpha_per") {
+ format!("{:.1}", (alpha / 255) * 100)
} else if template.contains(".alpha") {
- format!("#{:02X}{:02X}{:02X}{:02X}", r, g, b, alpha)
+ format!("#{:02x}{:02x}{:02x}{:02x}", r, g, b, alpha)
} else {
- format!("#{:02X}{:02X}{:02X}", r, g, b)
+ format!("#{:02x}{:02x}{:02x}", r, g, b)
}
}
@@ -35,7 +35,6 @@ fn fill_template(template_name: &str, template: &str, colors: &(Vec<(u8, u8, u8)
"{background.xrgba}",
"{background.rgba}",
"{background.rgb}",
- "{background.alpha_dec}",
"{background.alpha}",
"{background}",
];
@@ -52,7 +51,6 @@ fn fill_template(template_name: &str, template: &str, colors: &(Vec<(u8, u8, u8)
"{foreground.xrgba}",
"{foreground.rgba}",
"{foreground.rgb}",
- "{foreground.alpha_dec}",
"{foreground.alpha}",
"{foreground}",
];
@@ -67,7 +65,6 @@ fn fill_template(template_name: &str, template: &str, colors: &(Vec<(u8, u8, u8)
"{cursor.xrgba}",
"{cursor.rgba}",
"{cursor.rgb}",
- "{cursor.alpha_dec}",
"{cursor.alpha}",
"{cursor}",
];
diff --git a/src/reload.rs b/src/reload.rs
index 78421e4..cbcd4e2 100644
--- a/src/reload.rs
+++ b/src/reload.rs
@@ -62,12 +62,6 @@ fn polybar(send:bool) {
}
}
-fn sway(send:bool) {
- if run("which swaymsg") && run("pgrep sway") {
- run("swaymsg reload");
- info("Sway", "sway colorscheme set",send);
- }
-}
fn colors(colors:Vec<String>,send:bool){
@@ -117,7 +111,6 @@ pub fn reload(send:bool) {
xrdb(&cache,send);
kitty(&cache,send);
i3(send);
- sway(send);
bspwm(send);
polybar(send);
tty(&cache);
diff --git a/src/wallpaper.rs b/src/wallpaper.rs
index 9481355..26c5d05 100644
--- a/src/wallpaper.rs
+++ b/src/wallpaper.rs
@@ -187,27 +187,44 @@ fn set_desktop_wallpaper(desktop: &str, img: &str, send: bool) {
));
info("Wallpaper", "wallpaper set with Cinnamon settings", send);
} else if d.contains("hyprland") {
- // Try to determine the monitor configuration
- let monitors = run_with_output("hyprctl monitors -j | jq -r '.[].name'").unwrap_or_default();
- if !monitors.is_empty() {
- // Set for each monitor
- for monitor in monitors.lines() {
- spawn(&format!("hyprctl hyprpaper wallpaper \"{},{}\"", monitor.trim(), abs_path));
- }
+ // Get monitors using a more reliable approach
+ let monitors: Vec<String> = run_with_output("hyprctl monitors | grep Monitor | cut -d' ' -f2")
+ .unwrap_or_default()
+ .lines()
+ .map(|s| s.trim().to_string())
+ .filter(|s| !s.is_empty())
+ .collect();
+
+ if !monitors.is_empty() {
+ println!("Found monitors: {:?}", monitors);
+
+ // Create a new hyprpaper.conf file
+ let home = env::var("HOME").unwrap_or_else(|_| ".".to_string());
+ let config_path = format!("{}/.config/hypr/hyprpaper.conf", home);
+
+ // Write configuration as a single operation instead of multiple echo commands
+ let mut config = format!("preload = {}\n", abs_path);
+ for monitor in &monitors {
+ config.push_str(&format!("wallpaper = {},{}\n", monitor, abs_path));
+ }
+
+ // Use filesystem operations instead of echo
+ if let Err(e) = std::fs::write(&config_path, config) {
+ warning("Wallpaper", &format!("failed to write hyprpaper config: {}", e), send);
} else {
- // No monitors detected, try generic approach
- if run("which hyprpaper") {
- // Using hyprpaper
- spawn(&format!("echo 'preload = {}\\nwallpaper = {}' > ~/.config/hypr/hyprpaper.conf", abs_path, abs_path));
- //spawn(&format!("echo 'wallpaper = ,{}' >> ~/.config/hypr/hyprpaper.conf", abs_path));
- spawn("killall hyprpaper; hyprpaper &");
- info("Wallpaper", "wallpaper set with hyprpaper", send);
- } else {
- // Using swaybg as fallback for Hyprland
- spawn(&format!("pkill swaybg; swaybg -i '{}' -m fill &", abs_path));
- info("Wallpaper", "wallpaper set with swaybg for Hyprland", send);
- }
+ // Restart hyprpaper
+ spawn("killall hyprpaper 2>/dev/null; hyprpaper &");
+ info("Wallpaper", "wallpaper set with hyprpaper", send);
}
+ } else {
+ // Fallback to swaybg if no monitors detected
+ spawn(&format!("pkill swaybg; swaybg -i '{}' -m fill &", abs_path));
+ info("Wallpaper", "wallpaper set with swaybg for Hyprland", send);
+ }
+
+
+
+
} else if d == "sway" {
// Using swww or swaybg for Sway
if run("which swww") {
@@ -333,7 +350,6 @@ pub fn change_wallpaper(img: &str, send: bool) {
match get_desktop_env() {
Some(d) => {
- info("Wallpaper", &format!("detected environment: {}", d), send);
set_desktop_wallpaper(&d, img, send);
},
None => {
diff --git a/templates/colors-hyprland.conf b/templates/colors-hyprland.conf
index 4dc8aba..0181680 100644
--- a/templates/colors-hyprland.conf
+++ b/templates/colors-hyprland.conf
@@ -1,21 +1,21 @@
$wallpaper = {wallpaper}
-$foreground = rgba({foreground.rgba})
-$background = rgba({background.rgba})
+$foreground = {foreground.strip}
+$background = {background.strip}
-$color0 = rgba({color0.rgba})
-$color1 = rgba({color1.rgba})
-$color2 = rgba({color2.rgba})
-$color3 = rgba({color3.rgba})
-$color4 = rgba({color4.rgba})
-$color5 = rgba({color5.rgba})
-$color6 = rgba({color6.rgba})
-$color7 = rgba({color7.rgba})
-$color8 = rgba({color8.rgba})
-$color9 = rgba({color9.rgba})
-$color10 =rgba({color10.rgba})
-$color11 =rgba({color11.rgba})
-$color12 =rgba({color12.rgba})
-$color13 =rgba({color13.rgba})
-$color14 =rgba({color14.rgba})
-$color15 =rgba({color15.rgba})
+$color0 = {color0.strip}
+$color1 = {color1.strip}
+$color2 = {color2.strip}
+$color3 = {color3.strip}
+$color4 = {color4.strip}
+$color5 = {color5.strip}
+$color6 = {color6.strip}
+$color7 = {color7.strip}
+$color8 = {color8.strip}
+$color9 = {color9.strip}
+$color10 ={color10.strip}
+$color11 ={color11.strip}
+$color12 ={color12.strip}
+$color13 ={color13.strip}
+$color14 ={color14.strip}
+$color15 ={color15.strip}
|