@bobfrankston/msger 0.1.92 → 0.1.95

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,87 @@
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) - WSL Linux Support Fixed
4
+
5
+ **Status:** ✅ COMPLETED - Version 0.1.94
6
+
7
+ ### What Was Implemented:
8
+
9
+ 1. **Fixed WSL/Linux Support**
10
+ - Root cause: `wry` webview library requires platform-specific builders on Linux
11
+ - Windows uses `.build(window.as_ref())` with native window handles
12
+ - Linux requires `.build_gtk(vbox)` with GTK container
13
+ - Added imports:
14
+ - `tao::platform::unix::WindowExtUnix` for Linux
15
+ - `wry::WebViewBuilderExtUnix` for Linux
16
+ - Added conditional compilation to use correct builder per platform
17
+ - Location: msger-native/src/main.rs
18
+
19
+ 2. **Fixed Build Script Binary Placement**
20
+ - Linux binary was placed in wrong location (`../msgernative-linux-x64`)
21
+ - shower.ts expected it in `msger-native/bin/msgernative`
22
+ - Updated build.ts to copy to correct location
23
+ - Also maintains old location for compatibility
24
+
25
+ 3. **Platform-Specific Imports**
26
+ - Made Windows-specific imports conditional with `#[cfg(target_os = "windows")]`
27
+ - Added Linux-specific imports with `#[cfg(target_os = "linux")]`
28
+ - Prevents compilation errors when building for different platforms
29
+
30
+ ### Files Changed:
31
+ - `msger-native/src/main.rs` - Added GTK support for Linux webview creation
32
+ - `msger-native/build.ts` - Fixed binary placement for Linux builds
33
+ - `package.json` - Version bump to 0.1.94
34
+
35
+ ### Testing:
36
+ - ✅ Windows build and runtime (v0.1.94)
37
+ - ✅ Linux build via WSL (v0.1.94)
38
+ - ✅ WSL runtime - window displays correctly with GTK/webkit2gtk
39
+ - ✅ Timeout functionality works in WSL
40
+ - ✅ Button responses work in WSL
41
+
42
+ ### Previous WSL Issue - RESOLVED:
43
+ - Previous error: `Failed to create webview: UnsupportedWindowHandle`
44
+ - Cause: Using `.build(window.as_ref())` on Linux instead of `.build_gtk(vbox)`
45
+ - Fix: Implemented platform-specific webview building
46
+ - WSL now works perfectly with WSLg GUI support
47
+
48
+ ---
49
+
50
+ ## Session (2025-11-12) - Hash Option, F11 Fix, Button Response, Debug Mode
4
51
 
5
52
  **Status:** ✅ COMPLETED - Version 0.1.91 (published to npm)
6
53
 
7
54
  ### Installation Status:
8
55
  - ✅ Windows build successful (0.1.91)
9
56
  - ✅ 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
57
+ - Installed globally (required `taskkill /im msger*` to unlock files)
58
+ - WSL fails with `UnsupportedWindowHandle` error (tested with v0.1.91)
59
+
60
+ ### Known Issues:
61
+ 1. **WSL Build Error (E0432)**
62
+ - WSL Linux build fails during Rust compilation in installer script
63
+ - Error: Could not compile msgernative (bin "msgernative")
64
+ - Needs investigation of import/dependency issue
65
+ - Impact: Can't build Linux binary from Windows, but published npm package includes prebuilt binary
66
+
67
+ 2. **WSL Runtime Error - CONFIRMED in v0.1.91**
68
+ - Error: `Failed to create webview: UnsupportedWindowHandle`
69
+ - Location: main.rs:314 (`.build(window.as_ref())`)
70
+ - Root cause: WSL doesn't have native GUI/display server for Windows apps
71
+ - The `wry` crate requires a native window handle (HWND on Windows, X11 on Linux)
72
+ - **WSL environment:**
73
+ - Running from `wsl msger` tries to use Windows binary with WSL context
74
+ - No valid window handle available in this hybrid environment
75
+ - **Resolution options:**
76
+ 1. Use WSLg (Windows 11) - may need DISPLAY env var configuration
77
+ 2. Run from Windows PowerShell instead: `msger "hello"` (works perfectly)
78
+ 3. Future: Investigate if WSL2 GUI apps can create windows
79
+ - **Workaround:** Always run msger from Windows, not through `wsl` command
80
+
81
+ 3. **Installation Tip**
82
+ - Running msger processes can block file updates
83
+ - Before installing: `taskkill /im msger* /F` or close all msger windows
84
+ - This frees up binary files for replacement
13
85
 
14
86
  ### Next Steps:
15
87
  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,
@@ -434,9 +442,13 @@ fn main() {
434
442
  let mut web_context = WebContext::new(data_directory);
435
443
 
436
444
  // Create webview with IPC handler
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
+
437
449
  let mut webview = if let Some(ref url) = options.url {
438
450
  // Load URL with msger API injected
439
- WebViewBuilder::with_web_context(&mut web_context)
451
+ let builder = WebViewBuilder::with_web_context(&mut web_context)
440
452
  .with_url(url)
441
453
  .with_initialization_script(MSGER_JS_API)
442
454
  .with_devtools(true)
@@ -482,12 +494,19 @@ fn main() {
482
494
  } else if std::env::var("MSGER_DEBUG").is_ok() {
483
495
  eprintln!("🐛 Failed to parse IPC message as MessageBoxResult");
484
496
  }
485
- })
486
- .build(window.as_ref())
487
- .expect("Failed to create webview")
497
+ });
498
+
499
+ // Platform-specific webview building
500
+ #[cfg(target_os = "linux")]
501
+ let webview = builder.build_gtk(vbox).expect("Failed to create webview");
502
+
503
+ #[cfg(not(target_os = "linux"))]
504
+ let webview = builder.build(window.as_ref()).expect("Failed to create webview");
505
+
506
+ webview
488
507
  } else {
489
508
  // Use HTML content (msger API already in template.html)
490
- WebViewBuilder::with_web_context(&mut web_context)
509
+ let builder = WebViewBuilder::with_web_context(&mut web_context)
491
510
  .with_html(&html)
492
511
  .with_devtools(true)
493
512
  .with_ipc_handler(move |msg| {
@@ -532,9 +551,16 @@ fn main() {
532
551
  } else if std::env::var("MSGER_DEBUG").is_ok() {
533
552
  eprintln!("🐛 Failed to parse IPC message as MessageBoxResult");
534
553
  }
535
- })
536
- .build(window.as_ref())
537
- .expect("Failed to create webview")
554
+ });
555
+
556
+ // Platform-specific webview building
557
+ #[cfg(target_os = "linux")]
558
+ let webview = builder.build_gtk(vbox).expect("Failed to create webview");
559
+
560
+ #[cfg(not(target_os = "linux"))]
561
+ let webview = builder.build(window.as_ref()).expect("Failed to create webview");
562
+
563
+ webview
538
564
  };
539
565
 
540
566
  // 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.92",
3
+ "version": "0.1.95",
4
4
  "description": "Fast, lightweight, cross-platform message box - Rust-powered alternative to msgview",
5
5
  "type": "module",
6
6
  "main": "./index.js",