diff --git a/BRAND.md b/BRAND.md index 0991ff5..272e3ee 100644 --- a/BRAND.md +++ b/BRAND.md @@ -31,7 +31,7 @@ A letter **E** drawn with one stroke width on a 96-unit grid, then cut on a slan - The product is **EditsMaker**: one word, capital E, capital M. The command is **`edits`**, always in code type. - In sentences: "EditsMaker cuts…", never "the EditsMaker", never "Edits Maker" or "EDITSMAKER". -- The line is **Link in. Edits out.** with two full stops. It is never translated inside the logo lockup. +- The line is **The AI video harness.** with one full stop. It is never translated inside the logo lockup. ## 3. Colour @@ -126,7 +126,7 @@ Our comparisons have to survive someone checking them. The first and the last things on a page are the ones people remember best (the serial position effect) [10]. So the page opens with what it is and how to get it, and closes with how to install it: -1. **Title**: the mark and the name, centred, "Link in. Edits out." Nothing above it. +1. **Title**: the mark and the name, centred, "The AI video harness." Nothing above it. 2. **Download** band, red, linking to Install. 3. **Badges**: up to six chips, one red. 4. **Made with it**: the videos; proof before claims. diff --git a/Cargo.lock b/Cargo.lock index 96a1900..688052d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1325,7 +1325,7 @@ checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "edits" -version = "0.32.0" +version = "0.33.0" dependencies = [ "gpui-kit", "image", diff --git a/Cargo.toml b/Cargo.toml index e06b88e..492454c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "edits" -version = "0.32.0" +version = "0.33.0" edition = "2021" description = "One small download (under 15 MB, with its desktop app) that turns any YouTube link, channel or topic into viral TikTok, Reels and Shorts edits: Alight Motion and Premiere presets, trending songs, beat-synced cuts, captions, colour looks, MCP server for AI agents." repository = "https://github.com/OnurByte/EditsMaker" diff --git a/README.md b/README.md index 73ba193..962ac86 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ - EditsMaker. Link in. Edits out. + EditsMaker. The AI video harness. diff --git a/assets/illustrations/schedule.svg b/assets/illustrations/schedule.svg new file mode 100644 index 0000000..71688c5 --- /dev/null +++ b/assets/illustrations/schedule.svg @@ -0,0 +1 @@ + diff --git a/assets/readme/hero-dark.svg b/assets/readme/hero-dark.svg index 6cbac4b..3222ad2 100644 --- a/assets/readme/hero-dark.svg +++ b/assets/readme/hero-dark.svg @@ -1,5 +1,5 @@ - + EditsMaker -Link in. Edits out. +The AI video harness. diff --git a/assets/readme/hero-light.svg b/assets/readme/hero-light.svg index 67757bb..0fb5be4 100644 --- a/assets/readme/hero-light.svg +++ b/assets/readme/hero-light.svg @@ -1,5 +1,5 @@ - + EditsMaker -Link in. Edits out. +The AI video harness. diff --git a/install.sh b/install.sh index a18e9f8..74ad1ca 100755 --- a/install.sh +++ b/install.sh @@ -37,8 +37,8 @@ echo "edits: installed $("$BIN/edits" --version) to $BIN/edits" # the app (edits app) in the launcher: a .desktop entry on Linux, an app bundle on macOS (its notifications need one) case "$(uname -s)" in Linux) - A="${XDG_DATA_HOME:-$HOME/.local/share}/applications"; mkdir -p "$A" - printf '[Desktop Entry]\nType=Application\nName=EditsMaker\nComment=Link in. Edits out.\nExec=%s app\nIcon=video-x-generic\nCategories=AudioVideo;Video;\nStartupWMClass=edits\n' "$BIN/edits" > "$A/edits.desktop" ;; + # edits writes its own .desktop entry and icon (and mends them each time the app starts) + "$BIN/edits" app --launcher || true ;; Darwin) C="$HOME/Applications/EditsMaker.app/Contents"; mkdir -p "$C/MacOS" # started by this name, edits opens its app diff --git a/src/app/chat_view.rs b/src/app/chat_view.rs index 981ad53..2d7e49d 100644 --- a/src/app/chat_view.rs +++ b/src/app/chat_view.rs @@ -88,6 +88,29 @@ impl Workspace { } } + /// t3code's TimelineMinimap: a short line for each item down the timeline's right edge, the one in view + /// highlighted; a click jumps to it, the chevrons step one up or down. + fn minimap(&self, n: usize, b: &Brand, cx: &mut Context) -> impl IntoElement { + let at = self.timeline_scroll.logical_scroll_top().0.min(n - 1); + let jump = |to: usize| move |this: &mut Self, _: &ClickEvent, _: &mut Window, cx: &mut Context| { + this.timeline_scroll.scroll_to_top_of_item(to); + cx.notify(); + }; + let (hover, gray, ink) = (b.card, b.gray, b.ink); + let chevron = |id: &'static str, i: Icon, to: usize, cx: &mut Context| div().id(id).size(px(20.)).flex().items_center().justify_center().rounded(px(4.)).cursor_pointer() + .hover(move |s| s.bg(hover)).child(icon(i, gray).size(px(12.))).on_click(cx.listener(jump(to))); + div().absolute().right(px(8.)).top_0().bottom_0().flex().flex_col().justify_center() + .child(div().py(px(6.)).px(px(4.)).flex().flex_col().items_end().gap(px(2.)).rounded(px(8.)) + .child(chevron("mini-up", Icon::ChevronUp, at.saturating_sub(1), cx)) + .children((0..n).map(|i| { + let on = i == at; + div().id(("mini", i)).w(px(20.)).h(px(10.)).flex().items_center().justify_end().cursor_pointer() + .child(div().h(px(2.)).w(px(if on { 16. } else { 10. })).rounded(px(1.)).bg(if on { ink } else { gray.opacity(0.6) })) + .on_click(cx.listener(jump(i))) + })) + .child(chevron("mini-down", Icon::ChevronDown, (at + 1).min(n - 1), cx))) + } + pub fn chat_view(&self, window: &mut Window, cx: &mut Context) -> impl IntoElement { let b = brand(cx); let composer = div().flex_none().px(px(24.)).pb(px(24.)).child(self.composer(window, cx)); @@ -95,15 +118,21 @@ impl Workspace { return div().size_full().flex().flex_col() .child(div().flex_1().flex().flex_col().items_center().justify_center().gap(px(16.)).px(px(24.)) .child(crate::app::icons::mark(b.ink).size(px(48.))) - .child(text("Link in. Edits out.", 32., BOLD, b.ink)) + .child(text("The AI video harness.", 32., BOLD, b.ink)) .child(text("A YouTube video or channel, a topic, or a video file: drop one anywhere here.", 15., LIGHT, b.gray).max_w(px(420.)).text_center())) .child(composer); } let (subject, title, folder, items) = self.timeline(cx); + let n = items.len(); + // each item its own child of the scroll, so the minimap can jump to it + let rows = items.into_iter().map(|it| div().w_full().max_w(theme::column()).mx_auto().px(px(24.)).pt(px(24.)).child(it)); div().size_full().flex().flex_col() .child(self.header(&subject, title, folder, &b)) - .child(div().id("timeline").flex_1().min_h_0().overflow_y_scroll() - .child(div().w_full().max_w(theme::column()).mx_auto().px(px(24.)).py(px(24.)).flex().flex_col().gap(px(24.)).children(items))) + .child(div().flex_1().min_h_0().relative() + .child(div().id("timeline").size_full().overflow_y_scroll().track_scroll(&self.timeline_scroll).pb(px(24.)) + // the minimap follows what is in view + .on_scroll(cx.listener(|_, _, _, cx| cx.notify())).flex().flex_col().children(rows)) + .when(n >= 2, |d| d.child(self.minimap(n, &b, cx)))) .child(composer) } } diff --git a/src/app/discord.rs b/src/app/discord.rs index 859f862..29b23c4 100644 --- a/src/app/discord.rs +++ b/src/app/discord.rs @@ -24,7 +24,7 @@ pub fn doing(what: String) { pub fn activity(doing: &str, since: u64, nonce: u64) -> Value { let mut a = json!({ "details": if doing.is_empty() { "Making edits" } else { doing }, - "state": "Link in. Edits out.", + "state": "The AI video harness.", "timestamps": {"start": since}, "assets": {"large_image": ICON, "large_text": "EditsMaker"}, "buttons": [{"label": "Download EditsMaker", "url": DOWNLOAD}], diff --git a/src/app/flows.rs b/src/app/flows.rs index 1c2e786..3f4fd79 100644 --- a/src/app/flows.rs +++ b/src/app/flows.rs @@ -1,6 +1,6 @@ //! Flows, as in n8n but in one line each: a topic (the news on it, from a topic pack) or a channel, made into edits, //! posted to accounts. Each is an `edits follow`; `edits watch` (or the background service) runs them. -use crate::app::icons::{icon, Icon}; +use crate::app::icons::{icon, illustration, Icon}; use crate::app::runs::Flow; use crate::app::theme::{Brand, BOLD, LIGHT}; use crate::app::ui::{card, pill, primary, text}; @@ -80,13 +80,15 @@ impl Workspace { })) })); let source = self.picker_pill("flow-source", Icon::Workflow, self.flow_source.clone().unwrap_or_else(|| "Pick a topic".into()), Picker::FlowSource, b, cx); - let label = |s: &'static str| text(s, 13., BOLD, b.ink).w(px(96.)).flex_none(); + // each step with its micro illustration: what it is about, how it is made, where it goes, how often + let label = |s: &'static str, art: &'static str| div().w(px(152.)).flex_none().flex().items_center().gap(px(8.)) + .child(illustration(art).w(px(48.)).h(px(36.)).flex_none()).child(text(s, 13., BOLD, b.ink)); let new = card(b).gap(px(16.)) - .child(div().flex().items_center().gap(px(16.)).child(label("About")).child(source)) + .child(div().flex().items_center().gap(px(16.)).child(label("About", "topics")).child(source)) .when(self.picker == Some(Picker::FlowSource), |d| d.child(self.picker_list(Picker::FlowSource, b, cx))) - .child(div().flex().items_center().gap(px(16.)).child(label("Made with")).child(text(self.preset.clone().unwrap_or_else(|| "the composer's preset (none now)".into()), 13., FontWeight::NORMAL, b.gray))) - .child(div().flex().items_center().gap(px(16.)).child(label("Posted to")).child(post)) - .child(div().flex().items_center().gap(px(16.)).child(label("Every")).child(every)) + .child(div().flex().items_center().gap(px(16.)).child(label("Made with", "styles")).child(text(self.preset.clone().unwrap_or_else(|| "the composer's preset (none now)".into()), 13., FontWeight::NORMAL, b.gray))) + .child(div().flex().items_center().gap(px(16.)).child(label("Posted to", "accounts")).child(post)) + .child(div().flex().items_center().gap(px(16.)).child(label("Every", "schedule")).child(every)) .child(div().flex().gap(px(8.)) .child(primary("make-flow", "Make the flow", b).on_click(cx.listener(|this, _, window, cx| { let Some(src) = this.flow_source.clone() else { return }; diff --git a/src/app/icons.rs b/src/app/icons.rs index 9957352..d6a744a 100644 --- a/src/app/icons.rs +++ b/src/app/icons.rs @@ -6,7 +6,7 @@ use gpui_kit::{img, Hsla, Image, ImageFormat, Img, Rgba, Styled}; use std::sync::{Arc, LazyLock}; gpui_kit::assets::icon_assets!(pub Extra, [Trash, Rss, Film, Package, Download, Share2, Zap, Store, SquarePen, SlidersHorizontal, KeyRound, Brain, Library, PanelLeft, - Upload, FileDown, GitBranch, ExternalLink, Gauge, Box, ChevronDown, LockOpen, Lock, Check, RotateCcw, ChevronRight, Pause, Volume2, VolumeX]); + Upload, FileDown, GitBranch, ExternalLink, Gauge, Box, ChevronDown, LockOpen, Lock, Check, RotateCcw, ChevronRight, Pause, Volume2, VolumeX, ArrowLeft, ArrowRight, ChevronUp]); #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub enum Icon { @@ -55,6 +55,9 @@ pub enum Icon { Pause, Volume, Mute, + Back, + Forward, + ChevronUp, } fn name(i: Icon) -> IconName { @@ -103,6 +106,9 @@ fn name(i: Icon) -> IconName { Icon::Pause => IconName::Pause, Icon::Volume => IconName::Volume2, Icon::Mute => IconName::VolumeX, + Icon::Back => IconName::ArrowLeft, + Icon::Forward => IconName::ArrowRight, + Icon::ChevronUp => IconName::ChevronUp, } } @@ -190,7 +196,7 @@ pub fn illustration(name: &str) -> Img { match name { $($f => include_str!(concat!("../../assets/illustrations/", $f, ".svg")),)* _ => include_str!("../../assets/illustrations/styles.svg") } }; } - let src = art!("styles", "topics", "automations", "skills", "scene", "library", "search", "community", "hello", "brain", "agents", "accounts", "folder", "ready"); + let src = art!("styles", "topics", "automations", "skills", "scene", "library", "search", "community", "hello", "brain", "agents", "accounts", "folder", "ready", "schedule"); // on a dark page the pale backdrop would turn muddy: it is drawn whole, as a sticker let dark = ILLUSTRATIONS_DARK.load(std::sync::atomic::Ordering::Relaxed); picture(&format!("art:{name}:{dark}"), || { diff --git a/src/app/marketplace.rs b/src/app/marketplace.rs index b2bb657..ff20a1d 100644 --- a/src/app/marketplace.rs +++ b/src/app/marketplace.rs @@ -290,8 +290,21 @@ impl Workspace { .child(div().flex().items_center().gap(px(8.)).child(text(if on { "On" } else { "Off" }, 13., BOLD, if on { b.ink } else { b.gray })).child(toggle))) .child(text(p.description.clone(), 15., LIGHT, b.ink)) .when(!inside.is_empty(), |d| d.child(card(&b).bg(b.page).gap(px(4.)) - .child(text(if !p.presets.is_empty() { "Its styles" } else if !p.topics.is_empty() { "Its topics" } else { "What it does" }, 13., BOLD, b.gray).pb(px(4.))) + .child(div().flex().items_center().gap(px(8.)).pb(px(4.)) + .child(illustration(art(&p)).w(px(40.)).h(px(30.))) + .child(text(if !p.presets.is_empty() { "Its styles" } else if !p.topics.is_empty() { "Its topics" } else { "What it does" }, 13., BOLD, b.gray))) .children(inside))) + // a pack that runs by itself: how it goes, each step with its illustration + .when(runs_something(&p.kinds) || p.is("feed"), |d| d.child(card(&b).bg(b.page).gap(px(12.)) + .child(text("How it runs", 13., BOLD, b.gray)) + .child(div().flex().items_center().gap(px(8.)).children([ + ("topics", if p.is("feed") { "A new story comes in" } else if p.is("source") { "It finds something new" } else { "An edit is ready" }), + ("styles", "edits makes the video"), + ("accounts", if p.is("automation") { "It goes up on your account" } else { "It is posted, if you say where" }), + ].into_iter().enumerate().map(|(i, (a, said))| div().flex_1().flex().flex_col().items_center().gap(px(4.)) + .child(illustration(a).w(px(72.)).h(px(54.))) + .child(text(format!("{}. {said}", i + 1), 12., FontWeight::NORMAL, b.ink).text_center())))) + .when(!on, |d| d.child(text("It starts off: turn it on above when you want it to run.", 12., LIGHT, b.gray))))) .children(p.from.clone().map(|f| text(format!("From {f}"), 12., FontWeight::NORMAL, b.gray))) .child(div().pt(px(8.)).border_t_1().border_color(b.hair).flex().flex_wrap().items_center().gap(px(8.)).children(actions))); Some(div().absolute().inset_0().flex().items_center().justify_center().child(backdrop).child(body).into_any_element()) diff --git a/src/app/mod.rs b/src/app/mod.rs index 65228f1..01ba4ae 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -24,6 +24,7 @@ use std::path::PathBuf; actions!(edits, [Quit, ToggleSidebar, Search]); + /// gpui-kit's own icons, and the Lucide ones the app adds. struct AppAssets; @@ -50,7 +51,42 @@ extern "system" { fn FreeConsole() -> i32; } +/// The app in the Linux launcher: its icon in the user's icon theme and a .desktop entry naming it, written again when +/// they differ (an old install pointed at a stock icon that shows blank). Done each start, so `edits update` mends it. +pub fn launcher() -> std::io::Result<()> { + if !cfg!(target_os = "linux") { + return Ok(()); + } + let data = std::env::var_os("XDG_DATA_HOME").map(PathBuf::from).unwrap_or_else(|| crate::util::home().join(".local/share")); + let exe = std::env::current_exe()?; + // a cargo build is someone working on edits: the launcher stays on the installed one + if exe.components().any(|c| c.as_os_str() == "target") { + return Ok(()); + } + let files: [(PathBuf, Vec); 3] = [ + (data.join("icons/hicolor/scalable/apps/edits.svg"), include_bytes!("../../assets/icon.svg").to_vec()), + (data.join("icons/hicolor/512x512/apps/edits.png"), include_bytes!("../../assets/icon.png").to_vec()), + (data.join("applications/edits.desktop"), desktop_entry(&exe).into_bytes()), + ]; + for (f, bytes) in files { + if std::fs::read(&f).ok().as_deref() != Some(&bytes[..]) { + std::fs::create_dir_all(f.parent().unwrap_or(std::path::Path::new(".")))?; + std::fs::write(&f, bytes)?; + } + } + Ok(()) +} + +pub fn desktop_entry(exe: &std::path::Path) -> String { + format!("[Desktop Entry]\nType=Application\nName=EditsMaker\nComment=The AI video harness.\nExec={} app\nIcon=edits\nCategories=AudioVideo;Video;\nStartupWMClass=edits\n", exe.display()) +} + pub fn run(args: &[String]) { + let _ = launcher(); + // the installer's step: the launcher written, nothing opened + if args.iter().any(|a| a == "--launcher") { + return; + } // started from the Start menu, edits.exe has a console it does not need #[cfg(windows)] unsafe { @@ -110,3 +146,12 @@ pub fn run(args: &[String]) { cx.activate(true); }); } + +#[cfg(test)] +mod launcher_tests { + #[test] + fn the_launcher_names_its_own_icon() { + let d = super::desktop_entry(std::path::Path::new("/home/a/.local/bin/edits")); + assert!(d.contains("Icon=edits\n") && d.contains("Exec=/home/a/.local/bin/edits app\n") && !d.contains("video-x-generic")); + } +} diff --git a/src/app/review.rs b/src/app/review.rs index cc672b8..1da2e03 100644 --- a/src/app/review.rs +++ b/src/app/review.rs @@ -211,7 +211,25 @@ impl Workspace { .child(text(n.text.clone(), 14., LIGHT, b.ink)) .into_any_element() }).collect::>(); - div().size_full().flex().flex_col() + let focus = self.review_focus.clone(); + div().id("editor").size_full().flex().flex_col().track_focus(&focus) + // a click on the picture or the bare page gives the player the keys + .on_mouse_down(MouseButton::Left, cx.listener(|this, _, window, cx| window.focus(&this.review_focus, cx))) + // as any player: Space plays and pauses, the arrows step a second; only when no field has the keys + .on_key_down(cx.listener(|this, e: &KeyDownEvent, window, cx| { + if !this.review_focus.is_focused(window) { + return; + } + let Some(p) = this.review.as_mut().and_then(|r| r.player.as_mut()) else { return }; + match e.keystroke.key.as_str() { + "space" => p.toggle(), + "left" => p.seek(p.position() - 1.), + "right" => p.seek(p.position() + 1.), + _ => return, + } + cx.stop_propagation(); + cx.notify(); + })) .child(div().h(HEADER).flex_none().px(px(24.)).flex().items_center().gap(px(8.)).border_b_1().border_color(b.hair) .child(icon(Icon::Eye, b.gray).size(px(16.))) .child(text(name, 14., BOLD, b.ink).flex_none()) diff --git a/src/app/settings.rs b/src/app/settings.rs index 383cb89..54b9443 100644 --- a/src/app/settings.rs +++ b/src/app/settings.rs @@ -22,7 +22,7 @@ const SECTIONS: &[(Section, &str, Icon, &str)] = &[ (Section::Accounts, "Accounts", Icon::User, "accounts connect sign in tiktok youtube instagram bluesky facebook post"), (Section::Agents, "Agents", Icon::Terminal, "agents mcp server skills claude code chatgpt cursor tools"), (Section::Usage, "Usage", Icon::Usage, "usage how many edits clips space disk ai calls requests time spent stats"), - (Section::Appearance, "Appearance", Icon::Palette, "appearance theme dark light system omarchy accent colour color chat width text size font"), + (Section::Appearance, "Appearance", Icon::Palette, "appearance theme themes dark light system omarchy dracula nord catppuccin tokyo night gruvbox one dark rose pine solarized everforest accent colour color chat width text size font"), (Section::About, "About", Icon::Info, "about version github x twitter author issues program updates update rollback latest release check doctor ffmpeg yt-dlp whisper terms of use privacy license legal"), ]; @@ -307,7 +307,7 @@ impl Workspace { vec![group("", vec![ row("Where edits go", s.out.display().to_string(), pill("out", Some(Icon::Folder), "Open", false, b).on_click(move |_, _, cx| cx.open_with_system(&out)), true, b).into_any_element(), row("What renders the video", "auto uses the graphics card when it works, else the processor.", self.choice("encoder", &s.encoders, &s.encoder, &["encoder"], b, cx), false, b).into_any_element(), - row("Discord", "Shows Playing EditsMaker on your profile and what you are making. Your friends also see a Download button: Discord never shows you your own.", + row("Discord", "Show what you are making on your Discord profile.", Switch::new("discord").checked(theme::prefs().discord).on_click(|on: &bool, window, cx| theme::save(&Prefs { discord: *on, ..theme::prefs() }, window, cx)), false, b).into_any_element(), ], b).into_any_element()] } @@ -334,8 +334,13 @@ impl Workspace { row(&a.name, format!("{} · {}", a.platform, a.user), self.button(("disconnect", i), "Disconnect", &["disconnect", &a.name], b, cx), i == 0, b).into_any_element() }).collect(); let first = rows.is_empty(); - let sites = div().flex().gap(px(8.)).children(s.sites.iter().enumerate().map(|(i, site)| self.button(("connect", i), site, &["connect", site], b, cx))); - rows.push(row("Connect an account", "Signs in once in a window of its own; edits never sees the password.", sites, first, b).into_any_element()); + if s.sites.is_empty() { + // posting is a pack that starts off + rows.push(row("Connect an account", "Posting is off until the Post pack is on.", self.button("post-on", "Turn on Post", &["packs", "on", "edits.post"], b, cx), first, b).into_any_element()); + } else { + let sites = div().flex().gap(px(8.)).children(s.sites.iter().enumerate().map(|(i, site)| self.button(("connect", i), site, &["connect", site], b, cx))); + rows.push(row("Connect an account", "Signs in once in a window of its own; edits never sees the password.", sites, first, b).into_any_element()); + } let token = |i: usize, platform: &'static str, b: &Brand, cx: &mut Context| { let [who, secret] = [self.sign_in[i * 2].clone(), self.sign_in[i * 2 + 1].clone()]; div().flex().items_center().gap(px(8.)) @@ -460,10 +465,12 @@ impl Workspace { let d = Prefs::default(); let omarchy = theme::omarchy_dir().is_some(); let on_omarchy = p.mode == "omarchy" && omarchy; + // a theme from the library: the mode tiles are not what is in use + let on_named = p.mode.starts_with("theme:") && theme::named(&p.mode[6..]).is_some(); let accent = theme::hex_of(&p.accent); let (light, dark) = (theme::palette(false, accent), theme::palette(true, accent)); let tiles = [("system", "System"), ("light", "Light"), ("dark", "Dark")].into_iter().map(|(m, label)| { - let on = !on_omarchy && p.mode == m; + let on = !on_omarchy && !on_named && p.mode == m; let preview = match m { "light" => wireframe(&light).w_full(), "dark" => wireframe(&dark).w_full(), @@ -477,21 +484,26 @@ impl Workspace { theme::save(&Prefs { mode: m.into(), mode_picked: true, ..theme::prefs() }, window, cx); })).into_any_element() }).collect::>(); - // the theme library: EditsMaker's colours, and Omarchy's - let mut themes: Vec<(&'static str, String, String, Brand)> = vec![("edits", "EditsMaker".into(), "Ink and paper, one warm grey, your accent".into(), if theme::is_dark(cx) && !on_omarchy { dark } else { light })]; + // the theme library: EditsMaker's colours, Omarchy's, then the editor themes everyone knows + let mut themes: Vec<(String, String, String, Brand)> = vec![("edits".into(), "EditsMaker".into(), "Ink and paper, your accent".into(), if theme::is_dark(cx) && !on_omarchy && !on_named { dark } else { light })]; if omarchy { let name = std::fs::read_to_string(crate::util::home().join(".local/state/omarchy/current/theme.name")).unwrap_or_default(); if let Some(ob) = theme::omarchy_brand() { - themes.push(("omarchy", format!("Omarchy · {}", name.trim()), "Follows the theme you pick in Omarchy, live".into(), ob)); + themes.push(("omarchy".into(), format!("Omarchy · {}", name.trim()), "Follows Omarchy, live".into(), ob)); + } + } + for &(id, name, dark_, _) in theme::THEMES { + if let Some((c, _)) = theme::named(id) { + themes.push((format!("theme:{id}"), name.into(), if dark_ { "Dark".into() } else { "Light".into() }, c)); } } let cards = themes.into_iter().map(|(id, label, about, c)| { - let on = if id == "omarchy" { on_omarchy } else { !on_omarchy }; + let on = match id.as_str() { "omarchy" => on_omarchy, "edits" => !on_omarchy && !on_named, m => p.mode == m }; let hover = b.accent.opacity(0.06); - div().id(SharedString::from(format!("theme-{id}"))).flex_1().min_w(px(220.)).p(px(12.)).flex().items_center().gap(px(12.)).rounded(px(12.)).cursor_pointer() + div().id(SharedString::from(format!("theme-{id}"))).w(relative(0.32)).min_w(px(180.)).p(px(12.)).flex().items_center().gap(px(12.)).rounded(px(12.)).cursor_pointer() .bg(if on { b.accent.opacity(0.14) } else { b.page }).border_1().border_color(if on { b.accent } else { b.hair }) .when(!on, |d| d.hover(move |s| s.bg(hover))) - .child(div().size(px(40.)).flex_none().rounded_full().overflow_hidden().border_1().border_color(b.hair).flex() + .child(div().size(px(36.)).flex_none().rounded_full().overflow_hidden().border_1().border_color(b.hair).flex() .child(div().w(relative(0.5)).h_full().bg(c.page)).child(div().w(relative(0.5)).h_full().bg(c.card).flex().items_center().justify_center().child(div().size(px(8.)).rounded_full().bg(c.accent)))) .child(div().flex_1().min_w_0().flex().flex_col().gap(px(2.)) .child(text(label, 13., BOLD, b.ink).truncate()) @@ -499,8 +511,8 @@ impl Workspace { .when(on, |d| d.child(icon(Icon::Check, b.accent).size(px(16.)))) .on_click(cx.listener(move |_, _, window, cx| { let p = theme::prefs(); - // back from Omarchy: the mode picked before, else the system's - let mode = if id == "omarchy" { "omarchy".to_string() } else if p.mode == "omarchy" { "system".into() } else { p.mode.clone() }; + // back to EditsMaker's own: the mode picked before, else the system's + let mode = if id != "edits" { id.clone() } else if p.mode == "omarchy" || p.mode.starts_with("theme:") { "system".to_string() } else { p.mode.clone() }; theme::save(&Prefs { mode, mode_picked: true, ..p }, window, cx); })) .into_any_element() @@ -514,8 +526,8 @@ impl Workspace { .on_click(cx.listener(move |_, _, window, cx| theme::save(&f(theme::prefs()), window, cx))).into_any_element() }; // t3code's accent; Omarchy's own when following Omarchy - let accents: AnyElement = if on_omarchy { - text("Omarchy's accent", 13., FontWeight::NORMAL, b.gray).into_any_element() + let accents: AnyElement = if on_omarchy || on_named { + text("The theme's own", 13., FontWeight::NORMAL, b.gray).into_any_element() } else { div().flex().items_center().gap(px(8.)).child(reset("reset-accent", p.accent != d.accent, |p| Prefs { accent: Prefs::default().accent, ..p }, b, cx)) .children(theme::ACCENTS.iter().enumerate().map(|(i, &(name, hexv))| { diff --git a/src/app/sidebar.rs b/src/app/sidebar.rs index 74b98ee..ff6280f 100644 --- a/src/app/sidebar.rs +++ b/src/app/sidebar.rs @@ -4,7 +4,7 @@ //! then the thread's title. Collapsed (the panel button, Ctrl+B) it is a rail of the places' icons. use crate::app::icons::{icon, Icon}; use crate::app::runs; -use crate::app::theme::{brand, Brand, BOLD, HEADER, SIDEBAR, SMALL}; +use crate::app::theme::{brand, Brand, BOLD, HEADER, SMALL}; use crate::app::ui::{badge, icon_button, text}; use crate::app::workspace::{Route, Section, Workspace}; use gpui_kit::component::input::Input; @@ -114,20 +114,45 @@ impl Workspace { rows.retain(|r| matches(&q, &r.subject, &r.title)); let empty = rows.is_empty(); let list: Vec = rows.into_iter().enumerate().map(|(i, r)| self.row(i, r, &b, cx).into_any_element()).collect(); - div().w(SIDEBAR).h_full().flex_none().flex().flex_col().border_r_1().border_color(b.hair) - .child(div().h(HEADER).flex_none().pl(px(16.)).pr(px(8.)).flex().items_center().gap(px(8.)) + let nav = |id: &'static str, i: Icon, tip: &'static str, ahead: bool, can: bool, b: &Brand, cx: &mut Context| { + icon_button(id, i, b).size(px(28.)).when(!can, |d| d.opacity(0.35)) + .tooltip(move |w, cx| gpui_kit::component::tooltip::Tooltip::new(tip).build(w, cx)) + .on_click(cx.listener(move |this, _, _, cx| this.step(ahead, cx))) + }; + let (can_back, can_forward) = (!self.back.is_empty(), !self.forward.is_empty()); + let hover = b.card; + div().w(px(self.sidebar_w)).h_full().flex_none().relative().flex().flex_col().border_r_1().border_color(b.hair) + .child(div().h(HEADER).flex_none().pl(px(12.)).pr(px(8.)).flex().items_center().gap(px(4.)) // macOS draws its window buttons here .when(cfg!(target_os = "macos"), |d| d.pl(px(80.))) - .child(crate::app::icons::mark(b.ink).size(px(20.))) - .child(text("EditsMaker", 15., BOLD, b.ink).flex_1()) + // the mark and the name: a new edit, as t3code's brand starts a new thread + .child(div().id("brand").flex().items_center().gap(px(8.)).px(px(4.)).h(px(32.)).rounded(SMALL).cursor_pointer().hover(move |s| s.bg(hover)) + .tooltip(|w, cx| gpui_kit::component::tooltip::Tooltip::new("New edit").build(w, cx)) + .child(crate::app::icons::mark(b.ink).size(px(20.))) + .child(text("EditsMaker", 15., BOLD, b.ink)) + .on_click(cx.listener(|this, _, window, cx| { + this.go(Route::New, cx); + this.input.update(cx, |s, cx| s.focus(window, cx)); + }))) + .child(nav("nav-back", Icon::Back, "Back", false, can_back, &b, cx)) + .child(nav("nav-forward", Icon::Forward, "Forward", true, can_forward, &b, cx)) + .child(div().flex_1()) .child(toggle)) + // the search first: it reaches everything below it + .child(div().px(px(8.)).pb(px(8.)).child(Input::new(&self.thread_search).prefix(icon(Icon::Search, b.gray).size(px(14.))).suffix(shortcut(&b)).cleanable(true))) .child(div().px(px(8.)).flex().flex_col().gap(px(2.)).children(places)) - .child(div().px(px(8.)).pt(px(16.)).child(Input::new(&self.thread_search).prefix(icon(Icon::Search, b.gray).size(px(14.))).suffix(shortcut(&b)).cleanable(true))) .child(text("Edits", 12., FontWeight::NORMAL, b.gray).px(px(16.)).pt(px(16.)).pb(px(8.))) .child(div().id("threads").flex_1().min_h_0().overflow_y_scroll().px(px(8.)).pb(px(8.)).flex().flex_col().gap(px(2.)).children(list) .when(empty, |d| d.child(text(if q.trim().is_empty() { "Nothing made yet." } else { "No edit like that." }, 13., crate::app::theme::LIGHT, b.gray).px(px(8.))))) // t3code keeps its settings at the foot of the sidebar, and opens them over everything .child(div().flex_none().p(px(8.)).border_t_1().border_color(b.hair).child(settings)) + // its edge, to drag wider or narrower + .child(div().id("sidebar-edge").absolute().top_0().bottom_0().right(px(-3.)).w(px(6.)).cursor_col_resize() + .hover(move |s| s.bg(hover)) + .on_mouse_down(MouseButton::Left, cx.listener(|this, _, _, cx| { + this.sidebar_drag = true; + cx.notify(); + }))) .into_any_element() } } diff --git a/src/app/theme.rs b/src/app/theme.rs index f79b79d..c751f5b 100644 --- a/src/app/theme.rs +++ b/src/app/theme.rs @@ -40,10 +40,32 @@ fn parse(s: &str) -> Option { u32::from_str_radix(s.trim().trim_start_matches('#'), 16).ok().filter(|_| s.trim().len() == 7).map(hex) } +/// Themes to pick besides EditsMaker's own and Omarchy's, as t3code's theme library offers them: (id, name, dark, +/// page, card, hairline, ink, grey, red, accent), each from the theme's published palette. +pub const THEMES: &[(&str, &str, bool, [u32; 7])] = &[ + ("dracula", "Dracula", true, [0x282A36, 0x343746, 0x44475A, 0xF8F8F2, 0x8B93B8, 0xFF5555, 0xBD93F9]), + ("nord", "Nord", true, [0x2E3440, 0x3B4252, 0x434C5E, 0xECEFF4, 0x9AA5B8, 0xBF616A, 0x88C0D0]), + ("catppuccin-mocha", "Catppuccin Mocha", true, [0x1E1E2E, 0x313244, 0x45475A, 0xCDD6F4, 0x9399B2, 0xF38BA8, 0xCBA6F7]), + ("catppuccin-latte", "Catppuccin Latte", false, [0xEFF1F5, 0xE6E9EF, 0xCCD0DA, 0x4C4F69, 0x7C7F93, 0xD20F39, 0x8839EF]), + ("tokyo-night", "Tokyo Night", true, [0x1A1B26, 0x24283B, 0x414868, 0xC0CAF5, 0x787C99, 0xF7768E, 0x7AA2F7]), + ("gruvbox", "Gruvbox", true, [0x282828, 0x3C3836, 0x504945, 0xEBDBB2, 0xA89984, 0xFB4934, 0xFABD2F]), + ("one-dark", "One Dark", true, [0x282C34, 0x2C313A, 0x3E4451, 0xABB2BF, 0x7F848E, 0xE06C75, 0x61AFEF]), + ("rose-pine", "Rosé Pine", true, [0x191724, 0x1F1D2E, 0x26233A, 0xE0DEF4, 0x908CAA, 0xEB6F92, 0xC4A7E7]), + ("solarized-light", "Solarized Light", false, [0xFDF6E3, 0xEEE8D5, 0xDDD6C1, 0x073642, 0x657B83, 0xDC322F, 0x268BD2]), + ("everforest", "Everforest", true, [0x2D353B, 0x343F44, 0x475258, 0xD3C6AA, 0x859289, 0xE67E80, 0xA7C080]), +]; + +/// One of THEMES as brand colours, and whether it is dark. +pub fn named(id: &str) -> Option<(Brand, bool)> { + THEMES.iter().find(|t| t.0 == id).map(|&(_, _, dark, c)| { + (Brand { page: hex(c[0]), card: hex(c[1]), hair: hex(c[2]), ink: hex(c[3]), gray: hex(c[4]), red_text: hex(c[5]), accent: hex(c[6]) }, dark) + }) +} + /// What Settings > Appearance chose, after t3code's appearance settings. #[derive(Clone, Serialize, Deserialize, PartialEq)] pub struct Prefs { - /// system, light, dark or omarchy + /// system, light, dark, omarchy, or theme:ID (one of THEMES) pub mode: String, /// the chat column: narrow, normal, wide pub width: String, @@ -149,6 +171,9 @@ pub fn brand(cx: &App) -> Brand { return b; } } + if let Some((b, _)) = p.mode.strip_prefix("theme:").and_then(named) { + return b; + } palette(Theme::global(cx).is_dark(), hex_of(&p.accent)) } @@ -174,6 +199,10 @@ pub fn apply(window: Option<&mut Window>, cx: &mut App) { ("light", _) => Theme::change(ThemeMode::Light, window, cx), ("dark", _) => Theme::change(ThemeMode::Dark, window, cx), ("omarchy", Some((_, dark))) => Theme::change(if dark { ThemeMode::Dark } else { ThemeMode::Light }, window, cx), + (m, _) if m.strip_prefix("theme:").and_then(named).is_some() => { + let dark = m.strip_prefix("theme:").and_then(named).is_some_and(|t| t.1); + Theme::change(if dark { ThemeMode::Dark } else { ThemeMode::Light }, window, cx) + } _ => Theme::sync_system_appearance(window, cx), } let b = brand(cx); @@ -192,6 +221,14 @@ pub fn apply(window: Option<&mut Window>, cx: &mut App) { mod tests { use super::parse; + #[test] + fn every_theme_reads() { + for t in super::THEMES { + assert!(super::named(t.0).is_some_and(|x| x.1 == t.2), "{}", t.0); + } + assert!(super::named("nope").is_none()); + } + #[test] fn omarchy_colours_read() { assert!(parse("#89b4fa").is_some() && parse("\"#1e1e2e\"".trim_matches('"')).is_some()); diff --git a/src/app/workspace.rs b/src/app/workspace.rs index 6a9a87d..867b0c9 100644 --- a/src/app/workspace.rs +++ b/src/app/workspace.rs @@ -130,8 +130,13 @@ pub struct Workspace { pub review: Option, /// started by `edits review CLIP`: saving the notes closes the app pub review_only: bool, - /// the sidebar, open or a rail of icons (Ctrl+B) + /// the sidebar, open or a rail of icons (Ctrl+B), its width, and whether its edge is being dragged pub sidebar_open: bool, + pub sidebar_w: f32, + pub sidebar_drag: bool, + /// t3code's back and forward: the places been to, and the ones gone back from + pub back: Vec, + pub forward: Vec, /// t3code's thread search, the marketplace's search, and a pack's git address pub thread_search: Entity, pub market_search: Entity, @@ -143,6 +148,10 @@ pub struct Workspace { pub welcome_step: usize, /// Bluesky's handle and app password, Facebook's Page and token: signed in here, not in a terminal pub sign_in: [Entity; 4], + /// the editor's keys (Space, the arrows) + pub review_focus: FocusHandle, + /// the timeline's scroll, for t3code's minimap beside it + pub timeline_scroll: ScrollHandle, /// what Usage counts, read when it opens pub usage: Option, _subscriptions: Vec, @@ -217,7 +226,7 @@ impl Workspace { let mut this = Self { input, settings_open: None, ai_open: None, ai_key, ai_endpoint, ai_models: None, ai_adding: false, ai_more: false, settings_search, welcome: review.is_none() && !theme::prefs().onboarded, files: vec![], preset: None, overlay: None, post: vec![], picker: None, flows: None, flow_source: None, flow_post: vec![], flow_every: 60, jobs: vec![], past: runs::past(&runs::out_dir()), route: Route::New, show_log: false, market: Market::default(), settings: None, doctor: None, latest: None, changing: None, review: None, review_only: review.is_some(), - sidebar_open: true, thread_search, market_search, library_search, git_url, model_lists: Default::default(), welcome_step: 0, sign_in, usage: None, _subscriptions: subscriptions }; + sidebar_open: true, sidebar_w: f32::from(theme::SIDEBAR), sidebar_drag: false, back: vec![], forward: vec![], thread_search, market_search, library_search, git_url, model_lists: Default::default(), welcome_step: 0, sign_in, timeline_scroll: ScrollHandle::new(), review_focus: cx.focus_handle(), usage: None, _subscriptions: subscriptions }; crate::app::discord::start(); // the composer's model picker shows the AI in use from the start this.load_settings(cx); @@ -231,6 +240,25 @@ impl Workspace { } pub fn go(&mut self, to: Route, cx: &mut Context) { + if to != self.route { + self.back.push(self.route); + self.back.truncate(50); + self.forward.clear(); + } + self.visit(to, cx); + } + + /// Back (or forward, `ahead`) one place, as a browser's buttons. + pub fn step(&mut self, ahead: bool, cx: &mut Context) { + let (from, to) = if ahead { (&mut self.forward, &mut self.back) } else { (&mut self.back, &mut self.forward) }; + let Some(r) = from.pop() else { return }; + to.push(self.route); + // a review left behind is gone: step past it + let r = if r == Route::Review && self.review.is_none() { Route::New } else { r }; + self.visit(r, cx); + } + + fn visit(&mut self, to: Route, cx: &mut Context) { if to != Route::Review { if let Some(p) = self.review.as_mut().and_then(|r| r.player.as_mut()) { p.pause(); @@ -513,6 +541,10 @@ impl Workspace { _ => {} } this.load_settings(cx); + // a pack turned on or off here shows so in the marketplace too + if what.starts_with("packs ") { + this.load_market(cx); + } if this.route == Route::Automations { this.load_flows(cx); } @@ -560,7 +592,12 @@ impl Workspace { } })); self.review = Some(Review { clip: clip.clone(), sheet: None, at: 0, spot: None, notes: vec![], note, general, player: None }); + if self.route != Route::Review { + self.back.push(self.route); + self.forward.clear(); + } self.route = Route::Review; + window.focus(&self.review_focus, cx); let c = clip.clone(); cx.spawn(async move |this, cx| { let p = cx.background_executor().spawn(async move { crate::app::player::Player::open(&c, 0.0) }).await; @@ -656,6 +693,25 @@ impl Render for Workspace { } })) .on_action(cx.listener(|this, _: &crate::app::ToggleSidebar, _, cx| this.toggle_sidebar(cx))) + // the sidebar's edge, dragged: its width follows the pointer; pulled narrow it folds to the rail + .on_mouse_move(cx.listener(|this, e: &MouseMoveEvent, _, cx| { + if this.sidebar_drag { + let x = f32::from(e.position.x); + if x < 160. { + this.sidebar_open = false; + } else { + this.sidebar_open = true; + this.sidebar_w = x.clamp(200., 440.); + } + cx.notify(); + } + })) + .on_mouse_up(MouseButton::Left, cx.listener(|this, _, _, cx| { + if this.sidebar_drag { + this.sidebar_drag = false; + cx.notify(); + } + })) // t3code's search shortcut: the search of the page in view, else the edits' in the sidebar .on_action(cx.listener(|this, _: &crate::app::Search, window, cx| { let s = match this.route { diff --git a/src/packs.rs b/src/packs.rs index 86d126b..13be72c 100644 --- a/src/packs.rs +++ b/src/packs.rs @@ -491,21 +491,52 @@ fn disabled_file() -> PathBuf { } /// The packs turned off. +/// The packs turned on by hand that start off (packs-on.json). +fn enabled_file() -> PathBuf { + crate::util::home().join(".config/edits/packs-on.json") +} + +fn read_list(f: &Path) -> Vec { + std::fs::read_to_string(f).ok().and_then(|t| serde_json::from_str(&t).ok()).unwrap_or_default() +} + +/// A pack that runs on its own (posts, finds things, follows feeds) starts off: it is turned on by hand, once. +pub fn starts_off(m: &Manifest) -> bool { + m.kinds.iter().any(|k| k == "automation" || k == "source" || k == "feed") +} + +/// Whether a pack is off: turned off by hand, or one that starts off and was never turned on. +pub fn is_off(m: &Manifest, off: &[String], on: &[String]) -> bool { + off.contains(&m.id) || (starts_off(m) && !on.contains(&m.id)) +} + +/// Every pack that is off now. Tests see every pack on: they must not hang on this computer's choices (is_off's own +/// test covers which start off). pub fn disabled() -> Vec { - std::fs::read_to_string(disabled_file()).ok().and_then(|t| serde_json::from_str(&t).ok()).unwrap_or_default() + if cfg!(test) { + return vec![]; + } + let (off, on) = (read_list(&disabled_file()), read_list(&enabled_file())); + every().iter().filter(|p| is_off(&p.manifest, &off, &on)).map(|p| p.manifest.id.clone()).collect() +} + +/// The words that say how to turn a pack on, for an error that met it off. +pub fn turn_on(id: &str) -> String { + format!("{id} is off: turn it on in the app's Automations, or edits packs on {id}") } /// Turns a pack on or off; any pack, built in too. An off pack's preset, skill, feeds and automation are not used. pub fn enable(id: &str, on: bool) -> Result { let p = every().into_iter().find(|p| p.manifest.id == id).ok_or(format!("no pack \"{id}\" (edits packs lists them)"))?; - let mut off = disabled(); - off.retain(|x| x != id); - if !on { - off.push(id.to_string()); + for (f, add) in [(disabled_file(), !on), (enabled_file(), on)] { + let mut list = read_list(&f); + list.retain(|x| x != id); + if add { + list.push(id.to_string()); + } + std::fs::create_dir_all(f.parent().unwrap_or(Path::new("."))).map_err(|e| e.to_string())?; + std::fs::write(&f, serde_json::to_string_pretty(&list).unwrap_or_default()).map_err(|e| e.to_string())?; } - let f = disabled_file(); - std::fs::create_dir_all(f.parent().unwrap_or(Path::new("."))).map_err(|e| e.to_string())?; - std::fs::write(&f, serde_json::to_string_pretty(&off).unwrap_or_default()).map_err(|e| e.to_string())?; Ok(p) } @@ -962,6 +993,16 @@ pub fn gallery(d: &Path) -> Result { mod tests { use super::*; + #[test] + fn packs_that_run_alone_start_off() { + let by = |id: &str| built_in().into_iter().find(|p| p.manifest.id == id).unwrap().manifest; + let none: Vec = vec![]; + assert!(is_off(&by("edits.post"), &none, &none) && is_off(&by("edits.news"), &none, &none), "posting and feeds start off"); + assert!(!is_off(&by("edits.spin"), &none, &none), "styles start on"); + assert!(!is_off(&by("edits.news"), &none, &["edits.news".into()]), "turned on, it stays on"); + assert!(is_off(&by("edits.spin"), &["edits.spin".into()], &none)); + } + #[test] fn a_pack_carries_at_most_three_of_the_ten_tags() { assert_eq!(tidy_tags(&["slow", "9:16", "velocity", "rgb", "fade", "comic"]), ["hype", "glitch", "sad"]); diff --git a/src/rss.rs b/src/rss.rs index 696a736..d26a429 100644 --- a/src/rss.rs +++ b/src/rss.rs @@ -81,8 +81,14 @@ pub fn resolve(what: &str) -> Result<(Vec, Option), String> { } } let names = [want.clone(), format!("edits.rss-{want}"), format!("edits.{want}")]; - let p = packs::all().into_iter().find(|p| !p.manifest.feeds.is_empty() && names.contains(&p.manifest.id)) - .ok_or(format!("no feed pack or topic \"{what}\": edits packs lists them (the RSS ones say feed), or give a feed's address"))?; + let is = |p: &packs::Pack| p.manifest.topics.iter().any(|t| t.key == key) || (!p.manifest.feeds.is_empty() && names.contains(&p.manifest.id)); + let p = packs::all().into_iter().find(|p| !p.manifest.feeds.is_empty() && names.contains(&p.manifest.id)).ok_or_else(|| { + // in a pack that is off: say how to turn it on + match packs::every().into_iter().find(|p| is(p)) { + Some(off) => packs::turn_on(&off.manifest.id), + None => format!("no feed pack or topic \"{what}\": edits packs lists them (the RSS ones say feed), or give a feed's address"), + } + })?; let preset = p.preset.as_deref().and_then(|t| serde_json::from_str::(t).ok()).map(|p| p.name); Ok((p.manifest.feeds, preset)) } diff --git a/src/social.rs b/src/social.rs index 53e090a..bb02207 100644 --- a/src/social.rs +++ b/src/social.rs @@ -58,7 +58,10 @@ pub fn pick(names: &str) -> Result, String> { /// (sign-in page, page to post from, cookie that says signed in, its domain, the page script). fn site(platform: &str) -> Result<(String, String, String, String, String), String> { let p = crate::packs::all().into_iter().find(|p| p.automations().iter().any(|a| a.0.site == platform)) - .ok_or(format!("nothing posts to {platform}: edits connect {}, or an automation pack from edits packs browse", PLATFORMS.join("|")))?; + .ok_or_else(|| match crate::packs::every().into_iter().find(|p| p.automations().iter().any(|a| a.0.site == platform)) { + Some(off) => crate::packs::turn_on(&off.manifest.id), + None => format!("nothing posts to {platform}: edits connect {}, or an automation pack from edits packs browse", PLATFORMS.join("|")), + })?; if !crate::packs::trusted(&p) { let id = &p.manifest.id; return Err(format!("{id} runs in your signed-in {platform}: read what it runs in {} first, then edits packs trust {id}", crate::packs::dir().join(id).display()));