feat(workspace): map client classes to application icons (#368)
* feat(workspace): map client classes to application icons * refactor: extract app icon detection * feat: hide duplicate icons per workspace * feat: use dedicated icons for empty workspace and fallback * provide default icons * feat: title or class matcher can no provided as regex * style: change option description * style: use more descriptive param name * style: fix comment * fix(lint): missing return type * refactor: move type definitions into separate file * feat: defined default app icon set * docs: change option subtitles * style: change icons * fix: add missing default variant --------- Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
committed by
GitHub
parent
25753e5f17
commit
4e2a774c7e
@@ -2,11 +2,10 @@ const hyprland = await Service.import('hyprland');
|
||||
import options from 'options';
|
||||
import { getWorkspaceRules, getWorkspacesForMonitor, isWorkspaceIgnored } from '../helpers';
|
||||
import { Monitor, Workspace } from 'types/service/hyprland';
|
||||
import { getWsColor, renderClassnames, renderLabel } from '../utils';
|
||||
import { getAppIcon, getWsColor, renderClassnames, renderLabel } from '../utils';
|
||||
import { range } from 'lib/utils';
|
||||
import { BoxWidget } from 'lib/types/widget';
|
||||
import { WorkspaceIconMap } from 'lib/types/workspace';
|
||||
|
||||
const { workspaces, monitorSpecific, workspaceMask, spacing, ignored, showAllActive } = options.bar.workspaces;
|
||||
|
||||
export const occupiedWses = (monitor: number): BoxWidget => {
|
||||
@@ -26,6 +25,11 @@ export const occupiedWses = (monitor: number): BoxWidget => {
|
||||
spacing.bind('value'),
|
||||
options.bar.workspaces.workspaceIconMap.bind('value'),
|
||||
options.bar.workspaces.showWsIcons.bind('value'),
|
||||
options.bar.workspaces.showApplicationIcons.bind('value'),
|
||||
options.bar.workspaces.applicationIconOncePerWorkspace.bind('value'),
|
||||
options.bar.workspaces.applicationIconMap.bind('value'),
|
||||
options.bar.workspaces.applicationIconEmptyWorkspace.bind('value'),
|
||||
options.bar.workspaces.applicationIconFallback.bind('value'),
|
||||
options.theme.matugen.bind('value'),
|
||||
options.theme.bar.buttons.workspaces.smartHighlight.bind('value'),
|
||||
hyprland.bind('monitors'),
|
||||
@@ -46,6 +50,11 @@ export const occupiedWses = (monitor: number): BoxWidget => {
|
||||
spacing: number,
|
||||
wsIconMap: WorkspaceIconMap,
|
||||
showWsIcons: boolean,
|
||||
showAppIcons,
|
||||
applicationIconOncePerWorkspace,
|
||||
applicationIconMap,
|
||||
applicationIconEmptyWorkspace,
|
||||
applicationIconFallback,
|
||||
matugen: boolean,
|
||||
smartHighlight: boolean,
|
||||
monitors: Monitor[],
|
||||
@@ -98,6 +107,15 @@ export const occupiedWses = (monitor: number): BoxWidget => {
|
||||
if (isWorkspaceIgnored(ignored, i)) {
|
||||
return Widget.Box();
|
||||
}
|
||||
|
||||
const appIcons = showAppIcons
|
||||
? getAppIcon(i, applicationIconOncePerWorkspace, {
|
||||
iconMap: applicationIconMap,
|
||||
defaultIcon: applicationIconFallback,
|
||||
emptyIcon: applicationIconEmptyWorkspace,
|
||||
})
|
||||
: '';
|
||||
|
||||
return Widget.Button({
|
||||
class_name: 'workspace-button',
|
||||
on_primary_click: () => {
|
||||
@@ -124,6 +142,8 @@ export const occupiedWses = (monitor: number): BoxWidget => {
|
||||
available,
|
||||
active,
|
||||
occupied,
|
||||
showAppIcons,
|
||||
appIcons,
|
||||
workspaceMask,
|
||||
showWsIcons,
|
||||
wsIconMap,
|
||||
|
||||
Reference in New Issue
Block a user