(아주 간단한) 그놈 쉘 확장을 사용하여 포커스 모드를 전환했습니다 (우분투 14.04에서 gnome-shell 3.10). 연장은 github에 유효하다; 매우 성가신 버그가 있기 때문에 제출을 기다리고 있습니다 --- 이해할 수없고 수정할 수 없습니다.잠금 해제 화면주기 후 내 gnome-shell 확장자가 작동을 멈춤
확장명은 표준 예제 확장자를 기반으로하므로 코드를 사용하면 아이콘 파일을 필요로하지만 코드를 간단하게 붙여 넣을 수 있습니다.
const FFM_VARIANT='sloppy';
const St = imports.gi.St;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;
const Gtk = imports.gi.Gtk;
const Gdk = imports.gi.Gdk;
const ExtensionUtils = imports.misc.extensionUtils;
const Meta = ExtensionUtils.getCurrentExtension();
const Util = imports.misc.util;
const Gio = imports.gi.Gio;
let text, button, icon_f, icon_c, wm_prefs;
var focus;
const FFM=0;
const CTF=1;
function _set_FFM() {
focus = FFM;
button.set_child(icon_f);
wm_prefs.set_string('focus-mode', FFM_VARIANT);
}
function _set_CTF() {
focus = CTF;
button.set_child(icon_c);
wm_prefs.set_string('focus-mode', 'click');
}
function _hideMsg() {
if (text) {
Main.uiGroup.remove_actor(text);
text = null;
}
}
function _showMsg(what) {
if (!text) {
text = new St.Label({ style_class: 'msg-label', text: what });
Main.uiGroup.add_actor(text);
}
text.opacity = 255;
let monitor = Main.layoutManager.primaryMonitor;
text.set_position(Math.floor(monitor.width/2 - text.width/2),
Math.floor(monitor.height/2 - text.height/2));
Tweener.addTween(text,
{ opacity: 0,
time: 3,
transition: 'easeOutQuad',
onComplete: _hideMsg });
}
function _switch() {
_hideMsg();
if (focus == FFM) {
_showMsg("Setting Click-to-focus");
_set_CTF();
} else {
_showMsg("Setting Focus-follow-mouse");
_set_FFM();
}
}
function init() {
button = new St.Bin({ style_class: 'panel-button',
reactive: true,
can_focus: true,
x_fill: true,
y_fill: false,
track_hover: true });
Gtk.IconTheme.get_default().append_search_path(Meta.dir.get_child('icons').get_path());
icon_f = new St.Icon({ icon_name: 'fmode',
style_class: 'system-status-icon' });
icon_c = new St.Icon({ icon_name: 'cmode',
style_class: 'system-status-icon' });
wm_prefs=new Gio.Settings({schema: 'org.gnome.desktop.wm.preferences'});
}
function enable() {
// start with the current mode --- sync icon and internal state.
what=wm_prefs.get_string('focus-mode');
if (what == 'click') {
_set_CTF();
} else { // sloppy or mouse
_set_FFM();
}
button.connect('button-press-event', _switch);
Main.panel._rightBox.insert_child_at_index(button, 0);
}
function disable() {
Main.panel._rightBox.remove_child(button);
}
... 완벽하게 작동하며, 클릭 할 때마다 초점 모드를 전환하고 아이콘을 변경하고 수행해야 할 작업을 수행합니다.
그러나 화면을 잠그고 잠금 해제하면 확장 퍼즐이 작동하지 않습니다. 아이콘을 클릭하면 단순히 동일한 메시지가 표시됩니다 (잠금 전의 포커스 모드에 고정됨). 확장 프로그램을 사용 또는 사용 중지하면 올바른 작업이 다시 시작됩니다.
잠금 해제가 응용 프로그램에 투명하지 않아야합니까? 그리고 그렇지 않다면 화면 잠금 해제를 활성화/비활성화하도록 강제 할 수있는 몇 가지 훅이 있습니까? Looking glass는 오류를 나타내지 않으며 로그가 보이지 않습니다.