在 Ubuntu 19.10 和 GNOME Shell 版本 3.34.3 中,我希望我的用户名显示在右上角。我尝试了以下 GNOME Shell 扩展,但没有任何改变。
如果您有任何解决方案,请告诉我。
解决方法
即使在使用 Gnome Shell 版本 3.34.X https://extensions.gnome.org/extension/1108/add-username-to-top-panel/的Ubuntu 19.10 中,此扩展也应该可以工作
我已经测试过了。但是我已经制作了一个脚本,来自上面的链接..
username.sh
内容:
#!/bin/bash
file1=$HOME/.local/share/gnome-shell/extensions/[email protected]/extension.js
file2=$HOME/.local/share/gnome-shell/extensions/[email protected]/metadata.json
file3=$HOME/.local/share/gnome-shell/extensions/[email protected]/stylesheet.css
install -Dv /dev/null $file1
install -Dv /dev/null $file2
install -Dv /dev/null $file3
echo 'const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const Main = imports.ui.main;
const GLib = imports.gi.GLib;
let label;
let aggregateMenu;
let children;
function init() {
label = new St.Label({ text: GLib.get_real_name(), y_align: Clutter.ActorAlign.CENTER, style_class: "username-label" });
aggregateMenu = Main.panel.statusArea["aggregateMenu"];
powerIndicator = aggregateMenu._power.indicators;
}
function enable() {
powerIndicator.add_child(label);
}
function disable() {
powerIndicator.remove_child(label);
}
' >> $file1
echo '{
"name": "Add Username to Top Panel",
"description": "Simply add your username to topbar panel aggregate menu",
"uuid": "[email protected]",
"shell-version": ["3.34"]
}' >> $file2
echo ".username-label {
margin-left: 7px;
margin-right: 5px;
vertical-align: middle;
}" >> $file3
gnome-extensions enable [email protected]
命令:
/bin/bash $HOME/username.sh
如果要删除扩展名,请运行以下命令:
rm -r $HOME/.local/share/gnome-shell/extensions/[email protected]
并使用“Alt+F2 'r' Enter”方法刷新 gnome-shell
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句