Commit 4ae8e090 authored by Booloki's avatar Booloki
Browse files

Add first version

parent 649b9c71
# dsp-indicator
DSP Indicator - Gnome Shell extension
DSP Indicator - Gnome extension
Display Server Protocol Indicator (X11, Wayland,…)
\ No newline at end of file
Display Server Protocol Indicator (X11, Wayland,…)
// vim: set sw=4 sts=4 et:
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
const GObject = imports.gi.GObject;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const ByteArray = imports.byteArray;
const GLib = imports.gi.GLib;
function getDSP() {
let dsp = null;
let [ok, content, err, exit] = GLib.spawn_command_line_sync('/bin/bash -c "loginctl show-session $(awk \'/tty/ {print $1}\' <(loginctl)) -p Type | awk -F= \'{print $2}\'"');
if (content.length > 0) {
dsp = ByteArray.toString(content);
}
return dsp;
}
let DSPButton = GObject.registerClass(
class DSPButton extends PanelMenu.Button {
_init() {
super._init(0.0, 'DSP Indicator');
let dsp = getDSP();
if (dsp == null) {
dsp = 'N/A';
}
let label = new St.Label({ text: dsp,
y_expand: true });
this.add_actor(label);
}
});
let DSPIndicatorButton;
function enable() {
DSPIndicatorButton = new DSPButton();
Main.panel.addToStatusArea('dsp-indicator', DSPIndicatorButton);
}
function disable() {
DSPIndicatorButton.destroy();
}
{
"name": "DSP Indicator",
"description": "Display Server Protocol Indicator (X11, Wayland,…)",
"version": 1,
"uuid": "dspindicator@booloki.lokizone.net",
"shell-version": [ "3.36", "3.38", "40", "41" ],
"url": "https://git.lokizone.net/booloki/gnome-shell-extension-dsp-indicator"
}
/* Add your custom extension styling here */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment