feat: add support for workspace names and more icons
This commit is contained in:
parent
3cffe70a6e
commit
3bca1c8fa6
3 changed files with 4 additions and 6 deletions
|
@ -3,7 +3,6 @@
|
||||||
test/**
|
test/**
|
||||||
.gitattributes
|
.gitattributes
|
||||||
.gitignore
|
.gitignore
|
||||||
*.md
|
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
tslint.json
|
tslint.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
|
|
@ -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": {
|
||||||
|
|
|
@ -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}`)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue