This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Load a file content with a hotkey

Tags: None
(comma "," separated)
alexorly
Registered Member
Posts
11
Karma
0

Load a file content with a hotkey

Sun Nov 01, 2020 12:56 am
I am new to Linux (after 30 years with Windows...) and after several versions I decided to go with KDE Plasma (currently 5.18.5)

I want to save my email address into a text file, say : email.txt
Then, on hitting a hotkey, say CTRL+F1, it will open the nominated file, read it, and paste the email into the clipboard buffer.

Can I do this? How?

Thank you

P.S - I noticed that 5.20 has been released, how can I update?
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
Hello!

The long way to set a hotkey: «Systemsettings → Shortcuts → Custom Shortcuts → Edit ⇨ New ⇨ GlobalShortcut ⇨ Keyboard Input»
Using KRunner you can just type «custom shortcuts» which will lead you to the same settings page.

The second question depends on the distribution you choose. KDE-neon, ArchLinux, etc. will get you the latest (stable) KDE Release by default. If you're on a debian based platform (Debian, Kubuntu, … ) you will not automatically get the latest release as they stick on a version until the next distro-release, but they port back bugfixings; other distributions or operating systems like FreeBSD have another schedule of releasing.

Is there a specific feature you are missing or is it just «I want to always have the latest stuff»-thing?
alexorly
Registered Member
Posts
11
Karma
0

Re: Load a file content with a hotkey

Sun Nov 01, 2020 11:05 pm
koffeinfriedhof wrote:Hello!

The long way to set a hotkey: «Systemsettings → Shortcuts → Custom Shortcuts → Edit ⇨ New ⇨ GlobalShortcut ⇨ Keyboard Input»
Using KRunner you can just type «custom shortcuts» which will lead you to the same settings page.

The second question depends on the distribution you choose. KDE-neon, ArchLinux, etc. will get you the latest (stable) KDE Release by default. If you're on a debian based platform (Debian, Kubuntu, … ) you will not automatically get the latest release as they stick on a version until the next distro-release, but they port back bugfixings; other distributions or operating systems like FreeBSD have another schedule of releasing.

Is there a specific feature you are missing or is it just «I want to always have the latest stuff»-thing?


Hello and thanks for your feedback,
I wish there was a way here to add a screen shot, if that is available, please teach me how.

Anyway, I get to the page : Global shortcuts -> Application Launcher . in there I have KRunner and it has 2 shortcuts already in it:
KRunner > Alt+Space / Alt+F2
Run Command on clipboard contents > Alt+Shift+F2

The KRunner is prompting me to tell it which application to run, I don't know what to tell it, but if I decide say - my Kate text editor, how will it automatically "know" to open my file email.txt? How will it "know" to load the content into the clipboard? How will it "know" to shut down after doing that?

I need a way to do it all without showing anything on screen, please tell me how?

On my 2nd question:

1) My initial installation is Ubuntu 20.04 GNOME
2) ON top of that, I installed KDE Plasma

I am getting regular software updates and accept all of them, but my KDE Plasma remains the same version.

I believe that new versions have bug fixes and maybe some improvements, that's why I am asking

Cheers and Thanks again
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: Load a file content with a hotkey

Mon Nov 02, 2020 10:01 am
alexorly wrote:I wish there was a way here to add a screen shot, if that is available, please teach me how.

Sorry, no idea. You can upload the file anywhere else and link it here using the [img]-Tag. But I doubt it would help.
Anyway, I get to the page : Global shortcuts -> Application Launcher . in there I have KRunner and it has 2 shortcuts already in it:

You're in the wrong menu.
«Systemsettings → Shortcuts → Custom Shortcuts: On this page is a Button called «Edit». On use a context menu is displayed where you have to choose «New ⇨ GlobalShortcut ⇨ Keyboard Input»

1) My initial installation is Ubuntu 20.04 GNOME
2) ON top of that, I installed KDE Plasma

Thats a good way to complicate things ;) Installing Ubuntu brings in a lot of GNOME services that start at boot. The preferred way using Ubuntu is to install Kubuntu directly to avoid this. At least it is a GNU/Linux-System, so it is adjustable if anything does not work as expected, just use a different user for gnome and plasma to avoid configuration conflicts and it should work.

As Ubuntu is based on debian and uses the same release concept, there are LTS (long term: years of support for the repositories main and restricted) and STS (short term: 9 Month): the application versions are fixed at some point of the release schedule. All features coming up after this will not be applied. Bugfixes do.

As an example: The Program FooBarApp has version 1.2 at feature freeze date. This version gets to the repositories as it is. The FooBarApp-maintainer releases some critical bugfixes after this date with version 1.3 → the ubuntu-package-maintainer will port the bugfixes back, without modyfing the version (well, packages in ubuntu have their own versioning, so he does, but the FooBarApp still has version 1.2 even if the bugfixes from 1.3 are applied). Then The FooBarApp-maintainer releases a feature in version 1.4, this will not come up in ubuntu. Same is switching to a new major release: FooBarApp version 2.0 does not get into the ubuntu repos for this specifc version.

If you need a newer version of an application than ubuntu provides, there are possibilities to install them manually, but you should have a really good reason to do this as it always is a security issue. Installing a manual downloaded package won't get updates, using a PPA(personal package archive) gives a unproofed source administrator privileges on your system, and so on.
alexorly
Registered Member
Posts
11
Karma
0

Re: Load a file content with a hotkey

Mon Nov 02, 2020 11:46 am
Hello again,

For now, let's concentrate in my hot key topic please.

I followed your instractions, please see image here : https://ourvilla.net.au/newsc.jpg
I created a new shortcut called - "Read File" - I have no idea where to go from here....

Thanks again for your time
Hope you can give me some step by step instructions, I trust you understand what I am after

Cheers
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
If you need a detailed explanation, see KDE-UserBase:Custom Shortcuts

As an minmal example:
- Change the trigger to anything free, e.g. ALT+G
- create an action in the action-tab, place "M:Y:M:A:I:L:Shift+2:H:E:L:L:O:.:C:O:M" without quotes in the big free textedit area
- apply it
- open up Kate, press ALT+G

If you really need to insert file content, you should look up for Klipper (clipboard application with history, preinstalled) or use a separate tool for special pastings like autokey-qt . For simple lines like your email-adress, the default should work.
You could even use a script or dbus-methods with shortcuts, but this heavily depends on what you really want to do.
alexorly
Registered Member
Posts
11
Karma
0
koffeinfriedhof wrote:If you need a detailed explanation, see KDE-UserBase:Custom Shortcuts

As an minmal example:
- Change the trigger to anything free, e.g. ALT+G
- create an action in the action-tab, place "M:Y:M:A:I:L:Shift+2:H:E:L:L:O:.:C:O:M" without quotes in the big free textedit area
- apply it
- open up Kate, press ALT+G

If you really need to insert file content, you should look up for Klipper (clipboard application with history, preinstalled) or use a separate tool for special pastings like autokey-qt . For simple lines like your email-adress, the default should work.
You could even use a script or dbus-methods with shortcuts, but this heavily depends on what you really want to do.


What I want to do is have e hot key to load my email address into the clipboard, so each time I need to type the email into a web page, I can use it to paste from the clipboard into that page. The example of the email address - M:Y:M:A:I:L:Shift+2:H:E:L:L:O:.:C:O:M - do I really need to seprate it like that or just enter my actual email address?

Thanks
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
You really have to separate it with colons and type exactly what you would type on your keyboard. Please read the link I provided, it is explained there, including pictures.
alexorly
Registered Member
Posts
11
Karma
0

Re: Load a file content with a hotkey

Mon Nov 02, 2020 11:53 pm
[quote="koffeinfriedhof"]You really have to separate it with colons and type exactly what you would type on your keyboard. Please read the link I provided, it is explained there, including pictures.[/quoute]

OK, followed the steps and checke the link.
It does what I want, but one problem - in my email address it records 2, not @
That makes my email look like this : myemail2gmail.com - instead of myemail@gmail.com

My keyboard is English US, so how can I get it to record and @ not 2?

Cheers
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
As in my example. You missed the Shift-Key, as you need every keystroke exactly the same as you would type it.

For inserting an email-adress it seems to be complicated, but imagine something like this: select/copy something with `ctrl-a/ctrl-c` switch to another activity with `super-tab`, start Kate with `alt-space Kate Enter`, insert the stuff with `ctrl-v` and switch back with super-shift-tab`. This is possible with only one shortcut.
alexorly
Registered Member
Posts
11
Karma
0

Re: Load a file content with a hotkey

Tue Nov 03, 2020 11:18 am
koffeinfriedhof wrote:As in my example. You missed the Shift-Key, as you need every keystroke exactly the same as you would type it.

For inserting an email-adress it seems to be complicated, but imagine something like this: select/copy something with `ctrl-a/ctrl-c` switch to another activity with `super-tab`, start Kate with `alt-space Kate Enter`, insert the stuff with `ctrl-v` and switch back with super-shift-tab`. This is possible with only one shortcut.


I DID NOT miss the Shift Key, there is no other way on a US keyboard to get the "@" but with Shift+2

I even did multiple attempts, I did the following after hitting Caps Lock:

A:L:E:X:4:O:R:L:Y:@:G:M:A:I:L:.:C:O:M - Is there anything wrong with that?

This is how it shows in the Setup screen, but when I hit ALT+G it comes up as 2 instead of @

Can you think of any reason?

Thanks again for your time
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: Load a file content with a hotkey

Tue Nov 03, 2020 11:33 am
You must enter the shift key literally.

Tu doit entrer le libellé de la touche Maj, pas appuyer dessus. Ça veut dire «:Y:Shift+2:G:» comme j'ai t'écrit:
Code: Select all
M:Y:M:A:I:L:Shift+2:H:E:L:L:O:.:C:O:M
alexorly
Registered Member
Posts
11
Karma
0
koffeinfriedhof wrote:You must enter the shift key literally.

Tu doit entrer le libellé de la touche Maj, pas appuyer dessus. Ça veut dire «:Y:Shift+2:G:» comme j'ai t'écrit:
Code: Select all
M:Y:M:A:I:L:Shift+2:H:E:L:L:O:.:C:O:M


Maintenant je comprends, ça marche très bien, merci beaucoup

I am Australian, My main language is English, but I also speak a bit French and Spanish.

I have a lot to learn in this OS.

Thanks again
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS
Okay ;) I just thought it could have been a translator issue and wrote it in french. Have fun with your system ;)
alexorly
Registered Member
Posts
11
Karma
0

Re: Load a file content with a hotkey

Wed Nov 04, 2020 11:32 am
koffeinfriedhof wrote:Okay ;) I just thought it could have been a translator issue and wrote it in french. Have fun with your system ;)


Thank you so much again,
This now opens a lot of other possibilities for me.

Back to my 2nd question - how can I switch to KDE Plasma the latest, without the need to reinstall it all, I tried - but the USB was not good and it failed when I tried installing Kubuntu.

Cheers


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]