Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order of actions in context menu #3334

Merged
merged 2 commits into from
Jan 31, 2024
Merged

Fix order of actions in context menu #3334

merged 2 commits into from
Jan 31, 2024

Conversation

zsugabubus
Copy link
Contributor

Opening nemo 6.0.0 (but issue first seen about half year ago so it is not version specific), in the first tab of the first window, actions in context menu show up in reversed order. Order seems to be correct in further tabs and windows or after changing view mode (e.g. list -> icons).

@mtwebster
Copy link
Member

Hi,

I can't reproduce the ordering problem, but I wonder that's because of the way directories are processed individually, and not always all at once.

We're currently sorting files in each given folder, then adding their actions. The final action list won't be in order. And each folder can be updated separately, further affecting any order, as the old ones are removed and replacements added to the end of the list.

For instance, my startup (each ----- line is the end of refresh_actions():

------------------------------------
------------------------------------
------------------------------------
------------------------------------
Found: [email protected]_action
Found: [email protected]_action
------------------------------------
Found: [email protected]_action
Found: [email protected]_action
------------------------------------
Found: 90_new-workspace.nemo_action
Found: 91_delete-workspace.nemo_action
Found: 92_show-expo.nemo_action
Found: change-background.nemo_action
Found: mint_dev_tool_show_file_metadata.nemo_action
Found: mintstick-format.nemo_action
Found: mintstick-verify.nemo_action
Found: mintstick.nemo_action
Found: sample.nemo_action
Found: set-as-background.nemo_action
Found: warpinator-send.nemo_action
------------------------------------
Found: [email protected]_action
Found: [email protected]_action
------------------------------------
Found: [email protected]_action
Found: [email protected]_action
------------------------------------
Found: [email protected]_action
Found: [email protected]_action
------------------------------------
------------------------------------
------------------------------------
------------------------------------
------------------------------------
------------------------------------
Found: 90_new-workspace.nemo_action
Found: 91_delete-workspace.nemo_action
Found: 92_show-expo.nemo_action
Found: change-background.nemo_action
Found: mint_dev_tool_show_file_metadata.nemo_action
Found: mintstick-format.nemo_action
Found: mintstick-verify.nemo_action
Found: mintstick.nemo_action
Found: sample.nemo_action
Found: set-as-background.nemo_action
Found: warpinator-send.nemo_action
------------------------------------
Found: [email protected]_action
Found: [email protected]_action
------------------------------------

I think if there's to be any consistency, action_manager->actions would need to be re-sorted (based on action->key_file_path I guess) each time refresh_actions() runs.

@zsugabubus
Copy link
Contributor Author

Sorry if I was not totally clear, my issue was not about global ordering but order of actions from a single directory.

cd ~/.local/share/nemo/actions
/path/to/helper.zsh 3
helper.zsh
#!/bin/zsh -xeu
n=$1

# Will remove your existing actions, be careful!
# rm -f *.nemo_action(N); # Uncomment me.

for i in {001..$n}
do
  printf > $i.nemo_action "
[Nemo Action]
Name=x-%s
Exec=echo
Selection=any
Extensions=any
" "$i"
done

I'm on Arch Linux, using i3 (no desktop environment). The order I see in context menu is 3 2 1. In further tabs it correctly shows 1 2 3.

I guess it is likely related to timings of events and the number of directories. On my machine I can reproduce it with 100%. I can provide a similar output like yours if it would be helpful.

A final sorting would fix a superset of this issue so maybe I should give a try and implement that one too?

@zsugabubus
Copy link
Contributor Author

What's the state of this PR? Am I expected to do something?

@mtwebster mtwebster merged commit 3afe9d8 into linuxmint:master Jan 31, 2024
2 checks passed
@mtwebster
Copy link
Member

Sorry, nothing really wrong, it's just a bit incomplete like I mentioned above.

This will be less of an issue when #3353 is merged also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants