feat: add support for workspace names and more icons

This commit is contained in:
iCrawl 2017-11-23 20:43:10 +01:00
parent 3cffe70a6e
commit 3bca1c8fa6
No known key found for this signature in database
GPG key ID: E41A6DB922EC2CFE
3 changed files with 4 additions and 6 deletions

View file

@ -3,7 +3,6 @@
test/**
.gitattributes
.gitignore
*.md
tsconfig.json
tslint.json
yarn.lock

View file

@ -56,6 +56,7 @@
"homepage": "https://github.com/iCrawl/discord-vscode#readme",
"icon": "assets/icon.png",
"galleryBanner": {
"color": "#6477C1",
"theme": "dark"
},
"dependencies": {

View file

@ -21,15 +21,13 @@ function setActivity(rpc: Client): void {
if (!rpc) return;
const activity = {
details: window.activeTextEditor ? `Editing ${basename(window.activeTextEditor.document.fileName)}` : 'Idle.',
state: typeof workspace.workspaceFolders !== 'undefined' ? `Workspaces: ${workspace.workspaceFolders.map(folder => folder.name).join(' | ')}` : 'Idling.',
state: window.activeTextEditor ? `Workspace: ${workspace.getWorkspaceFolder(window.activeTextEditor.document.uri).name}` : 'Idling.',
startTimestamp: new Date().getTime() / 1000,
largeImageKey: window.activeTextEditor ? extname(basename(window.activeTextEditor.document.fileName)).substring(1) : 'vscode-big',
largeImageKey: window.activeTextEditor ? extname(basename(window.activeTextEditor.document.fileName)).substring(1) || basename(window.activeTextEditor.document.fileName).substring(1) || 'vscode-big' : 'vscode-big',
largeImageText: window.activeTextEditor ? window.activeTextEditor.document.languageId : 'Idling.',
smallImageKey: 'vscode',
smallImageText: 'Visual Studio Code',
instance: false
};
rpc.setActivity(activity).catch(error =>
window.showErrorMessage(`DiscordRPC: ${error.message}`)
);
rpc.setActivity(activity);
}