@bobfrankston/msger 0.1.93 → 0.1.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/TODO.md CHANGED
@@ -1,15 +1,109 @@
1
1
  # msger TODO List
2
2
 
3
- ## Recent Session (2025-11-12) - Hash Option, F11 Fix, Button Response, Debug Mode
3
+ ## Recent Session (2025-11-12) - Warning Cleanup
4
+
5
+ **Status:** ✅ COMPLETED - Version 0.1.95
6
+
7
+ ### What Was Fixed:
8
+
9
+ 1. **Rust Compiler Warnings**
10
+ - Fixed "unused variable: webview" warning on Linux
11
+ - Fixed "variable does not need to be mutable" warning
12
+ - Fixed "unused Result that must be used" warning
13
+ - Added `#[cfg_attr(not(windows), allow(unused_variables))]` for webview (only used on Windows for About menu)
14
+ - Changed `let mut webview` to `let webview`
15
+ - Changed `SetWindowSubclass(...).ok();` to `let _ = SetWindowSubclass(...).ok();`
16
+
17
+ ### Testing:
18
+ - ✅ Windows build: Zero warnings
19
+ - ✅ Linux build: Zero warnings
20
+ - ✅ Windows runtime: Working perfectly
21
+ - ✅ WSL runtime: Working perfectly
22
+
23
+ ---
24
+
25
+ ## Session (2025-11-12) - WSL Linux Support Fixed
26
+
27
+ **Status:** ✅ COMPLETED - Version 0.1.94
28
+
29
+ ### What Was Implemented:
30
+
31
+ 1. **Fixed WSL/Linux Support**
32
+ - Root cause: `wry` webview library requires platform-specific builders on Linux
33
+ - Windows uses `.build(window.as_ref())` with native window handles
34
+ - Linux requires `.build_gtk(vbox)` with GTK container
35
+ - Added imports:
36
+ - `tao::platform::unix::WindowExtUnix` for Linux
37
+ - `wry::WebViewBuilderExtUnix` for Linux
38
+ - Added conditional compilation to use correct builder per platform
39
+ - Location: msger-native/src/main.rs
40
+
41
+ 2. **Fixed Build Script Binary Placement**
42
+ - Linux binary was placed in wrong location (`../msgernative-linux-x64`)
43
+ - shower.ts expected it in `msger-native/bin/msgernative`
44
+ - Updated build.ts to copy to correct location
45
+ - Also maintains old location for compatibility
46
+
47
+ 3. **Platform-Specific Imports**
48
+ - Made Windows-specific imports conditional with `#[cfg(target_os = "windows")]`
49
+ - Added Linux-specific imports with `#[cfg(target_os = "linux")]`
50
+ - Prevents compilation errors when building for different platforms
51
+
52
+ ### Files Changed:
53
+ - `msger-native/src/main.rs` - Added GTK support for Linux webview creation
54
+ - `msger-native/build.ts` - Fixed binary placement for Linux builds
55
+ - `package.json` - Version bump to 0.1.94
56
+
57
+ ### Testing:
58
+ - ✅ Windows build and runtime (v0.1.94)
59
+ - ✅ Linux build via WSL (v0.1.94)
60
+ - ✅ WSL runtime - window displays correctly with GTK/webkit2gtk
61
+ - ✅ Timeout functionality works in WSL
62
+ - ✅ Button responses work in WSL
63
+
64
+ ### Previous WSL Issue - RESOLVED:
65
+ - Previous error: `Failed to create webview: UnsupportedWindowHandle`
66
+ - Cause: Using `.build(window.as_ref())` on Linux instead of `.build_gtk(vbox)`
67
+ - Fix: Implemented platform-specific webview building
68
+ - WSL now works perfectly with WSLg GUI support
69
+
70
+ ---
71
+
72
+ ## Session (2025-11-12) - Hash Option, F11 Fix, Button Response, Debug Mode
4
73
 
5
74
  **Status:** ✅ COMPLETED - Version 0.1.91 (published to npm)
6
75
 
7
76
  ### Installation Status:
8
77
  - ✅ Windows build successful (0.1.91)
9
78
  - ✅ Published to npm as @bobfrankston/msger@0.1.91
10
- - ⚠️ WSL Linux build failed (Rust compile error E0432)
11
- - ⚠️ Global install pending (npm needs time to propagate new version)
12
- - Note: WSL build issue needs investigation, Windows version fully functional
79
+ - Installed globally (required `taskkill /im msger*` to unlock files)
80
+ - WSL fails with `UnsupportedWindowHandle` error (tested with v0.1.91)
81
+
82
+ ### Known Issues:
83
+ 1. **WSL Build Error (E0432)**
84
+ - WSL Linux build fails during Rust compilation in installer script
85
+ - Error: Could not compile msgernative (bin "msgernative")
86
+ - Needs investigation of import/dependency issue
87
+ - Impact: Can't build Linux binary from Windows, but published npm package includes prebuilt binary
88
+
89
+ 2. **WSL Runtime Error - CONFIRMED in v0.1.91**
90
+ - Error: `Failed to create webview: UnsupportedWindowHandle`
91
+ - Location: main.rs:314 (`.build(window.as_ref())`)
92
+ - Root cause: WSL doesn't have native GUI/display server for Windows apps
93
+ - The `wry` crate requires a native window handle (HWND on Windows, X11 on Linux)
94
+ - **WSL environment:**
95
+ - Running from `wsl msger` tries to use Windows binary with WSL context
96
+ - No valid window handle available in this hybrid environment
97
+ - **Resolution options:**
98
+ 1. Use WSLg (Windows 11) - may need DISPLAY env var configuration
99
+ 2. Run from Windows PowerShell instead: `msger "hello"` (works perfectly)
100
+ 3. Future: Investigate if WSL2 GUI apps can create windows
101
+ - **Workaround:** Always run msger from Windows, not through `wsl` command
102
+
103
+ 3. **Installation Tip**
104
+ - Running msger processes can block file updates
105
+ - Before installing: `taskkill /im msger* /F` or close all msger windows
106
+ - This frees up binary files for replacement
13
107
 
14
108
  ### Next Steps:
15
109
  1. Wait ~5-10 minutes for npm to propagate version 0.1.91
Binary file
Binary file
@@ -151,18 +151,29 @@ function main() {
151
151
 
152
152
  if (success) {
153
153
  const srcPath = `./target/release/msgernative`;
154
- const destPath = `../msgernative-linux-x64`;
154
+ const destPath = `./bin/msgernative`;
155
155
 
156
156
  if (existsSync(srcPath)) {
157
+ // Ensure bin directory exists
158
+ if (!existsSync('./bin')) {
159
+ mkdirSync('./bin', { recursive: true });
160
+ }
161
+
157
162
  copyFileSync(srcPath, destPath);
158
163
  // Make executable
159
164
  chmodSync(destPath, 0o755);
160
165
  console.log(`\n✅ Binary copied to: ${destPath}`);
161
-
166
+
162
167
  // Show file size
163
168
  const stats = statSync(destPath);
164
169
  const sizeMB = (stats.size / (1024 * 1024)).toFixed(2);
165
170
  console.log(`📊 Binary size: ${sizeMB} MB`);
171
+
172
+ // Also copy to root for compatibility (old location)
173
+ const rootDestPath = `../msgernative-linux-x64`;
174
+ copyFileSync(srcPath, rootDestPath);
175
+ chmodSync(rootDestPath, 0o755);
176
+ console.log(`📋 Also copied to: ${rootDestPath} (for compatibility)`);
166
177
  }
167
178
  }
168
179
  } else {
@@ -171,18 +182,29 @@ function main() {
171
182
 
172
183
  if (success) {
173
184
  const srcPath = `./target/release/msgernative`;
174
- const destPath = `../msgernative-linux-x64`;
185
+ const destPath = `./bin/msgernative`;
175
186
 
176
187
  if (existsSync(srcPath)) {
188
+ // Ensure bin directory exists
189
+ if (!existsSync('./bin')) {
190
+ mkdirSync('./bin', { recursive: true });
191
+ }
192
+
177
193
  copyFileSync(srcPath, destPath);
178
194
  // Make executable
179
195
  chmodSync(destPath, 0o755);
180
196
  console.log(`\n✅ Binary copied to: ${destPath}`);
181
-
197
+
182
198
  // Show file size
183
199
  const stats = statSync(destPath);
184
200
  const sizeMB = (stats.size / (1024 * 1024)).toFixed(2);
185
201
  console.log(`📊 Binary size: ${sizeMB} MB`);
202
+
203
+ // Also copy to root for compatibility (old location)
204
+ const rootDestPath = `../msgernative-linux-x64`;
205
+ copyFileSync(srcPath, rootDestPath);
206
+ chmodSync(rootDestPath, 0o755);
207
+ console.log(`📋 Also copied to: ${rootDestPath} (for compatibility)`);
186
208
  }
187
209
  }
188
210
  }
@@ -5,10 +5,18 @@ use tao::{
5
5
  event_loop::{ControlFlow, EventLoop},
6
6
  keyboard::KeyCode,
7
7
  window::WindowBuilder,
8
- platform::windows::WindowExtWindows,
9
8
  };
10
9
  use wry::{WebViewBuilder, WebContext};
11
10
 
11
+ #[cfg(target_os = "windows")]
12
+ use tao::platform::windows::WindowExtWindows;
13
+
14
+ #[cfg(target_os = "linux")]
15
+ use tao::platform::unix::WindowExtUnix;
16
+
17
+ #[cfg(target_os = "linux")]
18
+ use wry::WebViewBuilderExtUnix;
19
+
12
20
  #[cfg(windows)]
13
21
  use windows::Win32::UI::WindowsAndMessaging::{
14
22
  GetSystemMenu, AppendMenuW, MF_STRING, MF_SEPARATOR, WM_SYSCOMMAND,
@@ -381,7 +389,7 @@ fn main() {
381
389
  AppendMenuW(hmenu, MF_STRING, IDM_ABOUT as usize, PCWSTR(about_text.as_ptr())).ok();
382
390
  }
383
391
  // Install window subclass to intercept WM_SYSCOMMAND
384
- SetWindowSubclass(hwnd, Some(subclass_proc), 1, 0).ok();
392
+ let _ = SetWindowSubclass(hwnd, Some(subclass_proc), 1, 0).ok();
385
393
  }
386
394
 
387
395
  // Generate HTML
@@ -434,9 +442,15 @@ fn main() {
434
442
  let mut web_context = WebContext::new(data_directory);
435
443
 
436
444
  // Create webview with IPC handler
437
- let mut webview = if let Some(ref url) = options.url {
445
+ // Get GTK container for Linux, or use window reference for other platforms
446
+ #[cfg(target_os = "linux")]
447
+ let vbox = window.default_vbox().expect("Failed to get GTK vbox");
448
+
449
+ // webview is only used on Windows for About menu functionality
450
+ #[cfg_attr(not(windows), allow(unused_variables))]
451
+ let webview = if let Some(ref url) = options.url {
438
452
  // Load URL with msger API injected
439
- WebViewBuilder::with_web_context(&mut web_context)
453
+ let builder = WebViewBuilder::with_web_context(&mut web_context)
440
454
  .with_url(url)
441
455
  .with_initialization_script(MSGER_JS_API)
442
456
  .with_devtools(true)
@@ -482,12 +496,19 @@ fn main() {
482
496
  } else if std::env::var("MSGER_DEBUG").is_ok() {
483
497
  eprintln!("🐛 Failed to parse IPC message as MessageBoxResult");
484
498
  }
485
- })
486
- .build(window.as_ref())
487
- .expect("Failed to create webview")
499
+ });
500
+
501
+ // Platform-specific webview building
502
+ #[cfg(target_os = "linux")]
503
+ let webview = builder.build_gtk(vbox).expect("Failed to create webview");
504
+
505
+ #[cfg(not(target_os = "linux"))]
506
+ let webview = builder.build(window.as_ref()).expect("Failed to create webview");
507
+
508
+ webview
488
509
  } else {
489
510
  // Use HTML content (msger API already in template.html)
490
- WebViewBuilder::with_web_context(&mut web_context)
511
+ let builder = WebViewBuilder::with_web_context(&mut web_context)
491
512
  .with_html(&html)
492
513
  .with_devtools(true)
493
514
  .with_ipc_handler(move |msg| {
@@ -532,9 +553,16 @@ fn main() {
532
553
  } else if std::env::var("MSGER_DEBUG").is_ok() {
533
554
  eprintln!("🐛 Failed to parse IPC message as MessageBoxResult");
534
555
  }
535
- })
536
- .build(window.as_ref())
537
- .expect("Failed to create webview")
556
+ });
557
+
558
+ // Platform-specific webview building
559
+ #[cfg(target_os = "linux")]
560
+ let webview = builder.build_gtk(vbox).expect("Failed to create webview");
561
+
562
+ #[cfg(not(target_os = "linux"))]
563
+ let webview = builder.build(window.as_ref()).expect("Failed to create webview");
564
+
565
+ webview
538
566
  };
539
567
 
540
568
  // Open DevTools if -dev flag was specified
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/msger",
3
- "version": "0.1.93",
3
+ "version": "0.1.96",
4
4
  "description": "Fast, lightweight, cross-platform message box - Rust-powered alternative to msgview",
5
5
  "type": "module",
6
6
  "main": "./index.js",