clan-app: Improve install-desktop.sh and add new desktop icons

This commit is contained in:
Qubasa
2024-07-17 13:24:38 +02:00
parent 483425d6a3
commit 5099669113
21 changed files with 20 additions and 80 deletions

1
pkgs/clan-app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
**/__pycache__

View File

@@ -34,7 +34,7 @@ class MainApplication(Adw.Application):
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(
application_id="org.clan.vm-manager",
application_id="org.clan.clan-app",
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

View File

@@ -26,7 +26,7 @@ let
desktop-file = makeDesktopItem {
name = "org.clan.app";
exec = "clan-app %u";
icon = ./clan_app/assets/clan_white.png;
icon = "clan-white";
desktopName = "Clan App";
startupWMClass = "clan";
mimeTypes = [ "x-scheme-handler/clan" ];
@@ -142,10 +142,11 @@ python3.pkgs.buildPythonApplication rec {
passthru.runtimeDependencies = runtimeDependencies;
passthru.testDependencies = testDependencies;
# TODO: place webui in lib/python3.11/site-packages/clan_app
postInstall = ''
mkdir -p $out/clan_app/.webui
cp -r ${webview-ui}/lib/node_modules/@clan/webview-ui/dist/* $out/clan_app/.webui
mkdir -p $out/${python3.sitePackages}/clan_app/.webui
cp -r ${webview-ui}/lib/node_modules/@clan/webview-ui/dist/* $out/${python3.sitePackages}/clan_app/.webui
mkdir -p $out/share/icons/hicolor
cp -r ./clan_app/assets/white-favicons/* $out/share/icons/hicolor
'';
# Don't leak python packages into a devshell.

View File

@@ -1,54 +0,0 @@
#!/usr/bin/env bash
set -e -o pipefail
check_git_tag() {
local repo_path="$1"
local target_tag="$2"
# Change directory to the specified Git repository
pushd "$repo_path" > /dev/null 2>&1
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
echo "Error: Failed to change directory to $repo_path"
return 1
fi
# Get the current Git tag
local current_tag
current_tag=$(git describe --tags --exact-match 2>/dev/null)
# Restore the original directory
popd > /dev/null 2>&1
# Check if the current tag is 2.0
if [ "$current_tag" = "$target_tag" ]; then
echo "Current Git tag in $repo_path is $target_tag"
else
echo "Error: Current Git tag in $repo_path is not $target_tag"
exit 1
fi
}
if [ -z "$1" ]; then
echo "Usage: $0 <democlan>"
exit 1
fi
democlan="$1"
check_git_tag "$democlan" "v2.2"
check_git_tag "." "demo-v2.3"
rm -rf ~/.config/clan
clan history add "clan://$democlan#localsend-wayland1"
clear
cat << EOF
Open up this link in a browser:
"clan://$democlan#localsend-wayland2"
EOF

View File

@@ -1,23 +1,22 @@
#!/usr/bin/env bash
CLAN=$(nix build .#clan-app --print-out-paths)
if ! command -v xdg-mime &> /dev/null; then
echo "Warning: 'xdg-mime' is not available. The desktop file cannot be installed."
fi
ALREADY_INSTALLED=$(nix profile list --json | jq 'has("elements") and (.elements | has("clan-app"))')
if [ "$ALREADY_INSTALLED" = "true" ]; then
echo "Upgrading installed clan-app"
nix profile upgrade clan-app
else
nix profile install .#clan-app
fi
# install desktop file
set -eou pipefail
DESKTOP_FILE_NAME=org.clan.app.desktop
DESKTOP_DST=~/.local/share/applications/"$DESKTOP_FILE_NAME"
DESKTOP_SRC="$CLAN/share/applications/$DESKTOP_FILE_NAME"
UI_BIN="$CLAN/bin/clan-app"
cp -f "$DESKTOP_SRC" "$DESKTOP_DST"
sleep 2
sed -i "s|Exec=.*clan-app|Exec=$UI_BIN|" "$DESKTOP_DST"
xdg-mime default "$DESKTOP_FILE_NAME" x-scheme-handler/clan
echo "==== Validating desktop file installation ===="
set -x
desktop-file-validate "$DESKTOP_DST"
set +xeou pipefail

View File

@@ -1,7 +0,0 @@
# Webkit GTK doesn't interop flawless with Solid.js build result
1. Webkit expects script tag to be in `body` only solid.js puts the in the head.
2. script and css files are loaded with type="module" and crossorigin tags beeing set. WebKit silently fails to load then.
3. Paths to resiources are not allowed to start with "/" because webkit interprets them relative to the system and not the base url.
4. webkit doesn't support native features such as directly handling external urls (i.e opening them in the default browser)
6. Other problems to be found?

View File

@@ -15,7 +15,7 @@ Documentation = "https://docs.clan.lol/"
Repository = "https://git.clan.lol/clan/clan-core"
[tool.setuptools.packages.find]
exclude = ["result"]
exclude = ["result", "**/__pycache__"]
[tool.setuptools.package-data]
clan_app = ["**/assets/*"]
@@ -30,7 +30,7 @@ norecursedirs = "tests/helpers"
markers = ["impure"]
[tool.mypy]
python_version = "3.11"
python_version = "3.12"
warn_redundant_casts = true
disallow_untyped_calls = true
disallow_untyped_defs = true
@@ -42,7 +42,7 @@ ignore_missing_imports = true
[tool.ruff]
target-version = "py311"
target-version = "py312"
line-length = 88
lint.select = ["E", "F", "I", "U", "N", "RUF", "ANN", "A"]
lint.ignore = ["E501", "E402", "N802", "ANN101", "ANN401", "A003"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB