mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 20:29:24 +00:00
80 lines
2.2 KiB
Plaintext
80 lines
2.2 KiB
Plaintext
# Compression
|
|
compress() { tar -czf "${1%/}.tar.gz" "${1%/}"; }
|
|
alias decompress="tar -xzf"
|
|
|
|
# Convert webm files generated by the Gnome screenshot video recorder to mp4s that are more compatible
|
|
webm2mp4() {
|
|
input_file="$1"
|
|
output_file="${input_file%.webm}.mp4"
|
|
ffmpeg -i "$input_file" -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 192k "$output_file"
|
|
}
|
|
|
|
# Write iso file to sd card
|
|
iso2sd() {
|
|
if [ $# -ne 2 ]; then
|
|
echo "Usage: iso2sd <input_file> <output_device>"
|
|
echo "Example: iso2sd ~/Downloads/ubuntu-25.04-desktop-amd64.iso /dev/sda"
|
|
echo -e "\nAvailable SD cards:"
|
|
lsblk -d -o NAME | grep -E '^sd[a-z]' | awk '{print "/dev/"$1}'
|
|
else
|
|
sudo dd bs=4M status=progress oflag=sync if="$1" of="$2"
|
|
sudo eject $2
|
|
fi
|
|
}
|
|
|
|
# Create a desktop launcher for a web app
|
|
web2app() {
|
|
if [ "$#" -ne 3 ]; then
|
|
echo "Usage: web2app <AppName> <AppURL> <IconURL> (IconURL must be in PNG -- use https://dashboardicons.com)"
|
|
return 1
|
|
fi
|
|
|
|
local APP_NAME="$1"
|
|
local APP_URL="$2"
|
|
local ICON_URL="$3"
|
|
local ICON_DIR="$HOME/.local/share/applications/icons"
|
|
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
|
|
local ICON_PATH="${ICON_DIR}/${APP_NAME}.png"
|
|
|
|
mkdir -p "$ICON_DIR"
|
|
|
|
if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then
|
|
echo "Error: Failed to download icon."
|
|
return 1
|
|
fi
|
|
|
|
cat > "$DESKTOP_FILE" <<EOF
|
|
[Desktop Entry]
|
|
Version=1.0
|
|
Name=$APP_NAME
|
|
Comment=$APP_NAME
|
|
Exec=google-chrome --app="$APP_URL" --name="$APP_NAME" --class="$APP_NAME" --window-size=800,600
|
|
Terminal=false
|
|
Type=Application
|
|
Icon=$ICON_PATH
|
|
Categories=GTK;
|
|
MimeType=text/html;text/xml;application/xhtml_xml;
|
|
StartupNotify=true
|
|
EOF
|
|
|
|
chmod +x "$DESKTOP_FILE"
|
|
}
|
|
|
|
web2app-remove() {
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "Usage: web2app-remove <AppName>"
|
|
return 1
|
|
fi
|
|
|
|
local APP_NAME="$1"
|
|
local ICON_DIR="$HOME/.local/share/applications/icons"
|
|
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
|
|
local ICON_PATH="${ICON_DIR}/${APP_NAME}.png"
|
|
|
|
rm "$DESKTOP_FILE"
|
|
rm "$ICON_PATH"
|
|
}
|
|
|
|
# Ensure that external keyboards that use an fn key has the F keys as the default
|
|
alias fix_fkeys='echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode'
|