-
-
Notifications
You must be signed in to change notification settings - Fork 24
Feature: window minimisation #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
0c9832d
65062c4
3d7bad0
616767d
5786a8a
641ef7a
4d79958
c2fdf27
e768db2
2a7d4cf
e0b1e9a
a842d94
749d1c7
d863624
de4b69b
c19693e
0dd548a
6b2e760
7fc65dc
de32422
33acbf1
1b89758
7a6cc1d
8fc71b1
5a67b22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,15 +12,15 @@ use pinnacle_api_defs::pinnacle::{ | |
| self, CloseRequest, GetAppIdRequest, GetAppIdResponse, GetFocusedRequest, | ||
| GetFocusedResponse, GetForeignToplevelListIdentifierRequest, | ||
| GetForeignToplevelListIdentifierResponse, GetLayoutModeRequest, GetLayoutModeResponse, | ||
| GetLocRequest, GetLocResponse, GetRequest, GetResponse, GetSizeRequest, | ||
| GetSizeResponse, GetTagIdsRequest, GetTagIdsResponse, GetTitleRequest, | ||
| GetTitleResponse, GetWindowsInDirRequest, GetWindowsInDirResponse, LowerRequest, | ||
| LowerResponse, MoveGrabRequest, MoveToOutputRequest, MoveToOutputResponse, | ||
| MoveToTagRequest, RaiseRequest, ResizeGrabRequest, ResizeTileRequest, | ||
| SetDecorationModeRequest, SetFloatingRequest, SetFocusedRequest, SetFullscreenRequest, | ||
| SetGeometryRequest, SetMaximizedRequest, SetTagRequest, SetTagsRequest, | ||
| SetTagsResponse, SetVrrDemandRequest, SetVrrDemandResponse, SwapRequest, SwapResponse, | ||
| WindowRuleRequest, WindowRuleResponse, | ||
| GetLocRequest, GetLocResponse, GetMinimizedRequest, GetMinimizedResponse, GetRequest, | ||
| GetResponse, GetSizeRequest, GetSizeResponse, GetTagIdsRequest, GetTagIdsResponse, | ||
| GetTitleRequest, GetTitleResponse, GetWindowsInDirRequest, GetWindowsInDirResponse, | ||
| LowerRequest, LowerResponse, MoveGrabRequest, MoveToOutputRequest, | ||
| MoveToOutputResponse, MoveToTagRequest, RaiseRequest, ResizeGrabRequest, | ||
| ResizeTileRequest, SetDecorationModeRequest, SetFloatingRequest, SetFocusedRequest, | ||
| SetFullscreenRequest, SetGeometryRequest, SetMaximizedRequest, SetMinimizedRequest, | ||
| SetTagRequest, SetTagsRequest, SetTagsResponse, SetVrrDemandRequest, | ||
| SetVrrDemandResponse, SwapRequest, SwapResponse, WindowRuleRequest, WindowRuleResponse, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
@@ -194,6 +194,27 @@ impl v1::window_service_server::WindowService for super::WindowService { | |
| .await | ||
| } | ||
|
|
||
| async fn get_minimized( | ||
| &self, | ||
| request: Request<GetMinimizedRequest>, | ||
| ) -> TonicResult<GetMinimizedResponse> { | ||
| let window_id = WindowId(request.into_inner().window_id); | ||
|
|
||
| run_unary(&self.sender, move |state| { | ||
| let minimized = window_id | ||
| .window(&state.pinnacle) | ||
| .or_else(|| { | ||
| window_id | ||
| .unmapped_window(&state.pinnacle) | ||
| .map(|unmapped| unmapped.window.clone()) | ||
| }) | ||
| .map(|win| win.with_state(|state| state.minimized)) | ||
| .unwrap_or(false); | ||
| Ok(GetMinimizedResponse { minimized }) | ||
| }) | ||
| .await | ||
| } | ||
|
|
||
| async fn get_tag_ids( | ||
| &self, | ||
| request: Request<GetTagIdsRequest>, | ||
|
|
@@ -479,6 +500,31 @@ impl v1::window_service_server::WindowService for super::WindowService { | |
| .await | ||
| } | ||
|
|
||
| async fn set_minimized(&self, request: Request<SetMinimizedRequest>) -> TonicResult<()> { | ||
| let request = request.into_inner(); | ||
| let window_id = WindowId(request.window_id); | ||
| let absolute_minimized = match request.set_or_toggle() { | ||
| SetOrToggle::Unspecified => { | ||
| return Err(Status::invalid_argument("unspecified set or toggle")); | ||
| } | ||
| SetOrToggle::Set => Some(true), | ||
| SetOrToggle::Unset => Some(false), | ||
| SetOrToggle::Toggle => None, | ||
| }; | ||
|
|
||
| run_unary_no_response(&self.sender, move |state| { | ||
| if let Some(window) = window_id.window(&state.pinnacle) { | ||
| crate::api::window::set_minimized(state, &window, absolute_minimized); | ||
| } else if let Some(unmapped) = window_id.unmapped_window_mut(&mut state.pinnacle) | ||
| && let UnmappedState::WaitingForRules { rules: _, .. } = &mut unmapped.state | ||
| { | ||
| // TODO: find a way to immediately minimize a window upon mapping. | ||
| warn!("minimizing unmapped windows not yet supported"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does seem to, with my preliminary testing. However during testing I discovered that getting the focus stack of active tags no longer includes minimised windows, since they seem to lose their location value (which makes sense, but I'm not certain what exactly to do about it). During testing I made a custom config that retrieved all windows then filtered them for windows on the focused output and also minimization, but it is less convenient (but still doable if you combined it with some sort of active tag filter). |
||
| } | ||
| }) | ||
| .await | ||
| } | ||
|
|
||
| async fn set_floating(&self, request: Request<SetFloatingRequest>) -> TonicResult<()> { | ||
| let request = request.into_inner(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.