Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

LegitCamper
Copy link

Adds support for two Komorebic commands 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.

This is my first real PR so if there is anything weird let me know.

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
@LGUG2Z
Copy link
Owner

LGUG2Z commented Apr 7, 2024

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 🚀

@LGUG2Z
Copy link
Owner

LGUG2Z commented Apr 7, 2024

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)

@@ -88,6 +88,8 @@ pub enum SocketMessage {
EnsureWorkspaces(usize, usize),
EnsureNamedWorkspaces(usize, Vec<String>),
NewWorkspace,
ToggleTaskbarVisibility,
ShowTaskbar(bool),
Copy link
Owner

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)

@@ -88,6 +88,8 @@ pub enum SocketMessage {
EnsureWorkspaces(usize, usize),
EnsureNamedWorkspaces(usize, Vec<String>),
NewWorkspace,
ToggleTaskbarVisibility,
Copy link
Owner

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

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));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsafe {
if hide {
// 0 hides the taskbar and 5 enables visibility
ShowWindow(taskbar_hwnds.0, SHOW_WINDOW_CMD(0));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WindowsApi::hide_taskbar((taskbar, startmenu), false);
}
}
SocketMessage::MoveWorkspaceToMonitorNumber(monitor_idx) => {
Copy link
Owner

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

@LGUG2Z
Copy link
Owner

LGUG2Z commented Apr 7, 2024

2024-04-07T22:28:52.335619Z ERROR komorebi::process_command: The operation completed successfully. (os error 0)
2024-04-07T22:28:59.118943Z ERROR komorebi::process_command: The operation completed successfully. (os error 0)
2024-04-07T22:29:02.876010Z ERROR komorebi::process_command: The operation completed successfully. (os error 0)
2024-04-07T22:29:04.672027Z ERROR komorebi::process_command: The operation completed successfully. (os error 0)

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.
@LGUG2Z LGUG2Z force-pushed the master branch 3 times, most recently from 11675ef to 6fe4661 Compare April 15, 2024 15:36
@Insprill
Copy link

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.

@LGUG2Z
Copy link
Owner

LGUG2Z commented Apr 18, 2024

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 komorebic and static config options for manipulating the behaviour.

@Insprill
Copy link

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.

@LGUG2Z LGUG2Z force-pushed the master branch 6 times, most recently from 0c842e4 to 05af7ce Compare May 19, 2024 21:27
@LGUG2Z LGUG2Z force-pushed the master branch 2 times, most recently from e6afece to 8ee9116 Compare July 4, 2024 19:42
@LGUG2Z LGUG2Z force-pushed the master branch 4 times, most recently from 468dcf6 to d110e12 Compare September 24, 2024 22:39
@LGUG2Z LGUG2Z force-pushed the master branch 6 times, most recently from 26a8912 to 2325d75 Compare October 11, 2024 15:46
@LGUG2Z LGUG2Z force-pushed the master branch 12 times, most recently from 12870dc to e46a1a6 Compare October 16, 2024 23:15
@LGUG2Z LGUG2Z force-pushed the master branch 3 times, most recently from ece5a57 to 9a3dbcc Compare November 3, 2024 23:43
@LGUG2Z LGUG2Z force-pushed the master branch 5 times, most recently from ed96b54 to e6ddccc Compare November 29, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants