Skip to content

Commit b25e7e8

Browse files
committed
Add a taskbar icon overlay for the editor window to tell if game window is paused or running
1 parent b89c47b commit b25e7e8

File tree

9 files changed

+75
-5
lines changed

9 files changed

+75
-5
lines changed

editor/debugger/editor_debugger_node.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include "editor/plugins/script_editor_plugin.h"
4646
#include "editor/scene_tree_dock.h"
4747
#include "editor/themes/editor_theme_manager.h"
48+
#include "main/app_pause_icon.gen.h"
49+
#include "main/app_run_icon.gen.h"
4850
#include "scene/gui/menu_button.h"
4951
#include "scene/gui/tab_container.h"
5052
#include "scene/resources/packed_scene.h"
@@ -594,8 +596,12 @@ void EditorDebuggerNode::_paused() {
594596
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
595597
if (paused && !dbg->is_breaked()) {
596598
dbg->debug_break();
599+
Ref<Image> icon = memnew(Image(app_pause_icon_png));
600+
DisplayServer::get_singleton()->set_icon(icon);
597601
} else if (!paused && dbg->is_breaked()) {
598602
dbg->debug_continue();
603+
Ref<Image> icon = memnew(Image(app_run_icon_png));
604+
DisplayServer::get_singleton()->set_icon(icon);
599605
}
600606
});
601607
}

editor/editor_node.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@
180180
#include "editor/plugins/shader_baker/shader_baker_export_plugin_platform_metal.h"
181181
#endif
182182

183+
#include "main/app_icon.gen.h"
184+
#include "main/app_run_icon.gen.h"
185+
183186
#include "modules/modules_enabled.gen.h" // For gdscript, mono.
184187

185188
#ifndef PHYSICS_2D_DISABLED
@@ -4934,13 +4937,17 @@ void EditorNode::_project_run_started() {
49344937
} else if (action_on_play == ACTION_ON_PLAY_OPEN_DEBUGGER) {
49354938
bottom_panel->make_item_visible(EditorDebuggerNode::get_singleton());
49364939
}
4940+
Ref<Image> icon = memnew(Image(app_run_icon_png));
4941+
DisplayServer::get_singleton()->set_icon(icon);
49374942
}
49384943

49394944
void EditorNode::_project_run_stopped() {
49404945
int action_on_stop = EDITOR_GET("run/bottom_panel/action_on_stop");
49414946
if (action_on_stop == ACTION_ON_STOP_CLOSE_BUTTOM_PANEL) {
49424947
bottom_panel->hide_bottom_panel();
49434948
}
4949+
Ref<Image> icon = memnew(Image(app_icon_png));
4950+
DisplayServer::get_singleton()->set_icon(icon);
49444951
}
49454952

49464953
void EditorNode::notify_all_debug_sessions_exited() {

main/SCsub

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,44 @@ if env_main.editor_build and not env_main["no_editor_splash"]:
3030
env.Run(main_builders.make_splash_editor),
3131
)
3232

33-
env_main.CommandNoCache(
34-
"#main/app_icon.gen.h",
35-
"#main/app_icon.png",
36-
env.Run(main_builders.make_app_icon),
37-
)
33+
if env["platform"] == "macos":
34+
env_main.CommandNoCache(
35+
"#main/app_icon.gen.h",
36+
"#main/app_icon_macos.png",
37+
env.Run(main_builders.make_app_icon),
38+
)
39+
40+
env_main.CommandNoCache(
41+
"#main/app_run_icon.gen.h",
42+
"#main/app_run_icon_macos.png",
43+
env.Run(main_builders.make_app_run_icon),
44+
)
45+
46+
env_main.CommandNoCache(
47+
"#main/app_pause_icon.gen.h",
48+
"#main/app_pause_icon_macos.png",
49+
env.Run(main_builders.make_app_pause_icon),
50+
)
51+
52+
else:
53+
env_main.CommandNoCache(
54+
"#main/app_icon.gen.h",
55+
"#main/app_icon.png",
56+
env.Run(main_builders.make_app_icon),
57+
)
58+
59+
env_main.CommandNoCache(
60+
"#main/app_run_icon.gen.h",
61+
"#main/app_run_icon.png",
62+
env.Run(main_builders.make_app_run_icon),
63+
)
64+
65+
env_main.CommandNoCache(
66+
"#main/app_pause_icon.gen.h",
67+
"#main/app_pause_icon.png",
68+
env.Run(main_builders.make_app_pause_icon),
69+
)
70+
3871

3972
lib = env_main.add_library("main", env.main_sources)
4073
env.Prepend(LIBS=[lib])

main/app_icon_macos.png

6.65 KB
Loading

main/app_pause_icon.png

5.8 KB
Loading

main/app_pause_icon_macos.png

7.72 KB
Loading

main/app_run_icon.png

6.22 KB
Loading

main/app_run_icon_macos.png

7.94 KB
Loading

main/main_builders.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,27 @@ def make_app_icon(target, source, env):
4040
{methods.format_buffer(buffer, 1)}
4141
}};
4242
""")
43+
44+
45+
def make_app_run_icon(target, source, env):
46+
buffer = methods.get_buffer(str(source[0]))
47+
48+
with methods.generated_wrapper(str(target[0])) as file:
49+
# Use a neutral gray color to better fit various kinds of projects.
50+
file.write(f"""\
51+
inline constexpr const unsigned char app_run_icon_png[] = {{
52+
{methods.format_buffer(buffer, 1)}
53+
}};
54+
""")
55+
56+
57+
def make_app_pause_icon(target, source, env):
58+
buffer = methods.get_buffer(str(source[0]))
59+
60+
with methods.generated_wrapper(str(target[0])) as file:
61+
# Use a neutral gray color to better fit various kinds of projects.
62+
file.write(f"""\
63+
inline constexpr const unsigned char app_pause_icon_png[] = {{
64+
{methods.format_buffer(buffer, 1)}
65+
}};
66+
""")

0 commit comments

Comments
 (0)