User Tools

Site Tools


config:nemo-performance

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
config:nemo-performance [2020/09/20 14:47] Wulf Rajekconfig:nemo-performance [2024/11/12 10:59] (current) Wulf Rajek
Line 12: Line 12:
 The shortcuts are stored in ''~/.gnome2/accels/nemo'' The shortcuts are stored in ''~/.gnome2/accels/nemo''
  
-Create the folder and edit this file and search for "Move to next pane" (or any other function you require. Remove the preceding semicolon and define the shortcut key. In this example, the shortcut will be set to ''CTRL+j'';+Create the folder and edit this file
 +<code> 
 +mkdir -p ~/.gnome2/accels 
 +vi ~/.gnome2/accels/nemo 
 +</code> 
 + or search for "Move to next pane" when the file exists (or any other function you require. Remove the preceding semicolon and define the shortcut key. In this example, the shortcut will be set to ''CTRL+j'';
 <code> <code>
 (gtk_accel_path "<Actions>/DirViewActions/Move to next pane" "<Primary>j") (gtk_accel_path "<Actions>/DirViewActions/Move to next pane" "<Primary>j")
 </code> </code>
  
-Restart nemo from the command line using+Quit nemo from the command line using:
 <code> <code>
 nemo -q nemo -q
Line 30: Line 35:
  
 Global action scripts need to be placed in ''/usr/share/nemo/actions'' and user actions can be placed in ''~/.local/share/nemo/actions/''. File extension has to be ''.nemo_action''. Global action scripts need to be placed in ''/usr/share/nemo/actions'' and user actions can be placed in ''~/.local/share/nemo/actions/''. File extension has to be ''.nemo_action''.
 +
 +<code>cd ~/.local/share/nemo/actions/</code>
  
 A full description of the syntax is available in the sample file ''/usr/share/nemo/actions/sample.nemo_action'' A full description of the syntax is available in the sample file ''/usr/share/nemo/actions/sample.nemo_action''
Line 36: Line 43:
 The sample file is also here:\\ The sample file is also here:\\
 https://github.com/linuxmint/nemo/blob/master/files/usr/share/nemo/actions/sample.nemo_action https://github.com/linuxmint/nemo/blob/master/files/usr/share/nemo/actions/sample.nemo_action
 +
 +=== Mass renaming ===
 +
 +<code>
 +sudo apt-get install gprename
 +</code>
 +<code - bulk-rename.nemo_action>
 +[Nemo Action]
 +Name=Bulk Rename
 +Comment=Multiple Rename with GPRename.  The action gets executed for the marked or the higher level directory.
 +Exec=gprename %F
 +Selection=m
 +Extensions=any;
 +EscapeSpaces=true
 +Dependencies=gprename;
 +</code>
 +
 +=== Image convert / rotate ====
 +
 +<code>
 +sudo apt-get install nemo-image-converter
 +</code>
 +Then restart nemo to activate the plugin. Right-click context menu entries for images will be available.
  
 === MP3 Tagging example scripts === === MP3 Tagging example scripts ===
Line 87: Line 117:
 chmod 755 .local/share/nemo/actions/beets_import_album.sh chmod 755 .local/share/nemo/actions/beets_import_album.sh
 </code> </code>
 +
 +=== Copy Full Path to clipboard ===
 +
 +<code - ~/.local/share/nemo/actions/copy_full_filepath.nemo_action>
 +[Nemo Action]
 +Name=Copy Full Filepath
 +Comment=Full Path: %F
 +Exec=sh -c "readlink -f %F | xclip -selection clipboard"
 +Icon-Name=gtk-copy
 +Selection=notnone
 +Extensions=dir;nodirs
 +Separator=,
 +Dependencies=readlink;xclip;
 +</code>
 +
 ==== Nemo Performance ==== ==== Nemo Performance ====
  
Line 107: Line 152:
 nemo -q nemo -q
 </code> </code>
 +
 +==== Save/Restore session ====
 +
 +Execute nemo_save.sh to save list of opened nemo windows in ~/.config/nemo/nemo.openwindows.
 +
 +Launch nemo_restore.sh to reopen saved list of windows.
 +
 +Restrictions : the script cannot save opened tabs, and won't save a folder whose name is too long. For special folders like Trash, you can replace the window title name in nemo_save.sh if you know the full path. Also, only the currently active pane in two-pane mode is being saved.
 +
 +Original source: https://github.com/x-hgg-x/Utils/tree/master/Nemo%20save%20and%20restore%20session
 +
 +<code - ~/.local/bin/nemo_save.sh>
 +#!/bin/bash
 +declare -x DISPLAY=":0.0"
 +sleep 5
 +PATHS=$(wmctrl -lx | grep nemo.Nemo | sed -e "s#$hostname Home# - $HOME#" | awk -F' - /' '{print "/"$2}')
 +if [ "$PATHS" == "" ];
 +then
 +    echo "" > ~/.config/nemo/nemo.openwindows
 +else
 +    echo "$PATHS" > ~/.config/nemo/nemo.openwindows
 +fi
 +</code>
 +
 +<code - ~/.local/bin/nemo_restore.sh>
 +#!/bin/bash
 +sleep 2
 +IFS=$'\n'; read -d '' -r -a dirs < ~/.config/nemo/nemo.openwindows
 +
 +for dir in "${dirs[@]}"; do
 +    nemo "$dir" &
 +    sleep 0.5
 +done
 +</code>
 +
 +<code>
 +chmod 755 ~/.local/bin/nemo_save.sh ~/.local/bin/nemo_restore.sh
 +#Add to current user's crontab
 +(crontab -l ; echo "*/5 * * * * /home/$USER/.local/bin/nemo_save.sh") | crontab -
 +</code>
 +
 +Auto-save on Cinnamon shutdown:
 +<code>
 +echo "session-cleanup-script = /home/$USER/.local/bin/nemo_save.sh" | sudo tee -a /etc/lightdm/lightdm.conf.d/70-linuxmint.conf
 +</code>
 +
 +Restore session on Cinnamon start:
 +<code>
 +/usr/bin/cat > ~/.config/autostart/nemo_restore.desktop << EOD
 +[Desktop Entry]
 +Version=1.0
 +Type=Application
 +Encoding=UTF-8
 +Name=Restore Nemo Session
 +Exec=/home/$USER/.local/bin/nemo_restore.sh
 +Terminal=false
 +StartupNotify=false
 +Categories=Application;
 +X-GNOME-Autostart-enabled=true
 +X-GNOME-Autostart-Delay=10
 +EOD
 +</code>
 +
 +==== Action Scripts ====
 +
 +https://github.com/smurphos/nemo_actions_and_cinnamon_scripts
 +
 +Attach file to email Thunderbird:
 +<code>
 +/usr/bin/cat > ~/.local/share/nemo/actions/attach_to_email_tbird.nemo_action << "EOD"
 +[Nemo Action]
 +Name=_Attach to email
 +Comment=Attach %F to email in Thunderbird
 +Exec=thunderbird -compose to=,attachment=%F
 +Icon-Name=mail-attachment-symbolic
 +Selection=notnone
 +Extensions=nodirs
 +Separator=,
 +Dependencies=thunderbird;
 +EOD
 +</code>
 +
 +Attach file to email general:
 +<code>
 +/usr/bin/cat > ~/.local/share/nemo/actions/attach_to_email_xdg-email.nemo_action << "EOD"
 +[Nemo Action]
 +Name=_Attach to email
 +Comment=Attach %F to email in default mail application
 +Exec=<action_scripts/attach_to_email_xdg-email.sh %F>
 +Icon-Name=mail-attachment-symbolic
 +Selection=notnone
 +Extensions=nodirs
 +Quote=double
 +Dependencies=xdg-email;
 +EOD
 +
 +mkdir -p ~/.local/share/nemo/actions/action_scripts
 +
 +/usr/bin/cat > ~/.local/share/nemo/actions/action_scripts/attach_to_email_xdg-email.sh << "EOD"
 +#!/bin/bash
 +COMMAND="xdg-email"
 +for file in "$@"
 +do
 +  COMMAND="$COMMAND --attach '$file'"
 +done
 +sh -c "$COMMAND"
 +EOD
 +</code>
 +
 +Edit with xed as superuser:
 +<code>
 +/usr/bin/cat > ~/.local/share/nemo/actions/xed_sudoedit.nemo_action << "EOD"
 +[Nemo Action]
 +
 +Name=_Xed (Sudoedit)
 +Comment=Open %F with xed opening as different user when needed via sudoedit.
 +Exec=<action_scripts/xed_sudoedit_check.sh %F>
 +Icon-Name=text-editor-symbolic
 +#Stock-Id=
 +Selection=s
 +#Extensions=
 +Mimetypes=text/plain;text/css;text/english;text/html;text/x-apt-sources-list;text/x-c;text/x-c++;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-diff;text/x-dsrc;text/x-java;text/x-makefile;text/x-moc;text/x-pascal;text/x-perl;text/x-python;text/x-sql;text/x-tcl;text/x-tex;
 +#Separator= 
 +#Quote=
 +Dependencies=sudoedit;xed;
 +#Conditions=
 +EscapeSpaces=true
 +Terminal=false
 +EOD
 +
 +mkdir -p ~/.local/share/nemo/actions/action_scripts
 +
 +/usr/bin/cat > ~/.local/share/nemo/actions/action_scripts/xed_sudoedit_check.sh << "EOD"
 +#!/bin/bash
 +FILEOWNER=$(stat -c %U "$1")
 +if [ "$FILEOWNER" = "$USER" ]; then
 +  xed "$1"
 +else
 +  export SUDO_EDITOR="xed -w"
 +  export SUDO_ASKPASS="$HOME/.local/share/nemo/actions/action_scripts/zenity_askpass.sh"  
 +  sudoedit -A -u "$FILEOWNER" "$1"
 +fi
 +EOD
 +
 +sudo apt-get install zenity
 +
 +/usr/bin/cat > ~/.local/share/nemo/actions/action_scripts/zenity_askpass.sh << "EOD"
 +#!/bin/bash
 +zenity --password --title="Authenticate"
 +EOD
 +</code>
 +
 +Edit with vi as superuser:
 +<code>
 +/usr/bin/cat > ~/.local/share/nemo/actions/vi_sudoedit.nemo_action << "EOD"
 +[Nemo Action]
 +
 +Name=_vi (Sudoedit)
 +Comment=Open %F with vi opening as different user when needed via sudoedit.
 +Exec=<action_scripts/vi_sudoedit_check.sh %F>
 +Icon-Name=text-editor-symbolic
 +#Stock-Id=
 +Selection=s
 +#Extensions=
 +Mimetypes=text/plain;text/css;text/english;text/html;text/x-apt-sources-list;text/x-c;text/x-c++;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-diff;text/x-dsrc;text/x-java;text/x-makefile;text/x-moc;text/x-pascal;text/x-perl;text/x-python;text/x-sql;text/x-tcl;text/x-tex;
 +#Separator= 
 +#Quote=
 +Dependencies=sudoedit;vi;
 +#Conditions=
 +EscapeSpaces=true
 +Terminal=false
 +EOD
 +
 +mkdir -p ~/.local/share/nemo/actions/action_scripts
 +
 +/usr/bin/cat > ~/.local/share/nemo/actions/action_scripts/vi_sudoedit_check.sh << "EOD"
 +#!/bin/bash
 +FILEOWNER=$(stat -c %U "$1")
 +if [ "$FILEOWNER" = "$USER" ]; then
 +  vi "$1"
 +else
 +  export SUDO_EDITOR="vi"
 +  sudoedit -A -u "$FILEOWNER" "$1"
 +fi
 +EOD
 +</code>
 +
 +Show dpkg package of file or folder:
 +<code>
 +/usr/bin/cat > ~/.local/share/nemo/actions/show_parent_package.nemo_action << "EOD"
 +[Nemo Action]
 +Name=Show _Parent Package
 +Comment=Display a dialogue that shows which package %F is from
 +Exec=<action_scripts/show_parent_package.sh %F>
 +Icon-Name=package-x-generic-symbolic
 +Selection=s
 +Extensions=any;
 +EscapeSpaces=true
 +Dependencies=zenity;dpkg;
 +EOD
 +
 +mkdir -p ~/.local/share/nemo/actions/action_scripts
 +sudo apt-get install zenity
 +
 +/usr/bin/cat > ~/.local/share/nemo/actions/action_scripts/show_parent_package.sh << "EOD"
 +#!/bin/dash
 +OUTPUT=$(dpkg -S "$1" | cut -f1 -d:)
 +if [ -z "$OUTPUT" ]; then
 +  zenity --info --ellipsize --text="$1\nis not provided by any known package"
 +else
 +  zenity --info --ellipsize --text="$1\nis from the package(s) $OUTPUT"
 +fi
 +EOD
 +</code>
 +
 +Various Nautilus scripts can be found here:
 +https://github.com/cfgnunes/nautilus-scripts
 +
 +==== Action Submenus ====
 +
 +{{:config:pasted:20241112-105830.png}}\\ 
 +
 +GUI change through Nemo -> Edit -> Preferences -> Plugins -> Edit Layout:\\ 
 +{{:config:pasted:20241112-105501.png}}
 +
 +
 +
 +Example of submenu for action scripts:
 +
 +<code - ~/.config/nemo/actions-tree.json>
 +,
 +    {
 +      "uuid": "Video Manipulations",
 +      "type": "submenu",
 +      "user-label": "Video Manipulations",
 +      "user-icon": null,
 +      "children": [
 +        {
 +          "uuid": "video_bitrate.nemo_action",
 +          "type": "action",
 +          "user-label": null,
 +          "user-icon": null
 +        },
 +        {
 +          "uuid": "video_downscale.nemo_action",
 +          "type": "action",
 +          "user-label": null,
 +          "user-icon": null
 +        },
 +        {
 +          "uuid": "video_merge.nemo_action",
 +          "type": "action",
 +          "user-label": null,
 +          "user-icon": null
 +        },
 +        {
 +          "uuid": "video_hflip.nemo_action",
 +          "type": "action",
 +          "user-label": null,
 +          "user-icon": null
 +        },
 +        {
 +          "uuid": "video_vflip.nemo_action",
 +          "type": "action",
 +          "user-label": null,
 +          "user-icon": null
 +        },
 +        {
 +          "uuid": "video_mergechapters.nemo_action",
 +          "type": "action",
 +          "user-label": null,
 +          "user-icon": null
 +        }
 +      ]
 +    },
 +</code>
 +
  
config/nemo-performance.1600609640.txt.gz · Last modified: 2023/05/29 11:53 (external edit)