pop-os / launcher

Modular IPC-based desktop launcher service
Mozilla Public License 2.0
228 stars 45 forks source link

feat: alt tab cycle #227

Open wiiznokes opened 1 month ago

wiiznokes commented 1 month ago

Old PR #225

impl https://github.com/pop-os/cosmic-launcher/issues/135

With this PR, the service is not intended to be restarted everytime the cosmic-launcher is shown, because the toplevel plugin needs to keep track of some states.

So i just added a field in the plugin config:

#[serde(default)]
pub long_lived: bool,

For plugins that need to always running.

And this variant Frontend -> Service/Plugin

/// The frontend was closed and the service should release resources
/// and prepare for the next query
Close,

I believe the service was written with this usecase in mind, so there isn't much change.

Also, i had to deactivate the sort when the query is empty.

jacobgkau commented 1 month ago

Reading https://github.com/pop-os/cosmic-launcher/issues/135, I do see it specifies applications and not windows. Let me know if we need to get UX clarification on that, if it's supposed to be working with applications right now. I think issue 1 is independent of that, based on the behavior.

wiiznokes commented 1 month ago

Just to be sure, did you test with https://github.com/pop-os/cosmic-launcher/pull/150 ? With this PR, alt+tab will select the second app.

I was able to reproduce 2.

jacobgkau commented 1 month ago

Ah, no I didn't. I'll get that built on CI for testing.

wiiznokes commented 1 month ago

I think it require launcher to be located in ../launcher currently. I will change that once i fix point 2

wiiznokes commented 1 month ago

I think there is a bug in cosmic-comp that make this PR not working:

code for the log:

ToplevelEvent::Update(handle, info) => {
                        warn!("Update {}: {:?}", &info.app_id, &info.state);

Output when selecting konsole -> cosmic-edit -> virtualbox -> firefox

(using cosmic-launcher)

juil. 19 01:22:31 fedasus pop-launcher[22633]: Update org.kde.konsole: {}
juil. 19 01:22:31 fedasus pop-launcher[22633]: Update com.system76.CosmicEdit: {Activated}

juil. 19 01:22:41 fedasus pop-launcher[22633]: Update com.system76.CosmicEdit: {}
juil. 19 01:22:41 fedasus pop-launcher[22633]: Update VirtualBox Manager: {Activated}
juil. 19 01:22:41 fedasus pop-launcher[22633]: Update com.system76.CosmicEdit: {Activated}
juil. 19 01:22:41 fedasus pop-launcher[22633]: Update VirtualBox Manager: {}
juil. 19 01:22:41 fedasus pop-launcher[22633]: Update com.system76.CosmicEdit: {}
juil. 19 01:22:41 fedasus pop-launcher[22633]: Update VirtualBox Manager: {Activated}

juil. 19 01:22:45 fedasus pop-launcher[22633]: Update VirtualBox Manager: {}
juil. 19 01:22:45 fedasus pop-launcher[22633]: Update org.mozilla.firefox: {Activated}
juil. 19 01:22:45 fedasus pop-launcher[22633]: Update com.system76.CosmicEdit: {Activated}
juil. 19 01:22:45 fedasus pop-launcher[22633]: Update org.mozilla.firefox: {}
juil. 19 01:22:45 fedasus pop-launcher[22633]: Update com.system76.CosmicEdit: {}
juil. 19 01:22:45 fedasus pop-launcher[22633]: Update org.mozilla.firefox: {Activated}

I'm not sure this protocol is intended for this use case tho

cc @Drakulix