Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Chinese water torture or blinking cursor at qt5 apps
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
cord
Guru
Guru


Joined: 28 Apr 2007
Posts: 344

PostPosted: Sun Apr 30, 2017 11:43 am    Post subject: Chinese water torture or blinking cursor at qt5 apps Reply with quote

One of the most famous methods of torture is Chinese water torture. In this torture a tied person is placed under a bucket filled with water with a tiny hole in the bottom. Water is slowly dripped on to a person's forehead, eventually driving the victim insane.
Software development is not an easy task, and often after a painful process of writing a program developers feel they should share their pains with users, so they put a part of own sufferings onto the shoulders of users in a method similar to the Chinese water torture - blinking cursors.
Fortunately, programmers are not insensitive torturers, and sometimes they provide an option in their programs to turn blinking cursors off. Often these options are not documented, and are not easily accessible, but many users can't stand the blinking cursor for a long time, because blinking cursors are very distracting.
http://www.jurta.org/en/prog/noblink


For the qt5 apps in KDE there's useful utility qt5noblink. It compiles and works clearly simple.
Code:
$ LD_PRELOAD=/full/path/to/qt5noblink.so kwrite

But, where and how to set LD_PRELOAD globally?


Last edited by cord on Sun Apr 30, 2017 6:00 pm; edited 3 times in total
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Sun Apr 30, 2017 12:34 pm    Post subject: Reply with quote

Try /etc/env.d

Code:
grep LD /etc/env.d/*


That will give you some ideas about where "LD*" variables are set. I must have an app or two that uses qt, as that "grep" command discloses a qt-related environment file. One could set LD_PRELOAD anywhere in that set of /etc/env.d files. I keep a /etc/env.d/00Local.

Changes in /etc/env.d/* have no effect until after `env-update` is run (which collates the various /etc/env.d settings into /etc/profile.env and /etc/csh.env), and the shell or environment that reads e.g., /etc/profile.env actually reads that file.
Back to top
View user's profile Send private message
cord
Guru
Guru


Joined: 28 Apr 2007
Posts: 344

PostPosted: Sun Apr 30, 2017 1:09 pm    Post subject: Reply with quote

cboldt wrote:
Try /etc/env.d

Code:
grep LD /etc/env.d/*


That will give you some ideas about where "LD*" variables are set. I must have an app or two that uses qt, as that "grep" command discloses a qt-related environment file. One could set LD_PRELOAD anywhere in that set of /etc/env.d files. I keep a /etc/env.d/00Local.

Changes in /etc/env.d/* have no effect until after `env-update` is run (which collates the various /etc/env.d settings into /etc/profile.env and /etc/csh.env), and the shell or environment that reads e.g., /etc/profile.env actually reads that file.

Thanks, I tried /etc/env.d/00Local but it doesn't work. Maybe there's way to set it somewhere in ~/.config/* (it would be enough for single user).
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Sun Apr 30, 2017 1:44 pm    Post subject: Reply with quote

/etc/env.d/00Local doesn't exist if you don't make it, and even IF and AFTER you make it, entries in there do NOTHING without following the steps I specified in my previous.

The program `env-update` reads ALL of the files in the directory /etc/env.d, and collates those entries into /etc/profile.env. I assure you, that process does in fact work.

Now, I have no clue as to whether or not having LD_PRELOAD in your bash/shell environment affects KDE the way you want it to, but if you make an LD_PRELOAD entry into ANY file in /etc/env.d, run `env-update`, and login to a fresh shell, you will find that the assignment of LD_PRELOAD you put into a file in /etc/env.d does in fact make it to your shell environment. You can prove it to yourself with `env | grep LD_PRELOAD`

If a single user want to make an entry in his or her environment, the details depends on the shell being used. Most people running Gentoo use bash for their shell. Setting an environment variable under bash is typically done in either ~/.bash_profile or ~/.bashrc
Back to top
View user's profile Send private message
cord
Guru
Guru


Joined: 28 Apr 2007
Posts: 344

PostPosted: Sun Apr 30, 2017 2:20 pm    Post subject: Reply with quote

Oh, thanks for detailed answer. Now it works (after full reboot; 'env-update' was not enough).
However, using ~/.bashrc is more attractive.
Back to top
View user's profile Send private message
cboldt
Veteran
Veteran


Joined: 24 Aug 2005
Posts: 1046

PostPosted: Sun Apr 30, 2017 2:30 pm    Post subject: Reply with quote

Good to know it works. You are correct, `env-update` is not enough, no more than just editing .bashrc is enough. The "proposed revised" environment has to be "entered" to the system, from the file. Rather than rebooting, if you run into this sort of thing again, logging your user out and back in again will cause the new environment to be in effect. Same goes for environment settings in .bashrc

That's not the only way to get the new environment in place, but something beyond editing the file or files that define the "proposed environment" is necessary.
Back to top
View user's profile Send private message
cord
Guru
Guru


Joined: 28 Apr 2007
Posts: 344

PostPosted: Sun Apr 30, 2017 3:05 pm    Post subject: Reply with quote

Yeah, some tips.
For /etc/env.d/* you can simply set
Code:
LD_PRELOAD="/full/path/to/qt5noblink.so"


But for ~/.bashrc there must be:
Code:
export LD_PRELOAD="/full/path/to/qt5noblink.so"
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21607

PostPosted: Sun Apr 30, 2017 4:04 pm    Post subject: Reply with quote

If you are confident that you will always want this, it might be easier to carry a local user patch to Qt5 to implement the equivalent change. The linked project is very simple. Assuming it produces the result you want, you could get equivalent results without need of LD_PRELOAD by patching QApplication::cursorFlashTime() and QStyleHints::cursorFlashTime() const to return 0 instead of whatever the Qt developers made them do normally. If you need help with this approach, post back and someone can give you more detailed assistance.
Back to top
View user's profile Send private message
cord
Guru
Guru


Joined: 28 Apr 2007
Posts: 344

PostPosted: Sun Apr 30, 2017 6:04 pm    Post subject: Reply with quote

All right. I'll be glad to see if someone do that patch.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum