diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-10-22 22:39:26 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-10-22 22:39:26 +0200 |
| commit | 3d9ff286af272a40c09edda50283c8d4ce959f32 (patch) | |
| tree | ca12463705af2ac872ca584683f4d8eaff350c72 /.local | |
| parent | 9a2951d12da3a8f284a68ac14ea35775881b04aa (diff) | |
| download | dotfiles-3d9ff286af272a40c09edda50283c8d4ce959f32.tar.gz dotfiles-3d9ff286af272a40c09edda50283c8d4ce959f32.zip | |
Moved scripts to ~/.scripts
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/scripts/Heads-Up-Display | 28 | ||||
| -rw-r--r-- | .local/bin/scripts/README.md | 1 | ||||
| -rwxr-xr-x | .local/bin/scripts/bspwm-toggle-visibility.sh | 23 | ||||
| -rwxr-xr-x | .local/bin/scripts/bspwm_resize.sh | 67 | ||||
| -rw-r--r-- | .local/bin/scripts/check-updates.sh | 0 | ||||
| -rwxr-xr-x | .local/bin/scripts/colors.sh | 78 | ||||
| -rwxr-xr-x | .local/bin/scripts/cryptocheck | 31 | ||||
| -rwxr-xr-x | .local/bin/scripts/cryptonotify | 19 | ||||
| -rwxr-xr-x | .local/bin/scripts/dotfiles.sh | 37 | ||||
| -rwxr-xr-x | .local/bin/scripts/ffmpeg | 24 | ||||
| -rwxr-xr-x | .local/bin/scripts/get_zle_keymap_select.sh | 13 | ||||
| -rwxr-xr-x | .local/bin/scripts/gsettings.sh | 27 | ||||
| -rwxr-xr-x | .local/bin/scripts/killandnotify | 4 | ||||
| -rwxr-xr-x | .local/bin/scripts/layer.sh | 24 | ||||
| -rwxr-xr-x | .local/bin/scripts/neovim.sh | 419 | ||||
| -rwxr-xr-x | .local/bin/scripts/opacity-change.sh | 34 | ||||
| -rwxr-xr-x | .local/bin/scripts/powermenu | 38 | ||||
| -rwxr-xr-x | .local/bin/scripts/qemu-helper.sh | 172 | ||||
| -rwxr-xr-x | .local/bin/scripts/random_data.py | 153 | ||||
| -rwxr-xr-x | .local/bin/scripts/scratchpad | 64 | ||||
| -rw-r--r-- | .local/bin/scripts/win-nvim.bat | 37 | ||||
| -rw-r--r-- | .local/bin/scripts/win-nvim.ps1 | 39 |
22 files changed, 0 insertions, 1332 deletions
diff --git a/.local/bin/scripts/Heads-Up-Display b/.local/bin/scripts/Heads-Up-Display deleted file mode 100755 index 8680123..0000000 --- a/.local/bin/scripts/Heads-Up-Display +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -# Created By: srdusr -# Created On: Wed 05 Feb 2023 01:24:37 AM CAT -# Project: bspwm scratchpad (Heads-Up-Display) with tmux session - -if id="$(xdo id -N Heads-Up-Display)" - then bspc node "$id" -g hidden -f - else kitty --class "Heads-Up-Display" -e tmux new-session -A -s HUD -e bash > /dev/null 2>&1 & -fi - -#- - - - - - - - - - - - -### Alternative method - -#id=$(xdotool search --class Heads-Up-Display); -#if [ -z "$id" ]; then -# #kitty --class "Heads-Up-Display" -e tmux new-session -A -s HUD -e bash > /dev/null 2>&1 & -# alacritty --class "Heads-Up-Display" -e tmux new-session -A -s HUD -e bash > /dev/null 2>&1 & -#else -# if [ ! -f /tmp/hide_hud ]; then -# touch /tmp/hide_hud && xdo hide "$id" -# elif [ -f /tmp/hide_hud ]; then -# rm /tmp/hide_hud && xdo show "$id" -# fi -#fi - diff --git a/.local/bin/scripts/README.md b/.local/bin/scripts/README.md deleted file mode 100644 index 458b3cc..0000000 --- a/.local/bin/scripts/README.md +++ /dev/null @@ -1 +0,0 @@ -# scripts diff --git a/.local/bin/scripts/bspwm-toggle-visibility.sh b/.local/bin/scripts/bspwm-toggle-visibility.sh deleted file mode 100755 index 45a4c53..0000000 --- a/.local/bin/scripts/bspwm-toggle-visibility.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Created By: srdusr -# Created On: Mon 18 Sep 2023 18:37:21 CAT -# Project: Bspwm script to toggle visibility of initial window and bring focus back to it - -# Get the ID of the currently focused desktop -current_desktop_id=$(bspc query -D -d focused --names) - -# Get the ID of the first hidden window in the current desktop -hidden_window_id=$(bspc query -N -d "$current_desktop_id" -n .hidden | head -n 1) - -# Check if there's a hidden window in the current desktop -if [[ -n "$hidden_window_id" ]]; then - # There's a hidden window, so unhide it - bspc node "$hidden_window_id" -g hidden=off - # Bring focus back to the previously hidden window - bspc node -f "$hidden_window_id" -else - # There's no hidden window in the current desktop, hide the first available window - first_window_id=$(bspc query -N -n focused.window) - bspc node "$first_window_id" -g hidden=on -fi diff --git a/.local/bin/scripts/bspwm_resize.sh b/.local/bin/scripts/bspwm_resize.sh deleted file mode 100755 index 29ab5cf..0000000 --- a/.local/bin/scripts/bspwm_resize.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -size=${2:-'10'} -dir=$1 - -# Find current window mode -is_tiled() { -bspc query -T -n | grep -q '"state":"tiled"' -} -# If the window is floating, move it -if ! is_tiled; then -#only parse input if window is floating,tiled windows accept input as is - case "$dir" in - west) switch="-w" - sign="-" - ;; - east) switch="-w" - sign="+" - ;; - north) switch="-h" - sign="-" - ;; - south) switch="-h" - sign="+" - ;; - esac - xdo resize ${switch} ${sign}${size} - -# Otherwise, window is tiled: switch with window in given direction -else - case "$dir" in - west) bspc node @west -r -$size || bspc node @east -r -${size} - ;; - east) bspc node @west -r +$size || bspc node @east -r +${size} - ;; - north) bspc node @south -r -$size || bspc node @north -r -${size} - ;; - south) bspc node @south -r +$size || bspc node @north -r +${size} - ;; - esac -fi - -##!/bin/bash -# -#[ "$#" -eq 3 ] || { echo "Needs exactly three arguments."; exit 1; } -# -#motion="$1" -#direction="$2" -#size="$3" -# -#if [ "$motion" = 'expand' ]; then -# # These expand the window's given side -# case "$direction" in -# north) bspc node -z top 0 -"$size" ;; -# east) bspc node -z right "$size" 0 ;; -# south) bspc node -z bottom 0 "$size" ;; -# west) bspc node -z left -"$size" 0 ;; -# esac -#else -# # These contract the window's given side -# case "$direction" in -# north) bspc node -z top 0 "$size" ;; -# east) bspc node -z right -"$size" 0 ;; -# south) bspc node -z bottom 0 -"$size" ;; -# west) bspc node -z left "$size" 0 ;; -# esac -#fi diff --git a/.local/bin/scripts/check-updates.sh b/.local/bin/scripts/check-updates.sh deleted file mode 100644 index e69de29..0000000 --- a/.local/bin/scripts/check-updates.sh +++ /dev/null diff --git a/.local/bin/scripts/colors.sh b/.local/bin/scripts/colors.sh deleted file mode 100755 index fc1c10c..0000000 --- a/.local/bin/scripts/colors.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash -colors=$@ -for (( n=0; n < $colors; n++ )) do - printf " [%d] $(tput setaf $n)%s$(tput sgr0)" $n "Hello World! -" -done -PADDING='Padding' - -main() { - local xterm_start=0 \ - xterm_width=8 \ - xterm_height=2 - - local cube_start=$((xterm_start + xterm_width * xterm_height)) \ - cube_width=6 \ - cube_height=$((6 * 6)) - - local greys_start=$((cube_start + cube_width * cube_height)) \ - greys_width=8 \ - greys_height=3 - - color_block $xterm_start $xterm_width $xterm_height - color_block $cube_start $cube_width $cube_height use_padding - color_block $greys_start $greys_width $greys_height - echo -} - -color_block() { - local start=$1 width=$2 height=$3 use_padding=$4 - local max s color_nums colors - - max=$((start + width * height - 1)) - - echo - for s in $(seq $start $width $max); do - color_nums=$(seq $s $((s + width - 1))) - colors="${use_padding:+$PADDING }${color_nums}${use_padding:+ $PADDING}" - - printf '%s%s %s%s\n' \ - "$(fg_bars $colors)" $ansi_reset \ - "$(bg_bars $colors)" $ansi_reset - done -} - -fg_bars() { - for color in $@; do - color_bar ansi_fg $color '' - done -} - -bg_bars() { - for color in $@; do - color_bar ansi_bg $color ' ' - done -} - -color_bar() { - local ansi=$1 color=$2 trail=$3 - - if [ "$color" == $PADDING ]; then - printf '%s %s' $ansi_reset "$trail" - else - local color_seq=$($ansi $color) - printf '%s %03d%s' $color_seq $color "$trail" - fi -} - -ansi_reset=$'\033[0m' - -ansi_fg() { - printf '\033[38;5;%dm' $1 -} - -ansi_bg() { - printf '\033[48;5;%dm' $1 -} - -main diff --git a/.local/bin/scripts/cryptocheck b/.local/bin/scripts/cryptocheck deleted file mode 100755 index 02ba42d..0000000 --- a/.local/bin/scripts/cryptocheck +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -if [ ! -d ~/.cache/crypto ]; then - mkdir ~/.cache/crypto -fi -ticker=(BTC ETH ADA DOT SOL XMR) - -for currency in "${ticker[@]}"; do - echo "$currency" -done | while read coin - do - price=$(curl rate.sx/1$coin) - if [ $coin = "BTC" ]; then - icon= - elif [ $coin = "ETH" ]; then - icon= - elif [ $coin = "ADA" ]; then - icon= - elif [ $coin = "DOT" ]; then - icon= - elif [ $coin = "SOL" ]; then - icon= - elif [ $coin = "XMR" ]; then - icon= - fi - - echo "$icon $coin: $price" > ~/.cache/crypto/$coin - - done - -date > ~/.cache/crypto/time - diff --git a/.local/bin/scripts/cryptonotify b/.local/bin/scripts/cryptonotify deleted file mode 100755 index 47883c3..0000000 --- a/.local/bin/scripts/cryptonotify +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -source cryptocheck -Output= -for file in ~/.cache/crypto/* -do - if [ ! -z "$Output" ]; then - if [ ! $(basename $file) = "time" ]; then - Output="$Output\n$(cat $file)" - fi - else - if [ ! $(basename $file) = "time" ]; then - Output="$Output$(cat $file)" - fi - fi - -done - -Output="$Output\n$(cat ~/.cache/crypto/time)" -notify-send "Crypto Prices" "$Output" diff --git a/.local/bin/scripts/dotfiles.sh b/.local/bin/scripts/dotfiles.sh deleted file mode 100755 index b231367..0000000 --- a/.local/bin/scripts/dotfiles.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Set the bare dotfiles repo directory -dotfiles_dir="$HOME/.cfg" - -# Set the home directory -home_dir="$HOME" - -# Exclude the .cfg directory and any other files/directories you want to ignore -exclude_list=(".cfg") - -# Change to the home directory -cd "$home_dir" - -# Get a list of all dotfiles in the repository -files=$(find "$dotfiles_dir" -maxdepth 1 -type f -not -name ".*" -not -name "${exclude_list[*]}" -printf "%f\n") - -# Link each file to its corresponding location in $HOME -for file in $files; do - ln -sf "$dotfiles_dir/$file" "$home_dir/.$file" -done - -# Get a list of all dot directories in the repository -dirs=$(find "$dotfiles_dir" -maxdepth 1 -type d -not -path "$dotfiles_dir" -not -name ".*" -not -name "${exclude_list[*]}" -printf "%f\n") - -# Link each directory to its corresponding location in $HOME -for dir in $dirs; do - ln -sf "$dotfiles_dir/$dir" "$home_dir/.$dir" -done - -# Remove any symlinks that are no longer present in the repo -while IFS= read -r -d '' link; do - if [[ ! -e "$link" ]]; then - rm "$link" - fi -done < <(find "$home_dir" -maxdepth 1 -type l -name ".*" -not -name ".cfg" -print0) - diff --git a/.local/bin/scripts/ffmpeg b/.local/bin/scripts/ffmpeg deleted file mode 100755 index 2258fbd..0000000 --- a/.local/bin/scripts/ffmpeg +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# audio -A="$(pactl list sources | grep 'analog.*monitor' | awk '{print $2}')" -# screen size -S="$(xdpyinfo | grep dimensions | awk '{print $2}')" -# file name -N="$(date +"%m-%d-%Y_%I:%M%p").mp4" - -# Desktop audio + screen recording -ffmpeg \ --s "$S" -r 25 -f x11grab -i :0.0+0,0 \ --ac 2 ~/"$N" - -# ffmpeg can output high quality GIF. Before you start it is always recommended to use a recent version: download or compile. - -# ffmpeg -ss 30 -t 3 -i input.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif - -# This example will skip the first 30 seconds (-ss 30) of the input and create a 3 second output (-t 3). -# fps filter sets the frame rate. A rate of 10 frames per second is used in the example. -# scale filter will resize the output to 320 pixels wide and automatically determine the height while preserving the aspect ratio. The lanczos scaling algorithm is used in this example. -# palettegen and paletteuse filters will generate and use a custom palette generated from your input. These filters have many options, so refer to the links for a list of all available options and values. Also see the Advanced options section below. -# split filter will allow everything to be done in one command and avoids having to create a temporary PNG file of the palette. -# Control looping with -loop output option but the values are confusing. A value of 0 is infinite looping, -1 is no looping, and 1 will loop once meaning it will play twice. So a value of 10 will cause the GIF to play 11 times. diff --git a/.local/bin/scripts/get_zle_keymap_select.sh b/.local/bin/scripts/get_zle_keymap_select.sh deleted file mode 100755 index 1e2eaf4..0000000 --- a/.local/bin/scripts/get_zle_keymap_select.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Get the value of the zle-keymap-select variable -value=$(print -v zle-keymap-select) - -# Specify the file path to save the value -file_path="~/file.txt" - -# Write the value to the file -echo "$value" > "$file_path" - -# Optionally, you can also print the value to the console -echo "The value of zle-keymap-select is: $value" diff --git a/.local/bin/scripts/gsettings.sh b/.local/bin/scripts/gsettings.sh deleted file mode 100755 index 0cd28c2..0000000 --- a/.local/bin/scripts/gsettings.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Disable screen lock -gsettings set org.gnome.desktop.screensaver lock-enabled false -gsettings set org.gnome.desktop.session idle-delay 0 - -# Mutter Overlay Key -gsettings set org.gnome.mutter overlay-key '' - -# Disable update notification -#gsettings set org.gnome.software download-updates false -#gsettings set com.ubuntu.update-notifier no-show-notifications true -#sudo rm /etc/xdg/autostart/upg-notifier-autostart.desktop - -#sudo mv /etc/xdg/autostart/update-notifier.desktop /etc/xdg/autostart/update-notifier.desktop.old -#sudo mv /etc/xdg/autostart/gnome-software-service.desktop /etc/xdg/autostart/gnome-software-service.desktop.old - -# Custom Keybinding Names -gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']" - -# Custom Keybinding 0 -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding "<Alt>T" -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "scratchpad" -gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name "scratchpad" - -# Disable keyboard plugin -gsettings set org.gnome.settings-daemon.plugins.keyboard active false diff --git a/.local/bin/scripts/killandnotify b/.local/bin/scripts/killandnotify deleted file mode 100755 index 2e7222e..0000000 --- a/.local/bin/scripts/killandnotify +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# Kills an application and sends a notification that it's been killed - -killall "$1" && notify-send "$1" "$2" diff --git a/.local/bin/scripts/layer.sh b/.local/bin/scripts/layer.sh deleted file mode 100755 index 4b17ed1..0000000 --- a/.local/bin/scripts/layer.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -current_layer="$(bspc query -T -n | jq -r '.client.layer')" -case $1 in - +|-) - declare -A _layers=( [below]=0 [normal]=1 [above]=2 ) - layers=( below normal above ) - maxl=$(( ${#layers[@]} - 1 )) - current_layer="$(bspc query -T -n | jq -r '.client.layer')" - i=$(( ${_layers[$current_layer]} $1 1 )) - if [[ $i -lt 0 ]]; then - i=0 - elif [[ $i -gt $maxl ]]; then - i=$maxl - fi - #cycle? nah - #i=$(( (${_layers[$current_layer]} + ${#layers[@]} ${1} 1) % ${#layers[@]} )) - new_layer="${layers[$i]}" - ;; - *) - new_layer="$(bspc query -T -n | jq -r '.client.lastLayer')" - ;; -esac -[[ "$current_layer" != "$new_layer" ]] && bspc node -l "$new_layer" diff --git a/.local/bin/scripts/neovim.sh b/.local/bin/scripts/neovim.sh deleted file mode 100755 index e905add..0000000 --- a/.local/bin/scripts/neovim.sh +++ /dev/null @@ -1,419 +0,0 @@ -#!/bin/bash - -# Created By: srdusr -# Created On: Sat 12 Aug 2023 13:11:39 CAT -# Project: Install/update/uninstall/change version Neovim script, primarily for Linux but may work in other platforms - -# Color definitions -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color - -# Function to handle errors -handle_error() { - local message="$1" - printf "${RED}Error: $message${NC}\n" -} - -# Check if necessary dependencies are installed -check_dependencies() { - if [ -x "$(command -v wget)" ]; then - DOWNLOAD_COMMAND="wget" - elif [ -x "$(command -v curl)" ]; then - DOWNLOAD_COMMAND="curl" - else - printf "${RED}Error: Neither wget nor curl found. Please install one of them to continue!${NC}\n" - exit 1 - fi -} - -# Check for privilege escalation tools -check_privilege_tools() { - if [ -x "$(command -v sudo)" ]; then - PRIVILEGE_TOOL="sudo" - elif [ -x "$(command -v doas)" ]; then - PRIVILEGE_TOOL="doas" - elif [ -x "$(command -v pkexec)" ]; then - PRIVILEGE_TOOL="pkexec" - elif [ -x "$(command -v dzdo)" ]; then - PRIVILEGE_TOOL="dzdo" - elif [ "$(id -u)" -eq 0 ]; then - PRIVILEGE_TOOL="" # root - else - PRIVILEGE_TOOL="" # No privilege escalation mechanism found - printf "\n${RED}Error: No privilege escalation tool (sudo, doas, pkexec, dzdo, or root privileges) found. You may not have sufficient permissions to run this script.${NC}\n" - printf "\nAttempt to continue Installation (might fail without a privilege escalation tool)? [yes/no] " - read continue_choice - case $continue_choice in - [Yy] | [Yy][Ee][Ss]) ;; - [Nn] | [Nn][Oo]) exit ;; - *) handle_error "Invalid choice. Exiting..." && exit ;; - esac - fi -} - -# Check if Neovim is already installed -check_neovim_installed() { - if [ -x "$(command -v nvim)" ]; then - return 0 # Neovim is installed - else - return 1 # Neovim is not installed - fi -} - -# Nightly version -nightly_version() { - local url="https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage" - install_neovim "$url" - local version_output=$(nvim --version) - version_id="Nightly $(echo "$version_output" | grep -oP 'NVIM \d+\.\d+')" -} - -# Stable version -stable_version() { - local url="https://github.com/neovim/neovim/releases/download/stable/nvim.appimage" - install_neovim "$url" - local version_output=$(nvim --version) - version_id="Stable $(echo "$version_output" | grep -oP 'NVIM \d+\.\d+')" -} - -# Specific version -specific_version() { - local version="$1" - - # Add 'v' prefix if not present - if [[ $version != v* ]]; then - version="v$version" - fi - - local url="https://github.com/neovim/neovim/releases/download/$version/nvim.appimage" - install_neovim "$url" - local version_output=$(nvim --version) - version_id="Version $version $(echo "$version_output" | grep -oP 'NVIM \d+\.\d+')" -} - -# Function to download a file using wget or curl -download_file() { - local url="$1" - local output="$2" - - if [ "$DOWNLOAD_COMMAND" = "wget" ]; then - if ! "$DOWNLOAD_COMMAND" -q --show-progress -O "$output" "$url"; then - handle_error "Download failed. Exiting..." - exit 1 - fi - elif [ "$DOWNLOAD_COMMAND" = "curl" ]; then - if ! "$DOWNLOAD_COMMAND" --progress-bar -# -o "$output" "$url"; then - handle_error "Download failed. Exiting..." - exit 1 - fi - else - echo "Unsupported download command: $DOWNLOAD_COMMAND" - exit 1 - fi -} - -# Check if a specific version of Neovim exists -version_exists() { - local version="$1" - - # Add 'v' prefix if not present - if [[ $version != v* ]]; then - version="v$version" - fi - - # Fetch all the release tags from GitHub - ALL_TAGS=$(curl -s "https://api.github.com/repos/neovim/neovim/tags" | grep '"name":' | cut -d '"' -f 4) - - # Check if the desired version is in the list of release tags - if echo "$ALL_TAGS" | grep -q "$version"; then - return 0 # Version exists - else - return 1 # Version does not exist - fi -} - -# Update Neovim to the latest version (nightly/stable) -update_version() { - valid_choice=false - while [ "$valid_choice" = false ]; do - # Determine which version to update to (nightly/stable) - printf "Select version to install/update to:\n" - printf " 1. Nightly\n" - printf " 2. Stable\n" - printf " 3. Choose specific version by tag\n" - printf "Enter the number corresponding to your choice (1/2/3): " - read update_choice - - case $update_choice in - 1) - version="Nightly" - nightly_version - valid_choice=true - ;; - 2) - version="Stable" - stable_version - valid_choice=true - ;; - 3) - # Ask user for specific version - read -p "Enter the specific version (e.g., v0.1.0): " version - # Normalize version - if [[ $version != v* ]]; then - version="v$version" - fi - # Check if the specific version exists on GitHub releases - if version_exists "$version"; then - # Install specific version - specific_version "$version" # Pass the normalized version to the function - valid_choice=true - else - printf "${RED}The specified version $version does not exist.${NC}\n" - fi - ;; - - *) - handle_error "Invalid choice. Please enter a valid option (1, 2 or 3)." - ;; - esac - done - -} - -# Install Neovim -install_neovim() { - local url="$1" - local install_action="$3" - - if [ "$install_action" = "installed" ]; then - printf "Downloading and installing Neovim $version...\n" - else - printf "${GREEN}Updating Neovim to the latest version ($version)...${NC}\n" - fi - - # Determine the platform-specific installation steps - case "$(uname -s)" in - Linux) - printf "Detected Linux OS.\n" - if [ -x "$(command -v fusermount)" ]; then - printf "FUSE is available. Downloading and running the AppImage...\n" - download_file "$url" "nvim.appimage" - chmod u+x nvim.appimage - "$PRIVILEGE_TOOL" cp nvim.appimage /usr/local/bin/nvim - "$PRIVILEGE_TOOL" mv nvim.appimage /usr/bin/nvim - else - printf "FUSE is not available. Downloading and extracting the AppImage...\n" - download_file "$url" "nvim.appimage" - chmod u+x nvim.appimage - ./nvim.appimage --appimage-extract - "$PRIVILEGE_TOOL" cp squashfs-root/usr/bin/nvim /usr/local/bin - "$PRIVILEGE_TOOL" mv squashfs-root/usr/bin/nvim /usr/bin - fi - ;; - - Darwin) - printf "Detected macOS.\n" - download_file "$url" "nvim-macos.tar.gz" - xattr -c ./nvim-macos.tar.gz - tar xzvf nvim-macos.tar.gz - "$PRIVILEGE_TOOL" cp nvim-macos/bin/nvim /usr/local/bin - "$PRIVILEGE_TOOL" mv nvim-macos/bin/nvim /usr/bin/nvim - ;; - - MINGW*) - printf "Detected Windows.\n" - download_file "$url" "nvim.appimage" - chmod +x nvim.appimage - if [ "$PRIVILEGE_TOOL" = "sudo" ]; then - "$PRIVILEGE_TOOL" cp nvim.appimage /usr/local/bin/nvim - "$PRIVILEGE_TOOL" mv /usr/local/bin/nvim /usr/bin - elif [ "$PRIVILEGE_TOOL" = "" ]; then - cp nvim.appimage /usr/local/bin/nvim - mv /usr/local/bin/nvim /usr/bin - else - printf "No privilege escalation tool found. Cannot install Neovim on Windows.\n" - fi - ;; - - *) - printf "Unsupported operating system.\n" - exit 1 - ;; - esac - # Check if the installation was successful - if [ $? -eq 0 ]; then - if [ "$install_action" = "installed" ]; then - printf "${GREEN}Neovim $version has been installed successfully!${NC}\n" - else - printf "${GREEN}Neovim has been updated successfully to $version!${NC}\n" - fi - else - printf "${RED}Error: Neovim installation/update failed.${NC}\n" - exit 1 - fi -} - -# Uninstall Neovim -uninstall_neovim() { - printf "${RED}Uninstalling Neovim...${NC}\n" - - # Detect the operating system to determine the appropriate uninstallation method - case "$(uname -s)" in - Linux) - printf "Detected Linux OS.\n" - "$PRIVILEGE_TOOL" rm /usr/local/bin/nvim - "$PRIVILEGE_TOOL" rm /usr/bin/nvim - ;; - - Darwin) - printf "Detected macOS.\n" - "$PRIVILEGE_TOOL" rm /usr/local/bin/nvim - "$PRIVILEGE_TOOL" rm /usr/bin/nvim - ;; - - MINGW*) - printf "Detected Windows.\n" - if [ "$PRIVILEGE_TOOL" = "sudo" ]; then - "$PRIVILEGE_TOOL" rm /usr/local/bin/nvim - "$PRIVILEGE_TOOL" rm /usr/bin/nvim - else - [ "$PRIVILEGE_TOOL" = "" ] - rm /usr/local/bin/nvim - rm /usr/bin/nvim - fi - ;; - *) - printf "Unsupported operating system.\n" - ;; - esac - - printf "${GREEN}Neovim has been uninstalled successfully!${NC}\n" -} - -# Check if Neovim is running -check_neovim_running() { - if pgrep nvim >/dev/null; then - printf "${RED}Error: Neovim is currently running. Please close Neovim before proceeding.${NC}\n" - read -p "Do you want to forcefully terminate Neovim and continue? [yes/no] " terminate_choice - - case $terminate_choice in - [Yy] | [Yy][Ee][Ss]) - pkill nvim # Forcefully terminate Neovim - ;; - [Nn] | [Nn][Oo]) - echo "Exiting..." - exit 1 - ;; - *) - handle_error "Invalid choice." - ;; - esac - fi -} - -check_neovim_running - -# Define the variable to control the prompt -SHOW_PROMPT=1 - -# Check if necessary dependencies are installed -check_dependencies - -# Check for privilege escalation tools -check_privilege_tools - -# Check if Neovim is already installed and ask the user if want to install it -if check_neovim_installed; then - printf "${GREEN}Neovim is already installed!${NC}\n" -else - printf "${RED}Neovim is not installed.${NC}\n" - read -p "Install Neovim? (y/n): " install_choice - - case $install_choice in - [Yy]) - update_version - ;; - [Nn]) - echo "Exiting..." - exit - ;; - *) - handle_error "Invalid choice. Please enter 'y' for yes or 'n' for no." - ;; - esac -fi - -# Function to check for updates and display breaking changes -check_version_updates() { - local latest_version_url="https://api.github.com/repos/neovim/neovim/releases/latest" - local latest_version="" - - if [ -x "$(command -v curl)" ]; then - latest_version=$(curl -sSL "$latest_version_url" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - elif [ -x "$(command -v wget)" ]; then - latest_version=$(wget -qO - "$latest_version_url" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - else - printf "${RED}Error: Neither curl nor wget found. Please install one of them to continue!${NC}\n" - exit 1 - fi - - if version_exists "$latest_version"; then - printf "${GREEN}An update is available!${NC}\n" - display_breaking_changes "$latest_version" - else - printf "You have the latest version of Neovim.\n" - fi -} - -# Function to display breaking changes for a specific version -display_breaking_changes() { - local version="$1" - local changelog_url="https://github.com/neovim/neovim/releases/tag/$version" - local changelog="" - - if [ -x "$(command -v curl)" ]; then - changelog=$(curl -sSL "$changelog_url" | grep -oE '<h1>Breaking Changes.*?</ul>' | sed 's/<[^>]*>//g') - elif [ -x "$(command -v wget)" ]; then - changelog=$(wget -qO - "$changelog_url" | grep -oE '<h1>Breaking Changes.*?</ul>' | sed 's/<[^>]*>//g') - else - printf "${RED}Error: Neither curl nor wget found. Please install one of them to continue!${NC}\n" - exit 1 - fi - - printf "\nBreaking Changes in Neovim $version:\n" - printf "$changelog\n" -} - -# Main loop -while [ "$SHOW_PROMPT" -gt 0 ]; do - printf "Select an option:\n" - printf " 1. Install/update Neovim\n" - printf " 2. Check for updates\n" - printf " 3. Uninstall Neovim\n" - printf " 4. Run Neovim\n" - printf " 5. Quit\n" - read -p "Enter a number or press 'q' to quit: " choice - - case $choice in - 1) - update_version - ;; - 2) - check_version_updates - ;; - 3) - uninstall_neovim - ;; - 4) - nvim - ;; - 5 | [Qq]) - echo "Exiting..." - exit - ;; - *) - handle_error "Invalid choice. Please choose a valid option by entering the corresponding number or press 'q' to 'quit'." - ;; - esac -done diff --git a/.local/bin/scripts/opacity-change.sh b/.local/bin/scripts/opacity-change.sh deleted file mode 100755 index b509936..0000000 --- a/.local/bin/scripts/opacity-change.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -set -eu -[[ -n ${DEBUG:-} ]] && set -x - -#### Example alacritty.yml usage -#key_bindings: -# - { key: N, mods: Control|Shift, action: SpawnNewInstance } -# - { key: O, mods: Control|Shift, command: { program: "opacity-change.sh", args: ["-"] } } -# - { key: P, mods: Control|Shift, command: { program: "opacity-change.sh", args: ["+"] } } - - -operation="${1:-}${2:-}" # Arg #1 & #2 (in case the user misinterpreted a space in the usage), Default '' -step="${operation:1}" # Substring from char index 1 -step="${step:-1}" # Default '1' -operation="${operation:0:1}" # Substring from char index 0 length of 1 -config_file="$HOME/.config/alacritty/alacritty.yml" -config_field="opacity" -tmp_file="/tmp/$(basename $config_file).$(date +%s)" -current_value=$(sed 's/#.*//g; /\b'"$config_field"':/!d; s/.*: \?//' < "$config_file") - -case $operation in -"-") - verb="Decreasing" ;; -"+") - verb="Increasing" ;; -*) - echo "Usage: ${BASH_SOURCE[0]} (-|+)[int]"; exit 255 ;; -esac - -new_value="$(awk '{n=$1+$2/10; print (n<0 ? 0 : n>1 ? 1 : n)}' <<<"$current_value $operation$step")" -echo "$verb $config_field from $current_value to $new_value" >&2 -cp "$config_file" "$tmp_file" -sed "s/\b$config_field:.*/$config_field: $new_value/" "$tmp_file" > "$config_file" - diff --git a/.local/bin/scripts/powermenu b/.local/bin/scripts/powermenu deleted file mode 100755 index 7bd913e..0000000 --- a/.local/bin/scripts/powermenu +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# display a power menu to: shutdown, reboot, -# lock, logout, and suspend. This script can be -# executed by clicking on the polybar powermenu module -# or with a keyboard shortcut - -# options to be displayed -shutdown=" Shutdown" -reboot=" Reboot" -lock=" Lock" -logout=" Logout" -suspend=" Suspend" - -uptime=$(uptime -p | sed -e 's/up //g') - -# options passed into variable -options="$shutdown\n$reboot\n$lock\n$logout\n$suspend" - -chosen="$(echo -e "$options" | rofi -theme ~/.config/rofi/styles/powermenu.rasi -lines 5 -dmenu -p "$uptime")" - -case $chosen in -$shutdown) - systemctl poweroff - ;; -$reboot) - systemctl reboot - ;; -$lock) - betterlockscreen --lock dimblur - ;; -$logout) - bspc quit - ;; -$suspend) - systemctl suspend - ;; -esac diff --git a/.local/bin/scripts/qemu-helper.sh b/.local/bin/scripts/qemu-helper.sh deleted file mode 100755 index 0d38aba..0000000 --- a/.local/bin/scripts/qemu-helper.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/bin/bash - -# Created By: srdusr -# Created On: Wed 02 Aug 2023 16:16:21 PM CAT -# Project: QEMU setup/opener helper wrapper script - -# Set global variables for VM parameters -ram_size="4G" - -# Function to prompt user for VM parameters -function get_vm_parameters() { - read -p "Enter VM name (default: vm): " vm_name - vm_name=${vm_name:-vm} - - # Set the default ISO file path to ~/machines/images - default_iso_path="$HOME/machines/images" - - # Generate completions for ISO and IMG files in the images directory - COMPREPLY=() - local files=$(compgen -G "$default_iso_path/*.{iso,img}" -o plusdirs) - for file in $files; do - COMPREPLY+=("$file") - done - - # Use read with -i and -e options for tab-completion - read -ep "Enter ISO file path (default: $default_iso_path): " -i "$default_iso_path" iso_path - - # Manually expand the ~ to the user's home directory - iso_path=$(eval echo "$iso_path") - - # Validate the user input - while [ ! -f "$iso_path" ]; do - read -ep "Invalid file path. Enter a valid ISO file path: " iso_path - done - - # Check if the selected file is an IMG file - if [[ "$iso_path" == *.img ]]; then - guest_os="windows" - else - guest_os="linux" - fi - - # Show available disk space before asking for disk image size - echo "Available disk space:" - df -h "$vm_images_path" - - read -p "Enter disk image size in GB (default: 10G): " disk_size - disk_size=${disk_size:-10G} - - read -p "Enter RAM size in GB (default: 4G): " ram_size - ram_size=${ram_size:-4G} - - # Check if the RAM size is in the correct format (e.g., "4G") - while ! [[ $ram_size =~ ^[0-9]+[kKmMgGtTpPeE]$ ]]; do - read -p "Invalid RAM size format. Enter RAM size in GB (e.g., 4G): " ram_size - done - - read -p "Enter number of CPU cores (default: 2): " cpu_cores - cpu_cores=${cpu_cores:-2} -} - - -# Function to list available VMs -function list_vms() { - echo "Available VMs:" - for vm_file in "$vm_images_path"/*.qcow2; do - vm=$(basename "$vm_file" .qcow2) - echo " - $vm" - done -} - -# Function to list available ISO and IMG files in the images directory -function list_iso_img_files() { - echo "Available ISO and IMG files in $iso_images_path:" - iso_img_files=() - while IFS= read -r -d $'\0' file; do - iso_img_files+=("$file") - done < <(find "$iso_images_path" -type f \( -iname \*.iso -o -iname \*.img \) -print0) - - for ((i = 0; i < ${#iso_img_files[@]}; i++)); do - echo " $((i + 1)). ${iso_img_files[i]##*/}" - done -} - -# Function to check if VM is already running -function is_vm_running() { - vm_name=$1 - if ps aux | grep -v grep | grep -q "[q]emu-system-x86_64.*$vm_name"; then - return 0 - else - return 1 - fi -} - -# Function to start VM -function start_vm() { - vm_name=$1 - is_vm_running "$vm_name" - if [ $? -eq 0 ]; then - echo "VM '$vm_name' is already running." - return - fi - - # VM parameters - qemu_cmd="qemu-system-x86_64 -enable-kvm -machine type=q35 -m $ram_size -cpu host -smp 2 -vga virtio" - qemu_cmd+=" -device qemu-xhci -device usb-tablet -device usb-kbd -device virtio-net,netdev=user0 -netdev user,id=user0,hostfwd=tcp::5555-:22" - qemu_cmd+=" -cdrom \"$iso_path\" -drive file=\"$vm_images_path/$vm_name.qcow2\",index=0,media=disk,if=virtio" - - if [[ $guest_os == "windows" ]]; then - qemu_cmd+=" -drive file=\"$iso_images_path/virtio-win.iso\",index=3,media=cdrom" - fi - - qemu_cmd+=" -boot menu=on" - qemu_cmd+=" -net nic -net user,hostname=$vm_name -name \"$vm_name\"" - - echo "Starting VM: $vm_name" - eval "$qemu_cmd" -} - -# Main script starts here -vm_images_path="$HOME/machines/vm" -iso_images_path="$HOME/machines/images" - -# Check if directories exist -mkdir -p "$vm_images_path" -mkdir -p "$iso_images_path" - -# List available VMs -list_vms - -# List available ISO and IMG files in the images directory -list_iso_img_files - -# Ask the user if they want to use an existing VM or create a new one -read -p "Do you want to use an existing VM? (y/n): " use_existing_vm -if [[ $use_existing_vm =~ ^[Yy]$ ]]; then - read -p "Enter the name of the existing VM: " existing_vm_name - while [ ! -f "$vm_images_path/$existing_vm_name.qcow2" ]; do - echo "VM '$existing_vm_name' does not exist." - read -p "Enter a valid existing VM name: " existing_vm_name - done - vm_name=$existing_vm_name -else - # Prompt user for VM parameters - get_vm_parameters - - # Check if VM already exists - if [ -f "$vm_images_path/$vm_name.qcow2" ]; then - read -p "VM '$vm_name' already exists. Do you want to start it? (y/n): " start_vm_choice - if [[ $start_vm_choice =~ ^[Yy]$ ]]; then - start_vm "$vm_name" - exit 0 - fi - else - # Create new VM - echo "Creating new VM: $vm_name" - qemu-img create -f qcow2 "$vm_images_path/$vm_name.qcow2" "$disk_size" - start_vm "$vm_name" - exit 0 - fi -fi - -# If an existing VM is selected, ask if the user wants to modify its parameters -read -p "Do you want to modify the VM parameters? (y/n): " modify_vm_params -if [[ $modify_vm_params =~ ^[Yy]$ ]]; then - get_vm_parameters -fi - -# Start the VM -start_vm "$vm_name" - -echo "Script execution completed." diff --git a/.local/bin/scripts/random_data.py b/.local/bin/scripts/random_data.py deleted file mode 100755 index 071ab7c..0000000 --- a/.local/bin/scripts/random_data.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env python3 - -import os -import random -import string -import json -import datetime -import csv - - -def generate_random_string(length, charset=string.ascii_letters): - """Generate a random string of given length and character set.""" - return ''.join(random.choice(charset) for _ in range(length)) - - -def generate_random_number(min_value, max_value): - """Generate a random number within the specified range.""" - return random.randint(min_value, max_value) - - -def generate_random_date(start_date, end_date): - """Generate a random date within the specified range.""" - time_between_dates = end_date - start_date - days_between_dates = time_between_dates.days - random_number_of_days = random.randrange(days_between_dates) - random_date = start_date + datetime.timedelta(days=random_number_of_days) - return random_date.strftime("%Y-%m-%d") - - -def generate_sql_insert(table_name, columns, num_records): - """Generate SQL INSERT statements for populating a table.""" - sql_statements = [] - for _ in range(num_records): - values = [f"'{generate_random_string(int(input(f'Enter length for {column}: ')))}'" for column in columns] - sql = f"INSERT INTO {table_name} ({', '.join(columns)}) VALUES ({', '.join(values)});" - sql_statements.append(sql) - return sql_statements - - -def generate_placeholder_data(num_records, data_format): - """Generate placeholder data based on user-defined format.""" - placeholder_data = [] - for _ in range(num_records): - record = {} - for field, field_data in data_format.items(): - data_type = field_data['type'] - if data_type == 'string': - length = field_data['length'] - charset = field_data['charset'] - record[field] = generate_random_string(length, charset) - elif data_type == 'number': - min_value = field_data['min'] - max_value = field_data['max'] - record[field] = generate_random_number(min_value, max_value) - elif data_type == 'date': - start_date = datetime.datetime.strptime(field_data['start_date'], "%Y-%m-%d") - end_date = datetime.datetime.strptime(field_data['end_date'], "%Y-%m-%d") - record[field] = generate_random_date(start_date, end_date) - elif data_type == 'boolean': - record[field] = random.choice([True, False]) - placeholder_data.append(record) - return placeholder_data - - -def get_data_format_from_user(): - """Prompt the user for data format preferences.""" - data_format = {} - while True: - field = input("Enter field name (or 'done' to finish): ").strip() - if field.lower() == 'done': - break - - data_type = input(f"Enter data type for '{field}' (string/number/date/boolean): ").strip() - if data_type not in ['string', 'number', 'date', 'boolean']: - print("Invalid data type. Please enter 'string', 'number', 'date', or 'boolean'.") - continue - - if data_type == 'string': - length = int(input(f"Enter length for '{field}' (integer): ")) - charset = input(f"Enter character set for '{field}' (optional, press Enter for default): ").strip() - if not charset: - charset = string.ascii_letters - data_format[field] = {'type': 'string', 'length': length, 'charset': charset} - elif data_type == 'number': - min_value = int(input(f"Enter minimum value for '{field}' (integer): ")) - max_value = int(input(f"Enter maximum value for '{field}' (integer): ")) - data_format[field] = {'type': 'number', 'min': min_value, 'max': max_value} - elif data_type == 'date': - start_date = input(f"Enter start date for '{field}' (YYYY-MM-DD): ") - end_date = input(f"Enter end date for '{field}' (YYYY-MM-DD): ") - data_format[field] = {'type': 'date', 'start_date': start_date, 'end_date': end_date} - elif data_type == 'boolean': - data_format[field] = {'type': 'boolean'} - - return data_format - - -def get_file_type_from_user(): - """Prompt the user for the desired file type (e.g., JSON, CSV, SQL, TXT, MD, HTML).""" - while True: - file_type = input("Enter the desired file type for saving the data (json/csv/sql/txt/md/html): ").strip().lower() - if file_type in ['json', 'csv', 'sql', 'txt', 'md', 'html']: - return file_type - else: - print("Invalid file type. Please enter 'json', 'csv', 'sql', 'txt', 'md', or 'html'.") - - -def save_data_to_file(data, file_type): - """Save the generated data to a file of the specified type.""" - if file_type == 'json': - with open('placeholder_data.json', 'w') as json_file: - json.dump(data, json_file, indent=4) - elif file_type == 'csv': - with open('placeholder_data.csv', 'w', newline='') as csv_file: - fieldnames = data[0].keys() - writer = csv.DictWriter(csv_file, fieldnames=fieldnames) - writer.writeheader() - for record in data: - writer.writerow(record) - elif file_type == 'sql': - table_name = input("Enter the SQL table name: ") - columns = input("Enter column names separated by commas: ").split(',') - sql_statements = generate_sql_insert(table_name, columns, len(data)) - with open('generated_data.sql', 'w') as sql_file: - sql_file.write('\n'.join(sql_statements)) - elif file_type == 'txt': - with open('placeholder_data.txt', 'w') as txt_file: - for record in data: - txt_file.write(str(record) + '\n') - elif file_type == 'md': - with open('placeholder_data.md', 'w') as md_file: - for record in data: - md_file.write('- ' + ', '.join([f"{key}: {value}" for key, value in record.items()]) + '\n') - elif file_type == 'html': - with open('placeholder_data.html', 'w') as html_file: - html_file.write('<html>\n<head>\n<title>Placeholder Data</title>\n</head>\n<body>\n') - for record in data: - html_file.write('<ul>\n') - for key, value in record.items(): - html_file.write(f'<li>{key}: {value}</li>\n') - html_file.write('</ul>\n') - - -if __name__ == "__main__": - num_records = int(input("Enter the number of records to generate: ")) - data_format = get_data_format_from_user() - file_type = get_file_type_from_user() - - placeholder_data = generate_placeholder_data(num_records, data_format) - - save_data_to_file(placeholder_data, file_type) - - print(f"Data will be saved to: {os.path.abspath('generated_data.sql')}") diff --git a/.local/bin/scripts/scratchpad b/.local/bin/scripts/scratchpad deleted file mode 100755 index 8a1aea0..0000000 --- a/.local/bin/scripts/scratchpad +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -# Created By: srdusr -# Created On: Tue 07 Mar 2023 15:06:47 PM CAT -# Project: Agnostic scratchpad/dropdown terminal that works on most window managers - -# Dependencies: wmctrl, xprop, xdo, xdotool -# NOTE: Ensure script is included in system's path and can therefore be invoked with the command 'scratchpad'. -# Furthermore make sure the terminal is using x11 as a backend in wayland to allow this to work. -# Example: wezterm.lua: enable_wayland = false, -# kitty.conf: linux_display_server x11 - -# Set the environment variables to x11 to allow working in Wayland -export GDK_BACKEND=x11 -export QT_QPA_PLATFORM=xcb -export WAYLAND_DISPLAY="" -export WINIT_UNIX_BACKEND=x11 - -# Supported terminals and dropdown class -supported_terminals=("wezterm" "kitty" "alacritty") - -# Check if any supported terminal with scratchpad class is running -for term in "${supported_terminals[@]}"; do - if pgrep -f "$term.*--class scratchpad" >/dev/null; then - my_term="$term" - break - fi -done - -# If no supported terminal is running, start the first available one -if [ "$my_term" = "" ]; then - for term in "${supported_terminals[@]}"; do - if command -v "$term" >/dev/null 2>&1; then - my_term="$term" - break - fi - done - if [ "$my_term" = "" ]; then - echo "No supported terminal found." && exit 1 - fi - - # Start terminal with scratchpad class - case "$my_term" in - "wezterm") wezterm start --class scratchpad -e tmux new-session -A -s tmux -e bash & ;; - "kitty") kitty --class scratchpad tmux new-session -A -s tmux -e bash & ;; - "alacritty") alacritty --class scratchpad -e tmux new-session -A -s tmux -e bash & ;; - esac -fi - -# Get the window ID of the scratchpad terminal -id="$(xdo id -N scratchpad)" - -# Toggle scratchpad terminal visibility -if [ "$id" != "" ]; then - if xwininfo -id "$id" | grep "Map State: IsViewable" >/dev/null; then - # Scratchpad is visible, hide it - dimensions="$(xwininfo -id "$id" | awk '/Width:|Height:/ { printf("%s=%s;", tolower($1), $2) }')" - xdo hide "$id" 2>/dev/null - else - # Scratchpad is hidden, show it and restore dimensions - xdo show "$id" - xdotool windowsize "$id" "$(echo "$dimensions" | tr ';' ' ')" 2>/dev/null - fi -fi diff --git a/.local/bin/scripts/win-nvim.bat b/.local/bin/scripts/win-nvim.bat deleted file mode 100644 index c99374d..0000000 --- a/.local/bin/scripts/win-nvim.bat +++ /dev/null @@ -1,37 +0,0 @@ -@echo off - -REM Install NeoVim with winget, if not already present on the system -where nvim >nul 2>nul -if %errorlevel% neq 0 ( - winget install Neovim.Neovim -q -) - -REM Clone my dotfiles repo -set dotFilesRoot=%USERPROFILE%\dotfiles -if not exist "%dotFilesRoot%\." ( - git clone git@github.com:srdusr/dotfiles.git "%dotFilesRoot%" -) - -REM Link NeoVim configuration -set localConfiguration=%LOCALAPPDATA%\nvim -set dotfilesConfiguration=%dotFilesRoot%\.config\nvim - -if not exist "%localConfiguration%\." ( - mklink /D "%localConfiguration%" "%dotfilesConfiguration%" -) - -REM Clone Packer.nvim, if not already present on the system -set localPacker=%LOCALAPPDATA%\nvim-data\site\pack\packer\start\packer.nvim - -if not exist "%localPacker%\." ( - git clone https://github.com/wbthomason/packer.nvim "%localPacker%" -) - -REM Run the script by using this command in the same existing directory: win-nvim.bat - -@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://aka.ms/install-winget'))" -iex ((new-object net.webclient).DownloadString('https://aka.ms/install-winget')) -curl -o winget-cli.appxbundle https://aka.ms/winget-cli-appxbundle - -powershell Add-AppxPackage -Path "winget-cli.appxbundle" - diff --git a/.local/bin/scripts/win-nvim.ps1 b/.local/bin/scripts/win-nvim.ps1 deleted file mode 100644 index ca67755..0000000 --- a/.local/bin/scripts/win-nvim.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -# Install NeoVim with winget, if not already present on the system -if (!(Get-Command nvim -ErrorAction SilentlyContinue)) { - winget install Neovim.Neovim -} - -# Clone my dotfiles repo -$dotFilesRoot = Join-Path $HOME "dotfiles" - -if (!(Test-Path $dotFilesRoot -PathType Container)) { - git clone https://github.com/srdusr/dotfiles.git $dotFilesRoot -} - -# Link NeoVim configuration -$localConfiguration = Join-Path $env:LOCALAPPDATA "nvim" -$dotfilesConfiguration = Join-Path $dotFilesRoot ".config" "nvim" - -if (!(Test-Path $localConfiguration -PathType Container)) { - Start-Process -FilePath "cmd.exe" -ArgumentList "/c mklink /D $localConfiguration $dotfilesConfiguration" -Verb runas -} - -# Clone Packer.nvim, if not already present on the system -$localPacker = Join-Path $env:LOCALAPPDATA "nvim-data" "site" "pack" "packer" "start" "packer.nvim" - -if (!(Test-Path $localPacker -PathType Container)) { - git clone https://github.com/wbthomason/packer.nvim $localPacker -} - -# To allow script execution, run the following command in PowerShell as an administrator: -# Set-ExecutionPolicy RemoteSigned -# Then run the script by using this command in the same existing directory: -# ./win-nvim.ps1 -#curl -o winget-cli.appxbundle https://aka.ms/winget-cli-appxbundle -#powershell Add-AppxPackage -Path "winget-cli.appxbundle" -#Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -#use `-y` or consider: choco feature enable -n allowGlobalConfirmation -#choco install git -#- Refresh the environment -#Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 -#refreshenv |
