0.6.0 #1

Merged
pogmommy merged 89 commits from 0.6.0 into main 2025-07-04 20:29:26 -07:00
5 changed files with 39 additions and 1 deletions
Showing only changes of commit c6decc815a - Show all commits

View file

@ -19,6 +19,7 @@ All notable changes to eww will be listed here, starting at changes since versio
- `get_locale` now follows POSIX standard for locale selection (By: mirhahn, w-lfchen) - `get_locale` now follows POSIX standard for locale selection (By: mirhahn, w-lfchen)
### Features ### Features
- Add `eww poll` subcommand to force-poll a variable (By: kiana-S)
- Add OnDemand support for focusable on wayland (By: GallowsDove) - Add OnDemand support for focusable on wayland (By: GallowsDove)
- Add jq `raw-output` support (By: RomanHargrave) - Add jq `raw-output` support (By: RomanHargrave)
- Update rust toolchain to 1.81.0 (By: w-lfchen) - Update rust toolchain to 1.81.0 (By: w-lfchen)

View file

@ -45,6 +45,7 @@ use yuck::{
pub enum DaemonCommand { pub enum DaemonCommand {
NoOp, NoOp,
UpdateVars(Vec<(VarName, DynVal)>), UpdateVars(Vec<(VarName, DynVal)>),
PollVars(Vec<VarName>),
ReloadConfigAndCss(DaemonResponseSender), ReloadConfigAndCss(DaemonResponseSender),
OpenInspector, OpenInspector,
OpenMany { OpenMany {
@ -167,6 +168,11 @@ impl<B: DisplayBackend> App<B> {
self.update_global_variable(var_name, new_value); self.update_global_variable(var_name, new_value);
} }
} }
DaemonCommand::PollVars(names) => {
for var_name in names {
self.force_poll_variable(var_name);
}
}
DaemonCommand::ReloadConfigAndCss(sender) => { DaemonCommand::ReloadConfigAndCss(sender) => {
let mut errors = Vec::new(); let mut errors = Vec::new();
@ -336,6 +342,23 @@ impl<B: DisplayBackend> App<B> {
} }
} }
fn force_poll_variable(&mut self, name: VarName) {
match self.eww_config.get_script_var(&name) {
Err(err) => error_handling_ctx::print_error(err),
Ok(var) => {
if let ScriptVarDefinition::Poll(poll_var) = var {
log::debug!("force-polling var {}", &name);
match script_var_handler::run_poll_once(&poll_var) {
Err(err) => error_handling_ctx::print_error(err),
Ok(value) => self.update_global_variable(name, value),
}
} else {
error_handling_ctx::print_error(anyhow!("Script var '{}' is not polling", name))
}
}
}
}
/// Close a window and do all the required cleanups in the scope_graph and script_var_handler /// Close a window and do all the required cleanups in the scope_graph and script_var_handler
fn close_window(&mut self, instance_id: &str) -> Result<()> { fn close_window(&mut self, instance_id: &str) -> Result<()> {
if let Some(old_abort_send) = self.window_close_timer_abort_senders.remove(instance_id) { if let Some(old_abort_send) = self.window_close_timer_abort_senders.remove(instance_id) {

View file

@ -98,6 +98,16 @@ pub enum ActionWithServer {
mappings: Vec<(VarName, DynVal)>, mappings: Vec<(VarName, DynVal)>,
}, },
/// Update a polling variable using its script.
///
/// This will force the variable to be updated even if its
/// automatic polling is disabled.
#[command(name = "poll")]
Poll {
/// Variables to be polled
names: Vec<VarName>,
},
/// Open the GTK debugger /// Open the GTK debugger
#[command(name = "inspector", alias = "debugger")] #[command(name = "inspector", alias = "debugger")]
OpenInspector, OpenInspector,
@ -254,6 +264,7 @@ impl ActionWithServer {
pub fn into_daemon_command(self) -> (app::DaemonCommand, Option<daemon_response::DaemonResponseReceiver>) { pub fn into_daemon_command(self) -> (app::DaemonCommand, Option<daemon_response::DaemonResponseReceiver>) {
let command = match self { let command = match self {
ActionWithServer::Update { mappings } => app::DaemonCommand::UpdateVars(mappings), ActionWithServer::Update { mappings } => app::DaemonCommand::UpdateVars(mappings),
ActionWithServer::Poll { names } => app::DaemonCommand::PollVars(names),
ActionWithServer::OpenInspector => app::DaemonCommand::OpenInspector, ActionWithServer::OpenInspector => app::DaemonCommand::OpenInspector,
ActionWithServer::KillServer => app::DaemonCommand::KillServer, ActionWithServer::KillServer => app::DaemonCommand::KillServer,

View file

@ -196,7 +196,7 @@ impl PollVarHandler {
} }
} }
fn run_poll_once(var: &PollScriptVar) -> Result<DynVal> { pub fn run_poll_once(var: &PollScriptVar) -> Result<DynVal> {
match &var.command { match &var.command {
VarSource::Shell(span, command) => { VarSource::Shell(span, command) => {
script_var::run_command(command).map_err(|e| anyhow!(create_script_var_failed_warn(*span, &var.name, &e.to_string()))) script_var::run_command(command).map_err(|e| anyhow!(create_script_var_failed_warn(*span, &var.name, &e.to_string())))

View file

@ -209,6 +209,9 @@ and thus are the perfect choice for showing your time, date, as well as other bi
You can also specify an initial-value. This should prevent eww from waiting for the result of a given command during startup, thus You can also specify an initial-value. This should prevent eww from waiting for the result of a given command during startup, thus
making the startup time faster. making the startup time faster.
To externally update a polling variable, `eww update` can be used like with basic variables to assign a value.
You can also call `eww poll` to poll the variable outside of its usual interval, or even while it isn't running at all.
**Listening variables (`deflisten`)** **Listening variables (`deflisten`)**
```lisp ```lisp