From d10f0018d1021fd00842de2938a39c7a58348b96 Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 14 May 2025 08:26:44 +0100 Subject: [PATCH] Added new fr24feed-dump1090 function --- .aliases | 37 ++++++++++++++++++++++++++++++++++++- .profile | 1 + install.sh | 46 ++++++++++++++++++++++++++++++++++++++++++---- rofi/config.rasi | 2 ++ 4 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 rofi/config.rasi diff --git a/.aliases b/.aliases index 7445db8..a7a8093 100644 --- a/.aliases +++ b/.aliases @@ -414,7 +414,31 @@ echo "Unleaded - $costco_unleaded p" ## Curl Dump1090 data from scanner alias fr24feed="curl --http0.9 192.168.10.21:30003 --output -" -alias fr24feed-dump1090="sh -c 'dump1090-mutability --net --net-only --net-bi-port 30004 --interactive & nc 192.168.10.21 30005 | nc 127.0.0.1 30004' +fr24feed-dump1090() { + # Start dump1090-mutability in the background + dump1090-mutability --net --net-only --net-bi-port 30004 --interactive & + DUMP1090_PID=$! + + # Start the nc pipe in the background + nc 192.168.10.21 30005 | nc 127.0.0.1 30004 & + NC_PID=$! + + # Define a cleanup function + cleanup() { + echo "Stopping processes..." + kill $DUMP1090_PID $NC_PID 2>/dev/null + wait $DUMP1090_PID $NC_PID 2>/dev/null + echo "Exited." + } + + # Trap Ctrl+C (SIGINT) and call cleanup + trap cleanup SIGINT + + # Wait for both background processes + wait $DUMP1090_PID + wait $NC_PID +} + " ## Subnet Table @@ -485,6 +509,17 @@ alias iplookup='iplookup-get(){ curl "ip.nclte.ch/json?ip=$1"; unset -f iplookup ## Make random dir alias mkdir-random='mkdir $(cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 50 | head -n 1) && echo "Directory created: $(cat /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 50 | head -n 1)"' +function rofi-file-browser(){ +rofi -dmenu -p "Select File Manager" -i -no-fixed-num-lines <<< "File Browser" +if [ $? -eq 0 ]; then + mate-terminal ranger +fi +} + ## Display all commands in this Alias file alias my-alias="cat ~/.aliases | grep -oP 'alias\s\K[^=]+' | sort -n" + name = "File Browser" + command = "/path/to/rofi-file-browser.sh" + combi-modes = ["run", "window", "file-browser"] +} diff --git a/.profile b/.profile index 1af6360..5f94ab0 100644 --- a/.profile +++ b/.profile @@ -22,5 +22,6 @@ if [ -n "$BASH_VERSION" ]; then if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" fi +rofi.terminal: /usr/bin/tmux export PATH="$PATH:$HOME/opt/esp/xtensa-lx106-elf/bin" export IDF_PATH="/opt/esp/ESP8266_RTOS_SDK" diff --git a/install.sh b/install.sh index f830cb7..6393f7e 100755 --- a/install.sh +++ b/install.sh @@ -4,9 +4,47 @@ # Find all dot files then if the original file exists, create a backup # Once backed up to {file}.dtbak symlink the new dotfile in place -for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n" ); do - if [ -e ~/$file ]; then - mv -f ~/$file{,.dtbak} +for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n"); do + # Check if it's a file and if a symlink already exists + target_file="~/$file" + if [ -e $target_file ]; then + if [ -L $target_file ]; then + # If it's a symlink and points to the correct location, skip it + target_link=$(readlink $target_file) + if [ "$target_link" != "$PWD/$file" ]; then + mv -f $target_file{,.dtbak} # Backup existing symlink or file + fi + else + mv -f $target_file{,.dtbak} # Backup if it's not a symlink + fi fi - ln -s $PWD/$file ~/$file + ln -s $PWD/$file $target_file done + +# Handle directories +for dir in $(find . -maxdepth 1 -name ".*" -type d); do + target_dir="~/$dir" + + # Create the directory in the target location if it doesn't exist + if [ ! -d $target_dir ]; then + mkdir -p $target_dir + fi + + # Now handle symlinks for files inside the directory + for subfile in $(find $dir -type f); do + relative_subfile="${subfile#$dir/}" + target_subfile="$target_dir/$relative_subfile" + + # Check if the symlink already exists and points to the correct location + if [ ! -e $target_subfile ]; then + ln -s $PWD/$subfile $target_subfile + elif [ -L $target_subfile ]; then + target_link=$(readlink $target_subfile) + if [ "$target_link" != "$PWD/$subfile" ]; then + mv -f $target_subfile{,.dtbak} # Backup existing symlink + ln -s $PWD/$subfile $target_subfile # Create new symlink + fi + fi + done +done + diff --git a/rofi/config.rasi b/rofi/config.rasi new file mode 100644 index 0000000..73df277 --- /dev/null +++ b/rofi/config.rasi @@ -0,0 +1,2 @@ +//@theme "/usr/share/rofi/themes/arthur.rasi" +@theme "/usr/share/rofi/themes/gruvbox-dark-soft.rasi"