Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/command/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,39 @@ struct app_bring_to_front final : public Command {
osx::bring_to_front();
}
};

struct app_hide final : public Command {
CMD_NAME("app/hide")
STR_MENU("Hide")
STR_DISP("Hide")
STR_HELP("Hide the application")

void operator()(agi::Context *) override {
osx::hide_aegisub();
}
};

struct app_hide_others final : public Command {
CMD_NAME("app/hide_others")
STR_MENU("Hide others")
STR_DISP("Hide others")
STR_HELP("Hide all other applications")

void operator()(agi::Context *) override {
osx::hide_others();
}
};

struct app_show_all final : public Command {
CMD_NAME("app/show_all")
STR_MENU("Show all")
STR_DISP("Show all")
STR_HELP("Show all applications")

void operator()(agi::Context *) override {
osx::show_all();
}
};
#endif

}
Expand All @@ -319,6 +352,9 @@ namespace cmd {
reg(std::make_unique<app_minimize>());
reg(std::make_unique<app_maximize>());
reg(std::make_unique<app_bring_to_front>());
reg(std::make_unique<app_hide>());
reg(std::make_unique<app_hide_others>());
reg(std::make_unique<app_show_all>());
#endif
#ifdef WITH_UPDATE_CHECKER
reg(std::make_unique<app_updates>());
Expand Down
9 changes: 9 additions & 0 deletions src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ class CommandManager {
case wxID_PREFERENCES:
cmd::call("app/options", context);
break;
case wxID_OSX_HIDE:
cmd::call("app/hide", context);
break;
case wxID_OSX_HIDEOTHERS:
cmd::call("app/hide_others", context);
break;
case wxID_OSX_SHOWALL:
cmd::call("app/show_all", context);
break;
case wxID_EXIT:
cmd::call("app/exit", context);
break;
Expand Down
12 changes: 12 additions & 0 deletions src/osx/osx_utils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,16 @@ bool activate_top_window_other_than(wxFrame *wx) {
void bring_to_front() {
[NSApp arrangeInFront:nil];
}

void hide_aegisub() {
[NSApp hide:nil];
}

void hide_others() {
[NSApp hideOtherApplications:nil];
}

void show_all() {
[NSApp unhideAllApplications:nil];
}
}
6 changes: 6 additions & 0 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,10 @@ namespace osx {
bool activate_top_window_other_than(wxFrame *wx);
// Bring all windows to the front, maintaining relative z-order
void bring_to_front();
// Hide the application
void hide_aegisub();
// Hide all other applications
void hide_others();
// Unhide all applications
void show_all();
}
Loading