mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Compare commits
5 Commits
v3.3.3
...
febd18ce84
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
febd18ce84 | ||
|
|
ed9a4a45ba | ||
|
|
697d09022a | ||
|
|
53b8fc4257 | ||
|
|
65bafa4f3b |
@@ -14,6 +14,7 @@ fi
|
||||
DESKTOP_AUDIO="false"
|
||||
MICROPHONE_AUDIO="false"
|
||||
WEBCAM="false"
|
||||
WEBCAM_DEVICE=""
|
||||
STOP_RECORDING="false"
|
||||
|
||||
for arg in "$@"; do
|
||||
@@ -21,6 +22,7 @@ for arg in "$@"; do
|
||||
--with-desktop-audio) DESKTOP_AUDIO="true" ;;
|
||||
--with-microphone-audio) MICROPHONE_AUDIO="true" ;;
|
||||
--with-webcam) WEBCAM="true" ;;
|
||||
--webcam-device=*) WEBCAM_DEVICE="${arg#*=}" ;;
|
||||
--stop-recording) STOP_RECORDING="true"
|
||||
esac
|
||||
done
|
||||
@@ -32,6 +34,15 @@ cleanup_webcam() {
|
||||
start_webcam_overlay() {
|
||||
cleanup_webcam
|
||||
|
||||
# Auto-detect first available webcam if none specified
|
||||
if [[ -z "$WEBCAM_DEVICE" ]]; then
|
||||
WEBCAM_DEVICE=$(v4l2-ctl --list-devices 2>/dev/null | grep -m1 "^\s*/dev/video" | tr -d '\t')
|
||||
if [[ -z "$WEBCAM_DEVICE" ]]; then
|
||||
notify-send "No webcam devices found" -u critical -t 3000
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get monitor scale
|
||||
local scale=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .scale')
|
||||
|
||||
@@ -41,7 +52,7 @@ start_webcam_overlay() {
|
||||
# Try preferred 16:9 resolutions in order, use first available
|
||||
local preferred_resolutions=("640x360" "1280x720" "1920x1080")
|
||||
local video_size_arg=""
|
||||
local available_formats=$(v4l2-ctl --list-formats-ext -d /dev/video0 2>/dev/null)
|
||||
local available_formats=$(v4l2-ctl --list-formats-ext -d "$WEBCAM_DEVICE" 2>/dev/null)
|
||||
|
||||
for resolution in "${preferred_resolutions[@]}"; do
|
||||
if echo "$available_formats" | grep -q "$resolution"; then
|
||||
@@ -50,7 +61,7 @@ start_webcam_overlay() {
|
||||
fi
|
||||
done
|
||||
|
||||
ffplay -f v4l2 $video_size_arg -framerate 30 /dev/video0 \
|
||||
ffplay -f v4l2 $video_size_arg -framerate 30 "$WEBCAM_DEVICE" \
|
||||
-vf "scale=${target_width}:-1" \
|
||||
-window_title "WebcamOverlay" \
|
||||
-noborder \
|
||||
|
||||
@@ -113,13 +113,43 @@ show_screenshot_menu() {
|
||||
esac
|
||||
}
|
||||
|
||||
get_webcam_list() {
|
||||
v4l2-ctl --list-devices 2>/dev/null | while IFS= read -r line; do
|
||||
if [[ "$line" != $'\t'* && -n "$line" ]]; then
|
||||
local name="$line"
|
||||
IFS= read -r device || break
|
||||
device=$(echo "$device" | tr -d '\t' | head -1)
|
||||
[[ -n "$device" ]] && echo "$device $name"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
show_webcam_select_menu() {
|
||||
local devices=$(get_webcam_list)
|
||||
local count=$(echo "$devices" | grep -c . 2>/dev/null || echo 0)
|
||||
|
||||
if [[ -z "$devices" || "$count" -eq 0 ]]; then
|
||||
notify-send "No webcam devices found" -u critical -t 3000
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$count" -eq 1 ]]; then
|
||||
echo "$devices" | awk '{print $1}'
|
||||
else
|
||||
menu "Select Webcam" "$devices" | awk '{print $1}'
|
||||
fi
|
||||
}
|
||||
|
||||
show_screenrecord_menu() {
|
||||
omarchy-cmd-screenrecord --stop-recording && exit 0
|
||||
|
||||
case $(menu "Screenrecord" " With desktop audio\n With desktop + microphone audio\n With desktop + microphone audio + webcam") in
|
||||
*"With desktop audio") omarchy-cmd-screenrecord --with-desktop-audio ;;
|
||||
*"With desktop + microphone audio") omarchy-cmd-screenrecord --with-desktop-audio --with-microphone-audio ;;
|
||||
*"With desktop + microphone audio + webcam") omarchy-cmd-screenrecord --with-desktop-audio --with-microphone-audio --with-webcam ;;
|
||||
*"With desktop + microphone audio + webcam")
|
||||
local device=$(show_webcam_select_menu) || { back_to show_capture_menu; return; }
|
||||
omarchy-cmd-screenrecord --with-desktop-audio --with-microphone-audio --with-webcam --webcam-device="$device"
|
||||
;;
|
||||
*) back_to show_capture_menu ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -13,22 +13,21 @@ hex_to_rgb() {
|
||||
|
||||
# Only generate dynamic templates for themes with a colors.toml definition
|
||||
if [[ -f $COLORS_FILE ]]; then
|
||||
# Parse TOML using yq (treating it as YAML since the flat key=value structure is compatible)
|
||||
# We convert 'key = value' to 'key: value' to make it valid YAML, then use yq/jq to generate the replacement commands.
|
||||
sed_script=$(mktemp)
|
||||
|
||||
# Generate standard and _strip substitutions
|
||||
sed 's/=/:/' "$COLORS_FILE" | yq -r 'to_entries[] | "s|{{ \(.key) }}|\(.value)|g", "s|{{ \(.key)_strip }}|\(.value | sub("^#";""))|g"' > "$sed_script"
|
||||
|
||||
# Generate _rgb substitutions for hex colors
|
||||
while IFS='=' read -r key value; do
|
||||
key=$(echo "$key" | xargs)
|
||||
value=$(echo "$value" | xargs | tr -d '"')
|
||||
key="${key//[\"\' ]/}" # strip quotes and spaces from key
|
||||
[[ $key && $key != \#* ]] || continue # skip empty lines and comments
|
||||
value="${value#*[\"\']}"
|
||||
value="${value%%[\"\']*}" # extract value between quotes (ignores inline comments)
|
||||
|
||||
printf 's|{{ %s }}|%s|g\n' "$key" "$value" # {{ key }} -> value
|
||||
printf 's|{{ %s_strip }}|%s|g\n' "$key" "${value#\#}" # {{ key_strip }} -> value without leading #
|
||||
if [[ $value =~ ^# ]]; then
|
||||
rgb=$(hex_to_rgb "$value")
|
||||
echo "s|{{ ${key}_rgb }}|${rgb}|g" >> "$sed_script"
|
||||
echo "s|{{ ${key}_rgb }}|${rgb}|g"
|
||||
fi
|
||||
done < "$COLORS_FILE"
|
||||
done <"$COLORS_FILE" >"$sed_script"
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
@@ -39,7 +38,7 @@ if [[ -f $COLORS_FILE ]]; then
|
||||
|
||||
# Don't overwrite configs already exists in the output directory (copied from theme specific folder)
|
||||
if [[ ! -f $output_path ]]; then
|
||||
sed -f "$sed_script" "$tpl" > "$output_path"
|
||||
sed -f "$sed_script" "$tpl" >"$output_path"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -144,5 +144,4 @@ xmlstarlet
|
||||
xournalpp
|
||||
yaru-icon-theme
|
||||
yay
|
||||
yq
|
||||
zoxide
|
||||
|
||||
@@ -19,5 +19,5 @@ if [[ -n ${OMARCHY_ONLINE_INSTALL:-} ]]; then
|
||||
|
||||
|
||||
# Refresh all repos
|
||||
sudo pacman -Syu --noconfirm
|
||||
sudo pacman -Syyu --noconfirm
|
||||
fi
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
echo "Migrate to new theme setup"
|
||||
|
||||
omarchy-pkg-add yq
|
||||
|
||||
# Move user-added backgrounds from Omarchy theme folders to user config
|
||||
OMARCHY_DIR="$HOME/.local/share/omarchy"
|
||||
USER_BACKGROUNDS_DIR="$HOME/.config/omarchy/backgrounds"
|
||||
|
||||
Reference in New Issue
Block a user