Enhance installation process with terminal selection, update autostart commands, and add PolyForm license; remove unused AGS config
This commit is contained in:
+21
-3
@@ -2,6 +2,7 @@ import * as p from "@clack/prompts";
|
||||
import { groups, packages, toDirs } from "./packages.js";
|
||||
import { detectGpuVendors, driverPackagesFor, type GpuVendor } from "./gpu.js";
|
||||
import {
|
||||
autostartCmdsFor,
|
||||
backupConflicts,
|
||||
ensureSddmEnabled,
|
||||
ensureSudoSession,
|
||||
@@ -15,9 +16,11 @@ import {
|
||||
writeLocaleConfig,
|
||||
writeNvidiaEnvConfig,
|
||||
writeState,
|
||||
writeTerminalConfig,
|
||||
} from "./stow.js";
|
||||
|
||||
const CANCELLED = Symbol("cancelled");
|
||||
const TERMINAL_CANDIDATES = ["kitty", "foot"];
|
||||
|
||||
async function selectGroupPackages(chosen: Set<string>): Promise<typeof CANCELLED | void> {
|
||||
for (const group of groups) {
|
||||
@@ -63,6 +66,20 @@ async function selectGpuDriverPackages(chosen: Set<string>): Promise<GpuVendor[]
|
||||
return vendors.filter((vendor) => driverPackagesFor([vendor]).some((pkg) => picked.includes(pkg)));
|
||||
}
|
||||
|
||||
/** null means no terminal was chosen — the SUPER+T keybind is skipped. */
|
||||
async function selectMainTerminal(chosen: Set<string>): Promise<string | null | typeof CANCELLED> {
|
||||
const candidates = TERMINAL_CANDIDATES.filter((name) => chosen.has(name));
|
||||
if (candidates.length === 0) return null;
|
||||
if (candidates.length === 1) return candidates[0];
|
||||
|
||||
const picked = await p.select({
|
||||
message: "Choose your main terminal (bound to SUPER+T)",
|
||||
options: candidates.map((name) => ({ value: name, label: name })),
|
||||
});
|
||||
if (p.isCancel(picked)) return CANCELLED;
|
||||
return picked;
|
||||
}
|
||||
|
||||
async function maybeReboot(yes: boolean) {
|
||||
if (yes) {
|
||||
p.log.info("Rebooting now...");
|
||||
@@ -85,6 +102,8 @@ export async function install({ yes = false }: { yes?: boolean } = {}) {
|
||||
|
||||
if ((await selectGroupPackages(chosen)) === CANCELLED) return p.cancel("Install cancelled.");
|
||||
if ((await selectRecommendedPackages(chosen)) === CANCELLED) return p.cancel("Install cancelled.");
|
||||
const mainTerminal = await selectMainTerminal(chosen);
|
||||
if (mainTerminal === CANCELLED) return p.cancel("Install cancelled.");
|
||||
const keptGpuVendors = await selectGpuDriverPackages(chosen);
|
||||
if (keptGpuVendors === CANCELLED) return p.cancel("Install cancelled.");
|
||||
|
||||
@@ -107,10 +126,9 @@ export async function install({ yes = false }: { yes?: boolean } = {}) {
|
||||
|
||||
if (keptGpuVendors.includes("nvidia")) writeNvidiaEnvConfig();
|
||||
|
||||
const autostartCmds = ["waybar", "ags", "mako", "hyprpaper"].filter((name) => chosen.has(name));
|
||||
if (chosen.has("hyprlauncher")) autostartCmds.push("hyprlauncher -d");
|
||||
writeAutostartConfig(autostartCmds);
|
||||
writeAutostartConfig(autostartCmdsFor([...chosen]));
|
||||
writeLocaleConfig();
|
||||
if (mainTerminal) writeTerminalConfig(mainTerminal);
|
||||
|
||||
const dirs = toDirs([...chosen]);
|
||||
const backupDir = backupConflicts(dirs);
|
||||
|
||||
Reference in New Issue
Block a user