I poweroff my laptop every night. So I have to open some app I use everyday when I started the laptop.

I use a script by Justin Hileman, to open news tabs in terminal. Save this script as init.sh, run sh init.sh in the terminal, and it will do several things:

  • run wg.sh, setup wireguard tunnal
  • open new tab, start a tmux session
  • open new tab, using mosh to ssh a server
  • open new tab, open a txt file using vim
  • open github in chrome
  • start vs code
  • show a popup message
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
#     Add the following function to your `.bashrc` or `.bash_profile`,
#     or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
# Usage:
#     tab                   Opens the current directory in a new tab
#     tab [PATH]            Open PATH in a new tab
#     tab [CMD]             Open a new tab and execute CMD
#     tab [PATH] [CMD] ...  You can prob'ly guess


function tab () {
    local cmd=""
    local cdto="$PWD"
    local args="$@"

    if [ -d "$1" ]; then
        cdto=`cd "$1"; pwd`
        args="${@:2}"
    fi

    if [ -n "$args" ]; then
        cmd="; $args"
    fi

    osascript &>/dev/null <<EOF
        tell application "iTerm"
            tell current window
                set newTab to (create tab with default profile)
                tell newTab
                    tell current session
                        write text "cd \"$cdto\"$cmd"
                    end tell
                end tell
            end tell
        end tell

EOF
}
function alert(){
    title="$1"
    msg="$2"
    osascript &>/dev/null <<EOF
    display notification "$msg" with title "$title"
EOF

}

~/wg.sh || exit

tab "tmux new -s x"
tab "mosh root@xxxx"
tab "vi notes.txt"

open -a "Google Chrome" https://github.com/
code
alert "have a nice day"