Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 hotkey
#1
I want to make the power on and off function work directly with F11 and F12. How do I use a hotkey?
Reply
#2
(01-23-2023, 06:02 AM)hyun9358 Wrote: I want to make the power on and off function work directly with F11 and F12. How do I use a hotkey?
elif [ "$vtHotkey" = "F6" ]; then
        ventoy_ext_menu
elif [ "$vtHotkey" = "F11" ]; then
        sleep 1
        reboot
elif [ "$vtHotkey" = "F12" ]; then
       sleep 1
        halt
fi
Reply
#3
(01-23-2023, 06:09 PM)nguyen ha thai trong Wrote:
(01-23-2023, 06:02 AM)hyun9358 Wrote: I want to make the power on and off function work directly with F11 and F12. How do I use a hotkey?
elif [ "$vtHotkey" = "F6" ]; then
        ventoy_ext_menu
elif [ "$vtHotkey" = "F11" ]; then
        sleep 1
        reboot
elif [ "$vtHotkey" = "F12" ]; then
       sleep 1
        halt
fi
F8 and later keys are disabled. unfortunately these commands don't work that way.
Reply
#4
(01-23-2023, 06:09 PM)nguyen ha thai trong Wrote:
(01-23-2023, 06:02 AM)hyun9358 Wrote: I want to make the power on and off function work directly with F11 and F12. How do I use a hotkey?
elif [ "$vtHotkey" = "F6" ]; then
        ventoy_ext_menu
elif [ "$vtHotkey" = "F11" ]; then
        sleep 1
        reboot
elif [ "$vtHotkey" = "F12" ]; then
       sleep 1
        halt
fi





======================================================================
if [ "$vtHotkey" = "F2" ]; then
            unset timeout
            vt_browser_disk
        elif [ "$vtHotkey" = "F4" ]; then
            ventoy_localboot
        elif [ "$vtHotkey" = "F5" ]; then
            ventoy_diagnosis
        elif [ "$vtHotkey" = "F6" ]; then
            ventoy_ext_menu
        elif [ "$vtHotkey" = "F11" ]; then
        echo -e "\n $VTLANG_System_rebooting \n"
            sleep 1
            reboot
        elif [ "$vtHotkey" = "F12" ]; then
        echo -e "\n $VTLANG_System_halting \n"
            sleep 1
            halt
        fi

I put it in grub.cfg but it doesn't work.

how does it work?


The L key is the language output key, how does it work?

If this is the case, wouldn't it be possible to apply it?
Reply
#5
This problem must be longpanda, the command lines you and I mentioned in grub.cfg have no effect on the F1-9 keys, let alone F11, F12. Try deleting the block
#special VTOY_DEFAULT_IMAGE process
if [ -n "$VTOY_DEFAULT_IMAGE" ]; then
    if regexp --set 1:vtHotkey --set 2:vtDefault "(F[2-9])>(.*)" "$VTOY_DEFAULT_IMAGE"; then
   
        set default="$vtDefault"
        if [ -z "$VTOY_MENU_TIMEOUT" ]; then
            set timeout=0
        else
            set timeout=$VTOY_MENU_TIMEOUT
        fi
       
        export timeout
        export default

        vt_fn_mutex_lock 1

        if [ "$vtHotkey" = "F2" ]; then
            unset timeout
            vt_browser_disk
        elif [ "$vtHotkey" = "F4" ]; then
            ventoy_localboot
        elif [ "$vtHotkey" = "F5" ]; then
            ventoy_diagnosis
        elif [ "$vtHotkey" = "F6" ]; then
            ventoy_ext_menu
fi
       
        vt_fn_mutex_lock 0
       
        unset timeout
        unset default
    fi
fi
Then try pressing the F1-9 keys, it still works. The above command block (as longpanda wrote) it only serves
  #special VTOY_DEFAULT_IMAGE process
Reply
#6
currently, the f11 and f12 buttons are not working. But this can be done with different spomobs: 
1. Make changes to longpanda. 
2. Change menu.c yourself and compile. 
3. I can add to my mod_Ventoy, but then I will have to use something other than the original.

4. Abandon f11 and f12. And to do as it was in the early versions of ventoy (somewhere before 1.0.67), the power menu was called by f2. And add ventoy- browers to the main menu. All changes of clause 4 in grub.conf.

submenu "  ventoy browser" --class=iconFM {
        if  [ "$VTOY_THEME_FMV" != "" ]; then
            if [ -f ${vt_plugin_path}${VTOY_THEME_FMV} ]; then
                set theme=${vt_plugin_path}${VTOY_THEME_FMV}
            fi
        fi
        unset timeout
        set VTOY_MENU_TIP_ENABLE=0
        vt_browser_disk
}
......
        if [ "$vtHotkey" = "F2" ]; then
            ventoy_power
        elif [ "$vtHotkey" = "F4" ]; then
            ventoy_localboot
        elif [ "$vtHotkey" = "F5" ]; then
            ventoy_diagnosis
        elif [ "$vtHotkey" = "F6" ]; then
            ventoy_ext_menu
elif [ "$vtHotkey" = "F9" ]; then
            ventoy_info
        fi
       
        vt_fn_mutex_lock 0
       
        unset timeout
        unset default
    fi   
fi

You can see the implementation of clause 4 in mod_ventoy 1.0.80
Reply
#7
(01-25-2023, 03:27 AM)AlexBryansk Wrote: currently, the f11 and f12 buttons are not working. But this can be done with different spomobs: 
1. Make changes to longpanda. 
2. Change menu.c yourself and compile. 
3. I can add to my mod_Ventoy, but then I will have to use something other than the original.

4. Abandon f11 and f12. And to do as it was in the early versions of ventoy (somewhere before 1.0.67), the power menu was called by f2. And add ventoy- browers to the main menu. All changes of clause 4 in grub.conf.

submenu "  ventoy browser" --class=iconFM {
        if  [ "$VTOY_THEME_FMV" != "" ]; then
            if [ -f ${vt_plugin_path}${VTOY_THEME_FMV} ]; then
                set theme=${vt_plugin_path}${VTOY_THEME_FMV}
            fi
        fi
        unset timeout
        set VTOY_MENU_TIP_ENABLE=0
        vt_browser_disk
}
......
        if [ "$vtHotkey" = "F2" ]; then
            ventoy_power
        elif [ "$vtHotkey" = "F4" ]; then
            ventoy_localboot
        elif [ "$vtHotkey" = "F5" ]; then
            ventoy_diagnosis
        elif [ "$vtHotkey" = "F6" ]; then
            ventoy_ext_menu
elif [ "$vtHotkey" = "F9" ]; then
            ventoy_info
        fi
       
        vt_fn_mutex_lock 0
       
        unset timeout
        unset default
    fi   
fi

You can see the implementation of clause 4 in mod_ventoy 1.0.80





================================================================

Can't we add this feature in the next version?

I wish it was added.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)