-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
feat(wm): adds Komorebic taskbar visibility controls #735
base: master
Are you sure you want to change the base?
feat(wm): adds Komorebic taskbar visibility controls #735
Conversation
Adds support for two Komorebic command ToggleTaskbarVisibility and ShowTaskbar which can either be true or false. This prevents the need to use alternative tools and will provide access for ahk scripts to control taskbar visibility,
feat(wm): adds Komorebic taskbar visibility controls
Thank you for this contribution, it looks very cool! I'll try this out during the week and flag it to the testers on Discord. If all is good hopefully we can ship this with v0.1.24 🚀 |
We'll need to update the application exit and stop handlers to restore the taskbar (any change to the system that komorebi makes should be reverted when the process stops) |
komorebi-core/src/lib.rs
Outdated
@@ -88,6 +88,8 @@ pub enum SocketMessage { | |||
EnsureWorkspaces(usize, usize), | |||
EnsureNamedWorkspaces(usize, Vec<String>), | |||
NewWorkspace, | |||
ToggleTaskbarVisibility, | |||
ShowTaskbar(bool), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this to Taskbar(Taskbar)
where the struct is generated by gen_enum_subcommand_args!
using Taskbar: BooleanState
; this way the call signature will match focus-follows-mouse
(eg. komorebic focus-follows-mouse disable
, komorebic taskbar disable
)
komorebi-core/src/lib.rs
Outdated
@@ -88,6 +88,8 @@ pub enum SocketMessage { | |||
EnsureWorkspaces(usize, usize), | |||
EnsureNamedWorkspaces(usize, Vec<String>), | |||
NewWorkspace, | |||
ToggleTaskbarVisibility, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one too we can just shorten to ToggleTaskbar
komorebi/src/windows_api.rs
Outdated
ShowWindow(taskbar_hwnds.0, SHOW_WINDOW_CMD(0)); | ||
ShowWindow(taskbar_hwnds.1, SHOW_WINDOW_CMD(0)); | ||
} else { | ||
ShowWindow(taskbar_hwnds.0, SHOW_WINDOW_CMD(5)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's replace this with the constant from windows-rs
https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/UI/WindowsAndMessaging/constant.SW_SHOW.html
komorebi/src/windows_api.rs
Outdated
unsafe { | ||
if hide { | ||
// 0 hides the taskbar and 5 enables visibility | ||
ShowWindow(taskbar_hwnds.0, SHOW_WINDOW_CMD(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
komorebi/src/process_command.rs
Outdated
WindowsApi::hide_taskbar((taskbar, startmenu), false); | ||
} | ||
} | ||
SocketMessage::MoveWorkspaceToMonitorNumber(monitor_idx) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this have been mistakenly duplicated from above
This is what I'm getting when running either of the new commands locally from this build 🤔 |
Tested `komorebic toggle-taskbar`, `komorebic taskbar enable`, and `komorebic taskbar disable`. They all seem to be working. When the taskbar is hiding, safely exiting unhides the taskbar properly.
11675ef
to
6fe4661
Compare
Would it be worth adding a config option for this? When using Komorebi, I'd like the taskbar to always be hidden, and the only way I see to do that now is to add another command to my startup script to toggle it off. |
I'll try building and running this branch again when I get some time; last time I tried it I didn't have any luck. Once the implementation is sound we can definitely look at adding both |
I'm testing this PR now, and it appears to be working fine on my primary monitor, but the taskbar doesn't get hidden on my other two monitors. I don't know what's up with that, as changing the scale of my secondary monitors causes the taskbar to deform like it's ignoring events as if it's supposed to be hidden. However, it still gets updated and is interactable. Reenabling it with komorebic will fix the deformation. |
0c842e4
to
05af7ce
Compare
e6afece
to
8ee9116
Compare
3aff79a
to
22c1d5f
Compare
468dcf6
to
d110e12
Compare
26a8912
to
2325d75
Compare
12870dc
to
e46a1a6
Compare
ece5a57
to
9a3dbcc
Compare
Adds support for two Komorebic commands
ToggleTaskbarVisibility
andShowTaskbar
which can either be true or false.This prevents the need to use alternative tools, and will provide access for ahk scripts to control taskbar visibility.
This is my first real PR so if there is anything weird let me know.