@@ -2,25 +2,6 @@ import AstalMpris from 'gi://AstalMpris?version=0.1';
22
33const normalizeName = ( name : string ) : string => name . toLowerCase ( ) . replace ( / \s + / g, '_' ) ;
44
5- /**
6- * Gets the desktop entry name from an MPRIS player.
7- *
8- * The desktop entry typically contains the actual application name,
9- * which is more reliable than the bus name for Electron apps.
10- *
11- * @param player The MPRIS player.
12- *
13- * @returns The desktop entry name or empty string.
14- */
15- const getDesktopEntry = ( player : AstalMpris . Player ) : string => {
16- try {
17- return player . entry || '' ;
18- } catch {
19- return '' ;
20- }
21- } ;
22-
23-
245/**
256 * Checks if a media player should be ignored based on the filter list.
267 *
@@ -32,10 +13,7 @@ const getDesktopEntry = (player: AstalMpris.Player): string => {
3213 *
3314 * @returns True if the player should be ignored, false otherwise.
3415 */
35- export const isPlayerIgnored = (
36- player : AstalMpris . Player | null | undefined ,
37- filter : string [ ] ,
38- ) : boolean => {
16+ export const isPlayerIgnored = ( player : AstalMpris . Player | null | undefined , filter : string [ ] ) : boolean => {
3917 if ( ! player ) {
4018 return false ;
4119 }
@@ -44,7 +22,7 @@ export const isPlayerIgnored = (
4422
4523 const identity = player . identity || '' ;
4624 const normalizedIdentity = normalizeName ( identity ) ;
47-
25+
4826 return playerFilters . has ( normalizedIdentity ) ;
4927} ;
5028
@@ -58,10 +36,7 @@ export const isPlayerIgnored = (
5836 *
5937 * @returns Filtered array of players.
6038 */
61- export const filterPlayers = (
62- players : AstalMpris . Player [ ] ,
63- filter : string [ ] ,
64- ) : AstalMpris . Player [ ] => {
39+ export const filterPlayers = ( players : AstalMpris . Player [ ] , filter : string [ ] ) : AstalMpris . Player [ ] => {
6540 const filteredPlayers = players . filter ( ( player : AstalMpris . Player ) => {
6641 return ! isPlayerIgnored ( player , filter ) ;
6742 } ) ;
0 commit comments