Skip to content

Commit 8b24b33

Browse files
committed
fix: mute preset uses new value for toggle action (-1)
change: preset names are now expressions
1 parent 18c1944 commit 8b24b33

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/presets.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ export function GetPresets(_instance: InstanceBaseExt<WingConfig>): CompanionPre
5656

5757
function getMutePreset(base: string, val: number): CompanionButtonPresetDefinition {
5858
const path = `/${base}/${val}`
59+
const name = `${base.toUpperCase()}${val}`
5960
return {
6061
name: 'Mute Button',
6162
category: 'Mute',
6263
type: 'button',
6364
style: {
64-
text: `Mute\\n$(wing:${base}${val}_name)`,
65+
text: `let name = 'Mute'const realName = $(wing:${base}${val}_name)let hasNoName = realName === '' || return hasNoName ? 'Mute ${name}' : \`Mute \${realName}\``,
66+
textExpression: true,
6567
size: 'auto',
6668
color: combineRgb(255, 255, 255),
6769
bgcolor: combineRgb(0, 0, 0),
@@ -74,7 +76,7 @@ function getMutePreset(base: string, val: number): CompanionButtonPresetDefiniti
7476
down: [
7577
{
7678
actionId: CommonActions.SetMute,
77-
options: { sel: path, mute: 2 },
79+
options: { sel: path, mute: -1 },
7880
},
7981
],
8082
up: [],
@@ -95,12 +97,14 @@ function getMutePreset(base: string, val: number): CompanionButtonPresetDefiniti
9597

9698
function getSoloPreset(base: string, val: number): CompanionButtonPresetDefinition {
9799
const path = `/${base}/${val}`
100+
const name = `${base.toUpperCase()}${val}`
98101
return {
99102
name: `SoloButton`,
100103
category: 'Solo',
101104
type: 'button',
102105
style: {
103-
text: `Solo\\n$(wing:${base}${val}_name)`,
106+
text: `let name = 'Solo'const realName = $(wing:${base}${val}_name)let hasNoName = realName === '' || return hasNoName ? 'Solo ${name}' : \`Solo \${realName}\``,
107+
textExpression: true,
104108
size: 'auto',
105109
color: combineRgb(255, 255, 255),
106110
bgcolor: combineRgb(0, 0, 0),
@@ -115,7 +119,7 @@ function getSoloPreset(base: string, val: number): CompanionButtonPresetDefiniti
115119
actionId: CommonActions.SetSolo,
116120
options: {
117121
sel: `${path}`,
118-
solo: 2,
122+
solo: -1,
119123
},
120124
},
121125
],
@@ -137,12 +141,14 @@ function getSoloPreset(base: string, val: number): CompanionButtonPresetDefiniti
137141

138142
function getBoostAndCenterPreset(base: string, val: number): CompanionButtonPresetDefinition {
139143
const path = `/${base}/${val}`
144+
const name = `${base.toUpperCase()}${val}`
140145
return {
141146
name: 'Boost and Center Button',
142147
category: 'Boost',
143148
type: 'button',
144149
style: {
145-
text: `Boost & Center\\n$(wing:${base}${val}_name)`,
150+
text: `let name = 'Boost & Center'const realName = $(wing:${base}${val}_name)let hasNoName = realName === '' || return hasNoName ? 'Boost & Center ${name}' : \`Boost & Center \${realName}\``,
151+
textExpression: true,
146152
size: 'auto',
147153
color: combineRgb(255, 255, 255),
148154
bgcolor: combineRgb(0, 0, 0),

0 commit comments

Comments
 (0)