1
1
<script lang="ts" setup>
2
2
import { nextTick , useId , watchEffect } from ' vue'
3
- import type { IconEntry , TerminalTab , TerminalTabCharacter } from ' @commas/types/terminal'
3
+ import type { TerminalTab , TerminalTabCharacter } from ' @commas/types/terminal'
4
4
import { useSettings } from ' ../compositions/settings'
5
5
import { closeTerminalTab , getTerminalTabTitle , useCurrentTerminal } from ' ../compositions/terminal'
6
6
import { getIconEntry , isShellProcess } from ' ../utils/terminal'
@@ -47,13 +47,24 @@ const pane = $computed(() => {
47
47
return tab .pane
48
48
})
49
49
50
+ const defaultIconEntry = $computed (() => {
51
+ if (character ) {
52
+ if (character .defaultIcon ) {
53
+ return character .defaultIcon
54
+ }
55
+ }
56
+ if (pane ) {
57
+ if (pane .icon ) {
58
+ return pane .icon
59
+ }
60
+ }
61
+ return undefined
62
+ })
63
+
50
64
const iconEntry = $computed (() => {
51
- let defaultIcon: IconEntry | undefined
52
65
if (character ) {
53
66
if (character .icon ) {
54
67
return character .icon
55
- } else {
56
- defaultIcon = character .defaultIcon
57
68
}
58
69
}
59
70
if (tab ) {
@@ -64,12 +75,17 @@ const iconEntry = $computed(() => {
64
75
} else {
65
76
if (tab .shell ) {
66
77
return getIconEntry (tab )
67
- } else if (pane .icon ) {
68
- return pane .icon
69
78
}
70
79
}
71
80
}
72
- return defaultIcon
81
+ return defaultIconEntry
82
+ })
83
+
84
+ const iconClass = $computed (() => {
85
+ if (! iconEntry ) return undefined
86
+ return {
87
+ ' is-filled' : iconEntry .filled ,
88
+ }
73
89
})
74
90
75
91
const iconStyle = $computed (() => {
@@ -168,7 +184,7 @@ function close() {
168
184
>
169
185
<div class =" tab-overview" >
170
186
<div class =" tab-title" >
171
- <span class =" tab-icon" :style =" iconStyle" >
187
+ <span : class =" [' tab-icon', iconClass] " :style =" iconStyle" >
172
188
<VisualIcon v-if =" iconEntry" :name =" iconEntry.name" />
173
189
<template v-else-if =" pane && tab ! .shell " >
174
190
<VisualIcon v-if =" tab!.process === tab!.cwd" name =" lucide-folder-open" />
@@ -254,12 +270,26 @@ function close() {
254
270
:deep (.visual-icon ) {
255
271
filter : drop-shadow (2px 2px 2px rgb (0 0 0 / 25% ));
256
272
}
273
+ & .is-filled {
274
+ padding : 0 ;
275
+ color : var (--icon-color );
276
+ font-size : #{12px + 3px * 2 } ;
277
+ overflow : hidden ;
278
+ background : white ;
279
+ :deep (.visual-icon ) {
280
+ filter : none ;
281
+ }
282
+ }
257
283
.tab-item.virtual & {
258
284
color : var (--icon-color );
259
285
background : color-mix (in oklab , var (--icon-color ) 16.6667% , transparent );
260
286
:deep (.visual-icon ) {
261
287
filter : none ;
262
288
}
289
+ & .is-filled {
290
+ color : color-mix (in oklab , var (--icon-color ) 16.6667% , white );
291
+ background : var (--icon-color );
292
+ }
263
293
}
264
294
}
265
295
.tab-name {
0 commit comments