Skip to content
JP Bruins Slot edited this page Oct 27, 2018 · 24 revisions

Configuration

version
v0.4.1

Running slack-term

In addition to running slack-term from the command line by using slack-term, you have some additional flags that you can use:

-config [path-to-config-file]

Allows you the specify a different location of the .slack-term file. Additionally, you'll able to to use run several slack-term instances with different configurations/tokens.

-token [slack-token]

Allows you to specify the slack-token that needs to be used, from the command line.

Running slack-term without legacy tokens

Also see: https://github.com/erroneousboat/slack-term/issues/136

  1. Go to the following page: https://slack.com/oauth/authorize?client_id=91899392594.382712253827&scope=client

  2. Select the workspace to which you want slack-term to provide access to.

  3. Click "Authorize", this will redirect you, this redirect will fail, which is expected.

  4. Copy the code portion of the URL. http://not.a.host?code=[code-will-be-here]&state=

  5. In your terminal issue the following command, inserting the code at the right location:

$ curl -s "https://slack.com/api/oauth.access?client_id=91899392594.382712253827&client_secret=c7986be41b6ddb478041d1848dad5f6e&code=[code-goes-here]"
  1. From the response, copy the access_token and place it in your .slack-term

.slack-term config file

Below is an example file, you can leave out the OPTIONAL parts, you are only required to specify a slack_token. Remember that your file should be a valid json file so don't forget to remove the comments.

{
    "slack_token": "yourslacktokenhere",

    // OPTIONAL: set the width of the sidebar (between 1 and 11), default is 1
    "sidebar_width": 1,

    // OPTIONAL: turn on desktop notifications for all incoming messages, set
    // the value as: "all". For only mentions and im messages set the
    // value as: "mention", default is turned off: ""
    "notify": "",

    // OPTIONAL: turn on emoji's, default is false
    "emoji": false,

    // OPTIONAL: define custom key mappings, defaults are:
    "key_map": {
        "command": {
            "i": "mode-insert",
            "/": "mode-search",
            "k": "channel-up",
            "j": "channel-down",
            "g": "channel-top",
            "G": "channel-bottom",
            "<previous>": "chat-up",
            "C-b": "chat-up",
            "C-u": "chat-up",
            "<next>": "chat-down",
            "C-f": "chat-down",
            "C-d": "chat-down",
            "n": "channel-search-next",
            "N": "channel-search-previous",
            "q": "quit",
            "<f1>": "help"
        },
        "insert": {
            "<left>": "cursor-left",
            "<right>": "cursor-right",
            "<enter>": "send",
            "<escape>": "mode-command",
            "<backspace>": "backspace",
            "C-8": "backspace",
            "<delete>": "delete",
            "<space>": "space"
        },
        "search": {
            "<left>": "cursor-left",
            "<right>": "cursor-right",
            "<escape>": "clear-input",
            "<enter>": "clear-input",
            "<backspace>": "backspace",
            "C-8": "backspace",
            "<delete>": "delete",
            "<space>": "space"
        }
    },

    // OPTIONAL: override the default theme, defaults are:
    "theme": {
        "view": {
            "fg": "white",
            "bg": "default",
            "border_fg": "white",
            "border_bg": "",
            "label_fg": "white",
            "label_bg": ""
        },
        "channel": {
            "prefix": "",
            "icon": "",
            "text": ""
        },
        "message": {
            "time": "",
            "name": "",
            "text": "",
            
            // This uses golang time formatting:
            // - https://yourbasic.org/golang/format-parse-string-time-date-example/
            // - https://golang.org/pkg/time/#Time.Format
            "time_format": "15:04"
        }
    }
}

Below is a full example of an updated .slack-term file:

{
    "slack_token": "token",
    "notify": "mention",
    "emoji": true,
    "theme": {
        "message": {
            "time_format": "02/01 15:04",
            "time": "fg-green,fg-bold",
            "name": "colorize,fg-bold",
            "text": "fg-blue"
        },
        "channel": {
            "prefix": "fg-red,fg-bold",
            "icon": "fg-green,fg-bold",
            "text": "fg-blue,fg-bold"
        }
    }
}

Theme

Since version 0.3.0 you'll be able to set some colors and the bold attribute in slack-term. To set this you'll need to update your .slack-term file. Below are the default settings which you can override. You can combine colors and attributes by separating them with a , (comma).

{
    "theme": {
        "view": {
            "fg": "white",
            "bg": "default",
            "border_fg": "white",
            "label_fg": "green,bold",
            "par_fg": "white",
            "par_label_fg": "white"
        },
        "channel": {
            "prefix": "",
            "icon": "",
            "text": ""
        },
        "message": {
            "time": "",
            "name": "",
            "text": ""
        }
    }
}

For the view section you're be able to choose the following colors:

colors
default
black
red
green
yellow
blue
magenta
cyan
white

For both the channel and message section you'll be able to set the fore- and background. Prepend the color with either fg- or bg- to get the desired result. E.g. fg-red or fg-magenta,bg-cyan,fg-bold.

Clone this wiki locally