fix ugly icons and spamming icon warnings

This commit is contained in:
end-4 2024-05-06 23:06:03 +07:00
parent 2531e38e35
commit d4ac618fb3
2 changed files with 9 additions and 4 deletions

View file

@ -13,8 +13,9 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
const { execAsync, exec } = Utils;
import { setupCursorHoverGrab } from '../.widgetutils/cursorhover.js';
import { dumpToWorkspace, swapWorkspace } from "./actions.js";
import { substitute } from "../.miscutils/icons.js";
import { iconExists, substitute } from "../.miscutils/icons.js";
import { monitors } from '../.miscutils/hyprlanddata.js';
import { MaterialIcon } from '../.commonwidgets/materialicon.js';
const NUM_OF_WORKSPACES_SHOWN = userOptions.overview.numOfCols * userOptions.overview.numOfRows;
const TARGET = [Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags.SAME_APP, 0)];
@ -64,9 +65,12 @@ export default (overviewMonitor = 0) => {
if (x + w > monitors[monitor]) w = monitors[monitor] - x;
if (y + h > monitors[monitor].height) h = monitors[monitor].height - y;
const appIcon = Widget.Icon({
const iconName = substitute(c);
const appIcon = iconExists(iconName) ? Widget.Icon({
icon: substitute(c),
size: Math.min(w, h) * userOptions.overview.scale / 2.5,
}) : MaterialIcon('terminal', 'gigantic', {
css: `font-size: ${Math.min(w, h) * userOptions.overview.scale / 2.5}px`,
});
return Widget.Button({
attribute: {

View file

@ -4,6 +4,7 @@ import Widget from 'resource:///com/github/Aylur/ags/widget.js';
const { Box, Button, Icon, Label, Revealer, Scrollable, Slider, Stack } = Widget;
import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
import { iconExists } from '../../.miscutils/icons.js';
const AppVolume = (stream) => Box({
className: 'sidebar-volmixer-stream spacing-h-10',
@ -66,10 +67,10 @@ const AudioDevices = (input = false) => {
child: Box({
className: 'txt spacing-h-10',
children: [
Icon({
iconExists(stream.iconName) ? Icon({
className: 'txt-norm symbolic-icon',
icon: stream.iconName,
}),
}) : MaterialIcon(input ? 'mic_external_on' : 'media_output', 'norm'),
Label({
hexpand: true,
xalign: 0,