1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-18 07:11:04 +02:00

refactor: pass context into modules controllers

This paves the way to keep things tidier for the next refactors.
This commit is contained in:
Jake Stanger 2024-01-07 23:42:34 +00:00
parent 651a27b143
commit 57b57ed002
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
13 changed files with 30 additions and 20 deletions

View file

@ -6,7 +6,7 @@ use color_eyre::{Help, Report, Result};
use gtk::prelude::*;
use gtk::Label;
use serde::Deserialize;
use tokio::sync::mpsc::{Receiver, Sender};
use tokio::sync::mpsc;
use tracing::error;
#[derive(Debug, Deserialize, Clone)]
@ -55,11 +55,12 @@ impl Module<Label> for ScriptModule {
fn spawn_controller(
&self,
_info: &ModuleInfo,
tx: Sender<ModuleUpdateEvent<Self::SendMessage>>,
_rx: Receiver<Self::ReceiveMessage>,
context: &WidgetContext<Self::SendMessage, Self::ReceiveMessage>,
_rx: mpsc::Receiver<Self::ReceiveMessage>,
) -> Result<()> {
let script: Script = self.into();
let tx = context.tx.clone();
spawn(async move {
script.run(None, move |out, _| match out {
OutputStream::Stdout(stdout) => {