list: add content_hash and last_accessed tracking with de-duplication

Adds a `content_hash` column and index for deduplication, and a
`last_accessed` column & index for time tracking. We now de-duplicate on
copy by not copying if present, but instead bubbling up matching entry.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Icbcdbd6ac28bbb21324785cae30911f96a6a6964
This commit is contained in:
raf 2026-01-20 10:14:32 +03:00
commit 59423f9ae4
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 180 additions and 98 deletions

View file

@ -33,12 +33,11 @@ pub fn init_wayland_state() {
/// Get the currently focused window application name using Wayland protocols
pub fn get_focused_window_app() -> Option<String> {
// Try Wayland protocol first
if let Ok(focused) = FOCUSED_APP.lock() {
if let Some(ref app) = *focused {
if let Ok(focused) = FOCUSED_APP.lock()
&& let Some(ref app) = *focused {
debug!("Found focused app via Wayland protocol: {app}");
return Some(app.clone());
}
}
debug!("No focused window detection method worked");
None
@ -81,12 +80,10 @@ impl Dispatch<wl_registry::WlRegistry, ()> for AppState {
interface,
version: _,
} = event
{
if interface == "zwlr_foreign_toplevel_manager_v1" {
&& interface == "zwlr_foreign_toplevel_manager_v1" {
let _manager: ZwlrForeignToplevelManagerV1 =
registry.bind(name, 1, qh, ());
}
}
}
fn event_created_child(
@ -155,12 +152,10 @@ impl Dispatch<ZwlrForeignToplevelHandleV1, ()> for AppState {
// Update focused app to the `app_id` of this handle
if let (Ok(apps), Ok(mut focused)) =
(TOPLEVEL_APPS.lock(), FOCUSED_APP.lock())
{
if let Some(app_id) = apps.get(&handle_id) {
&& let Some(app_id) = apps.get(&handle_id) {
debug!("Setting focused app to: {app_id}");
*focused = Some(app_id.clone());
}
}
}
},
zwlr_foreign_toplevel_handle_v1::Event::Closed => {