Skip to content

Commit

Permalink
feat: support windows via WSL
Browse files Browse the repository at this point in the history
  • Loading branch information
mykeels committed May 1, 2019
1 parent 48fc5c5 commit 500ac91
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions slack-day
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
BACKUP_FILE="$DIR/backup/ssb-interop.js"
if [ "$(uname)" == "Linux" ] # Linux OS
if [ "$(uname -r | sed -n 's/.*\( *Microsoft *\).*/\1/p')" == "Microsoft" ] # Windows OS
then
OS="windows"
INTEROP_FOLDER_ROOT="$(cmd.exe /c 'echo|set /p=%LOCALAPPDATA%' | sed -n 's/\\/\//pg' | sed -n 's/C:/\/mnt\/c/p')"
INTEROP_FOLDER="${INTEROP_FILE_ROOT}/slack/app-3.4.0/resources/app.asar.unpacked/src/static"
EXE_FILE="${INTEROP_FILE_ROOT}/slack/slack.exe"
elif [ "$(uname)" == "Linux" ] # Linux OS
then
INTEROP_FOLDER="/usr/lib/slack/resources/app.asar.unpacked/src/static"
elif [ "$(uname)" == "Darwin" ] # Mac OS
Expand All @@ -15,7 +21,11 @@ then
cp "$BACKUP_FILE" "$INTEROP_FOLDER"

# restart slack
if [ "$(uname)" == "Linux" ] # Linux OS
if [ "$OS" == "windows" ] # Windows OS
then
cmd.exe /c 'taskkill /F /IM slack.exe' &> /dev/null
$EXE_FILE </dev/null &>/dev/null & # start slack process in detached mode
elif [ "$(uname)" == "Linux" ] # Linux OS
then
killall "slack" # kill all slack processes
slack </dev/null &>/dev/null & # start slack process in detached mode
Expand Down
14 changes: 12 additions & 2 deletions slack-theme
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ SOLARIZED_LIGHT_URL="$CSS_URL/css/raw/variants/$SOLARIZED_LIGHT_FILE"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
BACKUP_FOLDER="$DIR/backup"
BACKUP_FILE="$BACKUP_FOLDER/ssb-interop.js"
if [ "$(uname)" == "Linux" ] # Linux OS
if [ "$(uname -r | sed -n 's/.*\( *Microsoft *\).*/\1/p')" == "Microsoft" ] # Windows OS
then
OS="windows"
INTEROP_FILE_ROOT="$(cmd.exe /c 'echo|set /p=%LOCALAPPDATA%' | sed -n 's/\\/\//pg' | sed -n 's/C:/\/mnt\/c/p')"
INTEROP_FILE="${INTEROP_FILE_ROOT}/slack/app-3.4.0/resources/app.asar.unpacked/src/static/ssb-interop.js"
EXE_FILE="${INTEROP_FILE_ROOT}/slack/slack.exe"
elif [ "$(uname)" == "Linux" ] # Linux OS
then
INTEROP_FILE="/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js"
elif [ "$(uname)" == "Darwin" ] # Mac OS
Expand Down Expand Up @@ -345,7 +351,11 @@ then
echo "$NODE_SCRIPT" >> "$INTEROP_FILE" # append script to file

# restart slack
if [ "$(uname)" == "Linux" ] # Linux OS
if [ "$OS" == "windows" ] # Windows OS
then
cmd.exe /c 'taskkill /F /IM slack.exe' &> /dev/null
$EXE_FILE </dev/null &>/dev/null & # start slack process in detached mode
elif [ "$(uname)" == "Linux" ] # Linux OS
then
killall "slack" # kill all slack processes
slack </dev/null &>/dev/null & # start slack process in detached mode
Expand Down

0 comments on commit 500ac91

Please sign in to comment.