@@ -169,7 +169,7 @@ export class Stack {
169
169
const entity = window . entity ;
170
170
const active = Ecs . entity_eq ( entity , this . active ) ;
171
171
172
- const button = new TabButton ( window )
172
+ const button = new TabButton ( window ) ;
173
173
const id = this . buttons . insert ( button ) ;
174
174
175
175
let tab : Tab = { active, entity, signals : [ ] , button : id , button_signal : null } ;
@@ -220,7 +220,7 @@ export class Stack {
220
220
221
221
let id = 0 ;
222
222
223
- for ( const component of this . tabs ) {
223
+ for ( const [ idx , component ] of this . tabs . entries ( ) ) {
224
224
let name ;
225
225
226
226
this . window_exec ( id , component . entity , ( window ) => {
@@ -244,12 +244,13 @@ export class Stack {
244
244
if ( component . active ) {
245
245
let settings = this . ext . settings ;
246
246
let color_value = settings . hint_color_rgba ( ) ;
247
- tab_color = `background: ${ color_value } ; color: ${ utils . is_dark ( color_value ) ? 'white' : 'black' } ` ;
248
-
247
+ tab_color = `${ color_value } ; color: ${ utils . is_dark ( color_value ) ? 'white' : 'black' } ` ;
249
248
} else {
250
- tab_color = `background: ${ INACTIVE_TAB_STYLE } ` ;
249
+ tab_color = `${ INACTIVE_TAB_STYLE } ` ;
251
250
}
252
- button . set_style ( tab_color ) ;
251
+
252
+ const tab_border_radius = this . get_tab_border_radius ( idx ) ;
253
+ button . set_style ( `background: ${ tab_color } ; border-radius: ${ tab_border_radius } ;` ) ;
253
254
}
254
255
} )
255
256
@@ -259,6 +260,23 @@ export class Stack {
259
260
this . reset_visibility ( permitted )
260
261
}
261
262
263
+ // returns the tab button border radius based on it's order.
264
+ // Only curving the corners on the edges.
265
+ private get_tab_border_radius ( idx : Number ) : string {
266
+ let result = `0px 0px 0px 0px` ;
267
+
268
+ // the minus 4px is to accomodate the inner radius being tighter
269
+ let radius = Math . max ( 0 , this . ext . settings . active_hint_border_radius ( ) - 4 ) ;
270
+ // only allow a radius up to half the tab_height
271
+ radius = Math . min ( radius , Math . trunc ( this . tabs_height / 2 ) ) ;
272
+ // set each corner's radius based on it's order
273
+ if ( this . tabs . length === 1 ) result = `${ radius } px` ;
274
+ else if ( idx === 0 ) result = `${ radius } px 0px 0px ${ radius } px` ;
275
+ else if ( idx === this . tabs . length - 1 ) result = `0px ${ radius } px ${ radius } px 0px` ;
276
+
277
+ return result ;
278
+ }
279
+
262
280
/** Connects `on_window_changed` callbacks to the newly-active window */
263
281
private active_connect ( window : Meta . Window , active : Entity ) {
264
282
// Disconnect before attaching new window as active window
0 commit comments