elementary / terminal

Terminal emulator designed for elementary OS
https://elementary.io
GNU Lesser General Public License v3.0
406 stars 97 forks source link

Tabs and tab-zooms not saved to settings continuously #741

Closed ldrahnik closed 1 month ago

ldrahnik commented 11 months ago

What Happened?

When I open the terminal via io.elementary.terminal (--version is io.elementary.terminal 6.1.2) and together dconf ( /io/elementary/terminal/saved-state/) I see immediately updated all values except tabs and tab-zooms. Is that a known limitation or it should work? If yes please could you guide me on what I do wrong? Because other window-position, window-size even focused-tab are saved fine, immediately.

I discovered that values tabs and tab-zooms are saved when is the terminal closed manually but then when is the terminal opened and the state is restored successfully is value tabs in dconf reset to an empty array and value tab-zooms is not updated but is not reset , in my eyes it confirms does not work only continuous saving. Anyway would be helpful to have this continuous feature working as I forget a lot of times to close the terminal app before is my laptop suspended or rebooted.

Steps to Reproduce

  1. Open the terminal via io.elementary.terminal (--version -> io.elementary.terminal 6.1.2)
  2. Open in dconf /io/elementary/terminal/saved-state/
  3. Open tabs / close tabs and values of tabs and tab-zooms should reflect current state / be changed continually not only when is terminal app closed manually

Expected Behavior

Be able to restore the last tabs with defined zooms without closing the terminal manually.

OS Version

7.x (Horus)

Software Version

Latest release (I have run all updates)

Log Output

ldrahnik@Zenbook-UP5401EA:~/$ G_MESSAGES_DEBUG=all io.elementary.terminal
(io.elementary.terminal:11923): GLib-GIO-DEBUG: 14:29:31.619: _g_io_module_get_default: Found default implementation gvfs (GDaemonVfs) for ‘gio-vfs’
(io.elementary.terminal:11923): GLib-DEBUG: 14:29:31.634: unsetenv() is not thread-safe and should not be used after threads are created
(io.elementary.terminal:11923): Gtk-DEBUG: 14:29:31.634: Connecting to session manager
(io.elementary.terminal:11923): GLib-GIO-DEBUG: 14:29:31.635: _g_io_module_get_default: Found default implementation dconf (DConfSettingsBackend) for ‘gsettings-backend’
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.635: watch_fast: "/io/elementary/terminal/saved-state/" (establishing: 0, active: 0)
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.635: watch_fast: "/io/elementary/terminal/settings/" (establishing: 0, active: 0)
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.635: watch_fast: "/org/gnome/desktop/interface/" (establishing: 0, active: 0)
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.635: watch_established: "/io/elementary/terminal/saved-state/" (establishing: 1)
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.635: watch_established: "/io/elementary/terminal/settings/" (establishing: 1)
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.635: watch_established: "/org/gnome/desktop/interface/" (establishing: 1)
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.640: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.721: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.721: change_notify: /io/elementary/terminal/saved-state/tabs
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.808: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:31.809: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:32.277: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:52.487: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:54.192: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:54.192: change_notify: /io/elementary/terminal/saved-state/window-state
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:54.192: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:54.193: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:54.193: change_notify: /io/elementary/terminal/saved-state/window-position
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:55.253: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:55.253: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:55.254: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:55.254: change_notify: /io/elementary/terminal/saved-state/window-position
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:59.528: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:59.528: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:59.529: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:29:59.529: change_notify: /io/elementary/terminal/saved-state/window-position
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:00.680: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:00.680: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:00.681: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:00.681: change_notify: /io/elementary/terminal/saved-state/window-position
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:01.753: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:01.753: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:01.753: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:01.753: change_notify: /io/elementary/terminal/saved-state/window-position
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:09.604: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:09.604: change_notify: /io/elementary/terminal/saved-state/focused-tab
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:15.081: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:15.081: change_notify: /io/elementary/terminal/saved-state/focused-tab
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:17.747: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:17.747: change_notify: /io/elementary/terminal/saved-state/focused-tab
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:18.584: change_fast
(io.elementary.terminal:11923): dconf-DEBUG: 14:30:18.584: change_notify: /io/elementary/terminal/saved-state/focused-tab

Hardware Info

No response

jeremypw commented 11 months ago

Where a setting corresponds to a simple property of the app (e.g. a boolean or integer value) then it is easy to bind the two together so that they automaticaly keep in sync. However a list of uris is not a simple property and the setting has to be constructed in a function. I guess this is why it is done like this. However, it would not be too onerous to call the function whenever the tabs or zooms change, I think.

This would also fix the issue of the tabs/zooms not being stored if the session is ended without closing the app.

ldrahnik commented 11 months ago

@jeremypw I made these changes https://github.com/ldrahnik/terminal/pull/1/files and it works when is tab removed or tabs are reordered but does not when a new tab is appended what is weird, in this situation is current state updated to gsettings with delay one opened tab, I do not know why atm. Do not you know? Anyway, I am satisfied even with this version which I will use on my laptop because of reason mentioned above. I can try finish work on this and make PR if you want. Let me know.

EDIT: About the new tab, I only misunderstood the purpose of the notebook events on_tab_added vs on_new_tab_requested. The code was updated and save together with insert tab now works fine.

ldrahnik commented 11 months ago

@jeremypw Save on events zoom in/out committed.

jeremypw commented 11 months ago

@ldrahnik Thanks for looking into this! If you prepare a PR I would be happy to review it for you and merge when ready. You may need to update the gsettings in an Idle loop if it is being done in a signal handler to make sure everything is handled before saving the state.

ldrahnik commented 11 months ago

@jeremypw Look at PR https://github.com/elementary/terminal/pull/742, please.

ldrahnik commented 11 months ago

@jeremypw About tests I can imagine something like https://github.com/ldrahnik/terminal/commit/21f9633bd7e2b8db93afcc6428d0637e3fec3969 (not finished)

jeremypw commented 11 months ago

@ldrahnik Yes, it makes sense to have tests that are explicitly designed for both situations (restore and not restore).

jeremypw commented 1 month ago

Looks like this has been fixed.