如何通过终端 (CLI) 加载(添加到面板)新添加到 /usr/share/cinnamon/applets 的 Cinnamon 小程序?

如何通过终端 (CLI) 加载(添加到面板)新添加到 /usr/share/cinnamon/applets 的 Cinnamon 小程序?

我发现可以使用编辑肉桂面板dconf

dconf read /org/cinnamon/enabled-applets
['panel1:left:0:[email protected]:0', 'panel1:left:1:[email protected]:1', 'panel1:left:2:[email protected]:2', 'panel1:right:2:[email protected]:3', 'panel1:right:3:[email protected]:4', 'panel1:right:4:[email protected]:5', 'panel1:right:5:[email protected]:6', 'panel1:right:6:[email protected]:7', 'panel1:right:7:[email protected]:8', 'panel1:right:8:[email protected]:9', 'panel1:right:9:[email protected]:10', 'panel1:right:10:[email protected]:11', 'panel1:right:11:[email protected]:12', 'panel1:right:12:[email protected]:13', 'panel1:right:1:temperature@fevimu:14']

我已经能够通过添加和删除小程序dconf write,但仅限于那些已在 GUI 中启用的小程序(面板右键单击 -> 小程序)和/或通过 GUI 添加一次后。

如何添加/加载刚刚/usr/share/cinnamon/applets通过终端命令添加的小程序?

答案1

在 Github 上,我收到了使用方案和覆盖的建议,并编写了一个脚本:

# edit panel
# editing /usr/share/glib-2.0/schemas/org.cinnamon.gschema.xml or 10_cinnamon.gschema.override
schema_override_file=/usr/share/glib-2.0/schemas/10_cinnamon.gschema.override
if [ ! -e "$schema_override_file" ]; then
    echo '[org.cinnamon]' | sudo tee "$schema_override_file" > /dev/null
fi

changed_panel=`grep 'panel1:right:' /usr/share/glib-2.0/schemas/org.cinnamon.gschema.xml | perl -pe 's/ *.{1,2}default.//g' | perl -pe 's/(right:)([0-9]+)/$1.($2+2)/eg' | perl -pe "s/]/, 'panel1:right:0:mem-monitor-text\@datanom.net', 'panel1:right:1:temperature\@fevimu']/"`

echo "enabled-applets=$changed_panel" | sudo tee --append "$schema_override_file" > /dev/null
sudo glib-compile-schemas /usr/share/glib-2.0/schemas

相关内容