bassmanitram / actions-for-nautilus

An extension to the Gnome "Files" file manager that allows you to add arbitrary actions to the file selection context menu.
Apache License 2.0
165 stars 16 forks source link

Certain commands don't seem to work with zenity #44

Closed D10f closed 1 year ago

D10f commented 1 year ago

Hi, I've been playing around with this amazing program for the past few hours trying to understand how it works and hopefully come up with useful quick actions for my context menu. In doing so I found that certain commands that run fine in the terminal, won't work when used as a command for Actions For Nautilus. For example:

du -sh ~/Downloads | xargs -I {} zenity --info --text={} --width 150

This command creates a new dialog window using zenity displaying the output of the du command. When translated to AFN however, it doesn't seem to do anything.

du -sh %d | xargs -I {} zenity --info --text={} --width 150

I've tried several combinations of placeholders such as %D or %F, as well as alternative ways to capture the output of the command to feed into zenity (quoting the placeholder, specifying the current working directory, etc). I've also enabled debugging output but again there's no output to be seen anywhere, even after running Nautilus from the terminal.

Here's the JSON produced by this action rule as described:

{
   "type": "command",
   "label": "Calculate total size",
   "command_line": "du -sh %D | xargs -I {} zenity --info --text={} --height 150",
   "filetypes": [
     "directory"
   ]
},

As a side note (I can create another issue if you want), I think it would be extremely useful to have a button to force the updated configuration to take place rather than waiting for 30 seconds.

Thanks!

D10f commented 1 year ago

Nevermind, I completely forgot to specify the use_shell: true... :sweat_smile:

bassmanitram commented 1 year ago

Hey, sorry I didn't get back to you before you resolved it. Glad you managed to figure it out. The "waiting 30 seconds" thing is actually because it's quite difficult to get the extension itself to respond to file change or other asynchronous notifications - the only way I've found that works at the moment is a timer event - hence the 30 seconds. I'll keep looking though.

On Wed, Mar 22, 2023 at 12:30 PM D10f @.***> wrote:

Nevermind, I completely forgot to specify the use_shell: true... 😅

— Reply to this email directly, view it on GitHub https://github.com/bassmanitram/actions-for-nautilus/issues/44#issuecomment-1479489933, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAKLWWJO4V4XNVYNUXQDJLW5LWGFANCNFSM6AAAAAAWDXTAXI . You are receiving this because you are subscribed to this thread.Message ID: @.***>