Merge branch 'master' into stable

* master:
  Bump version
  Add function to remove the app
  Consistent escaping
  Seperate out functions and add web2app for creating web-app desktop launchers
  Add libreoffice as a default
  Turn off ambient screen brightness setting
  Shorter text
  Two or bust
  Eject when done
  Add alias to write iso files to sd card
  fix: typo in dev language uninstall
  fix: remove unused localsend option from update
This commit is contained in:
David Heinemeier Hansson
2025-05-04 11:53:03 +02:00
10 changed files with 92 additions and 21 deletions

View File

@@ -18,7 +18,6 @@ else
case "$INSTALLER" in
"omakub") INSTALLER_FILE="$OMAKUB_PATH/bin/omakub-sub/migrate.sh" ;;
"localsend") INSTALLER_FILE="$OMAKUB_PATH/install/desktop/app-localsend.sh" ;;
"ollama") INSTALLER_FILE="$OMAKUB_PATH/install/terminal/optional/app-ollama.sh" ;;
*) INSTALLER_FILE="$OMAKUB_PATH/install/terminal/app-$INSTALLER.sh" ;;
esac

View File

@@ -25,20 +25,3 @@ alias lzd='lazydocker'
alias gcm='git commit -m'
alias gcam='git commit -a -m'
alias gcad='git commit -a --amend'
# 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"
}
# 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'
# Spotify window is too large on many displays, so fix this by zooming it down
alias fix_spotify_window_size="sudo sed -i 's|^Exec=.*|Exec=spotify --force-device-scale-factor=1.5 %U|' /usr/local/share/applications/spotify.desktop"

82
defaults/bash/functions Normal file
View File

@@ -0,0 +1,82 @@
# 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 --no-sandbox
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'
# Spotify window is too large on many displays, so fix this by zooming it down
alias fix_spotify_window_size="sudo sed -i 's|^Exec=.*|Exec=spotify --force-device-scale-factor=1.5 %U|' /usr/local/share/applications/spotify.desktop"

View File

@@ -1,4 +1,5 @@
source ~/.local/share/omakub/defaults/bash/shell
source ~/.local/share/omakub/defaults/bash/aliases
source ~/.local/share/omakub/defaults/bash/functions
source ~/.local/share/omakub/defaults/bash/prompt
source ~/.local/share/omakub/defaults/bash/init

View File

@@ -0,0 +1,2 @@
# Work with Word, Excel, Powerpoint files
sudo apt install -y libreoffice

View File

@@ -8,7 +8,7 @@ gnome-extensions disable ubuntu-dock@ubuntu.com
gnome-extensions disable ding@rastersoft.com
# Pause to assure user is ready to accept confirmations
gum confirm "To install Gnome extensions, you need to accept some confirmations. Are you ready?"
gum confirm "To install Gnome extensions, you need to accept some confirmations. Ready?"
# Install new extensions
gext install tactile@lundal.io

View File

@@ -6,3 +6,6 @@ gsettings set org.gnome.desktop.interface monospace-font-name 'CaskaydiaMono Ner
# Reveal week numbers in the Gnome calendar
gsettings set org.gnome.desktop.calendar show-weekdate true
# Turn off ambient sensors for setting screen brightness (they rarely work well!)
gsettings set org.gnome.settings-daemon.plugins.power ambient-enabled false

View File

@@ -0,0 +1 @@
sudo apt remove -y libreoffice

View File

@@ -35,7 +35,7 @@ if [[ -n $languages ]]; then
rustup self uninstall -y
;;
Java)
mise uninnstall java@latest
mise uninstall java@latest
;;
esac
done

View File

@@ -1 +1 @@
1.2.2
1.2.3