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/** test/**
.gitattributes .gitattributes
.gitignore .gitignore
*.md
tsconfig.json tsconfig.json
tslint.json tslint.json
yarn.lock yarn.lock

View file

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

View file

@ -21,15 +21,13 @@ function setActivity(rpc: Client): void {
if (!rpc) return; if (!rpc) return;
const activity = { const activity = {
details: window.activeTextEditor ? `Editing ${basename(window.activeTextEditor.document.fileName)}` : 'Idle.', 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, 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.', largeImageText: window.activeTextEditor ? window.activeTextEditor.document.languageId : 'Idling.',
smallImageKey: 'vscode', smallImageKey: 'vscode',
smallImageText: 'Visual Studio Code', smallImageText: 'Visual Studio Code',
instance: false instance: false
}; };
rpc.setActivity(activity).catch(error => rpc.setActivity(activity);
window.showErrorMessage(`DiscordRPC: ${error.message}`)
);
} }