[Moved to Github] Submenus for Nemo Actions?

Write suggestions and new ideas in here
More ideas here http://community.linuxmint.com/idea/welcome
Forum rules
  • Only post ideas here that are specifically about the Linux Mint distribution or its websites.
  • So that developers and users from any distribution can discuss ideas in one place, post ideas about improving software to the collaboration website for that software instead.
Post Reply
sadi
Level 1
Level 1
Posts: 41
Joined: Sat Aug 21, 2010 3:16 pm
Location: Istanbul

[Moved to Github] Submenus for Nemo Actions?

Post by sadi » Mon Jul 03, 2017 8:54 am

Coming from Nautilus, I loved Nemo Actions!
Even though there's a graphical tool for Nautilus Actions, I've found it much more simpler to create Nemo Actions.
It's also so nice to have all those actions and scripts listed in the Preferences (and individually enabled or disabled, etc.)

Now, one more step could bring us closer to perfection in this regard: submenus!
KDE's Dolphin has it, so why not Nemo as well ;-)
Last edited by sadi on Wed Jul 05, 2017 4:44 pm, edited 1 time in total.
OS: Linux Mint 18.3 Cinnamon 64-bit

User avatar
xenopeek
Level 24
Level 24
Posts: 22319
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Submenus for Nemo Actions?

Post by xenopeek » Wed Jul 05, 2017 12:58 am

You can post feature requests to the Nemo developers here: https://github.com/linuxmint/nemo/issues
Image

Cosmo.
Level 23
Level 23
Posts: 17830
Joined: Sat Dec 06, 2014 7:34 am

Re: Submenus for Nemo Actions?

Post by Cosmo. » Wed Jul 05, 2017 6:29 am

Open nemo and press alt-p and you have the graphical option to enable / disable actions individually.

sadi
Level 1
Level 1
Posts: 41
Joined: Sat Aug 21, 2010 3:16 pm
Location: Istanbul

Re: Submenus for Nemo Actions?

Post by sadi » Wed Jul 05, 2017 2:50 pm

Thank you both!

As a second-time newcomer, I didn't know about LM github repositories; it's a great place for issues, ideas, etc. indeed!

As for Actions GUI, although the one inside Nemo has very limited functionality, I don't miss the Nautilus one really -- a good sample nemo.action does the job just fine (although something more like a tutorial/manual could be better).
OS: Linux Mint 18.3 Cinnamon 64-bit

ciniset
Level 1
Level 1
Posts: 1
Joined: Thu Dec 28, 2017 10:14 am

Re: [Moved to Github] Submenus for Nemo Actions?

Post by ciniset » Fri Dec 29, 2017 9:19 am

hi. I'm new to linux mint/bash/aso but want 2 share a possible solution for those - like me - who need to have right click with nemo_action files organized by submenus. the idea is 2 simulate ur own menus on right click. is just a skeleton but is working and prove the idea.

0. apt install yad
1.

Code: Select all

mkdir ~/.local/share/nemo/custom
2. create the file ~/.local/share/nemo/actions/Custom\ Nemo\ extender.nemo_action
3. put in that file :

Code: Select all

[Nemo Action]
Name=Custom Nemo extender
Comment=Launch custom nemo menu extender

Exec=/home/ciniset/.local/share/nemo/custom/nemoext main
Icon-Name=media-playback-start
Selection=any
Extensions=dir;
Conditions=desktop;
4. create the file /home/ciniset/.local/share/nemo/custom/nemoext

Code: Select all

#! /bin/bash

read_menu_file() {
    unset file_name work_string menu line lenght_dim lines_dim histogram
    file_name=$1
    work_string="$(cat $file_name | cut -f 1 -d "+")"
    menu=$(cat $file_name | tr "+" " ")

    while read line; do
        ((histogram[${#line}]++))
    done <<< "$work_string"

    for length in "${!histogram[@]}"; do
        lenght_dim=$(( ${length} * 10 ))
    done
    lines_dim=$(( ${#histogram[@]} * 28 ))
}


if [ "$#" -ne 1 ]; then
    exit        # no menu file
fi

pushd . > /dev/null
SCRIPT_PATH="${BASH_SOURCE[0]}"
if ([ -h "${SCRIPT_PATH}" ]); then
  while([ -h "${SCRIPT_PATH}" ]); do cd `dirname "$SCRIPT_PATH"`; 
  SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;
popd  > /dev/null

menu_name=$(echo $SCRIPT_PATH"/"$1)
read_menu_file $menu_name

while true; do
    ANSWER=`yad --mouse --no-buttons --undecorated --skip-taskbar --width=$lenght_dim --height=$lines_dim --list --separator="+" --no-headers --column=Name --column=Type:HD --column=Function:HD  $menu`
    type=$(echo $ANSWER | cut -f 2 -d "+")
    case "$type" in
            "M")
                submenu=$(echo $ANSWER | cut -f 1 -d "+")
                submenu=${submenu::-4}
                read_menu_file $SCRIPT_PATH/$submenu
                continue
            ;;
            *)
                command=$(echo $ANSWER | cut -f 3 -d "+")
                $command &
                exit
            ;;
    esac
done
5. create the file /home/ciniset/.local/share/nemo/custom/main

Code: Select all

Firefox+C+firefox
Editor+C+gedit
Terminal+C+gnome-terminal
Utils[=>]+M+Utils
and create the file /home/ciniset/.local/share/nemo/custom/Utils

Code: Select all

VirtualBox[=>]+M+VirtualBox
Kalarm+C+kalarm
ur ready 4 test now :)

short explanation:
create nemo_action file who call a bash script from ~/.local/share/nemo/custom/ who read menu file/files from same folder.
link between menu files are made by name. inside files is <name>+<C(for command)/M(for submenu)>+<command/menu info>

2 cents thoughts: it would be very nice if the submenu feature will be implemented in the future, having already the structure for nemo_action/scripts and being (i believe) relatively easy to create extra folder(submenus) in .local/share/nemo/actions containing .nemo_action files.


LAST MINUTE UPDATE
I'm ashamed I didn't look also into scripting capability of nemo :oops:
Scripting is solving the whole problem.
Nemo IS great!

Post Reply

Return to “Suggestions & New Ideas”