Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ jobs:
- name: cargo clippy
run: cargo clippy --all-targets

- name: cargo test
run: cargo test --all-targets
# - name: cargo test
# run: cargo test --all-targets
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2024"
[dependencies]
anyhow = "1.0.100"
arboard = "3.6.1"
block2 = "0.6.2"
emojis = "0.8.0"
global-hotkey = "0.7.0"
iced = { version = "0.14.0", features = ["image", "tokio"] }
Expand Down
16 changes: 8 additions & 8 deletions scripts/package-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ echo "DMG_PATH=$DMG_PATH" >> "$GITHUB_ENV"
if [[ -n "$MACOS_NOTARY_KEY_ID" ]]; then
echo "$MACOS_NOTARY_KEY" | base64 --decode > notary.key

xcrun notarytool store-credentials "notarytool-profile" --apple-id "$MACOS_NOTARISATION_APPLE_ID" --team-id "$MACOS_NOTARY_TEAM_ID" --password "$MACOS_NOTARIZATION_PWD"

xcrun notarytool submit "$DMG_PATH" \
--key notary.key \
--key-id "$MACOS_NOTARY_KEY_ID" \
--issuer "$MACOS_NOTARY_ISSUER_ID" \
--team-id "$MACOS_NOTARY_TEAM_ID" \
--wait
# xcrun notarytool store-credentials "notarytool-profile" --apple-id "$MACOS_NOTARISATION_APPLE_ID" --team-id "$MACOS_NOTARY_TEAM_ID" --password "$MACOS_NOTARIZATION_PWD"

# xcrun notarytool submit "$DMG_PATH" \
# --key notary.key \
# --key-id "$MACOS_NOTARY_KEY_ID" \
# --issuer "$MACOS_NOTARY_ISSUER_ID" \
# --team-id "$MACOS_NOTARY_TEAM_ID" \
# --wait

echo "Waiting for ticket propagation..."
# sleep 30
Expand Down
68 changes: 68 additions & 0 deletions scripts/sign-macos-broken.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
set -euo pipefail

RELEASE_DIR="target/release"
APP_DIR="$RELEASE_DIR/macos"
APP_NAME="Rustcast.app"
APP_PATH="$APP_DIR/$APP_NAME"

# --- Required env vars (using the names you provided) ---
environment=(
"MACOS_CERTIFICATE"
"MACOS_CERTIFICATE_PWD"
"MACOS_CI_KEYCHAIN_PWD"
"MACOS_CERTIFICATE_NAME"
"MACOS_NOTARIZATION_PWD"
"MACOS_NOTARY_TEAM_ID"
"MACOS_NOTARY_KEY_ID"
"MACOS_NOTARY_KEY"
)

for var in "${environment[@]}"; do
if [[ -z "${!var:-}" ]]; then
echo "Error: $var is not set"
exit 1
fi
done

# Optional: only needed if you still want to keep this around
: "${MACOS_NOTARISATION_APPLE_ID:=}"

echo "Decoding certificate"
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12

echo "Installing cert in a new keychain"
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain

echo "Signing..."
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime --timestamp "$APP_PATH" -v

echo "Creating temp notarization archive"
ditto -c -k --keepParent "$APP_PATH" "notarization.zip"

echo "Notarize app (API key auth)"
# MACOS_NOTARY_KEY can be either:
# - the *contents* of the .p8 key, or
# - base64 of the .p8 key (recommended for CI)
#
# If it's base64, decode it first.
NOTARY_KEY_FILE="AuthKey.p8"
if printf '%s' "$MACOS_NOTARY_KEY" | grep -q "BEGIN PRIVATE KEY"; then
printf '%s' "$MACOS_NOTARY_KEY" > "$NOTARY_KEY_FILE"
else
printf '%s' "$MACOS_NOTARY_KEY" | base64 --decode > "$NOTARY_KEY_FILE"
fi

# xcrun notarytool submit "notarization.zip" \
# --team-id "$MACOS_NOTARY_TEAM_ID" \
# --issuer "$MACOS_NOTARY_ISSUER_ID" \
# --key-id "$MACOS_NOTARY_KEY_ID" \
# --key "$NOTARY_KEY_FILE" \
# --wait

echo "Attach staple"
xcrun stapler staple "$APP_PATH"
86 changes: 27 additions & 59 deletions scripts/sign-macos.sh
Original file line number Diff line number Diff line change
@@ -1,68 +1,36 @@
#!/bin/bash
set -euo pipefail
#!/usr/bin/env -S bash -e

RELEASE_DIR="target/release"
APP_DIR="$RELEASE_DIR/macos"
APP_NAME="Rustcast.app"
APP_PATH="$APP_DIR/$APP_NAME"
APP_BUNDLE_PATH="${APP_BUNDLE_PATH:?APP_BUNDLE_PATH not set}"

# --- Required env vars (using the names you provided) ---
environment=(
"MACOS_CERTIFICATE"
"MACOS_CERTIFICATE_PWD"
"MACOS_CI_KEYCHAIN_PWD"
"MACOS_CERTIFICATE_NAME"
"MACOS_NOTARIZATION_PWD"
"MACOS_NOTARY_TEAM_ID"
"MACOS_NOTARY_KEY_ID"
"MACOS_NOTARY_KEY"
)
# 1. Create a temporary keychain and import certificate
KEYCHAIN=build.keychain-db

for var in "${environment[@]}"; do
if [[ -z "${!var:-}" ]]; then
echo "Error: $var is not set"
exit 1
fi
done
if security list-keychains | grep -q "$KEYCHAIN"; then
echo "Keychain $KEYCHAIN already exists, using existing keychain."
else
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" "$KEYCHAIN"
fi

# Optional: only needed if you still want to keep this around
: "${MACOS_NOTARISATION_APPLE_ID:=}"
security default-keychain -s "$KEYCHAIN"
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" "$KEYCHAIN"
security set-keychain-settings "$KEYCHAIN"
security default-keychain -s "$KEYCHAIN"
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" "$KEYCHAIN"
security set-keychain-settings "$KEYCHAIN"

echo "Decoding certificate"
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
security import certificate.p12 \
-k "$KEYCHAIN" \
-P "$MACOS_CERTIFICATE_PWD" \
-T /usr/bin/codesign

echo "Installing cert in a new keychain"
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain

echo "Signing..."
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime --timestamp "$APP_PATH" -v

echo "Creating temp notarization archive"
ditto -c -k --keepParent "$APP_PATH" "notarization.zip"

echo "Notarize app (API key auth)"
# MACOS_NOTARY_KEY can be either:
# - the *contents* of the .p8 key, or
# - base64 of the .p8 key (recommended for CI)
#
# If it's base64, decode it first.
NOTARY_KEY_FILE="AuthKey.p8"
if printf '%s' "$MACOS_NOTARY_KEY" | grep -q "BEGIN PRIVATE KEY"; then
printf '%s' "$MACOS_NOTARY_KEY" > "$NOTARY_KEY_FILE"
else
printf '%s' "$MACOS_NOTARY_KEY" | base64 --decode > "$NOTARY_KEY_FILE"
fi
security set-key-partition-list -S apple-tool:,apple:,codesign: \
-s -k "$MACOS_CI_KEYCHAIN_PWD" "$KEYCHAIN"

xcrun notarytool submit "notarization.zip" \
--team-id "$MACOS_NOTARY_TEAM_ID" \
--issuer "$MACOS_NOTARY_ISSUER_ID" \
--key-id "$MACOS_NOTARY_KEY_ID" \
--key "$NOTARY_KEY_FILE" \
--wait
# 2. Sign app bundle
codesign --deep --force --options runtime --timestamp \
--sign "$MACOS_CERTIFICATE_NAME" \
"$APP_BUNDLE_PATH"

echo "Attach staple"
xcrun stapler staple "$APP_PATH"
codesign --verify --deep --strict --verbose=2 "$APP_BUNDLE_PATH"
echo "Signed app at $APP_BUNDLE_PATH"
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum Message {
SetSender(ExtSender),
SwitchToPage(Page),
ClipboardHistory(ClipBoardContentType),
ChangeFocus(ArrowKey),
ChangeFocus(ArrowKey, u32),
}

/// The window settings for rustcast
Expand Down
16 changes: 9 additions & 7 deletions src/app/tile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,24 @@ impl Tile {
return Some(Message::KeyPressed(65598));
}
keyboard::Key::Named(Named::ArrowUp) => {
return Some(Message::ChangeFocus(ArrowKey::Up));
return Some(Message::ChangeFocus(ArrowKey::Up, 1));
}
keyboard::Key::Named(Named::ArrowLeft) => {
return Some(Message::ChangeFocus(ArrowKey::Left));
return Some(Message::ChangeFocus(ArrowKey::Left, 1));
}
keyboard::Key::Named(Named::ArrowRight) => {
return Some(Message::ChangeFocus(ArrowKey::Right));
return Some(Message::ChangeFocus(ArrowKey::Right, 1));
}
keyboard::Key::Named(Named::ArrowDown) => {
return Some(Message::ChangeFocus(ArrowKey::Down));
return Some(Message::ChangeFocus(ArrowKey::Down, 1));
}
keyboard::Key::Character(chr) => {
if modifiers.command() && chr.to_string().to_lowercase() == "r" {
if modifiers.command() && chr.to_string() == "r" {
return Some(Message::ReloadConfig);
} else if modifiers.command() && chr.to_string() == "," {
open_settings();
} else if chr.to_string() == "p" && modifiers.control() {
return Some(Message::ChangeFocus(ArrowKey::Up, 1));
} else if chr.to_string() == "n" && modifiers.control() {
return Some(Message::ChangeFocus(ArrowKey::Down, 1));
} else {
return Some(Message::FocusTextInput(Move::Forwards(
chr.to_string(),
Expand Down
Loading