Skip to content

Commit

Permalink
#2124 restore system_woke signal
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Feb 26, 2024
1 parent 26e9bd8 commit 1072dcf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Allow re-applying existing rules to all known windows [#2121](https://github.com/koekeishiya/yabai/issues/2121)
- Restore application_activated and application_deactivated signals [#2122](https://github.com/koekeishiya/yabai/issues/2122)
- Rules can now be configured to apply *only once* for all known windows [#2123](https://github.com/koekeishiya/yabai/issues/2123)
- Restore system_woke signal [#2124](https://github.com/koekeishiya/yabai/issues/2124)

### Changed
- Preserve relative space ordering when moving spaces to other displays [#2114](https://github.com/koekeishiya/yabai/issues/2114)
Expand Down
9 changes: 7 additions & 2 deletions doc/yabai.1
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,11 @@ Triggered when mission\-control deactivates.
Passes one argument: $YABAI_MISSION_CONTROL_MODE
.RE
.sp
\fBdock_did_change_pref\fP
.RS 4
Triggered when the macOS Dock preferences changes.
.RE
.sp
\fBdock_did_restart\fP
.RS 4
Triggered when Dock.app restarts.
Expand All @@ -1062,9 +1067,9 @@ Triggered when Dock.app restarts.
Triggered when the macOS menubar \fIautohide\fP setting changes.
.RE
.sp
\fBdock_did_change_pref\fP
\fBsystem_woke\fP
.RS 4
Triggered when the macOS Dock preferences changes.
Triggered when macOS wakes from sleep.
.RE
.SS "ACTION"
.sp
Expand Down
7 changes: 5 additions & 2 deletions doc/yabai.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,17 @@ EVENT
Triggered when mission-control deactivates. +
Passes one argument: $YABAI_MISSION_CONTROL_MODE

*dock_did_change_pref*::
Triggered when the macOS Dock preferences changes.

*dock_did_restart*::
Triggered when Dock.app restarts.

*menu_bar_hidden_changed*::
Triggered when the macOS menubar 'autohide' setting changes.

*dock_did_change_pref*::
Triggered when the macOS Dock preferences changes.
*system_woke*::
Triggered when macOS wakes from sleep.

ACTION
^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions src/event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,8 @@ static EVENT_HANDLER(SYSTEM_WOKE)
window_manager_set_window_opacity(&g_window_manager, focused_window, g_window_manager.active_window_opacity);
window_manager_center_mouse(&g_window_manager, focused_window);
}

event_signal_push(SIGNAL_SYSTEM_WOKE, NULL);
}

static EVENT_HANDLER(DAEMON_MESSAGE)
Expand Down
8 changes: 6 additions & 2 deletions src/event_signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ enum signal_type
SIGNAL_MISSION_CONTROL_ENTER,
SIGNAL_MISSION_CONTROL_EXIT,

SIGNAL_DOCK_DID_CHANGE_PREF,
SIGNAL_DOCK_DID_RESTART,

SIGNAL_MENU_BAR_HIDDEN_CHANGED,
SIGNAL_DOCK_DID_CHANGE_PREF,
SIGNAL_SYSTEM_WOKE,

SIGNAL_TYPE_COUNT
};
Expand Down Expand Up @@ -76,9 +78,11 @@ static const char *signal_type_str[] =
[SIGNAL_MISSION_CONTROL_ENTER] = "mission_control_enter",
[SIGNAL_MISSION_CONTROL_EXIT] = "mission_control_exit",

[SIGNAL_DOCK_DID_CHANGE_PREF] = "dock_did_change_pref",
[SIGNAL_DOCK_DID_RESTART] = "dock_did_restart",

[SIGNAL_MENU_BAR_HIDDEN_CHANGED] = "menu_bar_hidden_changed",
[SIGNAL_DOCK_DID_CHANGE_PREF] = "dock_did_change_pref",
[SIGNAL_SYSTEM_WOKE] = "system_woke",

[SIGNAL_TYPE_COUNT] = "signal_type_count"
};
Expand Down
18 changes: 9 additions & 9 deletions src/workspace.m
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,16 @@ - (id)init
name:NSWorkspaceDidWakeNotification
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRestartDock:)
name:@"NSApplicationDockDidRestartNotification"
object:nil];

[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(didChangeMenuBarHiding:)
name:@"AppleInterfaceMenuBarHidingChangedNotification"
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didRestartDock:)
name:@"NSApplicationDockDidRestartNotification"
object:nil];

[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(didChangeDockPref:)
name:@"com.apple.dock.prefchanged"
Expand Down Expand Up @@ -235,14 +235,14 @@ - (void)didWake:(NSNotification *)notification
event_loop_post(&g_event_loop, SYSTEM_WOKE, NULL, 0);
}

- (void)didRestartDock:(NSNotification *)notification
- (void)didChangeMenuBarHiding:(NSNotification *)notification
{
event_loop_post(&g_event_loop, DOCK_DID_RESTART, NULL, 0);
event_loop_post(&g_event_loop, MENU_BAR_HIDDEN_CHANGED, NULL, 0);
}

- (void)didChangeMenuBarHiding:(NSNotification *)notification
- (void)didRestartDock:(NSNotification *)notification
{
event_loop_post(&g_event_loop, MENU_BAR_HIDDEN_CHANGED, NULL, 0);
event_loop_post(&g_event_loop, DOCK_DID_RESTART, NULL, 0);
}

- (void)didChangeDockPref:(NSNotification *)notification
Expand Down

0 comments on commit 1072dcf

Please sign in to comment.