diff --git a/Scripts/Dialogs/ImportSprites.gd b/Scripts/Dialogs/ImportSprites.gd index 82e9b004f..62cdeab5e 100644 --- a/Scripts/Dialogs/ImportSprites.gd +++ b/Scripts/Dialogs/ImportSprites.gd @@ -111,5 +111,5 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void: Global.canvas = Global.canvases[Global.canvases.size() - 1] Global.canvas.visible = true - OS.set_window_title(first_path.get_file() + " (" + tr("imported") + ") - Pixelorama") + Global.window_title = first_path.get_file() + " (" + tr("imported") + ") - Pixelorama" diff --git a/Scripts/Global.gd b/Scripts/Global.gd index b7bbb3656..19edb73a3 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -4,6 +4,7 @@ enum Pressure_Sensitivity {NONE, ALPHA, SIZE, ALPHA_AND_SIZE} enum Brush_Types {PIXEL, CIRCLE, FILLED_CIRCLE, FILE, RANDOM_FILE, CUSTOM} var root_directory := "." +var window_title := "" setget title_changed # Why doesn't Godot have get_window_title()? var config_cache := ConfigFile.new() # warning-ignore:unused_class_variable var loaded_locales : Array @@ -471,6 +472,10 @@ func redo(_canvases : Array, layer_index : int = -1) -> void: if control.redone: notification_label("Redo: %s" % action_name) +func title_changed(value : String) -> void: + window_title = value + OS.set_window_title(value) + func frame_changed(value : int) -> void: current_frame = value current_frame_label.text = tr("Current frame:") + " %s/%s" % [str(current_frame + 1), canvases.size()] diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 451de24f0..60c41e6ef 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -161,7 +161,7 @@ func _ready() -> void: else: $ImportSprites._on_ImportSprites_files_selected([arg]) - OS.set_window_title("(" + tr("untitled") + ") - Pixelorama") + Global.window_title = "(" + tr("untitled") + ") - Pixelorama" Global.canvas.layers[0][2] = tr("Layer") + " 0" Global.canvas.generate_layer_panels() @@ -484,7 +484,7 @@ func _on_OpenSprite_file_selected(path : String) -> void: file_menu.set_item_text(2, tr("Save") + " %s" % path.get_file()) file_menu.set_item_text(5, tr("Export") + " %s" % $ExportSprites.current_path.get_file()) - OS.set_window_title(path.get_file() + " - Pixelorama") + Global.window_title = path.get_file() + " - Pixelorama" func _on_SaveSprite_file_selected(path : String) -> void: @@ -560,7 +560,7 @@ func clear_canvases() -> void: $ExportSprites.current_export_path = "" file_menu.set_item_text(2, "Save") file_menu.set_item_text(5, "Export PNG...") - OS.set_window_title("(" + tr("untitled") + ") - Pixelorama") + Global.window_title = "(" + tr("untitled") + ") - Pixelorama" Global.undo_redo.clear_history(false) func _on_ImportSprites_popup_hide() -> void: