Skip to content

Commit 36fad6d

Browse files
authored
Merge pull request #293 from dwall-rs/main
0.1.17
2 parents 3a3a2a0 + 6fc9b80 commit 36fad6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1642
-633
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["src-tauri", "daemon"]
44

55
[workspace.package]
66
authors = ["thep0y"]
7-
version = "0.1.16"
7+
version = "0.1.17"
88
# homepage = ""
99
repository = "https://github.com/dwall-rs/dwall"
1010
license = "AGPL-3.0"

bun.lockb

32.6 KB
Binary file not shown.

daemon/src/color_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ fn notify_theme_change() -> DwallResult<()> {
287287
];
288288

289289
for notification in notifications {
290-
let theme_name: Vec<u16> = format!("{}\0", notification).encode_utf16().collect();
290+
let theme_name = Vec::from_str(notification);
291291
unsafe {
292292
if let Err(e) = SendNotifyMessageW(
293293
HWND_BROADCAST,

daemon/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl Config {
213213
pub fn github_asset_url(&self, github_url: &str) -> String {
214214
self.github_mirror_template
215215
.as_ref()
216-
.and_then(|v| if v == "" { None } else { Some(v) })
216+
.and_then(|v| if v.is_empty() { None } else { Some(v) })
217217
.and_then(|template| {
218218
use regex::Regex;
219219

daemon/src/monitor/mod.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,19 @@ pub struct MonitorInfoProvider {
7070
cache: Arc<RwLock<MonitorCache>>,
7171
}
7272

73-
impl MonitorInfoProvider {
74-
/// Creates a new MonitorInfoProvider instance
75-
pub fn new() -> Self {
73+
impl Default for MonitorInfoProvider {
74+
fn default() -> Self {
7675
Self {
7776
cache: Arc::new(RwLock::new(MonitorCache::new())),
7877
}
7978
}
79+
}
80+
81+
impl MonitorInfoProvider {
82+
/// Creates a new MonitorInfoProvider instance
83+
pub fn new() -> Self {
84+
Default::default()
85+
}
8086

8187
/// Gets all available monitors with caching
8288
pub async fn get_monitors(&self) -> DwallResult<HashMap<String, Monitor>> {
@@ -121,7 +127,7 @@ impl MonitorInfoProvider {
121127
}
122128

123129
// Check if any monitor IDs changed
124-
for (id, _) in &current_monitors {
130+
for id in current_monitors.keys() {
125131
if !cached_monitors.contains_key(id) {
126132
return Ok(true);
127133
}
@@ -304,9 +310,11 @@ impl MonitorManager {
304310
fn query_monitor_info() -> DwallResult<HashMap<String, Monitor>> {
305311
debug!("Querying monitor information from system");
306312
let mut monitors = HashMap::new();
307-
let mut index = 0;
308313

309-
for display_path in display_config::query_display_paths()?.into_iter() {
314+
for (index, display_path) in display_config::query_display_paths()?
315+
.into_iter()
316+
.enumerate()
317+
{
310318
let target_info =
311319
display_config::query_target_name(display_path.adapter_id, display_path.target_id)?;
312320
let device_path = target_info.monitorDevicePath.to_string();
@@ -333,11 +341,9 @@ fn query_monitor_info() -> DwallResult<HashMap<String, Monitor>> {
333341
id: device_path.clone(),
334342
device_path,
335343
friendly_name,
336-
index: Some(index),
344+
index: Some(index as u32),
337345
},
338346
);
339-
340-
index += 1;
341347
}
342348

343349
info!("Found {} monitors in total", monitors.len());

daemon/src/solar.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ impl SunPosition {
6464
let y = year + 4800.0 - a;
6565
let m = month + 12.0 * a - 3.0;
6666

67-
let jd = day + ((153.0 * m + 2.0) / 5.0) + 365.0 * y + (y / 4.0) - (y / 100.0)
68-
+ (y / 400.0)
69-
- 32045.5;
70-
jd
67+
day + ((153.0 * m + 2.0) / 5.0) + 365.0 * y + (y / 4.0) - (y / 100.0) + (y / 400.0)
68+
- 32045.5
7169
}
7270

7371
fn time_factor(&self) -> f64 {

daemon/src/utils/string.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ impl<const N: usize> WideStringExt for [u16; N] {
2121
let wide_chars: Vec<u16> = OsStr::new(s).encode_wide().collect();
2222
let copy_len = wide_chars.len().min(N - 1); // Ensure one position is reserved for the null terminator
2323

24-
for i in 0..copy_len {
25-
buf[i] = wide_chars[i];
26-
}
24+
buf[..copy_len].copy_from_slice(&wide_chars[..copy_len]);
2725

2826
buf
2927
}

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dwall-settings",
3-
"version": "0.1.16",
3+
"version": "0.1.17",
44
"description": "",
55
"type": "module",
66
"scripts": {
@@ -11,7 +11,9 @@
1111
"tauri": "tauri",
1212
"start:dev": "cargo build -p dwall --features log-color && cross-env RUST_BACKTRACE=1 tauri dev --features log-color",
1313
"check": "biome check --write src",
14-
"dev": "bun run start:dev"
14+
"dev": "bun run start:dev",
15+
"stage": "cargo build -r -p dwall --features log-color && cross-env RUST_BACKTRACE=1 tauri dev --features log-color devtools --release",
16+
"test": "vitest"
1517
},
1618
"license": "MIT",
1719
"dependencies": {
@@ -30,9 +32,11 @@
3032
"@tauri-apps/cli": "^2.4.1",
3133
"@types/node": "^22.14.0",
3234
"cross-env": "^7.0.3",
35+
"jsdom": "^26.0.0",
3336
"sass": "^1.86.3",
3437
"typescript": "^5.8.3",
3538
"vite": "^6.2.5",
36-
"vite-plugin-solid": "^2.11.6"
39+
"vite-plugin-solid": "^2.11.6",
40+
"vitest": "^3.1.1"
3741
}
3842
}

src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ tauri-plugin-process = "2"
5555
[features]
5656
default = []
5757
log-color = ["dwall/log-color"]
58+
devtools = ["tauri/devtools"]

0 commit comments

Comments
 (0)