scripts

Scripts for general automations
git clone git://git.laack.co/scripts.git
Log | Files | Refs

tmux.sh (747B)


      1 #!/bin/bash
      2 
      3 prompt="tmux dir:"
      4 
      5 # exclude git repos which have lots of sub-dirs,
      6 # .cache which has a ton of firefox crap
      7 # .local because I never really go there and lots
      8 # of crap there too, and finally .firefox.
      9 
     10 directory=$(find ~ -type d \
     11   ! -path '*/.local/*' \
     12   ! -path '*/.cache/*' \
     13   ! -path '*/.firefox/*' \
     14   ! -path '*/.mozilla/*' \
     15   ! -path '*/.git/*' \
     16   | dmenu -p "$prompt")
     17 
     18 # Check if a directory was selected
     19 if [ -z "$directory" ]; then
     20     echo "No directory selected."
     21     exit 1
     22 fi
     23 
     24 # Check if the directory exists
     25 if [ ! -d "$directory" ]; then
     26     echo "Directory not found!"
     27     exit 1
     28 fi
     29 
     30 dirWO=$(echo $directory | sed "s/\// /g"| cut -c 2- | awk '{print $NF}')
     31 cd "$directory"
     32 st -e tmux new-session -A -s $dirWO