如何在 Ubuntu 19.10 的 GNOME 菜单栏上显示用户名?

德万什·索尼

在 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 中,此扩展也应该可以工作

我已经测试过了。但是我已经制作了一个脚本,来自上面的链接..

  1. 打开 gedit。
  2. 复制粘贴下面的内容并将文件保存在您的主目录中 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]
  1. 打开终端并运行以下命令

命令:

/bin/bash $HOME/username.sh
  1. 使用“Alt+F2 'r' Enter”方法刷新 gnome-shell。

在此处输入图片说明


如果要删除扩展名,请运行以下命令:

rm -r $HOME/.local/share/gnome-shell/extensions/[email protected]

并使用“Alt+F2 'r' Enter”方法刷新 gnome-shell

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在gnome 3菜单栏中显示日期?

如何在Ubuntu GNOME上获取Ubuntu壁纸?

如何显示gnome-terminal菜单栏?

如何在Windows 10上检查PostgreSQL的用户名

如何在Ubuntu上使用gnome而不需要切换到Ubuntu Gnome

如何在Ubuntu 14.04上获取gnome Shell 3.12

如何在ubuntu 17.04上安装最新的gnome默认图标

如何在Ubuntu 14.04 LTS上更新GTK +和/或Gnome?

如何在Ubuntu上安装Gnome Flashback DE

如何在 Ubuntu 20.0.4 LTS 上安装 XFCE 并删除 gnome

如何在Ubuntu 14.04上安装Gnome-Commander 1.4.3

如何在Ubuntu GNOME上提交错误?

如何在Ubuntu 19.10上安装vim-gnome?

如何在Ubuntu 14.04 LTS(Gnome)上安装主题

如何在Ubuntu GNOME 16.04上启用自然滚动

如何在 Ubuntu20.04 上删除 gnome?

如何在Fedora 19中安装gnome-shell-extensions?

Ubuntu 19上的coredumpctl

Ubuntu 22.04 如何在 gnome 菜单中显示我最喜欢的应用程序?

Ubuntu/GNOME 菜单栏中更多 KDE 风格的音频控制?或 PulseAudio-cum-Gnome 集成?

在Ubuntu 18.04(Ubuntu GNOME或Vanilla Ubuntu)上,如何更顺利地过渡到GNOME?

如何在Ubuntu Gnome 16.04中升级Gnome文件(nautilus)

如何使用gnome在ubuntu 14.04上重复显示

Watson Speech to Text:如何在 Windows 10 上设置我的用户名和密码

Ubuntu 19 如何设置不同的显示器缩放

如何在GNOME Shell中隐藏窗口标题和菜单栏?

如何在Ubuntu扩展坞(GNOME侧边栏)中禁用窗口预览?

如何在菜单中显示用户名

如何在 gnome 3.28 Ubuntu 18.04 中的 javascript 中获取用户个人资料图像