如何在不使用 GUI 的情况下移除两个 MATE 面板中的一个?

如何在不使用 GUI 的情况下移除两个 MATE 面板中的一个?

在默认安装中,MATE 设置了两个面板(顶部和底部),我想使用mateconftool-2命令行(终端)或其他工具删除顶部面板。

但是我找不到如何执行此操作(从终端),因此我尝试删除目录~/.mateconf/apps/panel/toplevels/并重新启动面板,但它没有任何反应,所以面板仍然存在。

我怎样才能移除其中一个面板不是使用图形用户界面

答案1

经过反复尝试、无数次目录、文件差异比较,以及对 Mate-Panel 源代码进行深入研究后(面板),确认如下:

手动移除面板的步骤

(1)全部对象目标面板必须被移除

  • 删除对象的文件夹~/mateconf/app/panel/objects/
  • /apps/panel/general/object_id_list从中删除对象的引用~/mateconf/app/general/%mateconf.xml

(2)全部小程序目标面板必须被移除

  • 删除小程序文件夹~/mateconf/app/panel/applets/
  • /apps/panel/general/applet_id_list从中删除小程序的引用~/mateconf/app/general/%mateconf.xml

(3)拆卸面板

  • 删除面板文件夹~/mateconf/app/panel/toplevels/
  • /apps/panel/general/toplevel_id_list从中删除面板的引用~/mateconf/app/general/%mateconf.xml

长话短说,以下是结果

删除面板是要删除的面板。当前设置为顶部面板。

#!/bin/bash

PANEL_PATH="${HOME}/.mateconf/apps/panel"
DEL_PANEL='top_panel_screen0'

    echo 'DEBUG: Panel Path' ${PANEL_PATH}
    echo 'DEBUG: Panel to be deleted' ${DEL_PANEL}

# -- Get old toplevel id list

TOPLEVEL_ID_LIST_OLD=`mateconftool-2 -g /apps/panel/general/toplevel_id_list | cut -d\[ -f2 | cut -d\] -f1 | sed 's/,/ /g'`

    echo 'DEBUG: Old toplevel_id_list' ${TOPLEVEL_ID_LIST_OLD}

# -- Generate new toplevel id list

TOPLEVEL_ID_LIST_NEW=''
for i in ${TOPLEVEL_ID_LIST_OLD}
do
    if [[ "$DEL_PANEL" != *"${i}"* ]]
    then
        echo -e "DEBUG: \tKeep ${i}"
        TOPLEVEL_ID_LIST_NEW="${TOPLEVEL_ID_LIST_NEW} ${i}"
    else
        echo -e "DEBUG: \tDel  ${i}"
        # -- Delete panel folder
        rm -rf ${PANEL_PATH}/toplevels/${i}
    fi
done
TOPLEVEL_ID_LIST_NEW="[`echo ${TOPLEVEL_ID_LIST_NEW} | sed 's/ /,/g'`]"

# -- Apply new toplevel id list
mateconftool-2 -s /apps/panel/general/toplevel_id_list -t list --list-type=string "${TOPLEVEL_ID_LIST_NEW}"

    echo 'DEBUG: New toplevel_id_list' `mateconftool-2 -g /apps/panel/general/toplevel_id_list`


# - APPLETS
# -- Identify applet to be deleted

cd ${PANEL_PATH}/applets
DEL_APPLET=`grep -r ${DEL_PANEL} *|cut -d\/ -f1`

    echo 'DEBUG: DEL_APPLET' ; for i in ${DEL_APPLET} ; do echo -e "DEBUG: \t${i}" ; done

# -- Get old applet id list

APPLET_ID_LIST_OLD=`mateconftool-2 -g /apps/panel/general/applet_id_list | cut -d\[ -f2 | cut -d\] -f1 | sed 's/,/ /g'`

    echo 'DEBUG: Old applet_id_list' ${APPLET_ID_LIST_OLD}

# -- Generate new applet id list

APPLET_ID_LIST_NEW=''
for i in ${APPLET_ID_LIST_OLD}
do
    if [[ "$DEL_APPLET" != *"${i}"* ]]
    then
        echo -e "DEBUG: \tKeep ${i}"
        APPLET_ID_LIST_NEW="${APPLET_ID_LIST_NEW} ${i}"
    else
        echo -e "DEBUG: \tDel  ${i}"
        # -- Delete applet folder
        rm -rf ${PANEL_PATH}/applets/${i}
    fi
done
APPLET_ID_LIST_NEW="[`echo ${APPLET_ID_LIST_NEW} | sed 's/ /,/g'`]"

# -- Apply new applet id list
mateconftool-2 -s /apps/panel/general/applet_id_list -t list --list-type=string "${APPLET_ID_LIST_NEW}"

    echo 'DEBUG: New applet_id_list' `mateconftool-2 -g /apps/panel/general/applet_id_list`


# - OBJECTS
# -- Identify object to be deleted

cd ${PANEL_PATH}/objects
DEL_OBJECT=`grep -r ${DEL_PANEL} *|cut -d\/ -f1`

    echo 'DEBUG: DEL_OBJECT' ; for i in ${DEL_OBJECT} ; do echo -e "DEBUG: \t${i}" ; done

# -- Get old object id list

OBJECT_ID_LIST_OLD=`mateconftool-2 -g /apps/panel/general/object_id_list | cut -d\[ -f2 | cut -d\] -f1 | sed 's/,/ /g'`

    echo 'DEBUG: Old object_id_list' ${OBJECT_ID_LIST_OLD}

# -- Generate new object id list

OBJECT_ID_LIST_NEW=''
for i in ${OBJECT_ID_LIST_OLD}
do
    if [[ "$DEL_OBJECT" != *"${i}"* ]]
    then
        echo -e "DEBUG:\tKeep ${i}"
        OBJECT_ID_LIST_NEW="${OBJECT_ID_LIST_NEW} ${i}"
    else
        echo -e "DEBUG:\tDel  ${i}"
        # -- Delete object folder
        rm -rf ${PANEL_PATH}/objects/${i}
    fi
done
OBJECT_ID_LIST_NEW="[`echo ${OBJECT_ID_LIST_NEW} | sed 's/ /,/g'`]"

# -- Apply new object id list
mateconftool-2 -s /apps/panel/general/object_id_list -t list --list-type=string "${OBJECT_ID_LIST_NEW}"

    echo 'DEBUG: New applet_id_list' `mateconftool-2 -g /apps/panel/general/object_id_list`

测试环境

  • 操作系统:Ubuntu 12.04 LTS
  • Mate Desktop:1.4.x,来自 Ubuntu 的 Mate 官方仓库这里

答案2

将 dconf 键设置org.mate.session.required-component.panel为空字符串也有效。您可以使用以下 dconf 命令执行此操作:

dconf write /org/mate/session/required-components/panel "''"

编辑:哦,我没有看到这个部分抱歉。但我希望这能对其他人有所帮助。

相关内容