Xfce Forum

Sub domains
 

You are not logged in.

#1 2024-01-19 16:29:53

chang-zhao
Member
Registered: 2023-11-20
Posts: 38

[HOWTO] Workaround for having hotkeys in Thunar submenus

Hopefully it's going to be resolved soon, but currently if you put Thunar's custom actions in a submenu, their hotkeys stop working.
#1043 - Keyboard shortcuts for UCA's inside submenus do not work.

I think it inhibits wider usage of custom actions and/or grouping them in menus, so here is a temporary workaround.

You set one custom action in the main menu, with a hotkey. Set other actions of that group in a submenu:

Thunar UCAs with submenu

In this example, "Color Remove" is in the main menu, and there's a submenu with 3 more items:

  • Color: Unread

  • Color: Later

  • Color: ToDo

The trick is: for every item in the submenu, set a hotkey outside of Thunar (with AutoKey or with Keyboard Settings) to call a small additional script that would write a temporary file saying which action should be invoked. Also this script would send the hotkey to start the action that was set in the main menu. That action would read the temp file (and delete it) and apply necessary resulting action to the currently selected files.

This way we could invoke different actions with different hotkeys, and apply them to file selections of Thunar.

Those small additional scripts can be like this:

#!/bin/sh
echo -n "unread" >/tmp/set_param_for_color_file.tmp
xdotool key super+grave

And the main action that reads the temporary file and calls the appropriate sub-actions could start like this:

#!/bin/sh
ACTION=`cat /tmp/set_param_for_color_file.tmp` || ACTION=unset
rm /tmp/set_param_for_color_file.tmp

case "$ACTION" in
#...
# Perform actions depending on the parameter. (Perhaps with "$@" ).

Last edited by chang-zhao (2024-01-19 16:31:57)

Offline

#2 2024-04-03 01:20:18

cfgnunes
Member
Registered: 2024-04-03
Posts: 2

Re: [HOWTO] Workaround for having hotkeys in Thunar submenus

Thanks, chang-zhao!

I think this feature is important. Some projects depend on this functionality, such as my project, in:
https://github.com/cfgnunes/nautilus-scripts

The shortcuts do not work because of this issue.

Last edited by cfgnunes (2024-04-03 01:21:41)

Offline

Board footer

Powered by FluxBB