mirror of
https://github.com/edu4rdshl/Strata.git
synced 2026-07-17 23:24:46 +00:00
fix: remove dead SetFocusedApp D-Bus call
The daemon stored the focused app ID but never read it. App exclusion runs entirely in the extension before SubmitItem is called, so the D-Bus round-trip on every window focus change was pure overhead. Removed from: extension.js call site, dbus.js XML interface, dbus_service.rs method + struct field, main.rs Arc allocation. Focus tracking in _connectFocusTracking is kept since _currentFocusedApp is still used for the JS-side exclusion check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
575e216658
commit
4a6a5fc4e3
4 changed files with 1 additions and 17 deletions
|
|
@ -53,7 +53,6 @@ pub struct SubmitRequest {
|
|||
pub struct StrataManager {
|
||||
pub db: Arc<Db>,
|
||||
pub limits: Limits,
|
||||
pub focused_app: Arc<tokio::sync::Mutex<String>>,
|
||||
pub submit_tx: tokio::sync::mpsc::UnboundedSender<SubmitRequest>,
|
||||
/// Send a `()` here to trigger graceful shutdown from the D-Bus Shutdown method.
|
||||
pub shutdown_tx: tokio::sync::mpsc::UnboundedSender<()>,
|
||||
|
|
@ -197,13 +196,6 @@ impl StrataManager {
|
|||
.map_err(|e| zbus::fdo::Error::Failed(e.to_string()))
|
||||
}
|
||||
|
||||
/// Called by the GJS extension on every focused-window change.
|
||||
/// Used for app exclusion: if the focused app is in the exclusion list,
|
||||
/// the extension will immediately DeleteItem any new item from that app.
|
||||
async fn set_focused_app(&self, app_id: String) {
|
||||
*self.focused_app.lock().await = app_id;
|
||||
}
|
||||
|
||||
/// Push runtime limits from the front-end. Takes effect immediately.
|
||||
/// All three values are absolute (max_text and max_image are bytes,
|
||||
/// not MB). 0 means "leave unchanged" for that field.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use std::sync::Arc;
|
|||
|
||||
use anyhow::{Context, Result};
|
||||
use dbus_service::{Limits, StrataManager, SubmitRequest, THUMB_PX};
|
||||
use tokio::sync::{mpsc, Mutex};
|
||||
use tokio::sync::mpsc;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
use wl_clipboard_rs::paste::{get_contents, ClipboardType, MimeType, Seat};
|
||||
|
||||
|
|
@ -23,7 +23,6 @@ async fn main() -> Result<()> {
|
|||
|
||||
let cfg = config::Config::new();
|
||||
let db = Arc::new(db::Db::open(&cfg.db_path).context("Opening database")?);
|
||||
let focused_app = Arc::new(Mutex::new(String::new()));
|
||||
let limits = Limits::with_defaults();
|
||||
limits
|
||||
.max_history
|
||||
|
|
@ -45,7 +44,6 @@ async fn main() -> Result<()> {
|
|||
let manager = StrataManager {
|
||||
db: db.clone(),
|
||||
limits: limits.clone(),
|
||||
focused_app: focused_app.clone(),
|
||||
submit_tx,
|
||||
shutdown_tx,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -45,10 +45,6 @@ const STRATA_IFACE_XML = `
|
|||
|
||||
<method name="ClearHistory"/>
|
||||
|
||||
<method name="SetFocusedApp">
|
||||
<arg type="s" direction="in" name="app_id"/>
|
||||
</method>
|
||||
|
||||
<method name="Shutdown"/>
|
||||
|
||||
<method name="SetConfig">
|
||||
|
|
|
|||
|
|
@ -554,8 +554,6 @@ export default class StrataExtension extends Extension {
|
|||
this._focusSignalId = global.display.connect('notify::focus-window', () => {
|
||||
const win = global.display.focus_window;
|
||||
this._currentFocusedApp = (win?.get_wm_class() ?? '').toLowerCase();
|
||||
// Inform the daemon (best-effort, ignore failures).
|
||||
this._proxy?.SetFocusedAppRemote(this._currentFocusedApp, () => {});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue