This repo contains a tiny bit (~30 lines) of C++ code which compiles to a .so
file to dynamically override the QKeySequence::toString()
function in Qt to represent shortcuts with graphical symbols similar to the Mac.
On FreeBSD:
cd QKeySequenceOverride
mkdir build
./build.sh
env LD_PRELOAD=$(readlink -f build/libQKeySequenceOverride.so.1.0.0) menubar
The heart of this trick involves using LD_PRELOAD
. For an explanation of this powerful feature of the dynamic linker, check out this writeup.
For more advanced LD_PRELOAD
tricks check this out.