Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-01-27 10:46:05

vinox
Member
Registered: 2020-01-27
Posts: 32

Enabling cut/copy/paste keyboard buttons inside Thunar

I'm using a Microsoft Office Keyboard, which has several special buttons including dedicated ones for cut, copy and paste.
I chose it as keyboard model inside the Xfce keyboard settings GUI and cut/copy/paste works perfectly inside Firefox or LibreOffice.

However those keys don't work at all inside Thunar and the desktop, I can't cut/copy & paste any files.
Is there any way to enable those keys for Thunar?

Last edited by vinox (2020-01-27 11:23:28)

Offline

#2 2020-01-27 12:34:33

Aravisian
Member
Registered: 2019-08-17
Posts: 410

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

vinox wrote:

I'm using a Microsoft Office Keyboard, which has several special buttons including dedicated ones for cut, copy and paste.
I chose it as keyboard model inside the Xfce keyboard settings GUI and cut/copy/paste works perfectly inside Firefox or LibreOffice.

However those keys don't work at all inside Thunar and the desktop, I can't cut/copy & paste any files.
Is there any way to enable those keys for Thunar?

If it was me, I would go about it by remapping the keys using xmodmap. But I may be spraying into the wind as I am not sure if the keys in question on your board will register with xmodmap.
https://superuser.com/questions/385748/ … ste/411046

Offline

#3 2020-01-27 13:18:52

vinox
Member
Registered: 2020-01-27
Posts: 32

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

Correct me if I'm wrong, but isn't the correct mapping already there since the keys work in Firefox, LibreOffice and other programs that rely on X?

Is it probably GTK-related as suggested here?
https://docs.xfce.org/xfce/thunar/faq#h … _shortcuts

Offline

#4 2020-01-27 13:25:57

Aravisian
Member
Registered: 2019-08-17
Posts: 410

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

vinox wrote:

Correct me if I'm wrong, but isn't the correct mapping already there since the keys work in Firefox, LibreOffice and other programs that rely on X?

Is it probably GTK-related as suggested here?
https://docs.xfce.org/xfce/thunar/faq#h … _shortcuts

"This functionality has been disabled by GTK3. "
-facepalm- and XFCE-development wants to transition to that even more...



Well, did following the advice listed there help any?

Offline

#5 2020-01-27 22:32:52

ozjd
Member
From: Hawkesbury NSW Australia
Registered: 2012-02-05
Posts: 560
Website

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

You can edit ~/.config/Thunar/accels.scm. Locate the appropriate line, remove the semi-colon at the start of the line and replace the current key combination with your new keys. You will need to know the name of the keys you wish to use and xev can help there. Probably best not to have any Thunar windows open while doing this.

I have a Microsoft Ergonomic keyboard and found that not all the additional keys are recognised in Linux even when the correct keyboard is selected in the keyboard settings. Most, such as the multimedia keys, do work though so good luck.

Offline

#6 2020-01-28 08:36:14

vinox
Member
Registered: 2020-01-27
Posts: 32

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

@ozjd: Thanks mate, I'll look into that when I'm back home.

What I've learned in the meantime that the keyboard model selector in Xfce's settings basically defines XF86xxx entries like XF86Copy.
Unfortunately Gtk doesn't use these definitions, while FF and LibreOffice support these natively.

I was wondering if there's a way to emulate keypresses on the command line?
In that case keyboard shortcuts could be defined in Xfce's keyboard settings GUI.
I've already tried to add

xdotool key ctrl+c

and the like there, but unfortunately xdotool requires the corresponding window ID. to be given in order to work.
If anyone knows a tool that doesn't require this, let me know.
This would enable cut, copy & paste in basically every application, not just Thunar.

Last edited by vinox (2020-01-28 08:36:42)

Offline

#7 2020-01-28 09:07:42

Aravisian
Member
Registered: 2019-08-17
Posts: 410

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

vinox wrote:

@ozjd: Thanks mate, I'll look into that when I'm back home.

What I've learned in the meantime that the keyboard model selector in Xfce's settings basically defines XF86xxx entries like XF86Copy.
Unfortunately Gtk doesn't use these definitions, while FF and LibreOffice support these natively.

This makes sense as these are used on WIndows.

vinox wrote:

I was wondering if there's a way to emulate keypresses on the command line?
In that case keyboard shortcuts could be defined in Xfce's keyboard settings GUI.

This was the first suggestion I thought of- but I couldn't find or figure out a Command for "copy" and so I dropped that idea and didn't post it.

vinox wrote:

I've already tried to add

xdotool key ctrl+c

and the like there, but unfortunately xdotool requires the corresponding window ID. to be given in order to work.
If anyone knows a tool that doesn't require this, let me know.
This would enable cut, copy & paste in basically every application, not just Thunar.

You can find the corrosponding window ID using wmctrl

sudo apt-get install wmctrl
wmctrl -l

However, the window ID can change with each restart. So that may not be a solution. I use xdotool and wmctrl that way on certain tasks that are set up to start in a particular order to ensure the same window ID. But even then, that works about 80% of the time and sometimes, a process starts that normally doesn't and throws it off.

Offline

#8 2020-01-28 15:34:20

vinox
Member
Registered: 2020-01-27
Posts: 32

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

I dug deeper and learned that

xdotool key --window '$(xdotool getactivewindow)' ctrl+c

should do the trick.
The problem is, that xcfe4-keyboard-settings crashes/exits with single quotes, which I filed as bug report.

Any suggestions how I could work around this bug?
Could I probably edit the file where the info is store manually? If so, where can I find it?
Or could I somehow avoid the single quotes in the command?

Last edited by vinox (2020-01-28 15:45:03)

Offline

#9 2020-01-28 16:01:05

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

Thanks for reporting.

I can't reproduce it on xfce4-keyboard-settings 4.14.1 (Xfce 4.14)/Xubuntu 18.04, either single or double quotes work in keyboard shortcuts.

You can edit the settings in the xfce4-keyboard-shortcuts channel in the Settings Editor, and even manually edit the file at:

/home/USERNAME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml

Maybe you have to restart something or log out and login, not sure...

Offline

#10 2020-01-28 17:08:43

Aravisian
Member
Registered: 2019-08-17
Posts: 410

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

vinox wrote:

I dug deeper and learned that

xdotool key --window '$(xdotool getactivewindow)' ctrl+c

should do the trick.
The problem is, that xcfe4-keyboard-settings crashes/exits with single quotes, which I filed as bug report.

Any suggestions how I could work around this bug?
Could I probably edit the file where the info is store manually? If so, where can I find it?
Or could I somehow avoid the single quotes in the command?

I'm with alconiq.. alcornqui... I'd have to go look to see how to spell it...
That guy. I'm with him. Double quotes seemed to work. I wonder if there is another cause.

Thanks for teaching me something new about xdotool! Thanks to your post above, I now have a new method for pursuing one of my nefarious dastardly plots.

Offline

#11 2020-01-30 09:54:02

vinox
Member
Registered: 2020-01-27
Posts: 32

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

A small update, which might help others:
this post explains how to add bindings to two GTK config files and effectively adds cut, copy & paste special key support to most GTK2 and GTK3 programs.

Last edited by vinox (2020-01-30 09:54:48)

Offline

#12 2020-01-30 10:22:53

vinox
Member
Registered: 2020-01-27
Posts: 32

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

I just realised that Thunar doesn't care about the gtk.css settings, so I need to go that route in addition:

ozjd wrote:

You can edit ~/.config/Thunar/accels.scm. Locate the appropriate line, remove the semi-colon at the start of the line and replace the current key combination with your new keys. You will need to know the name of the keys you wish to use and xev can help there. Probably best not to have any Thunar windows open while doing this.

Can I assign more than one key/key combination? I'd like to use the dedicated copy key without losing the regular Ctrl+C option.

Offline

#13 2020-01-31 03:20:21

ozjd
Member
From: Hawkesbury NSW Australia
Registered: 2012-02-05
Posts: 560
Website

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

vinox wrote:

Can I assign more than one key/key combination? I'd like to use the dedicated copy key without losing the regular Ctrl+C option.

That's something I've never tried so can't answer but I suggest you try copying the whole line and trying it. In theory it should work, I think.

Offline

#14 2020-01-31 08:35:51

vinox
Member
Registered: 2020-01-27
Posts: 32

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

Xev gives me XF86Copy, XF86Paste and so on as codes.
I changed

; (gtk_accel_path "<Actions>/ThunarStandardView/paste" "<Primary>v")

to

(gtk_accel_path "<Actions>/ThunarStandardView/paste" "XF86Paste")

and logged out and back in.
Oddly Thunar rewrites this to...

(gtk_accel_path "<Actions>/ThunarStandardView/paste" "Paste")

but the dedicated paste key works afterwards. Unfortunately Ctrl+v is lost then.

To get both keys to work I tried

(gtk_accel_path "<Actions>/ThunarStandardView/paste" "Paste,<Primary>+v")

but that ended up being rewritten by Thunar as

(gtk_accel_path "<Actions>/ThunarStandardView/paste" "")

I assume gtk_accel_path is only able to handle one shortcut per action.
I tried to lookup the source code for gtk_accel_path if that's correct but I've zero experience with Git and Google didn't reveal anything.

Last edited by vinox (2020-01-31 08:37:26)

Offline

#15 2020-01-31 09:24:52

ozjd
Member
From: Hawkesbury NSW Australia
Registered: 2012-02-05
Posts: 560
Website

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

That appears to be the case. You could file a feature request bug at https://bugzilla.xfce.org/ or ask on the dev mailing list.

Offline

#16 2020-02-03 22:19:38

vinox
Member
Registered: 2020-01-27
Posts: 32

Re: Enabling cut/copy/paste keyboard buttons inside Thunar

Hmm, while the Cut/Copy/Paste keys work fine in Thunar windows with the modified accells.scm, they actually don't do anything on the desktop.
Is Thunar not responsible for the desktop?

Edit:
I found the answer:
https://bugzilla.xfce.org/show_bug.cgi?id=11455

Last edited by vinox (2020-02-03 22:35:28)

Offline

Board footer

Powered by FluxBB