It would be also nice to have global shortcuts, witch allow to create a new note from everywhere when QOwnNotes runs in background.
Would be nice, I will research that. I fear that global shortcuts are an OS-thing...
You can have a look at this library: UGlobalHotkey.
I didn't tried it so far, when I will find time I can do it.
Sounds interesting, thank you!
Please keep me posted if you find the time to test it.
UGlobalHotkey uses QPlatformNativeInterface, that is currently private in Qt. So far I wasn't able to build QOwnNotes with UGlobalHotkey.
You can maybe try to add:
QT += gui-private
in your project file, and then just
#include <qpa/qplatformnativeinterface.h>
should work
But I'm not sure if it still works with current QT version.
I already did that and I had to install quite some packages to do so. But I still get a lot of errors.
Using private classes can break the app at any time with an unsupported platform or a Qt update. And it has a lot of dependencies.
There is some other library too.
I tried this one but I get an error with the connect function, will try to find out the problem later.
I found that one too, from what I could see it's the same issue with gui-private.
I implemented a method working on windows, and I guess only there. I have no possibility to test it on any other OS. If you want I can make a pull request.
Yeah, I stumbled above that too. But again, it uses Windows API functions...
We need something that works on all operating systems. :disappointed:
As far I have seen there are also functions for Linux and Mac OS. You just have to implement them all separately. As for windows I implemented it already, I can move on maybe on weekend and implement it for Linux. But for Mac OS I wouldn't have any possibility.
UGlobalHotkey should theoretically do all that, but I haven't made out all the (non-Qt-) dependencies yet and fixed all error messages. And that would just be (Ubuntu) Linux. It has to build and work on all build systems (Travis, OBS, AUR, AppVeyor..) and platforms. :)
Any help is appreciated. :+1:
And of course we would have to make the hotkey configurable.
If we come up with a solution that doesn't need gui-private then even better...
I can understand your points.
Well but I don't see any other solution then making a own library.
I also tried UGlobalHotkey but it has do much broken dependencies.
When I have more time I will take a look into it.
QHotkey
I tested it on Windows, and Linux Mint it works flawlessly.
Maybe it's possible to implement it in QOwnNotes.
Can have a deeper look into it to a later point.
Nice find! Thank you!
Under Linux it needs the Qt X11 Extras library and some X11 and other header files, I wonder how that would work out on all the build systems. Under OS X it needs some additional headers too...
It would need cmake integration too...
Another possibility:
Thank you for your find, @richarson. There is no macOS support yet...
It might be a nice consideration to have it built in, but perhaps users could use something like autohotkey and it launches a command with arguments to make a new note?
It should be possible in other OS or window managers to provide an easy guide (http://askubuntu.com/questions/90567/quickly-launch-any-app-in-kde-with-a-shortcut) or to have a template file that users could drag and drop.
As a bridge solution, this might help - users do not have an easy, global cross platform - but with a little work or a series of scripts provided by other users, they achieve the functionality they want.
I have some new thoughts on subject.
There was a Qt library project called libqxt that had QxtGlobalShortcut with desired functionality. This libqxt is abandoned now, but QxtGlobalShortcut part seems to be adaptable to modern Qt versions.
Looks like this ongoing project successfully uses it.
Hm, the header of the files says 2011 and I can't see evidence that it is working on all platforms...
For now I see the following points for Linux:
1) It's hard for app to handle global shortcuts since it's window manager's job;
2) It's possible to work directly with WM for that, but there's no library, that can do it on all platforms;
3) User can easily assign a shell command to global shortcut, at least in KDE there's a GUI for that;
4) QON doesn't have any command line interface, it has web socket interface;
So the only way to have global shortcuts in QON is using/writing "keys to web socket" or at least "shell command to web socket" translator. Not a straight-forward way really, but possible.
I wonder if it is possible to use dbus from qml.
Am 08.09.2017 16:35 schrieb "Maboroshy" notifications@github.com:
For now I see the following points for Linux:
- It's hard for app to handle global shortcuts since it's window
manager's job;- It's possible to work directly with WM for that, but there's no
library, that can do it on all platforms;- User can easily assign a shell command to global shortcut, at least
in KDE there's a GUI for that;- QON doesn't have any command line interface, it has web socket
interface;So the only way to have global shortcuts in QON is writing "keys to web
socket" or at least "shell command to web socket" translator. Not a
straight-forward way really, but possible.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/pbek/QOwnNotes/issues/44#issuecomment-328120016, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABtv1ctmK7b9D0PYSXEcwQjvZAbThk-hks5sgVCegaJpZM4HR1sM
.
There is this project.
Then there really is something to play for you! :)
Me? No way! I don't yet understand, why choosing high level abstractions like web sockets and dbus over command line for something as simple as passing some data into the app. I'm a bash guy: shell, files and piping for all!
For now, if I really need to pass something to app, I'd use something like this. But I work with note files directly instead.
There now is a new release, could you please test it and report if it works for you?
Works on my Manjaro Linux. Very cool feature. I hope it will be exposed to scripting.
Great, thank you for testing @Maboroshy. It took a while to integrate that for all platforms and still needs a lot more work.
I hope it will be exposed to scripting.
Do you have any suggestions on how that should look like? (And I still need to look into the UX on how there will be settings for global shortcuts.)
Maybe there should be a second column in the key shortcut settings for a global shortcut.
That way it would also work for scripting since scripting actions show up in the key shortcut settings.
That also looks like a minimal effort solution.
Working great.
And I still need to look into the UX on how there will be settings for global shortcuts
Perhaps just in the keyboard shortucuts
Maybe there should be a second column in the key shortcut settings for a global shortcut.
Perhaps just in the keyboard shortucuts
yes, I also thought about that. the shortcut settings library will need some tweaking tho..
If I press Meta+Shift+N and then press cancel button in "New note" dialog or just press ESC then QOwnNotes exit out of memory...
@uffejakobsen, are you talking about the dialog you get when you use the The shortcut to create a new note asks for headline Checkbox? I have no issue with that dialog. Do you get the same issue when you use the in-application shortcut Ctrl + N? In any way please create a new issue.
No such issue on my system.
issue #1668 created
Search for shortcut line editThere now is a new release, could you please test it and report if it works for you?
Works for built-in and scripting actions. I had an issue with the meta key mapping. It's not recognized as a modifier properly. Maybe that's a KDE Plasma thing, the way it makes meta work as a "start menu" button.
Trying the scripting actions the global keys always switch focus to QON. Can it be optional? Maybe as an extra scripting action setting?
I had an issue with the meta key mapping. It's not recognized as a modifier properly. Maybe that's a KDE Plasma thing, the way it makes meta work as a "start menu" button.
Exactly, to my knowledge they tried to make a regular key out of it so they can trigger the start menu with it. I don't know if there is a way around this in plain Qt...
Trying the scripting actions the global keys always switch focus to QON. Can it be optional? Maybe as an extra scripting action setting?
Phew, it wouldn't be easy to make that optional. It's currently all in https://github.com/pbek/QOwnNotes/commit/6e62d7d819f8f5ac6a7604283fcef879d87d9fd6#diff-585cfecf0ce15ac75be3038e77e65611R564-R577
If you want debate about a way make that possible please open another feature request, @Maboroshy
Well it works better now - that mean that the app does not shutdown once i hit escape.
The problem now is that i cannot use the meta in the global hotkeys.
Also an unhide/hide windows action to assign a hot key to is also missing
The problem now is that i cannot use the meta in the global hotkeys.
see above (I can't tell what you are using, you never filled out the issue template, like advised 😁)
Also an unhide/hide windows action to assign a hot key to is also missing
That's something for #1324
The problem now is that i cannot use the meta in the global hotkeys.
There actually es even a bug reported for this: https://bugreports.qt.io/browse/QTBUG-62102