From 2dad1fa5a104e12e20b373a902633215774fc61a Mon Sep 17 00:00:00 2001 From: RabitLogic <30513610+RabitLogic@users.noreply.github.com> Date: Fri, 3 Jul 2026 16:51:18 +0800 Subject: [PATCH] fix: enable window title bar dragging on Linux via manual mouse tracking and deb packaging (#68) --- Cargo.toml | 12 ++++++++++++ README.en.md | 33 +++++++++++++++++++++++++++++++++ README.md | 33 +++++++++++++++++++++++++++++++++ assets/ashell.desktop | 9 +++++++++ src/app/mod.rs | 2 ++ src/app/ui.rs | 21 +++++++++++++++++++++ 6 files changed, 110 insertions(+) create mode 100644 assets/ashell.desktop diff --git a/Cargo.toml b/Cargo.toml index 2ea08b6..43e34d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,18 @@ rand = "0.8" reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } sha2 = "0.10" +[package.metadata.deb] +maintainer = "ashell contributors" +license-file = ["LICENSE"] +extended-description = "A GPUI Component based SSH and local terminal client" +section = "terminal" +priority = "optional" +assets = [ + ["target/release/ashell", "usr/bin/", "755"], + ["assets/ashell.desktop", "usr/share/applications/", "644"], + ["assets/icons/ashell.png", "usr/share/icons/hicolor/256x256/apps/", "644"], +] + [profile.release] opt-level = 3 lto = "thin" diff --git a/README.en.md b/README.en.md index d9f0b5b..95e3c9f 100644 --- a/README.en.md +++ b/README.en.md @@ -82,6 +82,39 @@ open target/release/ashell.app The packaging script creates a standard `.app` bundle. It does not attach an entitlements file, and after signing, it verifies that `com.apple.security.app-sandbox` is not present (meaning it runs non-sandboxed). +## Package Linux (Debian/Ubuntu) + +### Prerequisites + +```bash +sudo apt install pkg-config libfontconfig1-dev +cargo install cargo-deb +``` + +### Build .deb + +```bash +cargo build --release +cargo deb +``` + +The `.deb` file will be generated at: + +``` +target/debian/ashell_0.4.8-1_amd64.deb +``` + +### Install + +```bash +sudo dpkg -i target/debian/ashell_0.4.8-1_amd64.deb +``` + +After installation, you can launch from the application menu or by running `ashell` in the terminal. The `.deb` package includes: +- `/usr/bin/ashell` — Main binary +- `/usr/share/applications/ashell.desktop` — Desktop entry +- `/usr/share/icons/hicolor/256x256/apps/ashell.png` — Application icon + ## License This project is licensed under the [GPL-3.0-or-later License](LICENSE). diff --git a/README.md b/README.md index d058a58..e6e5555 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,39 @@ open target/release/ashell.app 该打包脚本会创建一个标准的 `.app` 应用程序包。它没有附加 entitlements 文件,并且在签名后会验证是否不存在 `com.apple.security.app-sandbox`(这意味着它在非沙盒模式下运行)。 +## 打包 Linux (Debian/Ubuntu) + +### 前置条件 + +```bash +sudo apt install pkg-config libfontconfig1-dev +cargo install cargo-deb +``` + +### 构建 .deb 包 + +```bash +cargo build --release +cargo deb +``` + +生成的 `.deb` 文件位于: + +``` +target/debian/ashell_0.4.9-1_amd64.deb +``` + +### 安装 + +```bash +sudo dpkg -i target/debian/ashell_0.4.9-1_amd64.deb +``` + +安装后可通过应用菜单或命令行 `ashell` 启动。`.deb` 包包含以下内容: +- `/usr/bin/ashell` — 主程序 +- `/usr/share/applications/ashell.desktop` — 桌面入口 +- `/usr/share/icons/hicolor/256x256/apps/ashell.png` — 应用图标 + ## 协议 本项目采用 [GPL-3.0-or-later 协议](LICENSE) 开源。 diff --git a/assets/ashell.desktop b/assets/ashell.desktop new file mode 100644 index 0000000..d85c10c --- /dev/null +++ b/assets/ashell.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=Ashell +Comment=A GPUI Component based SSH and local terminal client +Exec=ashell +Icon=ashell +Terminal=false +Type=Application +Categories=System;TerminalEmulator;Utility; +StartupWMClass=ashell diff --git a/src/app/mod.rs b/src/app/mod.rs index 05949a3..987ff9c 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -318,6 +318,7 @@ pub(crate) struct Ashell { pub(crate) events_tx: mpsc::Sender, pub(crate) last_window_size: Option>, pub(crate) last_sidebar_width: Option, + pub(crate) should_move_window: bool, pub(crate) hovered_url: Option, pub(crate) cmd_ctrl_pressed: bool, pub(crate) _subscriptions: Vec, @@ -691,6 +692,7 @@ impl Ashell { events_tx, last_window_size: None, last_sidebar_width, + should_move_window: false, hovered_url: None, cmd_ctrl_pressed: false, _subscriptions, diff --git a/src/app/ui.rs b/src/app/ui.rs index d64354a..bb7e118 100644 --- a/src/app/ui.rs +++ b/src/app/ui.rs @@ -2819,6 +2819,27 @@ impl Render for Ashell { #[cfg(not(target_os = "macos"))] window.zoom_window(); }) + .on_mouse_down( + MouseButton::Left, + cx.listener(|this, _, _, _| { + this.should_move_window = true; + }), + ) + .on_mouse_up( + MouseButton::Left, + cx.listener(|this, _, _, _| { + this.should_move_window = false; + }), + ) + .on_mouse_down_out(cx.listener(|this, _, _, _| { + this.should_move_window = false; + })) + .on_mouse_move(cx.listener(|this, _, window, _| { + if this.should_move_window { + this.should_move_window = false; + window.start_window_move(); + } + })) .child(self.render_window_controls(window, cx)) .child( div()