@domicile-desktop/manganese-launcher 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,35 +1,34 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@cprussin/option-result": "^2.0.1",
4
- "@domicile-desktop/component-library": "2.0.1",
5
- "@domicile-desktop/manganese-address": "1.0.2",
6
- "@domicile-desktop/manganese-host": "2.0.1",
7
- "@domicile-desktop/sdk": "2.1.0",
8
- "@domicile-desktop/system-apps": "1.1.1",
9
- "@pandacss/dev": "^1.12.1",
4
+ "@domicile-desktop/component-library": "2.2.0",
5
+ "@domicile-desktop/manganese-address": "1.1.0",
6
+ "@domicile-desktop/manganese-host": "2.0.3",
7
+ "@domicile-desktop/sdk": "3.0.0",
8
+ "@domicile-desktop/system-apps": "1.3.0",
9
+ "@pandacss/dev": "^1.12.2",
10
10
  "@phosphor-icons/react": "^2.1.10",
11
11
  "lowlight": "^3.3.0",
12
- "react": "^19.2.8",
13
- "zod": "^4.5.4"
12
+ "react": "^19.3.1",
13
+ "zod": "^4.6.7"
14
14
  },
15
15
  "description": "Manganese's launcher: apps, files, bookmarks, web addresses and searches in one panel.",
16
16
  "devDependencies": {
17
17
  "@cprussin/tsconfig": "^5.0.0",
18
- "@domicile-desktop/manganese-window-management": "1.2.0",
18
+ "@domicile-desktop/manganese-window-management": "2.0.0",
19
19
  "@domicile-desktop/test-support": "0.0.2",
20
- "@pandacss/preset-panda": "^1.12.1",
20
+ "@pandacss/preset-panda": "^1.12.2",
21
21
  "@testing-library/react": "^16.3.3",
22
- "@testing-library/user-event": "^14.6.7",
23
- "@types/bun": "^1.4.2",
24
- "@types/react": "^19.2.18",
25
- "@types/react-dom": "^19.2.7",
26
- "postcss": "^8.5.28",
27
- "react-dom": "^19.2.8",
22
+ "@testing-library/user-event": "^14.6.10",
23
+ "@types/bun": "^1.4.4",
24
+ "@types/react": "^19.3.0",
25
+ "@types/react-dom": "^19.3.0",
26
+ "postcss": "^8.5.32",
27
+ "react-dom": "^19.3.1",
28
28
  "typescript": "^7.0.2"
29
29
  },
30
30
  "engines": {
31
- "bun": ">=1.4.2",
32
- "node": ">=24"
31
+ "bun": ">=1.4.2"
33
32
  },
34
33
  "exports": {
35
34
  "./app-glance": "./src/app-glance.ts",
@@ -66,5 +65,5 @@
66
65
  "test:unit": "bun test"
67
66
  },
68
67
  "type": "module",
69
- "version": "1.1.1"
68
+ "version": "1.2.0"
70
69
  }
package/src/Launcher.tsx CHANGED
@@ -76,9 +76,12 @@ import { useSettled } from "./useSettled";
76
76
  import { VideoPreview } from "./VideoPreview";
77
77
  import { WikipediaLogoIcon } from "./WikipediaLogoIcon";
78
78
 
79
- /** The box's placeholder and accessible name. */
79
+ /** The box's accessible name. */
80
80
  const PROMPT = "Open an app, a file, a URL, or search";
81
81
 
82
+ /** The box's placeholder: the prompt, naming a few tags so people find them. */
83
+ const PLACEHOLDER = `${PROMPT}. Try !yt, !wiki or !gh.`;
84
+
82
85
  /**
83
86
  * How long the highlight must rest on a row before it is previewed. Long
84
87
  * enough to skip previews while typing, short enough to feel immediate.
@@ -344,7 +347,7 @@ const Query = ({
344
347
  }
345
348
  }
346
349
  }}
347
- placeholder={PROMPT}
350
+ placeholder={PLACEHOLDER}
348
351
  prefixIcon={<MagnifyingGlassIcon size={ICON_SIZE} />}
349
352
  ref={box}
350
353
  role="combobox"
@@ -804,7 +807,13 @@ const ChoicePreview = ({
804
807
  // Keyed on the URL, so each bookmark gets its own guest and icons don't
805
808
  // leak between them.
806
809
  return (
807
- <BookmarkPreview key={choice.url} onLearn={onLearn} url={choice.url} />
810
+ <BookmarkPreview
811
+ // Keyed on the profile too: a view reads it once.
812
+ key={`${choice.profile ?? ""} ${choice.url}`}
813
+ onLearn={onLearn}
814
+ profile={choice.profile}
815
+ url={choice.url}
816
+ />
808
817
  );
809
818
  }
810
819
  case ChoiceKind.Tag: {
@@ -837,7 +846,16 @@ const ChoicePreview = ({
837
846
  * A bookmark's page. Loads with the user's sign-in, so it can learn icons the
838
847
  * compositor's anonymous lookup can't see.
839
848
  */
840
- const BookmarkPreview = ({ onLearn, url }: { onLearn: Learn; url: string }) => {
849
+ const BookmarkPreview = ({
850
+ onLearn,
851
+ profile,
852
+ url,
853
+ }: {
854
+ onLearn: Learn;
855
+ /** The browser profile the bookmark opens in, so the preview is signed in as it will be. */
856
+ profile: string | undefined;
857
+ url: string;
858
+ }) => {
841
859
  // `null` because React passes it to a callback ref on unmount.
842
860
  const [view, setView] = useState<HTMLWebViewElement | null>(null);
843
861
 
@@ -859,7 +877,17 @@ const BookmarkPreview = ({ onLearn, url }: { onLearn: Learn; url: string }) => {
859
877
  }
860
878
  }, [onLearn, url, view]);
861
879
 
862
- return <webview className={viewStyles} ref={setView} src={url} title={url} />;
880
+ // `profile` is read as the view enters the document, so it is on the first
881
+ // render, before `src`.
882
+ return (
883
+ <webview
884
+ className={viewStyles}
885
+ profile={profile}
886
+ ref={setView}
887
+ src={url}
888
+ title={url}
889
+ />
890
+ );
863
891
  };
864
892
 
865
893
  /** Whether `a` and `b` are valid URLs with the same origin. */
@@ -1072,6 +1100,7 @@ const logoOf = (engine: Engine): typeof FileIcon => {
1072
1100
  case Engine.GitHub: {
1073
1101
  return GithubLogoIcon;
1074
1102
  }
1103
+ case Engine.Google:
1075
1104
  case Engine.GoogleImages:
1076
1105
  case Engine.GoogleMaps: {
1077
1106
  return GoogleLogoIcon;
@@ -1090,6 +1119,9 @@ const nameOf = (engine: Engine): string => {
1090
1119
  case Engine.GitHub: {
1091
1120
  return "GitHub";
1092
1121
  }
1122
+ case Engine.Google: {
1123
+ return "Google";
1124
+ }
1093
1125
  case Engine.GoogleImages: {
1094
1126
  return "Google Images";
1095
1127
  }
@@ -1116,10 +1148,15 @@ const tagDoesOf = (engine: Engine | undefined): string =>
1116
1148
  : `Search ${nameOf(engine)}`;
1117
1149
 
1118
1150
  /** What adding a tag does, for its preview. */
1119
- const tagUseOf = (engine: Engine | undefined): string =>
1120
- engine === undefined
1121
- ? "open sites and searches in a private browser"
1122
- : `search ${nameOf(engine)} instead of Google`;
1151
+ const tagUseOf = (engine: Engine | undefined): string => {
1152
+ if (engine === undefined) {
1153
+ return "open sites and searches in a private browser";
1154
+ } else {
1155
+ return engine === Engine.Google
1156
+ ? "search Google and skip the other matches"
1157
+ : `search ${nameOf(engine)} instead of Google`;
1158
+ }
1159
+ };
1123
1160
 
1124
1161
  // The search box is the panel's header, set off by a line under it.
1125
1162
  const searchStyles = css({
package/src/app-search.ts CHANGED
@@ -9,7 +9,7 @@ import { appIcons } from "@domicile-desktop/system-apps/app-icons";
9
9
  import type { AppsDesktop } from "@domicile-desktop/system-apps/apps-desktop";
10
10
  import { findBookmarks } from "@domicile-desktop/system-apps/bookmark";
11
11
  import { curlFetch } from "@domicile-desktop/system-apps/curl";
12
- import { dataDirs } from "@domicile-desktop/system-apps/data-dirs";
12
+ import { appPlaces } from "@domicile-desktop/system-apps/data-dirs";
13
13
  import type { DesktopEntry as InstalledEntry } from "@domicile-desktop/system-apps/desktop-entry";
14
14
  import { favicon } from "@domicile-desktop/system-apps/favicon";
15
15
  import type { Favicons } from "@domicile-desktop/system-apps/favicons";
@@ -39,6 +39,11 @@ export type WebApp = {
39
39
  appId: string;
40
40
  name: string;
41
41
  url: string;
42
+ /**
43
+ * The id of the browser profile its window opens in, such as `work`. By
44
+ * default, the one its site opens in.
45
+ */
46
+ profile?: string | undefined;
42
47
  };
43
48
 
44
49
  /** What is installed, as read on an opening. */
@@ -124,6 +129,7 @@ const webAppEntry = (app: WebApp): InstalledEntry => ({
124
129
  app.appId,
125
130
  "--reuse",
126
131
  "focus",
132
+ ...(app.profile === undefined ? [] : ["--profile", app.profile]),
127
133
  app.url,
128
134
  ],
129
135
  comment: "",
@@ -133,6 +139,7 @@ const webAppEntry = (app: WebApp): InstalledEntry => ({
133
139
  mimeTypes: [],
134
140
  name: app.name,
135
141
  preview: undefined,
142
+ terminal: undefined,
136
143
  windowClass: undefined,
137
144
  words: app.name.toLowerCase(),
138
145
  });
@@ -142,10 +149,11 @@ const read = async (
142
149
  omits: (id: string) => boolean,
143
150
  iconTheme: IconTheme,
144
151
  ): Promise<Installed> => {
145
- const dirs = succeeded(await dataDirs(domicile));
152
+ const { dirs, terminal } = succeeded(await appPlaces(domicile));
146
153
  const theme = await iconTheme();
147
154
  return {
148
- entries: succeeded(await installedApps(domicile, dirs)).filter(
155
+ // htop and vim, in the desk's terminal when the config names one.
156
+ entries: succeeded(await installedApps(domicile, dirs, terminal)).filter(
149
157
  ({ id }) => !omits(id),
150
158
  ),
151
159
  icon: appIcons(domicile, dirs, ["apps"], { theme }),
package/src/choices.ts CHANGED
@@ -13,17 +13,18 @@
13
13
  // 8. A Google search for the query, always, as the fallback.
14
14
  //
15
15
  // The site and the search each have a private row beside them. `!p` anywhere
16
- // in the query offers only the web rows, all private.
16
+ // in the query offers only the web rows, all private. `!g` offers only its
17
+ // Google search, so Enter searches without a look at the matches.
17
18
  //
18
19
  // `typedAddress` decides site vs. search, so this box and a browser window's
19
20
  // address bar agree.
20
21
 
21
22
  import type {
22
- Engine,
23
23
  TaggedSearch,
24
24
  TaggedSite,
25
25
  } from "@domicile-desktop/manganese-address/search";
26
26
  import {
27
+ Engine,
27
28
  googleUrl,
28
29
  TAGS,
29
30
  taggedSearch,
@@ -128,13 +129,17 @@ export const choicesFor = (
128
129
  ): Choice[] => {
129
130
  const words = query.split(/\s+/).filter((word) => word !== "");
130
131
  const typed = words.filter((word) => word !== PRIVATE_TAG).join(" ");
132
+ const isPrivate = words.includes(PRIVATE_TAG);
133
+ const tagged = taggedChoicesFor(isPrivate ? typed : query, isPrivate);
131
134
  return [
132
135
  ...tagsFor(query),
133
- ...(words.includes(PRIVATE_TAG)
134
- ? [...taggedChoicesFor(typed, true), ...webChoicesFor(typed, true)]
136
+ ...(taggedSearch(query)?.engine === Engine.Google
137
+ ? tagged
135
138
  : [
136
- ...taggedChoicesFor(query, false),
137
- ...plainChoicesFor(query, found, apps, bookmarks),
139
+ ...tagged,
140
+ ...(isPrivate
141
+ ? webChoicesFor(typed, true)
142
+ : plainChoicesFor(query, found, apps, bookmarks)),
138
143
  ]),
139
144
  ];
140
145
  };
@@ -149,7 +154,7 @@ export const launchOf = (choice: Launchable): Launch => {
149
154
  return Launch.Opened(choice.row.path);
150
155
  }
151
156
  case ChoiceKind.Bookmark: {
152
- return Launch.Browsed(choice.url, false);
157
+ return Launch.Browsed(choice.url, false, choice.profile);
153
158
  }
154
159
  case ChoiceKind.Site:
155
160
  case ChoiceKind.Search:
@@ -168,12 +173,16 @@ export const openWithOf = (choice: Launchable): Launch =>
168
173
 
169
174
  /**
170
175
  * The tags `query`'s last word starts, by tag, leaving out tags the line
171
- * already has. None once a space ends the word.
176
+ * already has. None once a space ends the word, or once the word is a whole
177
+ * tag after words to search: `kate bush !yt` then searches on Enter, as
178
+ * `!yt kate bush` does.
172
179
  */
173
180
  const tagsFor = (query: string): Choice[] => {
174
181
  const words = query.split(/\s+/);
175
182
  const typing = words.at(-1) ?? "";
176
- return typing.startsWith("!")
183
+ const isDone =
184
+ isTag(typing) && words.some((word) => word !== "" && !isTag(word));
185
+ return typing.startsWith("!") && !isDone
177
186
  ? [...Object.keys(TAGS), PRIVATE_TAG]
178
187
  .filter(
179
188
  (tag) => tag.startsWith(typing) && !words.slice(0, -1).includes(tag),
@@ -189,6 +198,9 @@ const tagsFor = (query: string): Choice[] => {
189
198
  : [];
190
199
  };
191
200
 
201
+ /** Whether `word` is a tag, `!p` included. */
202
+ const isTag = (word: string): boolean => word in TAGS || word === PRIVATE_TAG;
203
+
192
204
  /** The page and search `query`'s tag names, if any. */
193
205
  const taggedChoicesFor = (query: string, isPrivate: boolean): Choice[] => {
194
206
  const site = taggedSite(query);
package/src/found-apps.ts CHANGED
@@ -19,6 +19,8 @@ export type DesktopEntry = {
19
19
  export type Bookmark = {
20
20
  name: string;
21
21
  url: string;
22
+ /** The browser profile it opens in, or `undefined` for its site's. */
23
+ profile?: string | undefined;
22
24
  /** The icon its site names, as a `data:` URL, or `undefined` for none found. */
23
25
  icon: string | undefined;
24
26
  };
package/src/launch.ts CHANGED
@@ -10,10 +10,14 @@ export enum LaunchKind {
10
10
  }
11
11
 
12
12
  export const Launch = {
13
- /** Open `url` in a browser window on the desktop, private or not. */
14
- Browsed: (url: string, isPrivate: boolean) => ({
13
+ /**
14
+ * Open `url` in a browser window on the desktop, private or not, in
15
+ * browser profile `profile` or with none its site's.
16
+ */
17
+ Browsed: (url: string, isPrivate: boolean, profile?: string) => ({
15
18
  isPrivate,
16
19
  kind: LaunchKind.Browsed as const,
20
+ profile,
17
21
  url,
18
22
  }),
19
23
  /**
@@ -3,11 +3,11 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const aspectRatioConfig = {
5
5
  transform(props, { map }) {
6
- const { ratio = 4 / 3, ...rest } = props;
6
+ const { ratio = 1.3333333333333333, ...rest } = props;
7
7
  return {
8
8
  position: "relative",
9
9
  _before: {
10
- content: `""`,
10
+ content: '""',
11
11
  display: "block",
12
12
  height: "0",
13
13
  paddingBottom: map(ratio, (r) => `${1 / r * 100}%`)
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const bleedConfig = {
5
5
  transform(props, { map, isCssUnit, isCssVar }) {
6
- const { inline, block, ...rest } = props;
7
- const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
6
+ const { inline, block, ...rest } = props, valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
8
7
  return {
9
8
  "--bleed-x": map(inline, valueFn),
10
9
  "--bleed-y": map(block, valueFn),
@@ -11,28 +11,22 @@ transform(props, { map }) {
11
11
  position: "absolute",
12
12
  insetBlockStart: map(placement, (v) => {
13
13
  const [side] = v.split("-");
14
- const map2 = { top: offsetY, middle: "50%", bottom: "auto" };
15
- return map2[side];
14
+ return { top: offsetY, middle: "50%", bottom: "auto" }[side];
16
15
  }),
17
16
  insetBlockEnd: map(placement, (v) => {
18
17
  const [side] = v.split("-");
19
- const map2 = { top: "auto", middle: "50%", bottom: offsetY };
20
- return map2[side];
18
+ return { top: "auto", middle: "50%", bottom: offsetY }[side];
21
19
  }),
22
20
  insetInlineStart: map(placement, (v) => {
23
21
  const [, align] = v.split("-");
24
- const map2 = { start: offsetX, center: "50%", end: "auto" };
25
- return map2[align];
22
+ return { start: offsetX, center: "50%", end: "auto" }[align];
26
23
  }),
27
24
  insetInlineEnd: map(placement, (v) => {
28
25
  const [, align] = v.split("-");
29
- const map2 = { start: "auto", center: "50%", end: offsetX };
30
- return map2[align];
26
+ return { start: "auto", center: "50%", end: offsetX }[align];
31
27
  }),
32
28
  translate: map(placement, (v) => {
33
- const [side, align] = v.split("-");
34
- const mapX = { start: "-50%", center: "-50%", end: "50%" };
35
- const mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
29
+ const [side, align] = v.split("-"), mapX = { start: "-50%", center: "-50%", end: "50%" }, mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
36
30
  return `${mapX[align]} ${mapY[side]}`;
37
31
  }),
38
32
  ...rest
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const gridItemConfig = {
5
5
  transform(props, { map }) {
6
- const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props;
7
- const spanFn = (v) => v === "auto" ? v : `span ${v}`;
6
+ const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props, spanFn = (v) => v === "auto" ? v : `span ${v}`;
8
7
  return {
9
8
  gridColumn: colSpan != null ? map(colSpan, spanFn) : void 0,
10
9
  gridRow: rowSpan != null ? map(rowSpan, spanFn) : void 0,
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const gridConfig = {
5
5
  transform(props, { map, isCssUnit }) {
6
- const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props;
7
- const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
6
+ const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props, getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
8
7
  return {
9
8
  display: "grid",
10
9
  gridTemplateColumns: columns != null ? map(columns, (v) => `repeat(${v}, minmax(0, 1fr))`) : minChildWidth != null ? map(minChildWidth, (v) => `repeat(auto-fit, minmax(${getValue(v)}, 1fr))`) : void 0,
@@ -9,7 +9,7 @@ transform(props) {
9
9
  position: "absolute",
10
10
  inset: "0",
11
11
  zIndex: "0",
12
- ...props["_before"]
12
+ ...props._before
13
13
  },
14
14
  ...props
15
15
  };
@@ -8,9 +8,9 @@ transform(props, { map, isCssUnit, isCssVar }) {
8
8
  alignSelf: "stretch",
9
9
  justifySelf: "stretch",
10
10
  flex: map(size, (v) => {
11
- if (v == null) return "1";
12
- const val = isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
13
- return `0 0 ${val}`;
11
+ if (v == null)
12
+ return "1";
13
+ return `0 0 ${isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`}`;
14
14
  }),
15
15
  ...rest
16
16
  };
@@ -4,7 +4,7 @@ import { css } from '../css/index.mjs';
4
4
  const visuallyHiddenConfig = {
5
5
  transform(props) {
6
6
  return {
7
- srOnly: true,
7
+ srOnly: !0,
8
8
  ...props
9
9
  };
10
10
  }}