use std::cell::RefCell; use std::collections::HashMap; use std::process::Command; use amane::{ Center, Color, Column, Cursor, End, Full, Key, Padding, Rectangle, Row, ScrollArea, Service, SpaceBetween, Stack, Start, Text, TextInput, Weight, Widget, Window, children, close_window, open_window, window_size, }; use crate::config::{self, Kind, Opt}; use crate::hypr::{self, Hypr, HyprOption}; use crate::parse::{HyprKind, Value}; use crate::theme::{self, Colors}; /* * the config window: every shell setting (config.rs) and every Hyprland option (hypr.rs) * on pages in a sidebar, with a search over all of them. a normal window, opened from the * control centre's Settings button or `amane ipc call config open|toggle` */ const NAME: &str = "magic-island-settings"; const TITLE: &str = "Magic Island settings"; // the window's own layout; its text sizes come from appearance.text like the rest const SIDEBAR_W: f32 = 240.0; const PAD: f32 = 20.0; const CONTROL_W: f32 = 320.0; const FIELD_H: f32 = 30.0; const SLIDER_W: f32 = 200.0; const NUMBER_W: f32 = 104.0; const RESET_W: f32 = 56.0; const SEARCH: &str = "settings-search"; pub struct Ui { // a shell page ("island") or a Hyprland one ("hyprland:decoration") page: String, query: String, message: Option<(String, bool)>, hover: Option, } impl Service for Ui { fn new() -> Self { Self { page: String::from("appearance"), query: String::new(), message: None, hover: None } } fn listen() {} } pub fn open() { open_window(NAME, view); hypr::load(); } // whether the window is open: amane can't say, Hyprland lists it by title fn is_open() -> bool { Command::new("hyprctl").arg("clients").output().is_ok_and(|done| String::from_utf8_lossy(&done.stdout).contains(&format!("title: {TITLE}\n"))) } /* * `amane ipc call config ...`: open, close, toggle, page , search , * get , set , reset , status. paths as in config.toml; * hyprland.