Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The plugin Xi/Tweaks should not disable the use of the arrow keys of the message window when a tab-title has focus #58

Open
ralf3u opened this issue Oct 2, 2024 · 7 comments

Comments

@ralf3u
Copy link

ralf3u commented Oct 2, 2024

I don't know where to report the issue about the plugin Xi/Tweaks, so I report it here within the plugin Preview.

When the plugin Xi/Tweaks is deactivated, sidebar and message window have exactly the same behavior:

  • If the tab has focus, so not the content-area of the tab, then tab-browsing with the specific arrow-keys is possible (which arrow-keys depends on where the tabs are located).
  • If the tab has focus, so not the content-area of the tab, I can put the content-area of the tab in focus by pressing 1x the specific arrow-key (which arrow-key depends on where the tabs are located).

When the plugin Xi/Tweaks is activated, the behavior of the sidebar will not change, but the behavior of the message window:

  • If the tab has focus, so not the content-area of the tab, then tab-browsing with arrow-keys is not possible.
  • If the tab has focus, so not the content-area of the tab, I can not put the content-area of the tab in focus by pressing 1x an arrow-key.

Possible solution
I can imagine that there is code that tries to put the focus on the content-area of a tab. And I think that this disturbs the normal behavior of the message window.

History
I recognized yesterday the issue at geany with the issue number 3961 with the title: BUG: A release of a click on a tab-title of the sidebar does not put always the content-area of the tab in focus.

@xiota
Copy link
Owner

xiota commented Oct 2, 2024

I took a look at the plugin. I think the following code excerpt is responsible. However, I recall it was added at your request to try to focus the contents of the tab when the tab bar is clicked. I am willing to remove it, but if so, would definitely not add it back in the future. Consider the attempts to change focus to the tab contents to be a failure.

    g_handle_focus_sidebar =
        g_signal_connect(geany_sidebar, "focus", G_CALLBACK(focus), nullptr);
    g_handle_focus_msgwin =
        g_signal_connect(geany_msgwin, "focus", G_CALLBACK(focus), nullptr);
    g_handle_focus_editor =
        g_signal_connect(geany_editor, "focus", G_CALLBACK(focus), nullptr);

    g_handle_grab_focus_sidebar = g_signal_connect(
        geany_sidebar, "grab-focus", G_CALLBACK(grab_focus), nullptr);
    g_handle_grab_focus_msgwin = g_signal_connect(
        geany_msgwin, "grab-focus", G_CALLBACK(grab_focus), nullptr);
    g_handle_grab_focus_editor = g_signal_connect(
        geany_editor, "grab-focus", G_CALLBACK(grab_focus), nullptr);

    g_handle_grab_notify_sidebar = g_signal_connect(
        geany_sidebar, "grab-notify", G_CALLBACK(grab_notify), nullptr);
    g_handle_grab_notify_msgwin = g_signal_connect(
        geany_msgwin, "grab-notify", G_CALLBACK(grab_notify), nullptr);
    g_handle_grab_notify_editor = g_signal_connect(
        geany_editor, "grab-notify", G_CALLBACK(grab_notify), nullptr);

    g_handle_set_focus_child_sidebar = g_signal_connect(
        geany_sidebar, "set-focus-child", G_CALLBACK(set_focus_child), nullptr);
    g_handle_set_focus_child_msgwin = g_signal_connect(
        geany_msgwin, "set-focus-child", G_CALLBACK(set_focus_child), nullptr);
    g_handle_set_focus_child_editor = g_signal_connect(
        geany_editor, "set-focus-child", G_CALLBACK(set_focus_child), nullptr);

    g_handle_switch_page_sidebar = g_signal_connect(
        geany_sidebar, "switch-page", G_CALLBACK(switch_page), nullptr);
    g_handle_switch_page_msgwin = g_signal_connect(
        geany_msgwin, "switch-page", G_CALLBACK(switch_page), nullptr);
    g_handle_switch_page_editor = g_signal_connect(
        geany_editor, "switch-page", G_CALLBACK(switch_page), nullptr);

I think you're the only user of the xitweaks plugin. I can upload the source to another repo. Then once you figure out how to build it, you'll be able to experiment with making changes on your own.

@ralf3u
Copy link
Author

ralf3u commented Oct 2, 2024

However, I recall it was added at your request to try to focus the contents of the tab when the tab bar is clicked. I am willing to remove it, but if so, would definitely not add it back in the future. Consider the attempts to change focus to the tab contents to be a failure.

Since #15 was closed, it is better to solve the problem upstream, is it geany or gtk.
That is why I opened at geany the issue number 3966 with the title Feature request: When clicking on a tab-title of the sidebar, the focus should always be set on the content-area of the tab.
And in the next days I have the intention to contact the gtk-community.

So, you can remove all code that is trying to set the focus on the content-area of the tab when clicking on the tab-title, is it the plugin Preview or the plugin Xi/Tweaks.

I can upload the source to another repo. Then once you figure out how to build it, you'll be able to experiment with making changes on your own.

I would experiment it if I would understand how to code software. But I don't.

@xiota
Copy link
Owner

xiota commented Oct 2, 2024

I would experiment it if I would understand how to code software. But I don't.

You were able to modify Lua scripts, so you could probably figure it out. It's mostly searching documentation to find functions that might accomplish what you want.

I'll put the code in another repo after removing the code that attempts to change focus and updating the build system.

@ralf3u
Copy link
Author

ralf3u commented Oct 3, 2024

However, I recall it was added at your request to try to focus the contents of the tab when the tab bar is clicked.

I requested many things. And I'm so thankful that you solved most of them and tried to solve the rest. But if code does not work, just remove it. I never asked to keep code inside the plugins Preview or Xi/Tweaks that does not work. Ultimately, the goal is to have only code in the plugins that works. The code is then better to maintain and will create less problems, like this issue.

@xiota
Copy link
Owner

xiota commented Oct 4, 2024

I'm so thankful that you solved most of them and tried to solve the rest.

You're welcome. I was mainly clarifying that, since past attempts to change focus have been unsuccessful, so I'm giving up.

It's been a while since I've looked at the xi-tweaks plugin... looks like it has code to provide a shortcut and allow tabs to be styled with css. I'd like to change the name to something that better fits what it does. Any suggestions?

BTW: The code I pasted earlier seems (at least partly) to be necessary to allow css styles. I haven't looked for the part that changes focus yet.

@ralf3u
Copy link
Author

ralf3u commented Oct 4, 2024

... looks like it has code to provide a shortcut and allow tabs to be styled with css.

At the moment I use the plugin Xi/Tweaks only to identify which tab has focus what is possible with the css in the tab-title. If the plugin Xi/Tweaks would not exist, I would not know which of the active tabs of the three different areas (editor, sidebar or message window) has focus.
I don't know anything about a shortcut that is implemented in the plugin.

I'd like to change the name to something that better fits what it does. Any suggestions?

In issue number 59 with the title The glorious five shortcuts you wrote:

Maybe they would fit in the xi-tweaks plugin.

If you put the five shortcuts in the plugin Xi/Tweaks, then the plugin is a combination of allowing tabs to be styled with css and shortcuts. So, I would not change the name.

@ralf3u
Copy link
Author

ralf3u commented Oct 10, 2024

Could you please remove the non-working focus-code of the plugin Xi/Tweaks and also the shortcut, that does not work properly by the way?
Maybe the geanylua-switch-views-shortcuts will work correctly, and so maybe there is no need to have shortcuts in the plugin Xi/Tweaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants