Skip to content

Commit

Permalink
add zellij export
Browse files Browse the repository at this point in the history
  • Loading branch information
hamvocke committed Nov 3, 2024
1 parent 1f0ece6 commit 9297c9b
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/lib/export/exporters/exporters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { toKitty } from "./kitty";
import { toWezTerm } from "./wezterm";
import { toWindowsTerminal } from "./windows-terminal";
import { toXresources } from "./xresources";
import { toZellij } from "./zellij";
import { type Recipe, MilkAmount, Flavor, Fruit } from "$lib/ingredients";

describe("export", () => {
Expand Down Expand Up @@ -492,4 +493,33 @@ bright7=07080d # bright white`;

expect(config).toBe(expected);
});

it("to zellij", () => {
const config = toZellij(someRecipe);
// prettier-ignore
const expected = `// Copy the configuration below and add it to your
// ~/.config/zellij/zellij.kdl file
// Colors (Root Loops)
// via rootloops.sh
themes {
rootloops {
fg "#1e222d"
bg "#dfe2eb"
black "#d0d4e1"
red "#55403c"
green "#3c4a3e"
yellow "#4b4536"
blue "#3f4557"
magenta "#50404e"
cyan "#374a4d"
white "#4a5165"
orange "#5f5946"
}
}
theme "rootloops"`

expect(config).toBe(expected);
});
});
28 changes: 28 additions & 0 deletions src/lib/export/exporters/zellij.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { type Recipe } from "$lib/ingredients";
import { prepare } from "$lib/cereals";

export function toZellij(recipe: Recipe): string {
const cereals = prepare(recipe);
return `// Copy the configuration below and add it to your
// ~/.config/zellij/zellij.kdl file
// Colors (Root Loops)
// via rootloops.sh
themes {
rootloops {
fg "${cereals.foreground.color_hex}"
bg "${cereals.background.color_hex}"
black "${cereals.black.color_hex}"
red "${cereals.red.color_hex}"
green "${cereals.green.color_hex}"
yellow "${cereals.yellow.color_hex}"
blue "${cereals.blue.color_hex}"
magenta "${cereals.magenta.color_hex}"
cyan "${cereals.cyan.color_hex}"
white "${cereals.white.color_hex}"
orange "${cereals.brightYellow.color_hex}"
}
}
theme "rootloops"`;
}
2 changes: 2 additions & 0 deletions src/lib/export/formats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { toKitty } from "./exporters/kitty";
import { toWezTerm } from "./exporters/wezterm";
import { toWindowsTerminal } from "./exporters/windows-terminal";
import { toXresources } from "./exporters/xresources";
import { toZellij } from "./exporters/zellij";

export const exporters = {
Alacritty: { export: toAlacritty },
Expand All @@ -20,6 +21,7 @@ export const exporters = {
WezTerm: { export: toWezTerm },
WindowsTerminal: { export: toWindowsTerminal },
Xresources: { export: toXresources },
Zellij: { export: toZellij },
};

export type Format = keyof typeof exporters;
1 change: 1 addition & 0 deletions src/lib/export/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export const exportSelectOptions: ExportOption[] = [
{ value: "WindowsTerminal", label: "Windows Terminal", group: "Terminal Emulators" },
{ value: "Xresources", label: "Xresources", group: "Terminal Emulators" },
{ value: "Helix", label: "Helix", group: "CLI Tools" },
{ value: "Zellij", label: "Zellij", group: "CLI Tools" },
];
10 changes: 10 additions & 0 deletions src/routes/changelog/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
<a href="https://github.com/hamvocke/root-loops">our GitHub repository</a> and open up an issue.
</p>

<h3>2024-11-03</h3>
<p><strong>New</strong></p>
<ul>
<li>
New export option for <strong><a href="https://zellij.dev/">Zellij</a></strong>
as <a href="https://github.com/hamvocke/root-loops/issues/21">requested</a>
by <a href="https://github.com/tcoopman">tcoopman</a>
</li>
</ul>

<h3>2024-10-04</h3>
<p><strong>New & Breaking Change</strong></p>
<ul>
Expand Down

0 comments on commit 9297c9b

Please sign in to comment.