GithubHelp home page GithubHelp logo

bassmanitram / actions-for-nautilus Goto Github PK

View Code? Open in Web Editor NEW
144.0 3.0 13.0 11.01 MB

An extension to the Gnome "Files" file manager that allows you to add arbitrary actions to the file selection context menu.

License: Apache License 2.0

Makefile 0.27% Python 1.81% Shell 0.07% HTML 3.57% CSS 0.30% JavaScript 93.98%
files gnome-desktop nautilus-extension nautilus gnome-files

actions-for-nautilus's Introduction

IMPORTANT NOTE All users of releases 1.6.0 and before should update their installations to release 1.6.1 as soon as possible due to a security issue.

Actions For Nautilus

An extension to the Gnome Files file manager (otherwise known as Nautilus) that allows you to add arbitrary actions to the Gnome Files selection context menu.

This extension is a "replacement" for the now-defunct Nautilus file manager functionality of the filemanager/nautilus-actions project.

The extension supports many of the most commonly used features of the original extension project, including:

  • structuring context menu items for Nautilus File Manager selections including nested sub menus
  • filtering the displayed items based on:
    • number of files in the selection,
    • user's access permissions for the selected files,
    • mimetypes of the selected files (matching and non-matching conditions supported, as well as mimetype globs),
    • basic filetypes of the selected files - e.g. 'file', 'directory', 'symbolic-link' ... - (matching and non-matching conditions supported),
    • full path pattern matching, expressed as glob patterns or regular expressions, again with support for matching and non-matching conditions.
  • execution of an arbitrary command/script when a menu item is activated, with the same "PLURAL" and "SINGULAR" semantics as the filemanager/nautilus-actions project
  • support for all the command line placeholders implemented by the filemanager/nautilus-actions project, with the same semantics

It is also much better at executing commands in a shell than the original extension, allowing for the construction of pipelines and loops, as well as the use of more complex shell expressions, without the need for writing wrapper scripts.

A configuration application by the name "Actions For Nautilus Configurator" is installed into your desktop applications collection. When you first use the configurator, if no existing configuration file is found, the delivered sample configuration will be installed.

The project has a wiki that is used to share tips and tricks and useful configuration examples.

Installation

Debian-based systems

Debian packages of the most recent releases are provided in the dist folder.

Simply download the package, install with your package installer, then launch the Actions For Nautilus Configurator application from your applications list in order to start building a configuration based upon the delivered sample.

To enable the extension after installation, you will need to restart Nautilus/Files:

  • Alt F2
  • nautilus -q

should do it.

Suggested Additional Packages

The Debian package specifies the following Suggests dependencies that will greatly enhance the utility of the extension as well as allow the delivered sample configuration to work on first launch:

  • xclip - a command line tool for managing the X clipboards
  • zenity - a Gnome UI toolkit for shell scripts

It is highly recommended to install these extra packages.

Manual Installation

Install Dependencies

Firstly, of course, the extension relies upon GNOME and GNOME Files (aka Nautilus) being installed.

Then it relies on python 3+, nautilus-python, and certain process management tools (which are likely already installed but just in case :)).

  • Fedora sudo dnf install nautilus-python python3-gobject procps-ng js-jquery
  • Ubuntu sudo apt install python3-nautilus python3-gi procps libjs-jquery
  • Arch sudo pacman -S python-nautilus python-gobject procps-ng jquery

Download & Install the Extension

To install the extension manually, then, you will need to follow these steps:

  1. git clone https://github.com/bassmanitram/actions-for-nautilus.git
  2. cd actions-for-nautilus
  3. make install to install for only your use, or sudo make install_global to install for all users.
  4. You may have to restart the Gnome shell in order to see the configuration application in your desktop applications list

If you don't have the git or make commands in your system, simply install them in the same way you installed the other dependencies.

On first installation, you won't see anything different in the Nautilus context menus, because you need to have a working configuration for anything to change. The sample configuration will be installed for the user simply by starting the configuration UI.

Uninstallation

  1. cd path/to/actions-for-nautilus
  2. make uninstall if you installed for only your use, or sudo make uninstall_global if you installed for all users.
  3. You may have to restart the Gnome shell in order to remove the configuration application from your desktop applications list

Sample configuration

The delivered sample configuration file is copied to

${HOME}/.local/share/actions-for-nautilus/config.json

when you first start the configuration UI, if there is no existing configuration.

The configuration contains examples of command and menu construction, including:

  • contextual submenus,
  • mimetype, file type, and selection count conditions,
  • the use of command pipelines,
  • exploiting $(...)/backtick command and argument substitution.
  • ...

The configured commands rely on a few extra dependencies that need to be installed if you want to see the sample configuration working properly:

  • gedit - the standard Gnome editor - you probably already have this
  • gnome-terminal - the standard Gnome terminal emulator (for now) - you probably have this too.
  • xclip - a command line tool for managing the X clipboards
  • zenity - a Gnome UI toolkit for shell scripts

Again, these can be installed using your platform package manager as shown above.

It is also possible that the semantics of the more complex command structures rely upon shell features that, if you are not using BASH as your system shell, will not work for you.

The Gnome Terminal "No Close" profile

When executing the gnome-terminal command, the sample configuration references a gnome-terminal profile named "No Close".

This is not a standard profile, but is a useful one to define in that the terminal doesn't close when the command it is running ends, allowing you to see command output and/or to relaunch the command.

You can create this profile as follows:

  • Open the gnome-terminal application
  • Find the Preferences dialog (either a menu item or click on the ... button, then on Preferences)
  • Click on the + next to the word Profiles
  • Give the new profile the name No Close
  • Click on the Command tab
  • Ensure that the When command exits: option is set to Hold terminal open
  • Configure anything else you need concerning the profile behavior and look and feel

Configuration UI

When you install this extension, a configuration application is installed into your local desktop Applications collection.

To start the application:

  • Open your Applications collection navigator (menu, panel, ...)
  • Find Actions For Nautilus Configurator
  • Click on it

The application will open in your default Web Browser. It will present the current configuration (creating one from the delivered sample if no configuration yet exists for the user).

The UI should be pretty self-explanatory - you can add, delete, move and modify Menus and Commands at will.

There is also an embedded JSON source editor with syntax checking should you wish to perform actions not supported by the main UI (such as copy/paste of actions).

Simply close the web page to quit the configurator.

NOTE the configurator web application NEVER communicates outside of your own system unless you click on an external link referenced in the help information.

Configurator help

The UI includes integrated help that can be accessed in one of two ways:

  • Click on the Show Help button to open the help viewport to the right of the main configurator UI, positioned at the beginning of the help information.
  • Click on any of the ⓘ icons to open the help viewport to the right of the main configurator UI, positioned at the information pertaining to the UI element to which the ⓘ icon is attached.

When both the configurator and the help information are displayed, the viewport sizes can be adjusted by dragging the line that separates them.

To close the help information, simply click on the Hide Help button (which is the Show Help button with the label modified when the help information is being displayed).

Saving your changes

In order to save configuration changes, click on the Save Config button. Your changes should be visible in Nautilus after about 30 seconds (the timeout for the internal config file change watcher).

The existing configuration file is backed up before being overridden by a saved configuration. You can reinstate an older configuration by opening Nautilus/Files, navigating to the folder...

${HOME}/.local/share/nautilus-python/extensions/actions-for-nautilus

and replacing your current config.json file with any of the backed up copies. Again, changes will take effect after a maximum of about 30 seconds.

Configuration reference

The configuration is specified in a JSON text file named config.json located in

${HOME}/.local/share/actions-for-nautilus

The extension is delivered with a strict valid JSON Schema that describes exactly how the configuration file needs to be built.

(Note that there is also a second JSON Schema delivered. This is for internal use by the configurator and should not be considered a canonical description of the extension configuration file).

Top level structure

The top level structure in the configuration file must be a JSON object which is expected to contain a property named actions whose value is, itself, an array of objects, and a string property named sort:

{
  "actions": [
    {
      ...
    },
    "sort": "manual or auto"
  ]
}

The sort property is optional and indicates the approach to use for sorting the actions presented by the top level menu. The allowed values are:

  • manual - The extension leaves the items in the order in which they appear in the configuration
  • auto - The extension sorts the items in alphanumeric order

The default value is - manual

The actions array contains the configuration of each action to be presented in the top level menu

Each element of the array is then an object (and action) which, primarily, must have a property named type whose value is either command or menu, and a property named label whose value is the text that you wish to see in the Nautilus context menu.

    {
      "type": "command",
      "label": "My Command",
      ...
    },
    {
      "type": "menu",
      "label": "My Sub Menu",
      ...
    },
    ...

The subsequent sections describe these action objects in detail.

Menu actions

Actions with a type property of menu define "sub menu" actions that, when clicked on, expose a nested menu of further actions, themselves being command actions or further nested menus.

    ...
    {
      "type": "menu",
      "label": "My Sub Menu",
      "actions": [
        ...
      ],
      "sort": "manual or auto"
    },
    ...

Menu actions are expected to contain two additional properties:

  • actions - REQUIRED - an array of elements each of which follows the same pattern as the elements contained by the configuration's root actions property

  • sort - OPTIONAL - The approach to use for sorting the actions presented by the menu

    • manual - The extension leaves the items in the order in which they appear in the configuration
    • auto - The extension sorts the items in alphanumeric order

    Default - manual

When the Nautilus/Files context menu is activated for a selection, the extension assesses all the commands configured within a menu to establish if the commands are relevant for the current selection. If no commands are found to be relevant, then the menu does not appear in the Nautilus/Files context menu.

Command actions

Actions with a type property of command define actions that, when clicked on, execute a command.

    ...
    {
      "type": "command",
      "label": "My Command",
      command_line: "my-script.sh %F %c",
      cwd: "%d",
      use_shell: true,
      min_items: 1,
      max_items: 1,
      "mimetypes": [
        ...
      ],
      "filetypes": [
        ...
      ],
      "path_patterns": [
        ...
      ]
    },
    ...

These are expected to have the following additional properties:

  • command_line - REQUIRED - the system command the should be executed when the menu item is clicked on, expressed as a string.

    The command may contain place holder expressions that are expanded to hold details of the selected files that are passed as arguments to the command.

    The full set of placeholders implemented by the filemanager/nautilus-actions project are supported, with the same semantics - these are further documented below.

    Note that, when using the use_shell option (below), the command line can be just about anything you can enter at a shell prompt - including the following features:

    • Pipelines
    • $(...) or "backtick" command and argument generation/expansion
    • Environment variable resolution
    • Loops
    • ...

    See the sample configuration for a few examples.

  • cwd - OPTIONAL - the working directory that the command should "run in" expressed as a string

    This too can contain place holder expressions, though obviously they should resolve to a single valid directory name

    Default - undefined

  • use_shell - OPTIONAL - a boolean value (true or false) that indicates whether the command should be run by the default system shell. If the command is a shell script, or relies on any shell expansion semantics, you should set the value of this property to true.

    Default - false

  • filetypes - OPTIONAL - the general filetypes of the selected files for which this action is to be displayed (or for which the action is not to be displayed)

    The value should be a JSON list of strings each one of which should have one of the following values:

    • unknown - for files of an unknown type
    • directory - for directories
    • file - for standard files
    • symbolic-link - for symbolic links
    • special - for special files (pipes, devices, ...)
    • standard - shorthand for directories, standard files, and symbolic links

    Again, these can be prefixed with a ! character to indicate that the selected files should not be of that type.

    Only the first appearance of a specific filetype (regardless of any ! "not" prefix) is taken into account.

    Default - all filetypes are accepted

  • min_items - OPTIONAL - the minimum number of items in the selection for which this action will be displayed.

    For example, if the command is expected to, say, compare a number of files, it doesn't make sense for the action to be displayed when less than two files are in the selection. In that case, you would set the value of this property to 2 which would prevent the action from appearing in the context menu when only one file is in the selection.

    If specified, the value must be greater than zero.

    If the value of max_items is greater than zero, the value of this property must be less than or equal to the value of max_items.

    Default - 1

  • max_items - OPTIONAL - the maximum number of items in the selection for which this action will be displayed.

    For example, if the command is expected to, say, start an HTTP server in a selected directory, it doesn't make sense for the action to be displayed when more than one directory is in the selection. Therefore, in this case, you would set the value of this property to 1, which would prevent the action from appearing in the context menu when more than one directory is in the selection.

    A value of zero denotes unlimited.

    If the value is greater than zero, the value of the min_items property must be less than or equal to this value.

    Default - unlimited

  • mimetypes - OPTIONAL - the mimetypes of the selected files for which this action is to be displayed (or for which the action is not to be displayed).

    The value should be a JSON list of strings in the following format:

    • */* or * - meaning that the action can be displayed for all mimetypes
    • type/subtype - to display the action for files of a specific mimetype
    • type/* - to display the action for files whose mimetypes are any subtype of a specific type
    • !type/subtype - to not display the action for files of a specific mimetype
    • !type/* - to not display the action for files whose mimetypes are any subtype of a specific type

    All files in the selection must match an action's mimetype rules for that action to be displayed. Mixing "not" rules with ... well, "not not" rules, can be confusing.

    Only the first appearance of a specific rule (regardless of any ! "not" prefix) is taken into account.

    Default - all mimetypes are accepted

  • path_patterns - OPTIONAL - a list of glob or regular expression patterns against which the full paths of the selected files are to be matched.

    The value should be a JSON list of strings, each in one of the following formats:

    • a "glob" expression - a simple but limited string pattern expression syntax that is used by many UNIX shell commands as well as the shell itself, consisting of the following placeholders:

      • * indicating zero or more characters
      • ? indicating a single character
      • [abc] indicating one of the characters between the brackets
      • [!abc] indicating none of the characters between the brackets

      Quite often this syntax is all that you need in order to express the pattern you wish to match against.

      Note that globs inherently match against the whole path.

    • re: followed by a regular expression (WITHOUT / delimiters) - more complex needs can be expressed as regular expressions.

      Note that regular expressions do not inherently match against the whole path.

      This means that if any part of a selected file path matches the regular expression, the path will be accepted.

      If you want to match against the whole path, start your regular expression with ^ and end it with $.

    Either pattern format can be prefixed with ! in order to negate the pattern.

    All files in the selection must match an action's path pattern rules for that action to be displayed. Mixing "not" rules with ... well, "not not" rules, can be confusing.

    Only the first appearance of a specific rule (regardless of any ! "not" prefix) is taken into account.

    The accepted glob syntax is fully documented here. The accepted Regular Expression syntax is fully documented here .

    Default - all file paths are accepted

  • permissions - OPTIONAL - an indicator of the minimum access permissions that the user must have for the selected files in order for the associated action to be presented in the Nautilus context menu.

    The valid values are:

    • read - the user must at least have read permissions for the selected files
    • read-write - the user must at least have read and write permissions for the selected files
    • read-execute - For files, the user must at least have read and execute permissions for the selected files For folders, the user must at least have read and navigational permissions for the selected folders
    • read-write-execute - the user must have full read, write and execution/navigation permissions for the selected files

    Any other value will disable the permissions check.

    Default - user access permissions are not checked.

With the mimetypes, filetypes and path_patterns filter lists, all selected files must match at least one non-negated rule (if there are any non-negated rules), while matching none of the negated rules, in order for the associated action to appear in the context menu.

Place holders

All the command line and cwd placeholders implemented by the filemanager/nautilus-actions project are implemented by this extension, with the same semantics:

Placeholder Description Repetition
%b the basename of the first selected item (e.g. my-file.txt) SINGULAR
%B space-separated list of the %b values of all selected items PLURAL
%c the number of items in the selection ANY
%d the full path to the directory holding the first selected item (e.g. /home/me/my-first-dir/my-second-dir SINGULAR
%D space-separated list of the %d values of all selected items PLURAL
%f the full path of the first selected item (e.g. /home/me/my-first-dir/my-second-dir/my-file.txt SINGULAR
%F space-separated list of the %f values of all selected items PLURAL
%h the host name from the URI of the first selected item ANY
%m the mimetype of the first selected item (e.g. text/plain) SINGULAR
%M space-separated list of the %m values of all selected items PLURAL
%n the username from the URI of the first selected item ANY
%o no-op operator which forces a SINGULAR form of execution - see below for more details SINGULAR
%O no-op operator which forces a PLURAL form of execution - see below for more details PLURAL
%p the port from the URI of the first selected item ANY
%s the URI scheme from the URI of the first selected item (e.g. file) ANY
%u the URI of the first selected item (e.g. file:///home/me/my-first-dir/my-second-dir/my-file.txt) SINGULAR
%U space-separated list of the %u values of all selected items PLURAL
%w the basename of the first selected item without it's extension (e.g. my-file) SINGULAR
%W space-separated list of the %w values of all selected items PLURAL
%x the extension of the first selected item without it's extension (e.g. txt) SINGULAR
%X space-separated list of the %x values of all selected items PLURAL
%% the % character ANY

Any embedded spaces found in the individual values are 'escaped' to ensure that the shell or system recognizes each value as an independent and complete argument to the command.

The meaning of the Repetition value is explained in the next section.

Execution behavior

The filemanager/nautilus-actions project implemented a feature whereby a configured command could be executed once only, regardless of the number items in the selection, or once for each item in the selection.

This extension implements the same feature with the same semantics.

The decision as to which mode is desired is based upon the first placeholder found in the command_line property value for the activated action:

  • If the placeholder has a Repetition property of SINGULAR, the command is executed once for each item in the selection.
  • If the placeholder has a Repetition property of PLURAL, the command is executed once only.
  • If the placeholder has a Repetition property of ANY, then the next placeholder is examined.
  • If no placeholder with a SINGULAR or PLURAL repetition value is found in the command, then the command is executed only once.

Additionally, if the command is to be executed once for each item in the selection then any placeholder with a Repetition value of SINGULAR is resolved to the corresponding value for the selected item for which the command is being executed.

Placeholders with Repetition values that are not SINGULAR are resolved to their full values for each execution of the command.

An example

This example is taken directly from the filemanager/nautilus-actions project documentation:

Say the current folder is /data, and the current selection contains the three files pierre, paul and jacques.

If we have requested echo %b, then the following commands will be successively run:

echo pierre
echo paul
echo jacques

This is because %b marks a SINGULAR parameter. The command is then run once for each of the selected items.

Contrarily, if we have requested echo %B, then the following command will be run:

echo pierre paul jacques

This is because %B marks a PLURAL parameter. The command is then run only once, with the list of selected items as arguments.

If we have requested echo %b %B, then the following commands will be successively run:

echo pierre pierre paul jacques
echo paul pierre paul jacques
echo jacques pierre paul jacques

This is because the first relevant parameter is %b, and so the command is run once for each selected item, replacing at each occurrence the %b parameter with the corresponding item. The second parameter is computed and added as arguments to the executed command.

And if we have requested echo %B %b, then the following command will be run:

echo pierre paul jacques pierre

This is because the first relevant parameter here is %B. The command is then run only once, replacing %B with the space-separated list of basenames. As the command is only run once, the %b is substituted only once with the (first) basename.

Diagnostics

Error messages are sent to the Nautilus stdout or stderr - including errors found in the configuration file (such as invalid JSON format).

Additionally, the property debug can be set in the top level object, with a value of true or false (the default). When set to true further debug information is printed to the Nautilus stdout.

In order to see that output you will need to start Nautilus in a special way from a terminal emulator (e.g. gnome-terminal):

# Stop Nautilus
nautilus -q  
# Restart with `stdout` and `stderr` being displayed at the terminal
nautilus --no-desktop

Note that, in order to stop this special execution mode, you will need to either close the terminal emulator, or, from another emulator run the nautilus -q command.

Acknowledgments

The main acknowledgement is, of course, to the original Nautilus Actions extension, later renamed to Filemanager Actions to reflect its wider applicability (Nemo, for example).

Unfortunately, this extension is no longer maintained and is no longer functional since Nautilus 42.2 (itself now renamed Gnome Files, though the underlying programming objects are still in the Nautilus namespace).

I was tempted to take over the maintenance of that project, but was put off by its complex C implementation (I'm a perfectly competent C programmer, mind!).

I was convinced that a much less complex implementation of most of the main functionality was possible using Python and the glue to Nautilus found in the nautilus-python framework, and by using a far more semantically relevant configuration format such as JSON and adapting an existing JSON editor UI rather than building a configuration UI from scratch.

I think I have proved my point :)

Another big acknowledgement is of Christoforos Aslanov whose Nautilus Copy Path extension provided the inspiration and template for the original POC of this extension, and whose project structure, installation procedure and doc I initially mercilessly ripped off :)... and I'm even disrespectful enough to have provided an alternative to his extension in my own sample config!

Thanks and apologies, Christoforos.

The JSON Schema-based editor JSON-Editor is an amazing find! The configurator is, in effect, an instance of that editor with a few tweaks to make it look and feel a bit more natural for this use case!

The embedded JSON source editor is the ACE source editor - another amazing project which was so easy to embed that one wonders why JSON-Editor doesn't use that for its own JSON source editing feature - I feel a PR coming on :).

So, a BIG shout-out to those two projects!

actions-for-nautilus's People

Contributors

bassmanitram avatar lukas-schillinger avatar nova1545 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

actions-for-nautilus's Issues

Auto TAG debian package with github commit...

Hi,

On my side I always tend to make debian package whenever it is possible...

On that way, I also always use commit TAG as the debian package versioning, to be able to find quickly what exact version is installed/running.

To do that, I have :

  1. Created a symbolic link :
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$ ln -sf packaging/doc/actions-for-nautilus debian
  1. I have modified the « Makefile » like this :
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$ echo '--- Makefile-orig   2023-12-29 20:18:15.790419491 +0100
+++ Makefile    2023-12-29 20:25:07.476102657 +0100
@@ -2,7 +2,7 @@
 nautilus_path=`which nautilus`
 GLOBALLOC=/usr/share
 LOCALLOC=~/.local/share
-VERSION=1.6.1
+VERSION := $(shell git --git-dir .git --work-tree . describe --always --tags | cut -c2-)
 
 install:
        mkdir -p $(LOCALLOC)/nautilus-python/extensions/actions-for-nautilus' | patch -p0
patching file Makefile
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$
  1. I have updated the « changelog » using this command line :
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$ DEBEMAIL="COLIN Stephane <[email protected]>" dch -b -v $(git --git-dir .git --work-tree . describe --always --tags | cut -c2-) "Update to latest GIT Version..." && sed -i '$!N; /^\(.*\)\n\1$/!P; D' debian/changelog ; head -10 debian/changelog
dch warning: Previous package version was Debian native whilst new version is not
actions-for-nautilus (1.6.1-4-g0a3c7ce) UNRELEASED; urgency=medium

  * Update to latest GIT Version...

 -- COLIN Stephane <[email protected]>  Fri, 29 Dec 2023 20:47:00 +0100

actions-for-nautilus (1.6.1) stable; urgency=high
  * Fix config server being open on all interfaces
  * Fix config server not being closed by FF tab close

bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$
  1. Then I have build the package with :
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$ rm dist/* ; fakeroot make deb
rm -rf build
mkdir -p build//usr/share/nautilus-python
mkdir -p build//usr/share/actions-for-nautilus-configurator
mkdir -p build//usr/share/applications
mkdir -p build//usr/share/doc/actions-for-nautilus
mkdir -p build/DEBIAN
cp -r --preserve=mode,timestamps extensions build//usr/share/nautilus-python
cp -r --preserve=mode,timestamps configurator/* build//usr/share/actions-for-nautilus-configurator
rm build//usr/share/actions-for-nautilus-configurator/javascript/jquery.min.js
LOC=/usr/share python3 -c 'import os,sys; sys.stdout.write(os.path.expandvars(sys.stdin.read()))' \
	< build//usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.desktop \
	> build//usr/share/applications/actions-for-nautilus-configurator.desktop
VERSION=1.6.1-4-g0a3c7ce python3 -c 'import os,sys; sys.stdout.write(os.path.expandvars(sys.stdin.read()))' \
	< packaging/DEBIAN/control \
	> build/DEBIAN/control
cp -r --preserve=mode,timestamps packaging/doc build//usr/share
cp README.md build//usr/share/doc/actions-for-nautilus
cp RELEASE-NOTES.md build//usr/share/doc/actions-for-nautilus/NEWS
mv build//usr/share/actions-for-nautilus-configurator/README.md build//usr/share/doc/actions-for-nautilus/configurator.README.md
gzip -n9 build//usr/share/doc/actions-for-nautilus/NEWS
gzip -n9 build//usr/share/doc/actions-for-nautilus/changelog
find build/ -type d -exec chmod 0755 {} \;
find build/ -type f -exec chmod 0644 {} \;
chmod +x build//usr/share/actions-for-nautilus-configurator/start-configurator.sh
dpkg-deb -Z gzip --build build dist/actions-for-nautilus_1.6.1-4-g0a3c7ce_all.deb
dpkg-deb: construction du paquet « actions-for-nautilus » dans « dist/actions-for-nautilus_1.6.1-4-g0a3c7ce_all.deb ».
lintian dist/actions-for-nautilus_1.6.1-4-g0a3c7ce_all.deb
running with root privileges is not recommended!
E: actions-for-nautilus: debian-changelog-file-missing-or-wrong-name
W: actions-for-nautilus: copyright-without-copyright-notice
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$
  1. This ending with the « debian » package named like this :
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$ ls dist/
actions-for-nautilus_1.6.1-4-g0a3c7ce_all.deb
bigbob@bigbob-t480s:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$

Hope it help...

Python3.10 type error in /var/log/syslog

There is a small mistake filling up from time to time /var/log/syslog:

Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: Traceback (most recent call last): Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: File "/usr/share/nautilus-python/extensions/actions-for-nautilus/actions_for_nautilus.py", line 25, in get_background_items Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: return afn_menu.create_menu_items(self.config.get_config(), [file], "Background", _run_command) Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: File "/usr/share/nautilus-python/extensions/actions-for-nautilus/afn_menu.py", line 12, in create_menu_items Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: my_files = list(map(lambda file: { Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: File "/usr/share/nautilus-python/extensions/actions-for-nautilus/afn_menu.py", line 15, in <lambda> Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: "basename": os.path.basename(file.get_location().get_path()), Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: File "/usr/lib/python3.10/posixpath.py", line 142, in basename Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: p = os.fspath(p) Aug 9 22:13:48 InaUbuntu org.gnome.Nautilus[3732]: TypeError: expected str, bytes or os.PathLike object, not NoneType

It is repeated in blocks.

not an issue, for the Wiki

to compress pdf via gs

    {
        "type": "command",
        "label": "compress pdf",
        "command_line": "gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -dAutoRotatePages=/None  -dPDFSETTINGS=/ebook -r100 -sOutputFile=%w\"_compressed.pdf\"  %b",
        "cwd": "%d",
        "mimetypes": [
            "application/pdf"
        ],
        "filetypes": [
            "standard"
        ]
    },

-r sets the resolution and has a strong effect on file size; you may also delete -r in this case the file size is strongly effected by
-dPDFSETTINGS=/ebook if you set this to -dPDFSETTINGS=/screen you get tiny pdfs with very low resolution

Thanks again for this nice tool & Merry Xmas

ShowIfTrue feature would be nice!

First, this is great replacement for the old nautilus-actions package. Thanks!

The only feature that I miss from the old days is the ShowIfTrue condition that let you specify a command whose output would determine whether to show an action or not.

For example I had an Eject action to detach mounted filesystems defined by

Exec=umount %f
ShowIfTrue=sed -z 's/.*\\s%f\\>.*/true/' /etc/mtab

This would add even more flexibility on top of mime, file type and path pattern conditions.

Using pipe to another command to display progress bar...

Hi @bassmanitram ,

My original command that work fine :

ffmpeg -y -i "%d/%b" "%d/%w.mp4"

My same command using pipe to another one to display progress bar :

ffmpeg -y -i "%d/%b" "%d/%w.mp4" 2>&1 | LANG=C yad --progress --pulsate --center --no-buttons --auto-close --title "Video Converting" --progress-text="Please wait while your video(s) file(s) gets converted..." --height=50

This last one doesn't work, running « nautilus --no-desktop », report error :

ffmpeg version 6.1.1-0ubuntu1~22.04.sav0.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav0.1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-amf --enable-gnutls --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libharfbuzz --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-avisynth --enable-libfdk-aac --enable-libilbc --enable-librist --enable-vapoursynth --enable-libvmaf --enable-crystalhd --enable-libmfx --enable-libsvthevc --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-libsvtav1 --enable-shared
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Unrecognized option '-progress'.
Error splitting the argument list: Option not found

Do you have any idea on how to fix it ?

Here is a video of command directly launch from shell :

simplescreenrecorder-2024-03-06_02.10.46.mp4

Highlight Save button in Orange for unsaved settings

Hello, I note that the save button changes colour (to indicate that it can be clicked on) when there are unsaved changes but I don't find the change particularly visible.

saved changes
image
unsaved changes
image

May I suggest using something more visible like some sort of orange (#ffad55 shown below)?
image

hide/disable entries in the web interface

Hello,

I love this utility but I was wondering if it would be possible to hide/disable entries in the web interface so they can be kept as template or for future use without being deleted.

For instance, there could be a checkbox somewhere to disable it which would grey out the text and remove them from the export but leave them in the list?

Nautilus Desktop

Is there a way to configure "Desktop" ? and Not just inside Folders?

Action that requires user input

May I know if there is a way to request for user input in action?
A simple example would be to create a file using gedit.
gedit filename where filename is provided by user before executed?

Does not work with commands that use placeholders

First, many thanks for keeping this project alive. It's a key part of my professional workflow!

I am trying to add the following command (as I would write in a terminal):

pdfseparate myfile.pdf %d-myfile.pdf

which creates 0-myfile.pdf, 1-myfile.pdf, ... for each page of the original file.

As you can see pdfseparate requires %d to execute otherwise it fails and complains : must contain '%d' (or any variant respecting printf format) if more than one page should be extracted, in order to print the page number

I'm looking for a way to run this in actions-for-nautilus.
pdfseparate %F %d-myfile.pdf does not work because both %F and %d are changed.

I have not managed to write this command in actions-for-nautilus that makes it run successfully.

I need to be able to use %F as a placeholder but keep %d as is. How can I escape a specific part of the command?

The Configuration UI is open to all

The json configuration web portal can be accessed by anyone connected to the same network if he/she knows the port number it is running on. Is it possible to close the server from the UI or any other way?

Blank page when starting AFN

I have strange behavior on one computer.

If I open the link inside terminal, except from the fact I can't render properly, I can see AFN answering and serving the content :

root@oem-ThinkPad-P15-Gen-1:~# lynx -dump http://localhost:60125
   IFRAME: [1]/actions-for-nautilus-configurator.html

   IFRAME: [2]/actions-for-nautilus-configurator-help.html

Références

   1. http://localhost:60125/actions-for-nautilus-configurator.html
   2. http://localhost:60125/actions-for-nautilus-configurator-help.html
root@oem-ThinkPad-P15-Gen-1:~#

But the link doesn't render at all inside browser :

image

Add commands to top of context menu

Is it possible, or could it be made possible, to add options to the top of the context menu? I want to be able to double-click an image and have it open in the standard image viewer, but then to right-click it and directly have the option "Open in pinta" (for example). Currently, it seems the closest I can get with stock nautilus is "Open with Other Application" which then requires me to navigate a list of possibilities, and the closest I can get with actions-for-nautilus is an "Open with pinta" option way down at the bottom of the context menu. Or is there another option I haven't yet found?

how can I see the debug output?

I want to zip a file by using 7zip, here is my shell:

a="%F"; 7z a -si -bd -tzip "newZip.zip" <<< "$(echo -n "$a" | tr '\n' ' ')"

but it not works, so i want to see the debug output.

can you tell me how can I get the nautilus stdout :(

No issue - good !

I made a user make install. Works smoothly.

And configured one of the actions I started to miss from Gnome 42:

grafik

The nested structure in Folder actions and Copy is very nice as well.

Georg

Deletion and moving of actions occasionally corrupts other actions

Difficult to reproduce, but for me when I deleted a command action a menu action further down the list was interpreted as a command action and lost all its submenu configuration as well as being marked invalid.

Workaround - use the JSON editor to handle this kind of thing until a fix is available.

Not working on Ubuntu 22.10

Followed the install instructions:

  • Downloaded and installed the deb
  • Ran Actions for Nautilus Configurator
  • Added my command
  • Restarted Nautilus

I don't see any commands in the right-click menu of an image file.

How to move menu entries to the top?

How to popular the context menu options; say I added this context menu "Open in VS Code" I want to move to the top of the context menu, it should be the first appears before the "Open" option.

actions-for-nautilus doesn't handle specials character in filenames...

For example, a file containing an exclamation point :

bigbob@bigbob-t480s:~/Téléchargements$ ll Renouvellement\ de\ Votre\ Domaine\ blacktiger.tech\ Avant\ l\'Expiration\ \!.eml 
3158596 -rw-rw-r-- 1 bigbob bigbob 12612 2023-12-22 15:22:35.350213309 +0100 Renouvellement de Votre Domaine blacktiger.tech Avant l'Expiration !.eml
bigbob@bigbob-t480s:~/Téléchargements$

The log of « Nautilus » say :

bigbob@bigbob-t480s:~/Téléchargements$ # Stop Nautilus
nautilus -q  
# Restart with `stdout` and `stderr` being displayed at the terminal
nautilus --no-desktop
Traceback (most recent call last):
  File "/usr/share/nautilus-python/extensions/actions-for-nautilus/actions_for_nautilus.py", line 56, in _run_command
    final_command_line = list(map(lambda arg: arg.replace("\\\\","!§ESCBACKSLASH§µ").replace("\\", "").replace("!§ESCBACKSLASH§µ","\\"),shlex.split(final_command_line)))
  File "/usr/lib/python3.10/shlex.py", line 315, in split
    return list(lex)
  File "/usr/lib/python3.10/shlex.py", line 300, in __next__
    token = self.get_token()
  File "/usr/lib/python3.10/shlex.py", line 109, in get_token
    raw = self.read_token()
  File "/usr/lib/python3.10/shlex.py", line 191, in read_token
    raise ValueError("No closing quotation")
ValueError: No closing quotation
bigbob@bigbob-t480s:~/Téléchargements$

Static port for web interface

Hello,

I am not sure if I am using the right terminology, but I noticed as I tried to bookmark the web interface for easy access in my web browser that the "port" being used seems to change every time the app is being started. Would there be a way for this port to be fixed to allow bookmark, either by default or as an option in the interface where the user can specify the port to be used?
image

I'm guessing this would require some update in this file and probably a restart of nautilus to take the change into account. If ports with lower numbers are likely to be taken, perhaps limit the ports to being 10000+ or even higher number to minimise the risk of this being already being taken?

Open a terminal as root in a specific folder

This doesn't seem to work properly on Debian 11, Gnome 43.6, Wayland.
The elevated prompt authentication window prompt comes up but after entering the credentials the terminal won't open.

Certain commands don't seem to work with zenity

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!

Use fakeroot for « make deb »...

IMHO, it is better to use « fakeroot » to build the debian package :

bigbob@bigbob-ux331un:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$ fakeroot make deb
rm -rf build
mkdir -p build//usr/share/nautilus-python
mkdir -p build//usr/share/actions-for-nautilus-configurator
mkdir -p build//usr/share/applications
mkdir -p build//usr/share/doc/actions-for-nautilus
mkdir -p build/DEBIAN
cp -r --preserve=mode,timestamps extensions build//usr/share/nautilus-python
cp -r --preserve=mode,timestamps configurator/* build//usr/share/actions-for-nautilus-configurator
rm build//usr/share/actions-for-nautilus-configurator/javascript/jquery.min.js
LOC=/usr/share python3 -c 'import os,sys; sys.stdout.write(os.path.expandvars(sys.stdin.read()))' \
	< build//usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.desktop \
	> build//usr/share/applications/actions-for-nautilus-configurator.desktop
VERSION=1.6.0 python3 -c 'import os,sys; sys.stdout.write(os.path.expandvars(sys.stdin.read()))' \
	< packaging/DEBIAN/control \
	> build/DEBIAN/control
cp -r --preserve=mode,timestamps packaging/doc build//usr/share
cp README.md build//usr/share/doc/actions-for-nautilus
cp RELEASE-NOTES.md build//usr/share/doc/actions-for-nautilus/NEWS
mv build//usr/share/actions-for-nautilus-configurator/README.md build//usr/share/doc/actions-for-nautilus/configurator.README.md
gzip -n9 build//usr/share/doc/actions-for-nautilus/NEWS
gzip -n9 build//usr/share/doc/actions-for-nautilus/changelog
find build/ -type d -exec chmod 0755 {} \;
find build/ -type f -exec chmod 0644 {} \;
chmod +x build//usr/share/actions-for-nautilus-configurator/start-configurator.sh
dpkg-deb -Z gzip --build build dist/actions-for-nautilus_1.6.0_all.deb
dpkg-deb: construction du paquet « actions-for-nautilus » dans « dist/actions-for-nautilus_1.6.0_all.deb ».
lintian dist/actions-for-nautilus_1.6.0_all.deb
running with root privileges is not recommended!
W: actions-for-nautilus: copyright-without-copyright-notice
bigbob@bigbob-ux331un:~/tmp/Building/actions-for-nautilus/actions-for-nautilus$

deb package

Dear Martin,

thanks a lot that you started with this project. I use the file manager actions a lot was deeply disappointed that support for nautilus was dropped (it still works in Nemo though).

Anyway I get some warning/error messages when trying to install the deb package via Gdebi, see below:

E: actions-for-nautilus: depends-on-essential-package-without-using-version Suggests: bash
E: actions-for-nautilus: extended-description-is-empty
E: actions-for-nautilus: no-changelog usr/share/doc/actions-for-nautilus/changelog.gz (native package)
E: actions-for-nautilus: no-copyright-file
E: actions-for-nautilus: privacy-breach-uses-embedded-file You may use the libjs-bootstrap package. (https://cdn.jsdelivr.net/npm/bootstrap@latest/dist/css/bootstrap.min.css) [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html]
E: actions-for-nautilus: privacy-breach-uses-embedded-file You may use the libjs-jquery package. (https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js) [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html]
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/ 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/ 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/ 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/README.md 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.desktop 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.py 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/actions-for-nautilus.schema.json 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/command-line-help.html 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/find-a-port.py 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/sample-config.json 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/start-configurator.sh 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/sub-menu.png 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/actions-for-nautilus-configurator/test.html 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/applications/ 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/applications/actions-for-nautilus-configurator.desktop 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/ 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/extensions/ 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/extensions/actions-for-nautilus.py 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/extensions/actions-for-nautilus/ 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/extensions/actions-for-nautilus/actions_for_nautilus.py 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/extensions/actions-for-nautilus/afn_config.py 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/extensions/actions-for-nautilus/afn_menu.py 1000/1000
E: actions-for-nautilus: wrong-file-owner-uid-or-gid usr/share/nautilus-python/extensions/actions-for-nautilus/afn_place_holders.py 1000/1000
W: actions-for-nautilus: description-synopsis-starts-with-article
W: actions-for-nautilus: non-standard-dir-perm usr/ 0775 != 0755
W: actions-for-nautilus: non-standard-dir-perm usr/share/ 0775 != 0755
W: actions-for-nautilus: non-standard-dir-perm usr/share/actions-for-nautilus-configurator/ 0775 != 0755
W: actions-for-nautilus: non-standard-dir-perm usr/share/applications/ 0775 != 0755
W: actions-for-nautilus: non-standard-dir-perm usr/share/nautilus-python/ 0775 != 0755
W: actions-for-nautilus: non-standard-dir-perm usr/share/nautilus-python/extensions/ 0775 != 0755
W: actions-for-nautilus: non-standard-dir-perm usr/share/nautilus-python/extensions/actions-for-nautilus/ 0775 != 0755
W: actions-for-nautilus: non-standard-executable-perm usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.desktop 0775 != 0755
W: actions-for-nautilus: non-standard-executable-perm usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.py 0775 != 0755
W: actions-for-nautilus: non-standard-executable-perm usr/share/actions-for-nautilus-configurator/start-configurator.sh 0775 != 0755
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/README.md 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/actions-for-nautilus.schema.json 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/command-line-help.html 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/find-a-port.py 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/sample-config.json 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/sub-menu.png 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/actions-for-nautilus-configurator/test.html 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/applications/actions-for-nautilus-configurator.desktop 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/nautilus-python/extensions/actions-for-nautilus.py 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/nautilus-python/extensions/actions-for-nautilus/actions_for_nautilus.py 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/nautilus-python/extensions/actions-for-nautilus/afn_config.py 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/nautilus-python/extensions/actions-for-nautilus/afn_menu.py 0664 != 0644
W: actions-for-nautilus: non-standard-file-perm usr/share/nautilus-python/extensions/actions-for-nautilus/afn_place_holders.py 0664 != 0644
W: actions-for-nautilus: privacy-breach-generic [] (https://cdn.jsdelivr.net/npm/spectre.css@latest/dist/spectre-icons.min.css) [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html]
W: actions-for-nautilus: privacy-breach-generic [] (https://use.fontawesome.com/releases/v5.6.3/css/all.css) [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html]
W: actions-for-nautilus: privacy-breach-generic [<link rel="stylesheet"\n??href="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/css/jsoneditor.min.css">] (https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/css/jsoneditor.min.css) [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html]
W: actions-for-nautilus: privacy-breach-generic [<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/nonmin/jsoneditor.js">] (https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/nonmin/jsoneditor.js) [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.html]
W: actions-for-nautilus: script-not-executable [usr/share/applications/actions-for-nautilus-configurator.desktop]
W: actions-for-nautilus: synopsis-too-long
W: actions-for-nautilus: unknown-section GNOME Desktop Environment
W: actions-for-nautilus: unusual-interpreter /usr/bin/python [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.py]
W: actions-for-nautilus: unusual-interpreter /usr/bin/python [usr/share/actions-for-nautilus-configurator/find-a-port.py]
W: actions-for-nautilus: unusual-interpreter xdg-open [usr/share/actions-for-nautilus-configurator/actions-for-nautilus-configurator.desktop]
W: actions-for-nautilus: unusual-interpreter xdg-open [usr/share/applications/actions-for-nautilus-configurator.desktop]

Lintian finished with exit status 0`

Did not have that so far.

Anyway a big THANK YOU so far.
`

Add "Open in VS Code" to Wiki

Hello,

I'd like to contribute an "Open in VS Code" configuration to the project wiki. This is not an issue but Github doesn't support pull requests for wikis.

Looking at a google search for adding "Open in VS Code" to the context menu this is a fairly sought after feature.

The following configuration has worked for me on Ubuntu 22.04 and 22.10

, {
    "type": "command",
    "label": "Open in VS Code",
    "command_line": "code --new-window %f",
    "filetypes": [
        "directory", 
        "file"
    ]
}

Breaks on Ubuntu 22

$ nautilus                                   1
Fatal Python error: pycore_create_interpreter: can't make main interpreter
Python runtime state: preinitialized

After installing python3-nautilus, I get this error whenever I attempt to open Nautilus in any way. I was able to install AFN and modify config, but I can't see it because python3-nautilus breaks Nautilus.
How can I fix this?

Web UI not saving config edits

Hello,
Today I installed the most recent version of actions-for-nautilus on a new machine and saw that none of the changes made in the web interface save to the config.json file.

Install Steps

sudo apt install python3-nautilus python3-gi procps
git clone git clone https://github.com/bassmanitram/actions-for-nautilus.git
cd actions-for-nautilus
make install
After this I did a full reboot
Both the actions-for-nautilus and actions-for-nautilus-configurator are present in my Home/local/share/ directory

Steps to Reproduce Issue

'nautilus-actions-configurator' web interface launched from from 'applications' shortcut
No changes made to the configuration are actually saved after saving. I tried editing names, deleting commands, and adding new commands. Running nautilus -q and sudo reboot after saving changes did not work.

Manually editing the config.json still works

System Specs

Ubunut 22.04.1
GNOME nautilus 42.2

Multiple "not" rules do not resolve correctly.

E.g. the following mimetype "not" rules:

!application/pdf
!audio/*

should mean that the command is not displayed for PDFs nor for any audio file.

What it actually does is display the command for both because the algorithm is wrong - since an audio file is not a PDF, it displays, and since a PDF is not an audio file, it displays.

I'm working on it!

repetition behaviour not working correctly

Dear Martin,

reading carefully your manual I wanted to take the advantage of the repetition behaviour with SINGULAR placeholders. The command (echo %f) appears to be repeated but repeatedly on the first entry. That is what I understand from the output:

`COMMAND 0
['echo', '/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27']

COMMAND 1
['echo', '/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27']
/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27

COMMAND 2
['echo', '/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27']
/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27
/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27

COMMAND 3
['echo', '/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27']

COMMAND 4
['echo', '/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27']
/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27

COMMAND 5
['echo', '/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27']
/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27
/home/georg/Bilder/Bilder (home-hd)/import/Sony RX-100M3/2022/2022-08-27
`

The behaviour is the same with %d, %f and %b.

JQuery gets 404 in configurator

Hi first of all thank you for your amazing app i love it, it really helps with my workflow and me just being more productive over all.

I just noticed that on my personal PC at home i cant save or even click help so i investigated and found out that jquery wasn't loading, after i took a look in the actions-for-nautilus-configurator.py script i saw that the path for the minified jquery file was "path": "/usr/share/javascript/jquery/jquery.min.js", so i just quickly changed the path to be "path": "./javascript/jquery.min.js", bc i saw that you're shipping it with all the other files necessary.

i don't know if that's intended behavior or just an oversight that for example the make install should install jquery into this path but since you're shipping it with all the other files in ./javascript/ i think this can be a fix for now.

here my now working code again:

#!/usr/bin/python3
import http.server
import json
import sys
import os
import shutil
import datetime

PORT = 8000
HOME = os.environ.get('HOME')

# config_html = "./actions-for-nautilus-configurator.html"
# cmdline_help = "./command-line-help.html"
config_file = HOME + \
    "/.local/share/actions-for-nautilus/config.json"
# config_schema = "./actions-for-nautilus.schema.json"
# favicon = "./sub-menu.png"

textual_mimes = [
    "text/html",
    "application/json",
    "text/css",
    "application/javascript"
]
docs = {
    "/": {
        "path": "./actions-for-nautilus-configurator-container.html",
        "mimetype": "text/html",
        "default": None
    },
    "/actions-for-nautilus-configurator-container.html": {
        "path": "./actions-for-nautilus-configurator-container.html",
        "mimetype": "text/html",
        "default": None
    },
    "/actions-for-nautilus-configurator.html": {
        "path": "./actions-for-nautilus-configurator.html",
        "mimetype": "text/html",
        "default": None
    },
    "/config": {
        "path": config_file,
        "mimetype": "application/json",
        "default": "{\"actions\":[],\"debug\":false}"
    },
    "/schema": {
        "path": "./actions-for-nautilus.ui.schema.json",
        "mimetype": "application/json",
        "default": None
    },
    "/actions-for-nautilus-configurator-help.html": {
        "path": "./actions-for-nautilus-configurator-help.html",
        "mimetype": "text/html",
        "default": None
    },
    "/favicon.ico": {
        "path": "./images/sub-menu.png",
        "mimetype": "image/png",
        "default": None
    },
    "/webfonts/fa-solid-900.woff2": {
        "path": "./packages/fa-solid-900.woff2",
        "mimetype": "font/woff2",
        "default": None
    },
    "/images/ANY": {
        "path": "./images/",
        "mimetype": "image/png",
        "default": None
    },
    "/javascript/jquery.min.js": {
        "path": "./javascript/jquery.min.js",
        "mimetype": "application/javascript",
        "default": None
    },
    "/javascript/ANY": {
        "path": "./javascript/",
        "mimetype": "application/javascript",
        "default": None
    },
    "/css/ANY": {
        "path": "./css/",
        "mimetype": "text/css",
        "default": None
    },
}
[...]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.