Git Product home page Git Product logo

Comments (47)

pbek avatar pbek commented on September 6, 2024 1

20.3.8

  • added experimental global keyboard shortcut support
    • Meta + Shift + N will now create a new note

from qownnotes.

pbek avatar pbek commented on September 6, 2024 1

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.)

from qownnotes.

Waqar144 avatar Waqar144 commented on September 6, 2024 1

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

from qownnotes.

pbek avatar pbek commented on September 6, 2024

Would be nice, I will research that. I fear that global shortcuts are an OS-thing...

from qownnotes.

dasmaetthes avatar dasmaetthes commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

Sounds interesting, thank you!
Please keep me posted if you find the time to test it.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

UGlobalHotkey uses QPlatformNativeInterface, that is currently private in Qt. So far I wasn't able to build QOwnNotes with UGlobalHotkey.

from qownnotes.

dasmaetthes avatar dasmaetthes commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

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.

from qownnotes.

dasmaetthes avatar dasmaetthes commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

I found that one too, from what I could see it's the same issue with gui-private.

from qownnotes.

dasmaetthes avatar dasmaetthes commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

Yeah, I stumbled above that too. But again, it uses Windows API functions...
We need something that works on all operating systems. 😞

from qownnotes.

dasmaetthes avatar dasmaetthes commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

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. 👍

from qownnotes.

pbek avatar pbek commented on September 6, 2024

And of course we would have to make the hotkey configurable.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

If we come up with a solution that doesn't need gui-private then even better...

from qownnotes.

dasmaetthes avatar dasmaetthes commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

When I have more time I will take a look into it.

from qownnotes.

dasmaetthes avatar dasmaetthes commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

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...

from qownnotes.

richarson avatar richarson commented on September 6, 2024

Another possibility:

https://github.com/mitei/qglobalshortcut

from qownnotes.

pbek avatar pbek commented on September 6, 2024

Thank you for your find, @richarson. There is no macOS support yet...

from qownnotes.

erichgoldman avatar erichgoldman commented on September 6, 2024

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.

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

Hm, the header of the files says 2011 and I can't see evidence that it is working on all platforms...

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

There is this project.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

Then there really is something to play for you! :)

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

There now is a new release, could you please test it and report if it works for you?

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

Works on my Manjaro Linux. Very cool feature. I hope it will be exposed to scripting.

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

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.

from qownnotes.

pbek avatar pbek commented on September 6, 2024

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..

from qownnotes.

UffeJakobsen avatar UffeJakobsen commented on September 6, 2024

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...

from qownnotes.

pbek avatar pbek commented on September 6, 2024

@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.

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

No such issue on my system.

from qownnotes.

UffeJakobsen avatar UffeJakobsen commented on September 6, 2024

issue #1668 created

from qownnotes.

pbek avatar pbek commented on September 6, 2024

20.3.9

  • you can now also manage global keyboard shortcuts in the Shortcuts settings
    • there you can set a global shortcut to every action of the main menu,
      including custom scripting actions
    • you can also search for global shortcuts in the Search for shortcut line edit
    • by default there are no global shortcuts activated

from qownnotes.

pbek avatar pbek commented on September 6, 2024

There now is a new release, could you please test it and report if it works for you?

from qownnotes.

Maboroshy avatar Maboroshy commented on September 6, 2024

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?

from qownnotes.

pbek avatar pbek commented on September 6, 2024

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 6e62d7d#diff-585cfecf0ce15ac75be3038e77e65611R564-R577

from qownnotes.

pbek avatar pbek commented on September 6, 2024

If you want debate about a way make that possible please open another feature request, @Maboroshy

from qownnotes.

UffeJakobsen avatar UffeJakobsen commented on September 6, 2024

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

from qownnotes.

pbek avatar pbek commented on September 6, 2024

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

from qownnotes.

pbek avatar pbek commented on September 6, 2024

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

from qownnotes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.