重新启动到另一个 grub 条目

重新启动到另一个 grub 条目

我需要使用 Windows 执行 1 项任务。因此我编写了一个脚本以在另一个启动项中重新启动(仅用于下次重新启动):

#!/bin/bash

if [[ $UID != 0 ]] ; then
    sudo $0 $@
    exit $?
fi

ENTRY=$(gawk -F "'" '/menuentry / {print $2}' /boot/grub/grub.cfg | grep "Windows Boot Manager.*")

grub-reboot "$ENTRY"
if [ $? -ne 0 ] ; then
    exit 1
fi

if zenity --question --title="Reboot Now ?" --text="Are you ready to reboot now ?" --no-wrap ; then
    shutdown -r now
fi

我希望能够在电源菜单中调用它以及睡眠、关机、关闭会话...我想我必须编写一些 gnome-shell 扩展?由于我是 gnome shell 扩展的新手,我想知道从哪里开始?我如何添加/修改这些菜单项?

顺便说一下,我使用的是 Ubuntu 20.04。

相关内容