Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions archlinuxcn/flclash/0001-fix-build-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From a882bfadf9e75c8cea20759136503ede921e1ee1 Mon Sep 17 00:00:00 2001
From: Dee HY <dongfengweixiao@hotmail.com>
Date: Fri, 3 Apr 2026 13:41:47 +0800
Subject: [PATCH] fix build error

---
linux/CMakeLists.txt | 3 +++
1 file changed, 3 insertions(+)

diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt
index c419eea..c796bda 100644
--- a/linux/CMakeLists.txt
+++ b/linux/CMakeLists.txt
@@ -44,6 +44,9 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
+ # FIXME: workaround for tray_manager deprecation issue:
+ # https://github.com/leanflutter/tray_manager/issues/67
+ target_compile_options(${TARGET} PRIVATE -Wno-error=deprecated-declarations) # Allow deprecated warnings
endfunction()

# Flutter library and tool build rules.
--
2.53.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From fdb376d8e8189346338015eaa3e6dc6215f4ef01 Mon Sep 17 00:00:00 2001
From: Dee HY <dongfengweixiao@hotmail.com>
Date: Sun, 18 Jan 2026 18:12:51 +0800
Subject: [PATCH] fix: early return when hotkey not found in map

Avoid sending events for unregistered hotkeys and passing invalid
values to keybinder_unbind by returning early when lookup fails.
---
.../linux/hotkey_manager_linux_plugin.cc | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/packages/hotkey_manager_linux/linux/hotkey_manager_linux_plugin.cc b/packages/hotkey_manager_linux/linux/hotkey_manager_linux_plugin.cc
index 74fabe2..95fe80b 100644
--- a/packages/hotkey_manager_linux/linux/hotkey_manager_linux_plugin.cc
+++ b/packages/hotkey_manager_linux/linux/hotkey_manager_linux_plugin.cc
@@ -32,14 +32,14 @@ G_DEFINE_TYPE(HotkeyManagerLinuxPlugin,
g_object_get_type())

void handle_key_down(const char* keystring, void* user_data) {
- const char* identifier;
-
std::string val = keystring;
auto result = std::find_if(hotkey_id_map.begin(), hotkey_id_map.end(),
[val](const auto& e) { return e.second == val; });

- if (result != hotkey_id_map.end())
- identifier = result->first.c_str();
+ if (result == hotkey_id_map.end())
+ return;
+
+ const char* identifier = result->first.c_str();

g_autoptr(FlValue) event_data = fl_value_new_map();
fl_value_set_string_take(event_data, "identifier",
@@ -103,14 +103,16 @@ static FlMethodResponse* hkm_unregister(_HotkeyManagerLinuxPlugin* self,
FlValue* args) {
const char* identifier =
fl_value_get_string(fl_value_lookup_string(args, "identifier"));
- const char* keystring;

std::string val = identifier;
auto result = std::find_if(hotkey_id_map.begin(), hotkey_id_map.end(),
[val](const auto& e) { return e.first == val; });

- if (result != hotkey_id_map.end())
- keystring = result->second.c_str();
+ if (result == hotkey_id_map.end())
+ return FL_METHOD_RESPONSE(
+ fl_method_success_response_new(fl_value_new_bool(false)));
+
+ const char* keystring = result->second.c_str();

keybinder_unbind(keystring, handle_key_down);
hotkey_id_map.erase(identifier);
--
2.53.0

27 changes: 27 additions & 0 deletions archlinuxcn/flclash/0003-use-local-hotkey_manager.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 73ad9c98c66e9549ae51e1d42cb54bda14ae2a4b Mon Sep 17 00:00:00 2001
From: Dee HY <dongfengweixiao@hotmail.com>
Date: Wed, 8 Apr 2026 21:49:11 +0800
Subject: [PATCH] use local hotkey_manager_linux

---
pubspec.yaml | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/pubspec.yaml b/pubspec.yaml
index cca65ac..7fbe2c7 100755
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -82,6 +82,10 @@ dev_dependencies:

drift_dev: ^2.29.0

+dependency_overrides:
+ hotkey_manager_linux:
+ path: ../hotkey_manager/packages/hotkey_manager_linux
+
flutter:
uses-material-design: true
assets:
--
2.53.0

146 changes: 146 additions & 0 deletions archlinuxcn/flclash/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Maintainer: Dee.H.Y <dongfengweixiao at hotmail dot com>
# Contributor: Mark Wagie <mark dot wagie at proton dot me>
# This repository is a fork of musicpod-git.
# Before executing makepkg, you can set FVM_CACHE_PATH to $HOME/fvm or the path specified by the cachePath field in the $HOME/.config/fvm/.fvmrc file.

pkgname=flclash
pkgver=0.8.92
pkgrel=1
pkgdesc="A multi-platform proxy client based on ClashMeta,simple and easy to use, open-source and ad-free."
url="https://github.com/chen08209/FlClash"
license=('GPL-3.0-or-later')
arch=('x86_64' 'aarch64')
depends=(
'at-spi2-core'
'cairo'
'fontconfig'
'glib2'
'glibc'
'gtk3'
'libayatana-appindicator'
'libepoxy'
'libgcc'
'libkeybinder3'
'libstdc++'
'pango'
)
makedepends=(
'clang'
'cmake'
'fvm'
'git'
'lld'
'llvm'
'ninja'
'patchelf'
'rustup'
'go'
'libayatana-appindicator'
'libkeybinder3'
)

options=('!lto')

_pkgsrc="$pkgname-$pkgver"
_pkgext="tar.gz"
source=(
"${pkgname}"::"git+https://github.com/chen08209/FlClash.git#tag=v$pkgver"
"0001-fix-build-error.patch"
"0002-fix-early-return-when-hotkey-not-found-in-map.patch"
"0003-use-local-hotkey_manager.patch"
"com.follow.clash.desktop"
"Clash.Meta::git+https://github.com/chen08209/Clash.Meta.git"
"flutter_distributor::git+https://github.com/chen08209/flutter_distributor.git"
"tray_manager::git+https://github.com/chen08209/tray_manager.git"
"hotkey_manager::git+https://github.com/leanflutter/hotkey_manager.git#branch=main"
Comment thread
RocketMaDev marked this conversation as resolved.
Outdated
)
sha256sums=('aaf8c535929ecc642637334799f8396301fbc39a3ea25b2c9a8afdabf4a7e34d'
'b551c46a1577758c13bdd07868d41e4de817c6184114e1b10d39e04ae572a76a'
'b2791f04cd6d0752cc5b0746eec6b3b959def21eb21bfc3cf594deef8c8777d0'
'2c1b44a63729e8882e6f1e061d018f006450403d968aafd1046b0cdf79e50d90'
'0601176d0b5df7aafb3c949417b7f0d98ab17d21b6fcc89c6f83a7e031bbe45d'
'SKIP'
'SKIP'
'SKIP'
'SKIP')

prepare() {
cd "$srcdir/hotkey_manager"
patch -p1 -i "${srcdir}/0002-fix-early-return-when-hotkey-not-found-in-map.patch"
Comment thread
RocketMaDev marked this conversation as resolved.

cd "$srcdir/$pkgname"
git submodule init
git config submodule.core/Clash.Meta.url "$srcdir/Clash.Meta"
git config submodule.plugins/flutter_distributor.url "$srcdir/flutter_distributor"
git config submodule.plugins/tray_manager.url "$srcdir/tray_manager"
git -c protocol.file.allow=always submodule update
patch -p1 -i "${srcdir}/0001-fix-build-error.patch"
patch -p1 -i "${srcdir}/0003-use-local-hotkey_manager.patch"

# go mod download
cd "$srcdir/$pkgname/core"
export GOPATH="${srcdir}"
go mod download -modcacherw
}

build() {
# build core
cd "$srcdir/$pkgname/core"
if [ "$CARCH" == "aarch64" ]; then
export GOARCH=arm64
else
export GOARCH=amd64
fi
export GOOS=linux
export CGO_ENABLED=0
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
export TAGS="with_gvisor"
go build -tags="$TAGS" -o "../libclash/linux/FlClashCore"

export FVM_CACHE_PATH="$SRCDEST/fvm-cache"
cd "${srcdir}/$pkgname"

fvm install 3.35.7
fvm use 3.35.7
fvm flutter --disable-analytics
fvm flutter --no-version-check pub get
fvm flutter build linux --release --dart-define=APP_ENV=stable
}

package() {
if [ $CARCH == "aarch64" ]; then
FLUTTER_ARCH=arm64
else
FLUTTER_ARCH=x64
fi

cd "${srcdir}/$pkgname/build/linux/$FLUTTER_ARCH/release/bundle"

install -Dm755 "FlClash" "$pkgdir/usr/lib/$pkgname/FlClash"
install -Dm755 "FlClashCore" "$pkgdir/usr/lib/$pkgname/FlClashCore"
cp --reflink=auto -r lib/ "$pkgdir/usr/lib/$pkgname/"
cp --reflink=auto -r data/ "$pkgdir/usr/lib/$pkgname/"
# copy libquickjs_c_bridge_plugin.so
cp --reflink=auto "../plugins/flutter_js/bundle/lib/libquickjs_c_bridge_plugin.so" "$pkgdir/usr/lib/$pkgname/lib/libquickjs_c_bridge_plugin.so"

# runpath
patchelf --set-rpath '$ORIGIN/lib' "$pkgdir/usr/lib/$pkgname/FlClash"
for i in "$pkgdir/usr/lib/$pkgname/lib"/*.so; do
[ -z "$(patchelf --print-rpath "$i")" ] && continue
patchelf --set-rpath '$ORIGIN' "$i"
done

# symlink
install -dm755 "${pkgdir}/usr/bin"
ln -sfr "$pkgdir/usr/lib/$pkgname/FlClash" "$pkgdir/usr/bin/${pkgname}"

# icon
install -Dm644 "$srcdir/$pkgname/assets/images/icon.png" \
"$pkgdir/usr/share/pixmaps/$pkgname.png"

# .desktop file
install -Dm644 "$srcdir/com.follow.clash.desktop" "${pkgdir}/usr/share/applications/com.follow.clash.desktop"

# license
install -Dm644 "${srcdir}/$pkgname/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
}
11 changes: 11 additions & 0 deletions archlinuxcn/flclash/com.follow.clash.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=FlClash
Categories=Network;
GenericName=FlClash
Icon=flclash
Exec=flclash %U
Categories=Network;
Keywords=FlClash;Clash;ClashMeta;Proxy;
StartupWMClass=com.follow.clash
StartupNotify=true
12 changes: 12 additions & 0 deletions archlinuxcn/flclash/lilac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
maintainers:
- github: dongfengweixiao
email: Dee.H.Y <dongfengweixiao@hotmail.com>

pre_build_script: update_pkgver_and_pkgrel(_G.newver)
post_build: git_pkgbuild_commit

update_on:
- source: github
github: chen08209/FlClash
use_latest_release: true
prefix: v
Loading