我有一个非常烦人的错误:当我按CTRL + SHIFT + N来搜索文件时,有时会丢失焦点,输入的字符会被放入当前正在编辑的文件中,但随后它会重新获得它,并继续正确行为(这种情况不会移动鼠标!!!).
当我在ubuntu 14.04上使用unity(使用草率焦点模式)时,它没问题,但是使用Gnome shell 3.10,在更改窗口焦点时采用草率模式,会产生此错误.有谁知道这方面的解决方案?
它打破了我的发展,因为我甚至没有观察到我在文件中有一个新角色,它让我发疯.谢谢.
我目前正在Gjs上构建一个简单的应用程序,它应该改变我的gnome-shell的背景图像.gsettings可以在此处找到使用-tool 如何完成此操作的解决方案.
由于我想围绕它构建一个桌面应用程序,我想org.gnome.desktop.background.picture-uri通过使用Gio的GSettings类更改-key.但是使用set_X()-method并不会改变密钥的值.
这是我更改gsettings值的代码:
var gio = imports.gi.Gio;
// Get the GSettings-object for the background-schema:
var background = new gio.Settings({schema: "org.gnome.desktop.background"});
// Read the current Background-Image:
print( "Current Background-Image: "+background.get_string("picture-uri") );
if (background.is_writable("picture-uri")){
// Set a new Background-Image (should show up immediately):
if (background.set_string("picture-uri", "file:///path/to/some/pic.jpg")){
print("Success!");
}
else throw "Couldn't set the key!";
} else throw "The key is not writable";
Run Code Online (Sandbox Code Playgroud)
读取值确实按预期工作,is_writable()-method返回true …
将myexentension@me.com文件夹复制到后,.../gnome-shell/extensions/我在终端上执行以下命令:
gnome-shell-extension-tool -e myexentension@me.com
然后,我用Alt+ 重新启动会话F2并执行r,一切正常。
但是我只能通过命令行启动扩展程序吗?没有Alt+ F2+ r吗?不重新启动我的gnome-shell会话?
我正在 GJS 中开发 GTK 应用程序,并且喜欢在 Gnome Shell 扩展中重用部分 GTK 代码。但是,我没有找到将
Gtk.Widget图标添加到 Gnome Shell 面板菜单的方法。
我尝试使用GtkClutter.Actorfrom clutter-gtk,但该库似乎已经过时,并且在 Wayland 或 X11 Gnome Shell 中都不起作用,因为它需要 Clutter1.0但看到7已经加载。imports.gi.GtkClutter在扩展中导入时
,Gnome Shell 会产生以下错误:
Requiring GtkClutter, version none: Requiring namespace 'Clutter' version '1.0', but '7' is already loaded。
这里有一些代码来演示clutter-gtk如果直接通过 ; 运行它的话,它实际上是有效的gjs。可能是因为我可以在这里强制执行 GTK 3.0。
gtkclutter.js:
imports.gi.versions.Gtk = '3.0' // fails if set to 4.0
const { Gtk, GLib, Clutter, GtkClutter } = imports.gi
// …Run Code Online (Sandbox Code Playgroud) 我正在尝试仅使用 JavaScript 编写扩展程序。我通过 Hello World 用 Python 写的!代码。但是,一开始,我的菜单项按钮不起作用。此外,我无法使用 Hello World 添加菜单项!代码。我想,我想念一些东西。
按钮代码在这里:
const Lang = imports.lang;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const St = imports.gi.St;
const TimeButton = new Lang.Class({
Name: "Salah Time",
Extends: PanelMenu.Button,
_init: function () {
let box = new St.BoxLayout({
style_class: "system-status-icon"
});
let label = new St.Label({text: "Salah Time"});
box.add_child(label);
this.actor.addActor(box);
}
});
function init() {
}
function enable() {
let but = new TimeButton();
Main.panel._leftBox.insert_child_at_index(but, 1);
} …Run Code Online (Sandbox Code Playgroud)我曾经使用No Topleft Hot Corner扩展禁用 gnome-shell 的热角功能。升级到 gnome-shell 40 后它已被弃用。Gnome-tweaks声称它也能够禁用它,但是激活这个“禁用热角”选项根本不会停用热角。最后,我发现阅读这个 Ask Ubuntu 线程我可以
\ngsettings set org.gnome.desktop.interface enable-hot-corners false\nRun Code Online (Sandbox Code Playgroud)\n但即使命令成功,它也不起作用。所以这个类似 Apple\xc2\xa9 的小烦恼又回来了。
\n所以问题确实是:我该如何再次摆脱它?...天哪,我爱你,侏儒,但你确实时不时地让我感到不安。
\n我最近正在研究 Gnome shell 扩展。我查看了一些代码,如下所示:
\nconst Lang = imports.lang;\n\nconst extension = new Lang.Class({...}\xef\xbc\x89\nRun Code Online (Sandbox Code Playgroud)\n我在GJS中找不到任何有关Lang的信息。
\n相关的开发手册应该去哪里找?
\n我在找了一段时间,但仍然找不到从GnomeShell扩展代码中调用python函数的任何书面方法。有可能这样做吗?
在3.16之前,很容易从最大化窗口中删除窗口标题 - 只需编辑metacity-theme.xml文件.但是,3.16正在使用客户端装饰,而metacity无法控制窗口装饰.是否有另一种隐藏窗口标题的方法,或者至少使它们更小?
我正在编写一个python程序,该程序从网页获取信息并在Gnome Shell中的Notification上显示。我使用的是Arch,因此我想在启动时启动该程序,如果网页上有任何更改,它将通知我。这是我的代码:
import time
import webbrowser
import requests
from bs4 import BeautifulSoup
from gi.repository import Notify, GLib
IPS = {'Mobifone': True, 'Viettel': False, 'Vinaphone': False}
LINK = "https://id.vtc.vn/tin-tuc/chuyen-muc-49/tin-khuyen-mai.html"
def set_ips_state(ips_name, state):
global IPS
for key in IPS.iterkeys():
if key == ips_name:
IPS[key] = state
def call_webbrowser(notification, action_name, link):
webbrowser.get('firefox').open_new_tab(link)
def create_notify(summary, body, link):
Notify.init("Offer")
noti = Notify.Notification.new(summary, body, 'dialog-information')
noti.add_action('action_click', 'Read more...', call_webbrowser, link)
noti.show()
# GLib.MainLoop().run()
def save_to_file(path_to_file, string):
file = open(path_to_file, 'w')
file.write(string)
file.close()
def main():
global IPS …Run Code Online (Sandbox Code Playgroud) 我在CentOS 7下运行远程服务器,通常它足以使用SSH CLI运行 - 但有时我需要图形访问,所以我也在那里安装了Gnome Desktop.
但是如何停止或启动Gnome桌面?特别是因为当我不需要Gnome时gnome-shell会占用CPU.
这看起来很奇怪,但3页Google搜索没有帮助.我担心这里没有简单的解决方案
service gnome stop | start
Run Code Online (Sandbox Code Playgroud)
所以,提前感谢任何提示或howto!