Skip to content

Commit

Permalink
Merge pull request #15 from mykeels/linux
Browse files Browse the repository at this point in the history
Linux Support
  • Loading branch information
mykeels authored Jan 23, 2019
2 parents c6efbb1 + 09e76b4 commit ae338b3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@ A Command-Line Tool for changing Slack's desktop app colors, like

To download and install, run the following code in your terminal:

### For Mac Users

```sh
curl https://raw.githubusercontent.com/mykeels/slack-theme-cli/master/slack-theme -O && sh slack-theme install && . ~/.bash_profile
```

### For Linux Users

```sh
curl https://raw.githubusercontent.com/mykeels/slack-theme-cli/master/slack-theme -O && sudo sh slack-theme install && . ~/.profile
```

### For Zsh users

If you use zsh as your shell environment, you might want to run this instead:

```sh
curl https://raw.githubusercontent.com/mykeels/slack-theme-cli/master/slack-theme -O && SLACK_THEME_SHELL_PROFILE=~/.zshenv sh slack-theme install && . ~/.zshenv
curl https://raw.githubusercontent.com/mykeels/slack-theme-cli/master/slack-theme -O && sudo SLACK_THEME_SHELL_PROFILE=~/.zshenv sh slack-theme install && . ~/.zshenv
```

## How to use
Expand Down
20 changes: 16 additions & 4 deletions slack-day
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
INTEROP_FOLDER="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static"
# INTEROP_FOLDER="$DIR/"
BACKUP_FILE="$DIR/backup/ssb-interop.js"
if [ "$(uname)" == "Linux" ] # Linux OS
then
INTEROP_FOLDER="/usr/lib/slack/resources/app.asar.unpacked/src/static"
elif [ "$(uname)" == "Darwin" ] # Mac OS
then
INTEROP_FOLDER="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static"
fi

if [ -f "$BACKUP_FILE" ]
then
cp "$BACKUP_FILE" "$INTEROP_FOLDER"

# restart slack
killall "Slack" # kill all slack processes
/Applications/Slack.app/Contents/MacOS/Slack </dev/null &>/dev/null & # start slack process in detached mode
if [ "$(uname)" == "Linux" ] # Linux OS
then
killall "slack" # kill all slack processes
slack </dev/null &>/dev/null & # start slack process in detached mode
elif [ "$(uname)" == "Darwin" ] # Mac OS
then
killall "Slack" # kill all slack processes
/Applications/Slack.app/Contents/MacOS/Slack </dev/null &>/dev/null & # start slack process in detached mode
fi
fi
29 changes: 25 additions & 4 deletions slack-theme
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,23 @@ SOLARIZED_DARK_PATH="https://cdn.rawgit.com/laCour/slack-night-mode/master/css/r
SOLARIZED_LIGHT_PATH="https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/variants/solarized-light.css"

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
INTEROP_FILE="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js"
BACKUP_FOLDER="$DIR/backup"
BACKUP_FILE="$BACKUP_FOLDER/ssb-interop.js"
if [ "$(uname)" == "Linux" ] # Linux OS
then
INTEROP_FILE="/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js"
elif [ "$(uname)" == "Darwin" ] # Mac OS
then
INTEROP_FILE="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js"
fi

if [ -z "$SLACK_THEME_SHELL_PROFILE" ]
then
SLACK_THEME_SHELL_PROFILE=~/".bash_profile"
SLACK_THEME_SHELL_PROFILE=~/".bash_profile" # Mac OS
if [ "$(uname)" == "Linux" ] # Linux OS
then
SLACK_THEME_SHELL_PROFILE=~/".profile"
fi
else
echo "sh: $SLACK_THEME_SHELL_PROFILE"
fi
Expand All @@ -101,6 +111,10 @@ then
chmod 755 "$DIR/slack-theme"
chmod 755 "$DIR/slack-day"
chmod 755 "$DIR/slack-night"
if [ "$(uname)" == "Linux" ]
then
chmod 666 $INTEROP_FILE
fi
if [ -z "$(cat $SLACK_THEME_SHELL_PROFILE | grep "PATH=\$PATH:$PWD")" ]
then
if [ ! -f "$SLACK_THEME_SHELL_PROFILE" ]; then
Expand Down Expand Up @@ -220,8 +234,15 @@ then
echo "$NODE_SCRIPT" >> "$INTEROP_FILE" # append script to file

# restart slack
killall "Slack" # kill all slack processes
/Applications/Slack.app/Contents/MacOS/Slack </dev/null &>/dev/null & # start slack process in detached mode
if [ "$(uname)" == "Linux" ] # Linux OS
then
killall "slack" # kill all slack processes
slack </dev/null &>/dev/null & # start slack process in detached mode
elif [ "$(uname)" == "Darwin" ] # Mac OS
then
killall "Slack" # kill all slack processes
/Applications/Slack.app/Contents/MacOS/Slack </dev/null &>/dev/null & # start slack process in detached mode
fi
else
echo "file does not exist"
fi

0 comments on commit ae338b3

Please sign in to comment.