Skip to content

Commit d2427c8

Browse files
committed
Initial commit
0 parents  commit d2427c8

File tree

5 files changed

+115
-0
lines changed

5 files changed

+115
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# streamcontroller-core447.com

extension.js

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import GObject from 'gi://GObject';
2+
import St from 'gi://St';
3+
import Gio from 'gi://Gio';
4+
import GLib from 'gi://GLib';
5+
6+
import { Extension, gettext as _ } from 'resource:///org/gnome/shell/extensions/extension.js';
7+
import * as PanelMenu from 'resource:///org/gnome/shell/ui/panelMenu.js';
8+
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
9+
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
10+
11+
12+
class StreamControllerExtension extends Extension {
13+
enable() {
14+
console.error('Extension enabled 889900');
15+
this._focusChangedSignalId = global.display.connect('notify::focus-window', this._onFocusWindowChanged.bind(this));
16+
17+
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(`
18+
<node>
19+
<interface name='org.gnome.Shell.Extensions.StreamController'>
20+
<method name='GetFocusedWindow'>
21+
<arg type='s' name='window' direction='out'/>
22+
</method>
23+
<method name='GetAllWindows'>
24+
<arg type='s' name='window' direction='out'/>
25+
</method>
26+
<signal name='FocusedWindowChanged'>
27+
<arg type='s' name='new_window_name'/>
28+
</signal>
29+
<!-- Other methods and signals -->
30+
</interface>
31+
</node>`, this);
32+
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Extensions/StreamController');
33+
console.error('Extension enabled 889900');
34+
this._currentTitle = null;
35+
this._currentWMClass = null;
36+
}
37+
38+
disable() {
39+
if (this._focusChangedSignalId) {
40+
global.display.disconnect(this._focusChangedSignalId);
41+
this._focusChangedSignalId = null;
42+
}
43+
44+
if (this._dbusImpl) {
45+
this._dbusImpl.unexport();
46+
this._dbusImpl = null;
47+
}
48+
49+
this.handlerId = null;
50+
}
51+
52+
GetFocusedWindow() {
53+
var result = {
54+
wm_class : this._currentWMClass,
55+
title : this._currentTitle
56+
}
57+
return JSON.stringify(result);
58+
}
59+
60+
GetAllWindows() {
61+
const windows = global.get_window_actors();
62+
63+
let window_list = [];
64+
for (const window of windows) {
65+
window_list.push({
66+
wm_class : window.meta_window.get_wm_class(),
67+
title : window.meta_window.get_title()
68+
});
69+
}
70+
71+
return JSON.stringify(window_list);
72+
}
73+
74+
_onFocusWindowChanged() {
75+
let focusedWindow = global.display.focus_window;
76+
let title = focusedWindow ? focusedWindow.get_title() : null;
77+
let wmClass = focusedWindow ? focusedWindow.get_wm_class() : null;
78+
// Main.notify("changed", "changed");
79+
// this._dbusImpl.emit_signal('FocusedWindowChanged', new GLib.Variant('(s)', [wmClass, title]));
80+
let result = {
81+
wm_class : wmClass,
82+
title : title
83+
}
84+
this._dbusImpl.emit_signal('FocusedWindowChanged', new GLib.Variant('(s)', [JSON.stringify(result)]));
85+
Main.notify("before emmit", "before emmit");
86+
// Main.notify(wmClass, title);
87+
this._currentTitle = title;
88+
this._currentWMClass = wmClass;
89+
90+
}
91+
}
92+
93+
export default StreamControllerExtension;

metadata.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "StreamController Integration",
3+
"description": "Allow automatic page switching in StreamController",
4+
"uuid": "[email protected]",
5+
"shell-version": [
6+
"45",
7+
"46"
8+
],
9+
"url": "https://github.com/Core447/[email protected]",
10+
"version": 1
11+
}

run.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh -e
2+
3+
# export G_MESSAGES_DEBUG=all
4+
export MUTTER_DEBUG_DUMMY_MODE_SPECS=1366x768
5+
# export SHELL_DEBUG=all
6+
7+
dbus-run-session -- \
8+
gnome-shell --nested \
9+
--wayland

stylesheet.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Add your custom extension styling here */

0 commit comments

Comments
 (0)