Skip to content
Open
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ stowdir/.vim/undo
stowdir/.vim/viminfo
stowdir/.vim/bundle/vis/doc/tags

# Allow adding work-specific aliases without tracking them.
bashrc.d/100-work.sh
# Allow adding work or host specific tweaks without tracking them.
bashrc.d/1*.sh

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 2 additions & 0 deletions bashrc.d/060-ps1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ fi

##################################################################################################
# Add the __git_ps1 from /usr/share/git-core/contrib/completion/git-prompt.sh
#
# This moved to /usr/lib/git-core/git-sh-prompt in recent systems.
##################################################################################################
function_exists() {
declare -f -F "$1" >/dev/null
Expand Down
37 changes: 0 additions & 37 deletions setup.d/020-fancy-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,41 +49,4 @@ if prompt_default_yes "Install/update fancy shell tools?"; then
download_and_install_delta "$latest_version"
fi
fi

download_and_install_qsv() {
local version="$1"
local artifact="qsv-$version-x86_64-unknown-linux-gnu.zip"
pushd /tmp || exit
debug "downloading $artifact ..."
github_download_release "jqnatividad/qsv" "$version" "$artifact"
debug "unpacking $artifact ..."
unzip -d qsv "$artifact"
debug "installing ..."
cp qsv/qsv ~/.local/bin/

popd || exit 1
}

if prompt_default_yes "Install/update qsv from GitHub"; then
latest_version=$(github_latest_release_tag "jqnatividad/qsv")
info "Found latest version: $latest_version"

if command -v qsv &>/dev/null; then
installed_version=$(qsv --version | sed -En 's/^qsv ([0-9]+\.[0-9]+\.[0-9]+).*$/\1/p')
debug "Found installed version: $installed_version"
if [[ "$installed_version" != "$latest_version" ]]; then
info "Updating qsv ..."
download_and_install_qsv "$latest_version"
else
info "qsv $latest_version already installed"
if prompt_default_no "Reinstall qsv?"; then
info "Reinstalling qsv ..."
download_and_install_qsv "$latest_version"
fi
fi
else
info "Installing qsv for the first time..."
download_and_install_qsv "$latest_version"
fi
fi
fi
3 changes: 2 additions & 1 deletion stowdir/.local/bin/busylightd
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ class BusylightMonitor:
"""Monitor Teams status and update Busylight accordingly."""

def __init__(self, mqtt_config: Dict):
self.client: mqtt.Client = self.connect_mqtt(mqtt_config)
self.status = "unknown"
self.light: Optional[Light] = None

Expand All @@ -106,6 +105,8 @@ class BusylightMonitor:
self.observer = pyudev.MonitorObserver(monitor, callback=self.on_usb_event, name="udev-mon")
self.observer.daemon = False

self.client: mqtt.Client = self.connect_mqtt(mqtt_config)

def connect_mqtt(self, config: Dict) -> mqtt.Client:
"""Connect to the MQTT broker with the given configs."""
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
Expand Down
14 changes: 7 additions & 7 deletions stowdir/.local/bin/uhist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ COMMAND_WRAPPERS = {
"time",
}

BASH_HISTORY = expanduser("~/.bash_history")


def get_subcommands(command):
"""Takes the root, or root + subcommand if indicated by MULTI_COMMAND_COMMANDS."""
"""Take the root, or root + subcommand if indicated by MULTI_COMMAND_COMMANDS."""
if not command:
return ""

Expand All @@ -37,9 +35,10 @@ def get_subcommands(command):
return root


def main(n):
"""Analyze and print statistics about ~/.bash_history"""
with open(BASH_HISTORY, "r") as history:
def main(file, n):
"""Analyze and print statistics about ~/.bash_history."""
file = expanduser(file)
with open(file, "r") as history:
history = Counter(get_subcommands(c.split()) for c in history)
total = sum(history.values())

Expand All @@ -49,6 +48,7 @@ def main(n):

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("input", default="~/.bash_history", help="The bash history file to analyze")
parser.add_argument(
"-n",
"--number",
Expand All @@ -58,4 +58,4 @@ if __name__ == "__main__":
)

args = parser.parse_args()
main(args.number)
main(args.input, args.number)
6 changes: 5 additions & 1 deletion stowdir/.local/bin/vim
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/bin/bash

# The Fedora vim package doesn't include the clipboard features I want, so use gvim instead
exec gvim -v "$@"
if command -v gvim >/dev/null 2>&1; then
exec gvim -v "$@"
else
exec /usr/bin/vim -v "$@"
fi
13 changes: 13 additions & 0 deletions stowdir/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ bind-key -n C-Right select-window -t +1
###################################################################################################
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"

bind -T root F12 \
set prefix None \; \
display-message "disabled (F12 to enable)" \; \
set key-table off \; \
set status-style bg=yellow \; \
refresh-client -S

bind -T off F12 \
set -u prefix \; \
set -u key-table \; \
set -u status-style \; \
refresh-client -S

set -g prefix C-a
bind-key C-a send-prefix

Expand Down
2 changes: 1 addition & 1 deletion stowdir/.vim/bundle/ale
Submodule ale updated from 8eb480 to 6d9962
2 changes: 1 addition & 1 deletion stowdir/.vim/bundle/vim-airline
2 changes: 1 addition & 1 deletion stowdir/.vim/bundle/vim-tmux-navigator