icons: add regex substitutions (#487)

This commit is contained in:
end-4
2024-05-10 23:31:39 +07:00
parent 10d64ad6fe
commit f56f8c250c
4 changed files with 28 additions and 25 deletions
+1 -19
View File
@@ -11,6 +11,7 @@ const { Box, Revealer } = Widget;
import { setupCursorHover } from '../.widgetutils/cursorhover.js';
import { getAllFiles, searchIcons } from './icons.js'
import { MaterialIcon } from '../.commonwidgets/materialicon.js';
import { substitute } from '../.miscutils/icons.js';
const icon_files = userOptions.icons.searchPaths.map(e => getAllFiles(e)).flat(1)
@@ -24,25 +25,6 @@ function clearTimes() {
timers = []
}
function substitute(str) {
const subs = [
{ from: 'code-url-handler', to: 'visual-studio-code' },
{ from: 'Code', to: 'visual-studio-code' },
{ from: 'GitHub Desktop', to: 'github-desktop' },
{ from: 'wps', to: 'wps-office2019-kprometheus' },
{ from: 'gnome-tweaks', to: 'org.gnome.tweaks' },
{ from: 'Minecraft* 1.20.1', to: 'minecraft' },
{ from: '', to: 'image-missing' },
];
for (const { from, to } of subs) {
if (from === str)
return to;
}
return str;
}
function ExclusiveWindow(client) {
const fn = [
(client) => !(client !== null && client !== undefined),