diff options
Diffstat (limited to 'dotfiles/common/.local/bin')
| -rwxr-xr-x | dotfiles/common/.local/bin/dotfiles_pushall | 6 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/lsbak | 1 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/org-protocol-setup | 9 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/project | 100 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/protonvpn | 3 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/resetmimetypes | 123 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/steam | 2 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/sudo-update-grub | 1 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/sysupdate | 5 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/transadd | 9 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/update-backup-repositories | 56 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/virtstart | 8 | ||||
| -rwxr-xr-x | dotfiles/common/.local/bin/ytp | 1 |
13 files changed, 9 insertions, 315 deletions
diff --git a/dotfiles/common/.local/bin/dotfiles_pushall b/dotfiles/common/.local/bin/dotfiles_pushall deleted file mode 100755 index 3eef2c6..0000000 --- a/dotfiles/common/.local/bin/dotfiles_pushall +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Craig Jennings <craigmartinjennings@gmail.com> -# tired of pushing to multiple locations with multiple commands -/usr/bin/git --git-dir="$HOME"/.dotfiles/ --work-tree="$HOME" push origin main && \ -/usr/bin/git --git-dir="$HOME"/.dotfiles/ --work-tree="$HOME" push source main && \ -/usr/bin/git --git-dir="$HOME"/.dotfiles/ --work-tree="$HOME" push github main diff --git a/dotfiles/common/.local/bin/lsbak b/dotfiles/common/.local/bin/lsbak deleted file mode 100755 index 7803135..0000000 --- a/dotfiles/common/.local/bin/lsbak +++ /dev/null @@ -1 +0,0 @@ -ls -laF /media/backup/renovo diff --git a/dotfiles/common/.local/bin/org-protocol-setup b/dotfiles/common/.local/bin/org-protocol-setup new file mode 100755 index 0000000..5ed86a7 --- /dev/null +++ b/dotfiles/common/.local/bin/org-protocol-setup @@ -0,0 +1,9 @@ +#!/bin/sh +# org-protocol-setup +# Craig Jennings <c@cjennings.net> +# Register org-protocol scheme handler for Emacs capture + +xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol +update-desktop-database ~/.local/share/applications/ + +echo "org-protocol handler registered for Emacs" diff --git a/dotfiles/common/.local/bin/project b/dotfiles/common/.local/bin/project deleted file mode 100755 index cf5918d..0000000 --- a/dotfiles/common/.local/bin/project +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env bash - -echo "" - -# Check parameter -if [ "$#" -ne 1 ] || [ "$1" != "start" ] && [ "$1" != "end" ]; then - echo "This script must be called with either 'start' or 'end' as a parameter." - exit 1 -fi - -CHECK_MARK="\033[0;32m\xE2\x9C\x94\033[0m" -CLEAR_LINE="\033[1K" - -# Define directories to process -project_dirs="$HOME/projects" -code_dirs="$HOME/code" -sync_dirs="$HOME/sync" - - -# Git pull quietly unless there's an error -git_maybe_pull() { - git fetch --quiet - if ! git diff --quiet HEAD FETCH_HEAD; then - git pull --quiet - - # clear line and message - echo -ne "\033[1K" - echo -e "\\rpulled remote changes into $1" - fi -} - -# Git stash quietly unless there's an error -git_stash () { - git stash > /dev/null 2>&1 || \ - echo "git stash error in $1: $? " -} - -# Git stash pop quietly unless there's an error -git_stash_pop () { - git stash pop > /dev/null 2>&1 || \ - echo "git stash error in $1: $? " -} - -# Function to process a directory -process_directory() { - if [ -d "$1/.git" ]; then - # Check remote repository - cd "$1" - - # skip URLs with http/s URLS as they're directories cloned for reference only - # skip git directories with no remote repository associated as well - remote_url=$(git config --get remote.origin.url) - if [ -n "$remote_url" ]; then - # if remote URL is http or https or empty, skip the directory - if [ -z "$remote_url" ] || echo "$remote_url" | grep -E -q "^(http|https)://"; then - return - fi - - # clear line and update directory - echo -ne "$CLEAR_LINE" - echo -ne "\\rchecking: $1 " - - if [ "$2" = "start" ]; then - if [ -n "$(git status --porcelain)" ]; then - # notify user of uncommitted work - echo ""; echo ">>>> uncommitted work found in $1"; - - # git stash, pull latest files, then pop uncommitted work - git_stash "$1" - git_maybe_pull "$1" - git_stash_pop "$1" - else - # retrieve any latest changes - git_maybe_pull "$1" - fi - elif [ "$2" = "end" ]; then - # Check for uncommitted work - if [ -n "$(git status --porcelain)" ]; then - echo ""; echo ">>>> Uncommitted work found in $1. <<<<"; echo "" - fi - return # Skip pulling changes - fi - fi - fi -} - -# Process directories -for directory in "$project_dirs"/*; do - process_directory "$directory" "$1" -done -for directory in "$sync_dirs"/*; do - process_directory "$directory" "$1" -done -for directory in "$code_dirs"/*; do - process_directory "$directory" "$1" -done - -# clear line and message finished -echo -ne "\033[1K" -echo -ne "\\rfinished.\n" diff --git a/dotfiles/common/.local/bin/protonvpn b/dotfiles/common/.local/bin/protonvpn deleted file mode 100755 index 0f24068..0000000 --- a/dotfiles/common/.local/bin/protonvpn +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -flatpak run com.protonvpn.www
\ No newline at end of file diff --git a/dotfiles/common/.local/bin/resetmimetypes b/dotfiles/common/.local/bin/resetmimetypes deleted file mode 100755 index e2e8f06..0000000 --- a/dotfiles/common/.local/bin/resetmimetypes +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# resetmimetypes - Reset MIME type associations to preferred defaults -# Run after package updates that may have overwritten associations - -# Remove old databases to force regeneration -rm ~/.config/mimeapps.list 2>/dev/null -rm ~/.local/share/applications/mimeinfo.cache 2>/dev/null -rm ~/.local/share/applications/mimeinfo.list 2>/dev/null - -# Directories: Nautilus -xdg-mime default org.gnome.Nautilus.desktop inode/directory - -# Audio: mpv -xdg-mime default mpv.desktop audio/basic -xdg-mime default mpv.desktop audio/flac -xdg-mime default mpv.desktop audio/mp4 -xdg-mime default mpv.desktop audio/mpeg -xdg-mime default mpv.desktop audio/ogg -xdg-mime default mpv.desktop audio/opus -xdg-mime default mpv.desktop audio/vnd.rn-realaudio -xdg-mime default mpv.desktop audio/vnd.wav -xdg-mime default mpv.desktop audio/vorbis -xdg-mime default mpv.desktop audio/x-aiff -xdg-mime default mpv.desktop audio/x-mpegurl -xdg-mime default mpv.desktop audio/x-wav - -# Video: VLC -xdg-mime default vlc.desktop application/ogg -xdg-mime default vlc.desktop application/vnd.apple.mpegurl -xdg-mime default vlc.desktop video/avi -xdg-mime default vlc.desktop video/divx -xdg-mime default vlc.desktop video/flv -xdg-mime default vlc.desktop video/mp4 -xdg-mime default vlc.desktop video/mp4v-es -xdg-mime default vlc.desktop video/mpeg -xdg-mime default vlc.desktop video/ogg -xdg-mime default vlc.desktop video/quicktime -xdg-mime default vlc.desktop video/webm -xdg-mime default vlc.desktop video/x-avi -xdg-mime default vlc.desktop video/x-flv -xdg-mime default vlc.desktop video/x-m4v -xdg-mime default vlc.desktop video/x-matroska -xdg-mime default vlc.desktop video/x-mpeg -xdg-mime default vlc.desktop video/x-ms-wmv -xdg-mime default vlc.desktop video/x-msvideo -xdg-mime default vlc.desktop x-content/video-dvd - -# Images: feh -xdg-mime default feh.desktop image/bmp -xdg-mime default feh.desktop image/gif -xdg-mime default feh.desktop image/jpeg -xdg-mime default feh.desktop image/jpg -xdg-mime default feh.desktop image/png -xdg-mime default feh.desktop image/tiff -xdg-mime default feh.desktop image/webp -xdg-mime default feh.desktop image/x-bmp -xdg-mime default feh.desktop image/x-ico -xdg-mime default feh.desktop image/x-icon - -# Torrents: Transmission Remote -xdg-mime default io.github.TransmissionRemoteGtk.desktop application/x-bittorrent -xdg-mime default io.github.TransmissionRemoteGtk.desktop x-scheme-handler/magnet - -# Web: Chrome -xdg-mime default com.google.Chrome.desktop application/rdf+xml -xdg-mime default com.google.Chrome.desktop application/rss+xml -xdg-mime default com.google.Chrome.desktop application/xhtml+xml -xdg-mime default com.google.Chrome.desktop application/xml -xdg-mime default com.google.Chrome.desktop text/html -xdg-mime default com.google.Chrome.desktop text/xml -xdg-mime default com.google.Chrome.desktop x-scheme-handler/http -xdg-mime default com.google.Chrome.desktop x-scheme-handler/https - -# Ebooks (mobi): Calibre -xdg-mime default calibre-ebook-viewer.desktop application/x-mobi8-ebook -xdg-mime default calibre-ebook-viewer.desktop application/x-mobipocket-ebook - -# Text/Code: Emacsclient -xdg-mime default emacsclient.desktop application/x-shellscript -xdg-mime default emacsclient.desktop text/english -xdg-mime default emacsclient.desktop text/markdown -xdg-mime default emacsclient.desktop text/plain -xdg-mime default emacsclient.desktop text/x-c -xdg-mime default emacsclient.desktop text/x-c++ -xdg-mime default emacsclient.desktop text/x-c++hdr -xdg-mime default emacsclient.desktop text/x-c++src -xdg-mime default emacsclient.desktop text/x-chdr -xdg-mime default emacsclient.desktop text/x-csrc -xdg-mime default emacsclient.desktop text/x-java -xdg-mime default emacsclient.desktop text/x-makefile -xdg-mime default emacsclient.desktop text/x-pascal -xdg-mime default emacsclient.desktop text/x-tcl -xdg-mime default emacsclient.desktop text/x-tex - -# PDF/EPUB/Documents: Zathura -xdg-mime default org.pwmt.zathura.desktop application/epub+zip -xdg-mime default org.pwmt.zathura.desktop application/pdf -xdg-mime default org.pwmt.zathura.desktop application/postscript -xdg-mime default org.pwmt.zathura.desktop image/vnd.djvu -xdg-mime default org.pwmt.zathura.desktop image/vnd.djvu+multipage - -# Comics: Zathura -xdg-mime default org.pwmt.zathura.desktop application/vnd.comicbook+zip -xdg-mime default org.pwmt.zathura.desktop application/vnd.comicbook-rar - -# Office documents: LibreOffice Writer -xdg-mime default libreoffice-writer.desktop application/msword -xdg-mime default libreoffice-writer.desktop application/rtf -xdg-mime default libreoffice-writer.desktop application/vnd.ms-word -xdg-mime default libreoffice-writer.desktop application/vnd.oasis.opendocument.text -xdg-mime default libreoffice-writer.desktop application/vnd.openxmlformats-officedocument.wordprocessingml.document -xdg-mime default libreoffice-writer.desktop text/rtf - -# FTP: FileZilla -xdg-mime default filezilla.desktop x-scheme-handler/ftp - -# Org-Protocol: Emacsclient -xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol - -# Regenerate database -update-desktop-database ~/.local/share/applications/ - -echo "MIME associations reset." diff --git a/dotfiles/common/.local/bin/steam b/dotfiles/common/.local/bin/steam deleted file mode 100755 index 3d30238..0000000 --- a/dotfiles/common/.local/bin/steam +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -flatpak run com.valvesoftware.Steam >> "$HOME/.local/var/logs/steam.log" 2>&1 diff --git a/dotfiles/common/.local/bin/sudo-update-grub b/dotfiles/common/.local/bin/sudo-update-grub deleted file mode 100755 index 5d67823..0000000 --- a/dotfiles/common/.local/bin/sudo-update-grub +++ /dev/null @@ -1 +0,0 @@ -sudo grub-mkconfig -o /boot/grub/grub.cfg diff --git a/dotfiles/common/.local/bin/sysupdate b/dotfiles/common/.local/bin/sysupdate deleted file mode 100755 index 357348d..0000000 --- a/dotfiles/common/.local/bin/sysupdate +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Craig Jennings <c@cjennings.net> - - -yay -Syu --noconfirm
\ No newline at end of file diff --git a/dotfiles/common/.local/bin/transadd b/dotfiles/common/.local/bin/transadd deleted file mode 100755 index a598fad..0000000 --- a/dotfiles/common/.local/bin/transadd +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Mimeapp script for adding torrent to transmission-daemon, but will also start the daemon first if not running. - -# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep. - -pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") - -transmission-remote -a "$@" && notify-send "🔽 Torrent added." diff --git a/dotfiles/common/.local/bin/update-backup-repositories b/dotfiles/common/.local/bin/update-backup-repositories deleted file mode 100755 index a91b438..0000000 --- a/dotfiles/common/.local/bin/update-backup-repositories +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Craig Jennings <c@cjennings.net> -# updates or clones repositories for backup - -REPOS_HOME="/media/backup/repositories/" - -# Create REPOS_HOME dir if not exists -if [ ! -d "$REPOS_HOME" ]; then - mkdir -p "$REPOS_HOME" -fi - -# Make sure REPOS_HOME dir is writable -if [ ! -w "$REPOS_HOME" ]; then - echo "Directory $REPOS_HOME is not writable." - exit 1 -fi - -# Make sure git is available -if ! command -v git >/dev/null 2>&1; then - echo "Git command does not exist. Please install git." - exit 1 -fi - -cd "$REPOS_HOME" - -repos=" -git@cjennings.net:archsetup.git -git@cjennings.net:dmenu.git -git@cjennings.net:dotemacs.git -git@cjennings.net:dotfiles.git -git@cjennings.net:dwm.git -git@cjennings.net:pinentry-dmenu.git -git@cjennings.net:rsyncshot.git -git@cjennings.net:st.git -git@github.com:cjennings/emacs-wttrin.git -https://github.com/d12frosted/elpa-mirror.git -https://github.com/mirrors/emacs.git -" - -for repo in $repos; do - dir=$(echo "$repo" | awk -F'[/:]' '{gsub(/.git/, "", $NF); print $NF}') - # Note on the above awk command: - # awk -F'[/:]': uses awk with a regex field delimiter that matches both : and / - # which will work with both ssh and http style URLs. - # '{gsub(/.git/, "", $NF); print $NF}: This removes the ".git" postfixes from the last field ($NF) - # which leaves only the repo name. - - fullpath="$REPOS_HOME$dir" - if [ -d "$fullpath" ]; then - echo "Repository $dir exists at $fullpath, pulling..." - (cd "$fullpath" && git pull) - else - echo "Repository $dir doesn't exist at $fullpath, cloning..." - cd "$REPOS_HOME" && git clone --depth 1 "$repo" "$fullpath" - fi -done diff --git a/dotfiles/common/.local/bin/virtstart b/dotfiles/common/.local/bin/virtstart deleted file mode 100755 index f9a326f..0000000 --- a/dotfiles/common/.local/bin/virtstart +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# launch a virtual machine in fullscreen. -# the argument is the machine name - -export LIBVIRT_DEFAULT_URI="qemu:///system" - -/usr/bin/virsh start $1 -/usr/bin/virt-viewer -f -w -a $1 diff --git a/dotfiles/common/.local/bin/ytp b/dotfiles/common/.local/bin/ytp deleted file mode 100755 index c24d50f..0000000 --- a/dotfiles/common/.local/bin/ytp +++ /dev/null @@ -1 +0,0 @@ -yt-dlp --ignore-config --yes-playlist --embed-metadata -i -o '%(channel)s-%(playlist_title)s-%(playlist_index)s-%(title)s.%(ext)s' $1 $2 $3 $4 |
