pake-cli 3.12.0 โ†’ 3.12.1

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/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  <div align="center">
8
8
  <a href="https://twitter.com/HiTw93" target="_blank">
9
9
  <img alt="twitter" src="https://img.shields.io/badge/follow-Tw93-red?style=flat-square&logo=Twitter"></a>
10
- <a href="https://t.me/+GclQS9ZnxyI2ODQ1" target="_blank">
10
+ <a href="https://t.me/+9f9gf4ZrFSQ2OWVl" target="_blank">
11
11
  <img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
12
12
  <a href="https://github.com/tw93/Pake/releases" target="_blank">
13
13
  <img alt="GitHub downloads" src="https://img.shields.io/github/downloads/tw93/Pake/total.svg?style=flat-square"></a>
@@ -19,7 +19,7 @@
19
19
 
20
20
  ## Features
21
21
 
22
- - ๐ŸŽ **Lightweight**: Nearly 20 times smaller than Electron packages, typically around 5M
22
+ - ๐ŸŽ **Lightweight**: Installer is nearly 20 times smaller than Electron packages, typically under 10M on disk
23
23
  - ๐Ÿš€ **Fast**: Built with Rust Tauri, much faster than traditional JS frameworks with lower memory usage
24
24
  - โšก **Easy to use**: One-command packaging via CLI or online building, no complex configuration needed
25
25
  - ๐Ÿ“ฆ **Feature-rich**: Supports shortcuts, immersive windows, drag & drop, style customization, ad removal
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import { InvalidArgumentError, program as program$1, Option } from 'commander';
20
20
  import fs$1 from 'fs';
21
21
 
22
22
  var name = "pake-cli";
23
- var version = "3.12.0";
23
+ var version = "3.12.1";
24
24
  var description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚";
25
25
  var engines = {
26
26
  node: ">=18.0.0"
@@ -1272,7 +1272,9 @@ class MacBuilder extends BaseBuilder {
1272
1272
  this.buildArch = validArchs.includes(options.targets || '')
1273
1273
  ? options.targets
1274
1274
  : 'auto';
1275
- if (options.iterativeBuild ||
1275
+ // `app` is a valid macOS bundle target (see merge.ts); honour it explicitly.
1276
+ if (options.targets === 'app' ||
1277
+ options.iterativeBuild ||
1276
1278
  options.install ||
1277
1279
  process.env.PAKE_CREATE_APP === '1') {
1278
1280
  this.buildFormat = 'app';
@@ -2685,7 +2687,7 @@ ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with
2685
2687
  .addOption(new Option('--maximize', 'Start window maximized')
2686
2688
  .default(DEFAULT_PAKE_OPTIONS.maximize)
2687
2689
  .hideHelp())
2688
- .addOption(new Option('--dark-mode', 'Force Mac app to use dark mode')
2690
+ .addOption(new Option('--dark-mode', 'Force app to use dark mode (supports macOS, Windows, and Linux)')
2689
2691
  .default(DEFAULT_PAKE_OPTIONS.darkMode)
2690
2692
  .hideHelp())
2691
2693
  .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "3.12.0",
3
+ "version": "3.12.1",
4
4
  "description": "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -2564,7 +2564,7 @@ dependencies = [
2564
2564
 
2565
2565
  [[package]]
2566
2566
  name = "pake"
2567
- version = "3.12.0"
2567
+ version = "3.12.1"
2568
2568
  dependencies = [
2569
2569
  "objc2",
2570
2570
  "objc2-app-kit",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pake"
3
- version = "3.12.0"
3
+ version = "3.12.1"
4
4
  description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with Rust."
5
5
  authors = ["Tw93"]
6
6
  license = "GPL-3.0-or-later"
@@ -7,7 +7,6 @@ use tauri::http::Method;
7
7
  use tauri::{command, AppHandle, Manager, Url, WebviewWindow};
8
8
  use tauri_plugin_http::reqwest::{ClientBuilder, Request};
9
9
 
10
- #[cfg(target_os = "macos")]
11
10
  use tauri::Theme;
12
11
 
13
12
  static BADGE_COUNT: AtomicI64 = AtomicI64::new(0);
@@ -183,40 +182,12 @@ pub fn set_dock_badge_label(app: AppHandle, label: Option<String>) -> Result<(),
183
182
 
184
183
  #[command]
185
184
  pub async fn update_theme_mode(app: AppHandle, mode: String) {
186
- #[cfg(target_os = "macos")]
187
- {
188
- if let Some(window) = app.get_webview_window("pake") {
189
- let theme = if mode == "dark" {
190
- Theme::Dark
191
- } else {
192
- Theme::Light
193
- };
194
- let _ = window.set_theme(Some(theme));
195
- }
196
- }
197
- #[cfg(not(target_os = "macos"))]
198
- {
199
- let _ = app;
200
- let _ = mode;
201
- }
202
- }
203
-
204
- #[command]
205
- #[allow(unreachable_code)]
206
- pub fn clear_cache_and_restart(app: AppHandle) -> Result<(), String> {
207
185
  if let Some(window) = app.get_webview_window("pake") {
208
- match window.clear_all_browsing_data() {
209
- Ok(_) => {
210
- // Clear all browsing data successfully
211
- app.restart();
212
- Ok(())
213
- }
214
- Err(e) => {
215
- eprintln!("Failed to clear browsing data: {}", e);
216
- Err(format!("Failed to clear browsing data: {}", e))
217
- }
218
- }
219
- } else {
220
- Err("Main window not found".to_string())
186
+ let theme = if mode == "dark" {
187
+ Theme::Dark
188
+ } else {
189
+ Theme::Light
190
+ };
191
+ let _ = window.set_theme(Some(theme));
221
192
  }
222
193
  }
@@ -1,6 +1,4 @@
1
- // Menu functionality is only used on macOS
2
- #![cfg(target_os = "macos")]
3
-
1
+ // Menu functionality is only used on macOS; the module is gated in app/mod.rs.
4
2
  use crate::app::window::open_additional_window_safe;
5
3
  use tauri::menu::{AboutMetadata, Menu, MenuItem, PredefinedMenuItem, Submenu};
6
4
  use tauri::{AppHandle, Manager, Wry};
@@ -308,7 +306,7 @@ pub fn handle_menu_click(app_handle: &AppHandle, id: &str) {
308
306
  }
309
307
  "clear_cache_restart" => {
310
308
  if let Some(window) = app_handle.get_webview_window("pake") {
311
- if let Ok(_) = window.clear_all_browsing_data() {
309
+ if window.clear_all_browsing_data().is_ok() {
312
310
  app_handle.restart();
313
311
  }
314
312
  }
@@ -66,8 +66,8 @@ pub fn set_system_tray(
66
66
  }
67
67
  _ => (),
68
68
  })
69
- .on_tray_icon_event(move |tray, event| match event {
70
- TrayIconEvent::Click { button, .. } => {
69
+ .on_tray_icon_event(move |tray, event| {
70
+ if let TrayIconEvent::Click { button, .. } = event {
71
71
  if button == tauri::tray::MouseButton::Left {
72
72
  if let Some(window) = tray.app_handle().get_webview_window("pake") {
73
73
  let is_visible = window.is_visible().unwrap_or(false);
@@ -84,7 +84,6 @@ pub fn set_system_tray(
84
84
  }
85
85
  }
86
86
  }
87
- _ => {}
88
87
  });
89
88
 
90
89
  let resolved_icon = if tray_icon_path.is_empty() {
@@ -12,8 +12,10 @@ use tauri::{
12
12
  AppHandle, Config, Manager, Url, WebviewUrl, WebviewWindow, WebviewWindowBuilder,
13
13
  };
14
14
 
15
+ use tauri::Theme;
16
+
15
17
  #[cfg(target_os = "macos")]
16
- use tauri::{Theme, TitleBarStyle};
18
+ use tauri::TitleBarStyle;
17
19
 
18
20
  #[cfg(target_os = "windows")]
19
21
  fn build_proxy_browser_arg(url: &Url) -> Option<String> {
@@ -344,6 +346,14 @@ fn build_window(
344
346
 
345
347
  let mut parsed_proxy_url: Option<Url> = None;
346
348
 
349
+ // Default to following the system theme (None), only force dark when explicitly set.
350
+ // Computed once; the matching platform block below is the sole consumer.
351
+ let theme = if window_config.dark_mode {
352
+ Some(Theme::Dark)
353
+ } else {
354
+ None // Follow system theme
355
+ };
356
+
347
357
  // Platform-specific configuration must be set before proxy on Windows/Linux
348
358
  #[cfg(target_os = "macos")]
349
359
  {
@@ -353,20 +363,13 @@ fn build_window(
353
363
  TitleBarStyle::Visible
354
364
  };
355
365
  window_builder = window_builder.title_bar_style(title_bar_style);
356
-
357
- // Default to following system theme (None), only force dark when explicitly set
358
- let theme = if window_config.dark_mode {
359
- Some(Theme::Dark)
360
- } else {
361
- None // Follow system theme
362
- };
363
366
  window_builder = window_builder.theme(theme);
364
367
  }
365
368
 
366
369
  // Windows and Linux: set data_directory before proxy_url
367
370
  #[cfg(not(target_os = "macos"))]
368
371
  {
369
- window_builder = window_builder.data_directory(_data_dir).theme(None);
372
+ window_builder = window_builder.data_directory(_data_dir).theme(theme);
370
373
 
371
374
  if !config.proxy_url.is_empty() {
372
375
  if let Ok(proxy_url) = Url::from_str(&config.proxy_url) {
@@ -16,11 +16,13 @@ const PAKE_LINUX_WEBKIT_SAFE_MODE: &str = "PAKE_LINUX_WEBKIT_SAFE_MODE";
16
16
  const WEBKIT_DISABLE_DMABUF_RENDERER: &str = "WEBKIT_DISABLE_DMABUF_RENDERER";
17
17
  #[cfg(target_os = "linux")]
18
18
  const WEBKIT_DISABLE_COMPOSITING_MODE: &str = "WEBKIT_DISABLE_COMPOSITING_MODE";
19
+ #[cfg(target_os = "linux")]
20
+ const GDK_BACKEND: &str = "GDK_BACKEND";
19
21
 
20
22
  use app::{
21
23
  invoke::{
22
- clear_cache_and_restart, clear_dock_badge, download_file, increment_dock_badge,
23
- send_notification, set_dock_badge, set_dock_badge_label, update_theme_mode,
24
+ clear_dock_badge, download_file, increment_dock_badge, send_notification, set_dock_badge,
25
+ set_dock_badge_label, update_theme_mode,
24
26
  },
25
27
  setup::{set_global_shortcut, set_system_tray},
26
28
  window::{open_additional_window_safe, set_window, MultiWindowState},
@@ -66,6 +68,34 @@ fn should_enable_linux_webkit_safe_mode_from_values(
66
68
  !is_niri_session
67
69
  }
68
70
 
71
+ #[cfg(any(target_os = "linux", test))]
72
+ fn should_force_wayland_gdk_backend(
73
+ gdk_backend: Option<&str>,
74
+ wayland_display: Option<&str>,
75
+ display: Option<&str>,
76
+ ) -> bool {
77
+ // Respect an explicit user choice.
78
+ if is_non_empty_env_value(gdk_backend) {
79
+ return false;
80
+ }
81
+
82
+ // On pure Wayland compositors without XWayland (e.g. Niri), $DISPLAY is unset
83
+ // and GTK defaults to the X11 backend, which aborts with "Failed to initialize
84
+ // GTK". Wayland is then the only viable backend, so forcing it is safe.
85
+ is_non_empty_env_value(wayland_display) && !is_non_empty_env_value(display)
86
+ }
87
+
88
+ #[cfg(target_os = "linux")]
89
+ fn apply_linux_gdk_backend() {
90
+ if should_force_wayland_gdk_backend(
91
+ std::env::var(GDK_BACKEND).ok().as_deref(),
92
+ std::env::var("WAYLAND_DISPLAY").ok().as_deref(),
93
+ std::env::var("DISPLAY").ok().as_deref(),
94
+ ) {
95
+ std::env::set_var(GDK_BACKEND, "wayland");
96
+ }
97
+ }
98
+
69
99
  #[cfg(target_os = "linux")]
70
100
  fn apply_linux_webkit_runtime_flags() {
71
101
  let safe_mode = std::env::var(PAKE_LINUX_WEBKIT_SAFE_MODE).ok();
@@ -103,7 +133,10 @@ fn apply_linux_webkit_runtime_flags() {
103
133
 
104
134
  pub fn run_app() {
105
135
  #[cfg(target_os = "linux")]
106
- apply_linux_webkit_runtime_flags();
136
+ {
137
+ apply_linux_gdk_backend();
138
+ apply_linux_webkit_runtime_flags();
139
+ }
107
140
 
108
141
  let (pake_config, tauri_config) = get_pake_config();
109
142
  let tauri_app = tauri::Builder::default();
@@ -159,7 +192,6 @@ pub fn run_app() {
159
192
  set_dock_badge_label,
160
193
  clear_dock_badge,
161
194
  update_theme_mode,
162
- clear_cache_and_restart,
163
195
  ])
164
196
  .setup(move |app| {
165
197
  app.manage(MultiWindowState::new(
@@ -329,4 +361,45 @@ mod tests {
329
361
  );
330
362
  }
331
363
  }
364
+
365
+ #[test]
366
+ fn forces_wayland_backend_on_pure_wayland() {
367
+ assert!(should_force_wayland_gdk_backend(
368
+ None,
369
+ Some("wayland-0"),
370
+ None
371
+ ));
372
+ }
373
+
374
+ #[test]
375
+ fn forces_wayland_backend_when_display_is_blank() {
376
+ assert!(should_force_wayland_gdk_backend(
377
+ None,
378
+ Some("wayland-0"),
379
+ Some(" ")
380
+ ));
381
+ }
382
+
383
+ #[test]
384
+ fn keeps_default_backend_when_x11_display_present() {
385
+ assert!(!should_force_wayland_gdk_backend(
386
+ None,
387
+ Some("wayland-0"),
388
+ Some(":0")
389
+ ));
390
+ }
391
+
392
+ #[test]
393
+ fn keeps_default_backend_without_wayland_display() {
394
+ assert!(!should_force_wayland_gdk_backend(None, None, None));
395
+ }
396
+
397
+ #[test]
398
+ fn respects_explicit_gdk_backend_override() {
399
+ assert!(!should_force_wayland_gdk_backend(
400
+ Some("x11"),
401
+ Some("wayland-0"),
402
+ None
403
+ ));
404
+ }
332
405
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "productName": "Weekly",
3
3
  "identifier": "com.pake.weekly",
4
- "version": "3.12.0",
4
+ "version": "3.12.1",
5
5
  "app": {
6
6
  "withGlobalTauri": true,
7
7
  "trayIcon": {