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

Cursor autohide feature #403

Closed
ysoloviov opened this issue Feb 12, 2018 · 10 comments · Fixed by #1222
Closed

Cursor autohide feature #403

ysoloviov opened this issue Feb 12, 2018 · 10 comments · Fixed by #1222

Comments

@ysoloviov
Copy link

ysoloviov commented Feb 12, 2018

Can this feature be added? It was very useful when I used vte based terminals. Konsole also has this feature but for my purposes it is a little bit bloated.

@RomanBruhanov
Copy link

There is setAutoHideCursor in qtermwidget, but for that to work you will need to link to KDE. I guess it will be a lot of work to implement hiding in lxqt natively. Easier to stick with KDE or GTK terminals.

@yan12125
Copy link
Member

KWidgetsAddons is also in Tier 1, so depending on it will not be a big problem. Of course it's better to be optional to avoid issue on platforms where KF5 is not fully supported (e.g., macOS).

@tsujan
Copy link
Member

tsujan commented Jul 11, 2019

KWidgetsAddons is also in Tier 1

Yes tier-1 K-things are nice extensions of Qt that don't depend on KDE. I think we could use them in LXQt if really needed -- as we use KWindowSystem.

@luebking
Copy link

Why does that need some KDE stuff?
You monitor MouseMove events re/start a timer and when that actually fires QApplication::setOverrideCursor(Qt::BlankCursor); and QApplication::restoreOverrideCursor(); once the mouse starts moving.

Alternatively (just seeing this in phototonic) you could poll the mouse position (not sure whether I'm gonna replace that during the alpha cycle, but I'm pretty sure that's gonna leave there at some point ;)

@tsujan
Copy link
Member

tsujan commented Jan 27, 2025

Why does that need some KDE stuff?

You're right: there's no need to any KDE stuff for that.

At the time this report was opened, I was rather a bystander (and a user) here. Months ago, I started to maintain qterminal and qtermwidget, went through their bug trackers to find the most important reports, and fixed them. Sadly, I can't check all valid reports, being busy with several other codes. Contributions are really appreciated.

@luebking
Copy link

Preferably in qterminal or qtermwidget?
(I'm gonna check whether the latter tracks the mouse anyway and would base the decision whether to go for polling or event handling based on that - the implementation can be in either location)

@tsujan
Copy link
Member

tsujan commented Jan 27, 2025

Preferably in qterminal or qtermwidget?

Wherever you see fit — I'm confident of your coding skills, having seen your codes and used some of them in Kvantum.

qtermwidget is the place where we put the core codes, i.e., those that can be used by any app based on qtermwidget. QTerminal is only one app that uses qtermwidget. So, if the feature you want to implement is for QTerminal, qterminal is the proper place.

@marcusbritanicus
Copy link

marcusbritanicus commented Jan 27, 2025

@luebking Have a look at TerminalDisplay.cpp/TerminalDisplay.h in qtermwidget. It already tracks mouse move events. What we could do is use a QBasicTimer (preferable) or a QTimer to measure the idle time. The moment we observe any movement (mouseMoveEvent/enterEvent) restart the timer. If the mouse leaves the widget (leaveEvent), stop the timer, and restart it when the mouseEnters it again.

This is a rather rough idea based on your comments, and a quick glance at the code. You may have to figure out some of the finer details and edge cases.

Edit:
I forgot to mention that you'll have to add two functions to QTermWidget class: void setCursorAutohide( bool ); and bool isCursorAutohidden(), and then find a way to percolate the auto-hide information to TerminalDisplay class. All the timer business begins when setCursorAutohide( true ) is called, and should stop when setCursorAutohide( false ) is called.

@marcusbritanicus
Copy link

So, if the feature you want to implement is for QTerminal, qterminal is the proper place.

@tsujan It will be hassle to implement it in qterminal. The mouse should be hidden only when it's inside the qtermwidget. So I think it is better to implement the setCursorAutohide in qtermwidget and turn that on in qterminal with the help of a switch.

@tsujan
Copy link
Member

tsujan commented Jan 27, 2025

@tsujan It will be hassle to implement it in qterminal.

It's OK with me. What can I say when two competent devs agree on something?

tsujan added a commit that referenced this issue Feb 6, 2025
This patch needs lxqt/qtermwidget#582.

The new option is in Preferences → Behavior. It can be from "Never" to 60 seconds. A value of zero hides the cursor immediately (as designed by @luebking).

Closes #403
tsujan added a commit that referenced this issue Feb 7, 2025
This patch needs lxqt/qtermwidget#582.

The new option is in Preferences → Behavior. It can be from "No hiding" to 60 seconds. A value of zero hides the cursor immediately (as designed by @luebking).

Closes #403
@tsujan tsujan closed this as completed in e3fd168 Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants