Update dotfiles/.local/share/chezmoi/dot_local/assets/Betelgeuse.macOS.terminal, dotfiles/.local/share/chezmoi/dot_local/bin/executable_squash-symlink, dotfiles/.local/share/chezmoi/dot_local/bin/executable_run, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ramqube, dotfiles/.local/share/chezmoi/dot_local/bin/executable_quickstart, dotfiles/.local/share/chezmoi/dot_local/bin/executable_provision, dotfiles/.local/share/chezmoi/dot_local/bin/executable_opener, dotfiles/.local/share/chezmoi/dot_local/bin/executable_logg, dotfiles/.local/share/chezmoi/dot_local/bin/executable_ksetwallpaper, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-terminal-theme, dotfiles/.local/share/chezmoi/dot_local/bin/executable_install-dotfiles, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-import, dotfiles/.local/share/chezmoi/dot_local/bin/executable_firefox-profile-export, dotfiles/.local/share/chezmoi/dot_local/bin/executable_chrome-profile-export

Deleted dotfiles/.local/bin/dotfile-system-prune
This commit is contained in:
Brian Zalewski 2022-11-22 17:48:25 +00:00
parent 3ec44faf2a
commit af66941bbe
16 changed files with 2109 additions and 10 deletions

View file

@ -1,10 +0,0 @@
#!/usr/bin/env bash
# Clean up macOS-specific files if they are present
if [ -d /Library ] && [ -d /System ]; then
# System is macOS
else
if [ -d ~/Library ]; then
rm -rf ~/Library
fi
fi

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Betelgeuse</string>
<key>type</key>
<string>Window Settings</string>
<key>BackgroundColor</key>
<data>YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdC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Y2xhc3NuYW1lWCRjbGFzc2VzVk5TRm9udKIZG1hOU09iamVjdAgRGiQpMjdJTFFTWF5nbnd+hY6QkpSwtcDJ0NMAAAAAAAABAQAAAAAAAAAcAAAAAAAAAAAAAAAAAAAA3A==</data>
</dict>
</plist>

View file

@ -0,0 +1 @@
#!/usr/bin/env bash

View file

@ -0,0 +1,133 @@
#!/usr/bin/env bash
# Alias logg function to true if it is not available
if ! command -v logg > /dev/null; then
alias logg='true'
fi
# Clear ZSH cached stuff
if [ -f "$HOME/.zshrc.zwc" ]; then
rm -f "$HOME/.zshrc.zwc"
fi
if [ -d "$HOME/.local/antigen" ]; then
rm -rf "$HOME/.local/antigen"
fi
if [ -d "$HOME/.zsh_sessions" ]; then
rm -rf "$HOME/.zsh_sessions"
fi
if [ -f '/etc/qubes-release' ]; then
# Qubes dom0
logg info 'Ensuring provision VM is present'
qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$?
logg info 'Downloading dotfile assets with provision VM'
qvm-run --pass-io provision 'if [ -d ~/Downloads/professor-dotfiles ]; then cd ~/Downloads/professor-dotfiles && git config pull.rebase false && rm -rf dotfiles/.local/asdf && rm -rf dotfiles/.local/common/shared && git pull origin master && git clone https://github.com/asdf-vm/asdf.git dotfiles/.local/asdf --branch v0.10.2 && mkdir -p dotfiles/.local/common/shared && git clone https://gitlab.com/megabyte-labs/common/shared.git dotfiles/.local/common/shared; else git clone https://gitlab.com/megabyte-labs/dotfiles.git ~/Downloads/professor-dotfiles; cd ~/Downloads/professor-dotfiles/dotfiles/.local && git clone https://github.com/asdf-vm/asdf.git asdf --branch v0.10.2 && mkdir common && git clone https://gitlab.com/megabyte-labs/common/shared.git common/shared; fi; cd ~/Downloads; tar -zcvf /tmp/professor-dotfiles.tar.gz professor-dotfiles'
logg info 'Transferring dotfiles to dom0 from provision VM'
qvm-run --pass-io provision "cat /tmp/professor-dotfiles.tar.gz" > "/tmp/dotfiles.tar.gz"
logg info 'Unpacking dotfile assets to /usr/local/src/professor-dotfiles'
tar -xzf "/tmp/dotfiles.tar.gz" -C "$HOME"
rm -f "/tmp/dotfiles.tar.gz"
sudo rm -rf /usr/local/src/professor-dotfiles
sudo mv "$HOME/professor-dotfiles" /usr/local/src/professor-dotfiles
else
if [ ! -w /usr/local/src/professor-dotfiles ]; then
logg info 'Using sudo because /usr/local/src/professor-dotfiles is not writable'
SUDO_PREFIX="sudo"
fi
if [ -d /usr/local/src/professor-dotfiles/.git ]; then
logg info 'Updating dotfiles already present in /usr/local/src/professor-dotfiles'
cd /usr/local/src/professor-dotfiles
${SUDO_PREFIX} git config pull.rebase false
${SUDO_PREFIX} rm -rf dotfiles/.local/asdf
${SUDO_PREFIX} rm -rf dotfiles/.local/common/shared
${SUDO_PREFIX} git pull origin master
${SUDO_PREFIX} git clone https://github.com/asdf-vm/asdf.git dotfiles/.local/asdf --branch v0.10.2
${SUDO_PREFIX} git clone https://gitlab.com/megabyte-labs/common/shared.git dotfiles/.local/common/shared
${SUDO_PREFIX} chown -Rf "$USER":"$(id -g -n)" /usr/local/src/professor-dotfiles
cd ~/
else
logg info 'Cloning new dotfiles to /usr/local/src/professor-dotfiles'
${SUDO_PREFIX} rm -rf /usr/local/src/professor-dotfiles
${SUDO_PREFIX} git clone https://gitlab.com/megabyte-labs/dotfiles.git /usr/local/src/professor-dotfiles
${SUDO_PREFIX} git clone https://github.com/asdf-vm/asdf.git /usr/local/src/professor-dotfiles/dotfiles/.local/asdf --branch v0.10.2
${SUDO_PREFIX} mkdir -p /usr/local/src/professor-dotfiles/dotfiles/.local/common/shared
${SUDO_PREFIX} git clone https://gitlab.com/megabyte-labs/common/shared.git /usr/local/src/professor-dotfiles/dotfiles/.local/common/shared
${SUDO_PREFIX} chown -Rf "$USER":"$(id -g -n)" /usr/local/src/professor-dotfiles
fi
if [ -n "$CREATE_PACKAGE" ]; then
logg info 'Creating /tmp/professor-dotfiles.tar.gz'
cd /usr/local/src
${SUDO_PREFIX} tar -zcvf /tmp/professor-dotfiles.tar.gz professor-dotfiles
cd ~/
fi
fi
# Copy dotfile folders
logg info 'Copying dotfiles folders to user $HOME directory'
while read DOTFILE_FOLDER; do
BASENAME_FOLDER="$(basename "$DOTFILE_FOLDER")"
if [ ! -d "$HOME/$BASENAME_FOLDER" ]; then
mkdir -p "$HOME/$BASENAME_FOLDER"
fi
cp -rf "$DOTFILE_FOLDER/"* "$HOME/$BASENAME_FOLDER"
done < <(find /usr/local/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type d)
# Copy dotfile files
logg info 'Copying dotfiles files to user $HOME directory'
while read DOTFILE_FILE; do
BASENAME_FILE="$(basename "$DOTFILE_FILE")"
cp "$DOTFILE_FILE" "$HOME/$BASENAME_FILE"
chmod 600 "$HOME/$BASENAME_FILE"
done < <(find /usr/local/src/professor-dotfiles/dotfiles -maxdepth 1 -mindepth 1 -type f)
# Ensure .local/bin contents are executable
logg info 'Ensuring programs in ~/.local/bin are executable'
while read LOCAL_BIN; do
chmod +x "${LOCAL_BIN}"
done < <(find "$HOME/.local/bin" -maxdepth 1 -mindepth 1 -type f)
if [ -d /Applications ] && [ -d /System ]; then
logg info 'Adding Hack font to ~/Library/Fonts'
mkdir -p "$HOME/Library/Fonts"
cp "$HOME/.local/share/fonts/Hack Bold Nerd Font Complete.ttf" "$HOME/Library/Fonts/Hack Bold Nerd Font Complete.ttf"
logg info 'Configuring the Terminal.app'
theme=$(<$HOME/.local/theme/Betelgeuse.macOS.terminal)
plutil -replace Window\ Settings.Betelgeuse -xml "$theme" ~/Library/Preferences/com.apple.Terminal.plist
defaults write com.apple.Terminal "Default Window Settings" -string "Betelgeuse"
defaults write com.apple.Terminal "Startup Window Settings" -string "Betelgeuse"
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betelgeuse:columnCount integer 124" ~/Library/Preferences/com.apple.Terminal.plist
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betelgeuse:rowCount integer 35" ~/Library/Preferences/com.apple.Terminal.plist
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betel-Bash:columnCount integer 124" ~/Library/Preferences/com.apple.Terminal.plist
/usr/libexec/PlistBuddy -c "Add :Window\ Settings:Betel-Bash:rowCount integer 35" ~/Library/Preferences/com.apple.Terminal.plist
# macOS desktop background
if command -v m > /dev/null; then
logg info 'Updating desktop wallpaper'
m wallpaper "/Users/$(whoami)/.local/theme/background.jpg"
fi
fi
# Update local Betelgeuse theme files (if not on macOS system)
if [ ! -d /Applications ] && [ ! -d /Library ]; then
logg info 'Updating Betelgeuse theme files'
if [ -f '/etc/qubes-release' ]; then
# Qubes dom0
qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$?
qvm-run --pass-io provision 'rm -f ~/Downloads/betelgeuse-master.tar.gz && curl -sSL https://gitlab.com/megabyte-labs/misc/betelgeuse/-/archive/master/betelgeuse-master.tar.gz > /tmp/betelgeuse-master.tar.gz'
qvm-run --pass-io provision "cat /tmp/betelgeuse-master.tar.gz" > "/tmp/betelgeuse-master.tar.gz"
cd /tmp
tar -xvf betelgeuse-master.tar.gz > /dev/null
rm betelgeuse-master.tar.gz
cp -rf betelgeuse-master/share/ "$HOME/.local/share"
rm -rf betelgeuse-master
else
curl -sSL https://gitlab.com/megabyte-labs/misc/betelgeuse/-/archive/master/betelgeuse-master.tar.gz > betelgeuse-master.tar.gz
tar -xzf betelgeuse-master.tar.gz > /dev/null
rm betelgeuse-master.tar.gz
cp -rf betelgeuse-master/share/ "$HOME/.local/share"
rm -rf betelgeuse-master
fi
fi
# grep -q QT_QPA_PLATFORMTHEME=qt5ct /etc/environment || echo QT_QPA_PLATFORMTHEME=qt5ct | sudo tee -a /etc/environment
# sudo cp -rv "$HOME/.local/share/qt5ct" /usr/share

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,107 @@
#!/usr/bin/env python3
import time
import dbus
import argparse
import glob
import random
import os
import subprocess
from pathlib import Path
HOME = str(Path.home())
SCREEN_LOCK_CONFIG = HOME+"/.config/kscreenlockerrc"
def setwallpaper(filepath, plugin='org.kde.image'):
jscript = """
var allDesktops = desktops();
print (allDesktops);
for (i=0;i<allDesktops.length;i++) {
d = allDesktops[i];
d.wallpaperPlugin = "%s";
d.currentConfigGroup = Array("Wallpaper", "%s", "General");
d.writeConfig("Image", "file://%s")
}
"""
bus = dbus.SessionBus()
plasma = dbus.Interface(bus.get_object(
'org.kde.plasmashell', '/PlasmaShell'), dbus_interface='org.kde.PlasmaShell')
plasma.evaluateScript(jscript % (plugin, plugin, filepath))
def set_lockscreen_wallpaper(filepath,plugin='org.kde.image'):
if os.path.exists(SCREEN_LOCK_CONFIG):
new_data=[]
with open(SCREEN_LOCK_CONFIG, "r") as kscreenlockerrc:
new_data = kscreenlockerrc.readlines()
is_wallpaper_section=False
for num,line in enumerate(new_data,1):
if "[Greeter][Wallpaper]["+plugin+"][General]" in line:
is_wallpaper_section = True
if "Image=" in line and is_wallpaper_section:
new_data[num-1] = "Image="+filepath+"\n"
break
with open(SCREEN_LOCK_CONFIG, "w") as kscreenlockerrc:
kscreenlockerrc.writelines(new_data)
def is_locked():
is_locked=subprocess.check_output("qdbus org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.GetActive",shell=True,universal_newlines=True).strip()
if is_locked == "true":
is_locked = True
else:
is_locked = False
return is_locked
def get_walls_from_folder(directory):
return glob.glob(directory+'/*')
def wallpaper_slideshow(wallapapers, plugin, timer, lock_screen):
if timer > 0:
wallpaper_count = len(wallapapers)
delta_s = timer
s = int(delta_s % 60)
m = int((delta_s / 60) % 60)
h = int((delta_s / 3600) % 3600)
if h > 0:
timer_show = f"{h}h {m}m {s}s"
elif m > 0:
timer_show = f"{m}m {s}s"
elif s > 0:
timer_show = f"{s}s"
print(
f"Looping through {wallpaper_count} wallpapers every {timer_show}")
while True:
if is_locked() != True:
random_int = random.randint(0, wallpaper_count-1)
wallpaper_now = wallapapers[random_int]
setwallpaper(wallpaper_now, plugin)
if lock_screen == True:
set_lockscreen_wallpaper(wallpaper_now, plugin)
time.sleep(timer)
else:
raise ValueError('Invalid --timer value')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='KDE Wallpaper setter')
parser.add_argument('--file','-f', help='Wallpaper file name', default=None)
parser.add_argument(
'--plugin', '-p', help='Wallpaper plugin (default is org.kde.image)', default='org.kde.image')
parser.add_argument('--dir', '-d', type=str,
help='Absolute path of folder containging your wallpapers for slideshow', default=None)
parser.add_argument('--timer', '-t', type=int,
help='Time in seconds between wallpapers', default=900)
parser.add_argument('--lock-screen', '-l', action="store_true",
help="Set lock screen wallpaper")
args = parser.parse_args()
if args.file != None:
setwallpaper(filepath=args.file, plugin=args.plugin)
if args.lock_screen == True:
set_lockscreen_wallpaper(filepath=args.file, plugin=args.plugin)
elif args.dir != None:
wallpapers = get_walls_from_folder(args.dir)
wallpaper_slideshow(wallapapers=wallpapers,
plugin=args.plugin, timer=args.timer,lock_screen=args.lock_screen)
else:
print("Need help? use -h or --help")

View file

@ -0,0 +1,393 @@
#!/usr/bin/env bash
# @file .config/log
# @brief Logger / prompt library that logs pretty console messages and provides several prompt methods
# @description
# This file contains several functions that log content in different formats. It also provides an
# interface for [Gum](https://github.com/charmbracelet/gum) based prompts. The available methods include:
#
# * `choose` - Prompt user with choices
# * `confirm` - Fancy Yes/No confirmation prompt
# * `error` - Logs an error message
# * `filter` - Filterable list of choices (with choices passed in as a line-return seperated file)
# * `info` - Logs a regular message
# * `input` - Prompt for a text input
# * `md` - Render a markdown file with [Glow](https://github.com/charmbracelet/glow)
# * `password` - Prompt for text that is masked by the prompt
# * `prompt` - Log a description for a prompt that follows
# * `spin` - Show a spinner while background job completes
# * `star` - Logs a message with a star icon at the beginning
# * `start` - Log a job start message
# * `success` - Logs a success message
# * `warn` - Logs a warning message
# * `write` - Multi-line input prompt
#
# If the `docker` environment variable is not set, the script / library will ensure both Gum and Glow are installed.
# @description Installs glow (a markdown renderer) from GitHub releases
# @example installGlow
installGlow() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
GLOW_DOWNLOAD_URL="https://github.com/charmbracelet/glow/releases/download/v1.4.1/glow_1.4.1_Darwin_x86_64.tar.gz"
elif [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then
GLOW_DOWNLOAD_URL="https://github.com/charmbracelet/glow/releases/download/v1.4.1/glow_1.4.1_linux_x86_64.tar.gz"
fi
if type curl &> /dev/null; then
if { [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; } || [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then
TMP="$(mktemp)"
TMP_DIR="$(dirname "$TMP")"
curl -sSL "$GLOW_DOWNLOAD_URL" > "$TMP"
tar -xzf "$TMP" -C "$TMP_DIR"
if [ -n "$HOME" ]; then
if mkdir -p "$HOME/.local/bin" && mv "$TMP_DIR/glow" "$HOME/.local/bin/glow"; then
GLOW_PATH="$HOME/.local/bin/glow"
else
GLOW_PATH="$(dirname "${BASH_SOURCE[0]}")/glow"
mv "$TMP_DIR/gum" "$GLOW_PATH"
fi
chmod +x "$GLOW_PATH"
else
echo "WARNING: The HOME environment variable is not set! (Glow)"
fi
else
echo "WARNING: Unable to detect system type. (Glow)"
fi
fi
}
# @description Installs gum (a logging CLI) from GitHub releases
# @example installGum
installGum() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
GUM_DOWNLOAD_URL="https://github.com/charmbracelet/gum/releases/download/v0.4.0/gum_0.4.0_Darwin_x86_64.tar.gz"
elif [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then
GUM_DOWNLOAD_URL="https://github.com/charmbracelet/gum/releases/download/v0.4.0/gum_0.4.0_linux_x86_64.tar.gz"
fi
if type curl &> /dev/null; then
if { [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; } || [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then
TMP="$(mktemp)"
TMP_DIR="$(dirname "$TMP")"
curl -sSL "$GUM_DOWNLOAD_URL" > "$TMP"
tar -xzf "$TMP" -C "$TMP_DIR"
if [ -n "$HOME" ]; then
if mkdir -p "$HOME/.local/bin" && mv "$TMP_DIR/gum" "$HOME/.local/bin/gum"; then
GUM_PATH="$HOME/.local/bin/gum"
else
GUM_PATH="$(dirname "${BASH_SOURCE[0]}")/gum"
mv "$TMP_DIR/gum" "$GLOW_PATH"
fi
chmod +x "$GUM_PATH"
else
echo "WARNING: The HOME environment variable is not set! (Gum)"
fi
else
echo "WARNING: Unable to detect system type. (Gum)"
fi
fi
}
# @description Configure the logger to use echo or gum
if [ "${container:=}" != 'docker' ]; then
# Acquire gum's path or attempt to install it
if type gum &> /dev/null; then
GUM_PATH="$(which gum)"
elif [ -f "$HOME/.local/bin/gum" ]; then
GUM_PATH="$HOME/.local/bin/gum"
elif [ -f "$(dirname "${BASH_SOURCE[0]}")/gum" ]; then
GUM_PATH="$(dirname "${BASH_SOURCE[0]}")/gum"
elif type brew &> /dev/null; then
brew install gum
GUM_PATH="$(which gum)"
else
installGum
fi
# If gum's path was set, then turn on enhanced logging
if [ -n "$GUM_PATH" ]; then
chmod +x "$GUM_PATH"
ENHANCED_LOGGING=true
fi
fi
# @description Disable logging for Semantic Release because it tries to parse it as JSON
if [ -n "$SEMANTIC_RELEASE" ]; then
NO_LOGGING=true
fi
# @description Logs using Node.js
# @example logger info "An informative log"
logger() {
if [ "$1" == 'error' ]; then
"$GUM_PATH" style --border="thick" "$("$GUM_PATH" style --foreground="#ff0000" "✖") $("$GUM_PATH" style --bold --background="#ff0000" --foreground="#ffffff" " ERROR ") $("$GUM_PATH" style --bold "$(format "$2")")"
elif [ "$1" == 'info' ]; then
"$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ffff" "○") $2"
elif [ "$1" == 'md' ]; then
# @description Ensure glow is installed
if [ "${container:=}" != 'docker' ]; then
if type glow &> /dev/null; then
GLOW_PATH="$(which glow)"
elif [ -f "$HOME/.local/bin/glow" ]; then
GLOW_PATH="$HOME/.local/bin/glow"
elif [ -f "$(dirname "${BASH_SOURCE[0]}")/glow" ]; then
GLOW_PATH="$(dirname "${BASH_SOURCE[0]}")/glow"
elif type brew &> /dev/null; then
brew install glow
GLOW_PATH="$(which glow)"
else
installGlow
fi
if [ -n "$GLOW_PATH" ]; then
chmod +x "$GLOW_PATH"
ENHANCED_LOGGING=true
fi
fi
"$GLOW_PATH" "$2"
elif [ "$1" == 'prompt' ]; then
"$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00008b" "▶") $("$GUM_PATH" style --bold "$(format "$2")")"
elif [ "$1" == 'star' ]; then
"$GUM_PATH" style " $("$GUM_PATH" style --foreground="#d1d100" "◆") $("$GUM_PATH" style --bold --underline "$(format "$2")")"
elif [ "$1" == 'start' ]; then
"$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ff00" "▶") $("$GUM_PATH" style --bold "$(format "$2")")"
elif [ "$1" == 'success' ]; then
"$GUM_PATH" style "$("$GUM_PATH" style --foreground="#00ff00" "✔") $("$GUM_PATH" style --bold "$(format "$2")")"
elif [ "$1" == 'warn' ]; then
"$GUM_PATH" style " $("$GUM_PATH" style --foreground="#d1d100" "◆") $("$GUM_PATH" style --bold --background="#ffff00" --foreground="#000000" " WARNING ") $("$GUM_PATH" style --bold --italic "$(format "$2")")"
else
echo "WARNING: Unknown log type"
echo "$2"
fi
}
format() {
# shellcheck disable=SC2001,SC2016
ANSI_STR="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`/\1\\u001b[47;1;30m \2 \\e[0;39m/')"
if [[ $ANSI_STR == *'`'*'`'* ]]; then
ANSI_STR="$(format "$ANSI_STR")"
fi
echo -e "$ANSI_STR"
}
# @description Display prompt that allows you to choose between options
# @example RESPONSE="$(.config/log choose "file.png" "another-file.jpg")"
choose() {
if type gum &> /dev/null; then
CHOOSE_ARGS="gum choose"
for CURRENT_VAR in "$@"; do
CHOOSE_ARGS="$CHOOSE_ARGS \"$CURRENT_VAR\""
done
eval $CHOOSE_ARGS
else
echo "ERROR: gum is not installed!"
fi
}
# @description Display a confirmation prompt that returns an exit code if "No" is selected
# @example RESPONSE="$(.config/log confirm "Are you sure?" "Yeah" "Naa")"
confirm() {
if type gum &> /dev/null; then
GUM_OPTS=""
if [ -n "$2" ]; then
# shellcheck disable=SC089
GUM_OPTS="$GUM_OPTS --affirmative=""'$2'"
fi
if [ -n "$3" ]; then
GUM_OPTS="$GUM_OPTS --negative=""'$3'"
fi
if [ -n "$1" ]; then
if [ -n "$GUM_OPTS" ]; then
gum confirm "$1" "$GUM_OPTS"
else
gum confirm "$1"
fi
else
gum confirm
fi
else
echo "ERROR: gum is not installed!"
fi
}
# @description Logs an error message
# @example .config/log error "Something happened!"
error() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger error "$1"
else
echo -e "\e[1;41m ERROR \e[0m $(format "$1")\e[0;39m"
fi
fi
}
# @description Display a filterable prompt that is populated with options from a text file
# @example echo Strawberry >> flavors.text && echo Banana >> flavors.text && RESPONSE="$(.config/log filter flavors.txt)"
filter() {
if type gum &> /dev/null; then
TMP="$(mktemp)"
gum filter < "$1"
else
echo "ERROR: gum is not installed!"
fi
}
# @description Logs an info message
# @example .config/log info "Here is some information"
info() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger info "$1"
else
echo -e "\e[1;46m INFO \e[0m $(format "$1")\e[0;39m"
fi
fi
}
# @description Displays an input with masked characters
# @example INPUT="$(.config/log input 'Enter the value..')"
input() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then
gum input --placeholder="$1"
else
gum input
fi
else
echo "ERROR: gum is not installed!"
fi
}
# @description Logs a message written in markdown
# @example .config/log md "[styled_link](https://google.com)"
# @example .config/log md mymarkdown/file.md
md() {
if [ ! -f "$1" ]; then
echo "ERROR: A markdown file must be passed in as the parameter" && exit 1
fi
if [ -n "$ENHANCED_LOGGING" ]; then
logger md "$1"
fi
}
# @description Displays an input with masked characters
# @example PASSWORD="$(.config/log password 'Enter the Ansible vault password')"
password() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then
gum input --password --placeholder="$1"
else
gum input --password
fi
else
echo "ERROR: gum is not installed!"
fi
}
# @description Logs a message that describes a prompt
# @example .config/log prompt "Enter text into the following prompt"
prompt() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger prompt "$1"
else
echo -e "\e[1;104m PROMPT \e[0m $(format "$1")\e[0;39m"
fi
fi
}
# @description Display a spinner that stays until a command is completed
# @example .config/log spin "brew install yq" "Installing yq..")"
spin() {
if type gum &> /dev/null; then
if [ -n "$1" ] && [ -n "$2" ]; then
gum spin --title="$2" "$1"
elif [ -n "$1" ]; then
gum spin "$1"
else
gum input
fi
else
echo "ERROR: gum is not installed!"
fi
}
# @description Logs a message that starts with a star emoji
# @example .config/log star "Congratulations"
star() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger star "$1"
else
echo -e "\e[1;104m LINK \e[0m $(format "$1")\e[0;39m"
fi
fi
}
# @description Logs a message at the beginning of a task
# @example .config/log start "Starting the process.."
start() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger start "$1"
else
echo -e "\e[1;46m START \e[0m $(format "$1")\e[0;39m"
fi
fi
}
# @description Logs a success message
# @example .config/log success "Yay!"
success() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger success "$1"
else
echo -e "\e[1;42m SUCCESS \e[0m $(format "$1")\e[0;39m"
fi
fi
}
# @description Logs a warning message
# @example .config/log warn "Just so you know.."
warn() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
logger warn "$1"
else
echo -e "\e[1;43m WARNING \e[0m $(format "$1")\e[0;39m"
fi
fi
}
# @description Displays a multi-line prompt for text input
# @example .config/log write "Write something..")"
write() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then
gum write --placeholder="$1"
else
gum write
fi
else
echo "ERROR: gum is not installed!"
fi
}
if [ -n "$1" ] && [ -n "$2" ]; then
# Public functions that require at least two parameters to be used
if [ "$1" == 'warn' ] || [ "$1" == 'success' ] || [ "$1" == 'star' ] || [ "$1" == 'info' ] \
|| [ "$1" == 'error' ] || [ "$1" == 'md' ] || [ "$1" == 'write' ] || [ "$1" == 'start' ] \
|| [ "$1" == 'spin' ] || [ "$1" == 'prompt' ] || [ "$1" == 'filter' ] || [ "$1" == 'input' ] \
|| [ "$1" == 'confirm' ] || [ "$1" == 'password' ]; then
"$1" "$2"
elif [[ "$1" == 'choose' ]]; then
"$@"
fi
elif [ -n "$1" ]; then
# Public functions that can run with only one argument passed to .config/log (i.e. `.config/log password`)
if [ "$1" == 'write' ] || [ "$1" == 'password' ] || [ "$1" == 'confirm' ] || [ "$1" == 'input' ]; then
"$1"
fi
fi

View file

@ -0,0 +1,259 @@
#!/usr/bin/env bash
# @file /usr/bin/opener
# @brief Opens a file type with the appropriate program based on the mime-type
# @description
# This script heavily borrows from [opener](https://github.com/Docbroke/shell_tools/blob/main/opener).
# It makes some minor tweaks including linting fixes. It is configured
# to properly work with [Gas Station](https://github.com/megabyte-labs/Gas-Station).
# It is used to handle cross-VM links when Gas Station is used to provision [Qubes](https://www.qubes-os.org/).
# When called with -d, the default program is used.
# shellcheck disable=SC2124
getopts d: name
case $name in
d) file=$OPTARG
default=true ;;
*) file="$@" ;;
esac
[[ -z $file || ! -e $file ]] &&
exit 1
## mimetype from perl-file-mimeinfo gives better results compared to file
type mimetype &> /dev/null && mime_type="$(mimetype -b "$file")" || \
mime_type="$(file -b --mime-type "$file")"
## create some lists
XBROWSERS=("firefox" "chromium" "vimb" "qutebrowser" "weaver" "vivaldi")
TBROWSERS=("w3m" "links" "lynx" "elinks")
XEDITORS=("gvim" "geany" "leafpad" "mousepad")
TEDITORS=("cat" "less" "vim" "vis" "nano" "micro")
XFMS=("pcmanfm" "nautilus" "rof" "thunar")
TFMS=("ncdu" "du -h" "vifm" "ranger" "mc" "fff" "nnn" "clifm")
PDFVIEWERS=("llpp" "xournalpp" "mupdf" "qpdfview")
DOCVIEWERS=("llpp" "foliate" "mupdf" "qpdfview")
CHMVIEWERS=("kchmviewer" "xchm" "chmopen")
BOOKVIEWERS=("$TERMINAL --geometry=1920x1050 -p Large -x epy.py" "foliate" "llpp" "mupdf")
ARCHIVERS=("als" "lsar" "unar" "aunpack -D")
VIEWERS=("feh" "sxiv" "gifview -a" "display" "mtpaint" "gimp" "viewnoir" "fbi" "lp")
VPLAYERS=("mpv --player-operation-mode=pseudo-gui" "vlc" "cvlc" "ffplay" "ffprobe" "mediainfo")
APLAYERS=("mpv --player-operation-mode=pseudo-gui" "vlc" "cvlc" "ffplay" "ffprobe" "mediainfo" "soxi" "mpg123")
## some defaults
if [[ -n "$DISPLAY" ]]; then
PLAYER="mpv --player-operation-mode=pseudo-gui"
else
PLAYER="mpv --vo=drm"
fi
if [[ -n "$DISPLAY" ]]; then
VIEWER="sxiv -fbq $file $PWD"
else
VIEWER=fbi
fi
TERMINAL=terminator
EDITOR=vis
BROWSER=weaver
PDFVIEWER=llpp
DOCVIEWER=llpp
CHMVIEWER=kchmviewer
BOOKVIEWER="$TERMINAL --geometry=1920x1050 -p Large -x epy.py"
case "$mime_type" in
text/html|text/xml|application/x-mimearchive|message/rfc822)
if [[ $default == true ]]; then
$BROWSER "$file" && exit
elif [[ $TERM = linux && -n $DISPLAY ]]; then
select ops in exit "${XBROWSERS[@]}" "${TBROWSERS[@]}" $EDITOR; do
[[ $ops = exit ]] && exit
[[ $ops = w3m || $ops = links || $ops = elinks || $EDITOR ]] && $TERMINAL -x "$ops" "$file" &
"$ops" "$file" &> /dev/null &
done
elif [[ $TERM != linux && -n $DISPLAY ]]; then
select ops in exit "${XBROWSERS[@]}" "${TBROWSERS[@]}" $EDITOR; do
[[ $ops = exit ]] && exit
"$ops" "$file"
done
else
select ops in exit "${TBROWSERS[@]}" $EDITOR; do
[[ $ops = exit ]] && exit
"$ops" "$file"
done
fi
;;
text/*|*/xml|application/x-httpd-php3|application/x-httpd-php4|application/x-httpd-php5|application/x-shellscript)
[[ $default == true ]] && \
if [[ $TERM = linux && -n $DISPLAY ]]; then
$TERMINAL -x "${VISUAL:-${EDITOR:-vis}}" "$file"
else
"${VISUAL:-${EDITOR:-vis}}" "$file"
fi && exit
select ops in exit "${XEDITORS[@]}" "${TEDITORS[@]}"; do
[[ $ops = exit ]] && exit
"$ops" "$file"
done
;;
image/*)
[[ $default == true ]] && $VIEWER "$file" && exit
select ops in exit "${VIEWERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &> /dev/null &
done
;;
video/*|application/x-matroska)
[[ $default == true ]] && $PLAYER "$file" && exit
if [[ -n $DISPLAY ]]; then
select ops in exit "${VPLAYERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &
done
else
mpv --vo=drm -- "$file"
fi
;;
audio/*| application/ogg|application/x-ogg|application/mxf|application/sdp|application/smil|application/x-smil|application/streamingmedia|application/x-streamingmedia|application/vnd.rn-realmedia|application/vnd.rn-realmedia-vbr)
[[ $default == true ]] && $PLAYER "$file" && exit
select ops in exit "${APLAYERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &
done
;;
application/pdf|application/x-pdf)
[[ $default == true ]] && $PDFVIEWER "$file" && exit
if [[ -n $DISPLAY ]]; then
select ops in exit "${PDFVIEWERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &> /dev/null &
done
else
fbgs "$file"
fi
;;
application/x-cbz|applilcation/oxps|application/vnd.ms-xpsdocument)
[[ $default == true ]] && $DOCVIEWER "$file" && exit
select ops in exit "${DOCVIEWERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &> /dev/null &
done
;;
application/octet-stream)
case "$file" in
*.chm|*.CHM)
[[ $default == true ]] && $CHMVIEWER "$file" && exit
select ops in exit "${CHMVIEWERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &
done
;;
*.gpg)
gpg -d "$file"
;;
*.mobi)
[[ $default == true ]] && $BOOKVIEWER "$file" && exit
select ops in exit "${BOOKVIEWERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &> /dev/null &
done
;;
*)
echo "unknow filetype, probably binary"
;;
esac
;;
application/vnd.ms-htmlhelp)
[[ $default == true ]] && $CHMVIEWER "$file" && exit
select ops in exit "${CHMVIEWERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &
done
;;
application/vnd.comicbook*)
select ops in exit llpp mupdf foliate; do
[[ $ops = exit ]] && break
$ops "$file" &
done
;;
application/epub+zip|application/x-mobipocket-ebook)
[[ $default == true ]] && $BOOKVIEWER "$file" && exit
select ops in exit "${BOOKVIEWERS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file" &> /dev/null &
done
;;
application/pgp-encrypted)
gpg -d "$file"
;;
application/*zip*|application/x-?ar|application/x-?z*|application/x-compressed*|application/vnd.rar|application/x-*-image|application/x-msi)
case "$file" in
*.xoj|*.xopp) xournalpp "$file" &> /dev/null ;;
*.cb?)
select ops in exit llpp mupdf foliate als unar; do
[[ $ops = exit ]] && break
[[ $ops = als || $ops = unar ]] && "$ops" "$file"
"$ops" "$file" &> /dev/null &
done
;;
*)
if [[ $default == true ]]; then
mkdir "$file.tmp"
archivemount "$file" "$file.tmp"
echo -e "$file mounted at $file.tmp directory\n remove with fusermount -u $file.tmp"
else
select ops in exit "${ARCHIVERS[@]}" ; do
[[ $ops = exit ]] && break
# [[ $ops = aunpack ]] && aunpack -D "$file"
$ops "$file"
done
fi
;;
esac
;;
*opendocument*|*openxmlformats*|*msword|*ms-excel|*ms-powerpoint|*abiword|*write*)
[[ -n $DISPLAY ]] && libreoffice "$file" --norestore &> /dev/null
[[ -z $DISPLAY ]] && \
case "$file" in
*.odt|*.odp|*.ods|*.sxw) odt2txt "$file" ;;
*.doc) antiword "$file" ;;
*.docx) docx2txt "$file" - | $PAGER ;;
*) echo "unable to open" ;;
esac
;;
inode/directory)
select ops in exit "${TFMS[@]}" "${XFMS[@]}"; do
[[ $ops = exit ]] && break
$ops "$file"
done
;;
inode/x-empty)
echo "empty file"
rm -i "$file"
;;
inode/mount-point)
## unmount by default
# select ops in exit unmount; do
# [[ $ops = exit ]] && break
# [[ $ops = unmount ]] && fusermount -zu "$file" && rmdir "$file"
fusermount -zu "$file" && rmdir "$file" && echo "$file unmounted and removed"
# done
;;
*)
case "$file" in
*) echo "no filetype association for $file" ;;
esac
;;
esac

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Install Homebrew
if ! type brew &> /dev/null; then
if type sudo &> /dev/null && sudo -n true; then
echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
fi
# Install Homebrew bundle and go-task
brew install go-task/tap/go-task
brew install jq
brew install yq
# Ensure dotfiles are present
if [ ! -f "$HOME/.local/bin/install-dotfiles" ]; then
bash <(curl -sSL https://gitlab.com/megabyte-labs/misc/dotfiles/-/raw/master/dotfiles/.local/bin/install-dotfiles)
else
chmod +x "$HOME/.local/bin/install-dotfiles"
install-dotfiles
fi
# Use run alias to invoke the `$HOME/.local/Taskfile.yml`
if [ -z "$1" ]; then
run localhost:provision
else
run "localhost:provision:$1"
fi

View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
if [ -f ~/.config/autostart/first-boot.desktop ]; then
rm ~/.config/autostart/first-boot.desktop
fi
if type qvm-run &> /dev/null; then
mkdir -p "$HOME/.local"
qvm-run --pass-io sys-firewall 'curl -sSL https://install.doctor/qubes' > "$HOME/.local/setup.sh" && bash "$HOME/.local/setup.sh"
elif [ -d '/Applications' ] && [ -d '/Users' ] && [ -d '/Library' ]; then
mkdir -p "$HOME/.local"
curl -sSL https://install.doctor/quickstart > "$HOME/.local/setup.sh" && bash "$HOME/.local/setup.sh"
elif [ -f '/etc/os-release' ]; then
mkdir -p "$HOME/.local"
curl -sSL https://install.doctor/quickstart > "$HOME/.local/setup.sh" && bash "$HOME/.local/setup.sh"
fi

View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Creates a Qube on RAM disk and opens Firefox if the Qube does not already exist.
# If the Qube already exists, then running this will delete it.
# Source: https://github.com/unman/stuff/blob/main/ramqube.sh
# Source: https://github.com/unman/stuff/blob/main/rmram.sh
if [ -f '/home/user/RQube' ]; then
mkdir /home/user/RQube
sudo mount -t tmpfs -o size=2G rqube /home/user/RQube/
qvm-pool --add rqubepool file -o revisions_to_keep=1,dir_path=/home/user/RQube/
qvm-create rqube -P rqubepool -t debian-11 -l purple --property netvm=tor
qvm-run rqube firefox-esr
else
read -p "RAM Qube alredy exists. Press ENTER to delete."
qvm-kill rqube
qvm-remove -f rqube
qvm-pool -r rqubepool
sudo umount rqube
rm -rf /home/user/RQube
sudo rm -rf /var/log/libvirt/libxl/new.log
sudo rm -rf /var/log/libvirt/libxl/new.log
sudo rm -rf /var/log/qubes/vm-new.log
sudo rm -rf /var/log/guid/new.log
sudo rm -rf /var/log/qrexec.new.log
sudo rm -rf /var/log/pacat.new.log
sudo rm -rf /var/log/qubesdb.new.log
fi

View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
task --taskfile $HOME/.local/common/shared/Taskfile.yml $@

View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Example: find . -type l -exec /path/tos/script {} +
set -e
for link; do
test -h "$link" || continue
dir=$(dirname "$link")
reltarget=$(readlink "$link")
case $reltarget in
/*) abstarget=$reltarget;;
*) abstarget=$dir/$reltarget;;
esac
rm -fv "$link"
cp -afv "$abstarget" "$link" || {
# on failure, restore the symlink
rm -rfv "$link"
ln -sfv "$reltarget" "$link"
}
done