a few firefox tweaks
This commit is contained in:
@ -25,7 +25,7 @@ const Gvc = imports.gi.Gvc;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Lib = Me.imports.convenience;
|
||||
const _d = Lib.log;
|
||||
const _d = Lib._log;
|
||||
const Prefs = Me.imports.prefs;
|
||||
const SignalManager = Lib.SignalManager;
|
||||
|
||||
@ -44,7 +44,7 @@ var SoundDeviceChooserBase = class SoundDeviceChooserBase{
|
||||
|
||||
this._setLog();
|
||||
this._signalManager = new SignalManager();
|
||||
this._signalManager.addSignal(this._settings,"changed::" + Prefs.ENABLE_LOG, this._setLog.bind(this));
|
||||
this._signalManager.addSignal(this._settings,"changed::" + Prefs.ENABLE_LOG, this._setLog.bind(this));
|
||||
|
||||
if(this._control.get_state() == Gvc.MixerControlState.READY) {
|
||||
this._onControlStateChanged();
|
||||
@ -54,7 +54,7 @@ var SoundDeviceChooserBase = class SoundDeviceChooserBase{
|
||||
}
|
||||
}
|
||||
|
||||
_setLog(){ Lib.setLog(this._settings.get_boolean(Prefs.ENABLE_LOG));}
|
||||
_setLog(){ Lib.setLog(this._settings.get_boolean(Prefs.ENABLE_LOG));}
|
||||
|
||||
_onControlStateChanged() {
|
||||
if(this._control.get_state() == Gvc.MixerControlState.READY) {
|
||||
@ -109,7 +109,7 @@ var SoundDeviceChooserBase = class SoundDeviceChooserBase{
|
||||
}
|
||||
}
|
||||
|
||||
this.activeProfileTimeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000,
|
||||
this.activeProfileTimeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000,
|
||||
this._setActiveProfile.bind(this));
|
||||
|
||||
if(this._controlStateChangeSignal) {
|
||||
@ -148,7 +148,7 @@ var SoundDeviceChooserBase = class SoundDeviceChooserBase{
|
||||
let icon = uidevice.get_icon_name();
|
||||
if(icon == null || icon.trim() == "")
|
||||
icon = this.getDefaultIcon();
|
||||
let icon_name = this._getIcon(icon);
|
||||
let icon_name = this._getIcon(icon);
|
||||
|
||||
obj.item = this.menuItem.menu.addAction( obj.text, function() {
|
||||
this.changeDevice(uidevice);
|
||||
@ -322,7 +322,7 @@ var SoundDeviceChooserBase = class SoundDeviceChooserBase{
|
||||
icon = this.getDefaultIcon();
|
||||
this.menuItem.icon.icon_name = this._getIcon(icon);
|
||||
} else {
|
||||
this.menuItem.icon.icon_name = "blank";
|
||||
this.menuItem.icon.gicon = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -414,7 +414,7 @@ var SoundDeviceChooserBase = class SoundDeviceChooserBase{
|
||||
|
||||
this.menuItem.icon.icon_name = this._getIcon(icon);
|
||||
} else {
|
||||
this.menuItem.icon.icon_name = "blank";
|
||||
this.menuItem.icon.gicon = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -482,4 +482,3 @@ var SoundDeviceChooserBase = class SoundDeviceChooserBase{
|
||||
this.menuItem.destroy();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,14 @@ const Prefs = Me.imports.prefs;
|
||||
|
||||
var DEBUG = false;
|
||||
|
||||
var logWrap;
|
||||
if(log != undefined){
|
||||
logWrap = log;
|
||||
}
|
||||
else {
|
||||
logWrap = global.log
|
||||
}
|
||||
|
||||
/**
|
||||
* getSettings:
|
||||
*
|
||||
@ -35,7 +43,7 @@ var DEBUG = false;
|
||||
* @schema is not provided, it is taken from metadata['settings-schema'].
|
||||
*/
|
||||
function getSettings(schema) {
|
||||
//let extension = ExtensionUtils.getCurrentExtension();
|
||||
// let extension = ExtensionUtils.getCurrentExtension();
|
||||
|
||||
schema = schema || Me.metadata['settings-schema'];
|
||||
|
||||
@ -72,7 +80,7 @@ function getProfiles(control, uidevice)
|
||||
}
|
||||
|
||||
if(cards && cards[stream.card_index]) {
|
||||
log("Getting profile form stream id " + uidevice.port_name );
|
||||
_log("Getting profile form stream id " + uidevice.port_name );
|
||||
return getProfilesForPort(uidevice.port_name, cards[stream.card_index]);
|
||||
}
|
||||
}
|
||||
@ -82,7 +90,7 @@ function getProfiles(control, uidevice)
|
||||
refreshCards();
|
||||
for (let id in cards) {
|
||||
let profiles;
|
||||
log("Getting profile from cards " + uidevice.port_name + " for card id " + id);
|
||||
_log("Getting profile from cards " + uidevice.port_name + " for card id " + id);
|
||||
if((profiles = getProfilesForPort(uidevice.port_name, cards[id])))
|
||||
{
|
||||
return profiles;
|
||||
@ -101,49 +109,74 @@ function getPorts(refresh) {
|
||||
return ports;
|
||||
}
|
||||
|
||||
function isCmdFound(cmd){
|
||||
try {
|
||||
let [result, out, err, exit_code] = GLib.spawn_command_line_sync(cmd);
|
||||
return true;
|
||||
}
|
||||
catch(e) {
|
||||
_log('ERROR: '+ cmd +' execution failed. ' + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function refreshCards() {
|
||||
cards = {};
|
||||
ports = [];
|
||||
// if(_settings == null) {getSettings(Prefs.SETTINGS_SCHEMA);}
|
||||
let _settings = getSettings(Prefs.SETTINGS_SCHEMA);
|
||||
let error = false;
|
||||
if(_settings.get_boolean(Prefs.NEW_PROFILE_ID)) {
|
||||
log("New logic");
|
||||
if(_settings.get_boolean(Prefs.NEW_PROFILE_ID)) {
|
||||
_log("New logic");
|
||||
let pyLocation = Me.dir.get_child('utils/pa_helper.py').get_path();
|
||||
try {
|
||||
let [result, out, err, exit_code] = GLib.spawn_command_line_sync('python ' + pyLocation);
|
||||
// log("result" + result +" out"+out + " exit_code" + exit_code + "
|
||||
// err" +err);
|
||||
if(result && !exit_code) {
|
||||
if (out instanceof Uint8Array) {
|
||||
out = ByteArray.toString(out);
|
||||
}
|
||||
let obj = JSON.parse(out);
|
||||
cards = obj['cards'];
|
||||
ports = obj['ports'];
|
||||
}
|
||||
let pythonExec = 'python';
|
||||
let pyVer = 3;
|
||||
while(!isCmdFound(pythonExec) && pyVer >=2){
|
||||
_log(pythonExec + " is not found. Try next");
|
||||
pythonExec = 'python' + pyVer--;
|
||||
}
|
||||
catch(e) {
|
||||
error = true;
|
||||
log('ERROR: Python execution failed. fallback to default mode');
|
||||
|
||||
if(pyVer <= 1) {
|
||||
_log('ERROR: Python not found. fallback to default mode' + e);
|
||||
_settings.set_boolean(Prefs.NEW_PROFILE_ID, false);
|
||||
Gio.Settings.sync();
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
let [result, out, err, exit_code] = GLib.spawn_command_line_sync(pythonExec+ ' ' + pyLocation);
|
||||
// _log("result" + result +" out"+out + " exit_code" +
|
||||
// exit_code + "err" +err);
|
||||
if(result && !exit_code) {
|
||||
if (out instanceof Uint8Array) {
|
||||
out = ByteArray.toString(out);
|
||||
}
|
||||
let obj = JSON.parse(out);
|
||||
cards = obj['cards'];
|
||||
ports = obj['ports'];
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
error = true;
|
||||
_log('ERROR: Python execution failed. fallback to default mode' + e);
|
||||
_settings.set_boolean(Prefs.NEW_PROFILE_ID, false);
|
||||
Gio.Settings.sync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!_settings.get_boolean(Prefs.NEW_PROFILE_ID) || error){
|
||||
try {
|
||||
let [result, out, err, exit_code] = GLib.spawn_command_line_sync('pactl list cards');
|
||||
if(result && !exit_code) {
|
||||
parseOutput(out);
|
||||
parseOutput(out);
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
log('ERROR: pactl execution failed. No ports/profiles will be displayed');
|
||||
_log('ERROR: pactl execution failed. No ports/profiles will be displayed');
|
||||
}
|
||||
}
|
||||
// log(JSON.stringify(cards));
|
||||
// log(JSON.stringify(ports));
|
||||
// _log(JSON.stringify(cards));
|
||||
// _log(JSON.stringify(ports));
|
||||
|
||||
}
|
||||
|
||||
@ -159,7 +192,7 @@ function parseOutput(out) {
|
||||
let parseSection = "CARDS";
|
||||
let port;
|
||||
let matches;
|
||||
// log("Unmatched line:" + out);
|
||||
// _log("Unmatched line:" + out);
|
||||
while(lines.length > 0) {
|
||||
let line = lines.shift();
|
||||
|
||||
@ -285,9 +318,10 @@ function setLog(value) {
|
||||
DEBUG = value;
|
||||
}
|
||||
|
||||
function log(msg) {
|
||||
function _log(msg) {
|
||||
if ( DEBUG == true ) {
|
||||
global.log("SDC Debug: " + msg);
|
||||
// global.log("SDC Debug: " + msg);
|
||||
logWrap("SDC Debug: " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,8 +330,8 @@ function dump(obj) {
|
||||
for(var propName in obj) {
|
||||
try{
|
||||
propValue = obj[propName];
|
||||
log(propName + propValue);
|
||||
_log(propName + propValue);
|
||||
}
|
||||
catch(e){log(propName + "!!!Error!!!");}
|
||||
catch(e){_log(propName + "!!!Error!!!");}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Base = Me.imports.base;
|
||||
const Lib = Me.imports.convenience;
|
||||
const _d = Lib._log;
|
||||
const SignalManager = Lib.SignalManager;
|
||||
const Prefs = Me.imports.prefs;
|
||||
const Main = imports.ui.main;
|
||||
@ -109,7 +110,7 @@ var SDCInstance = class SDCInstance {
|
||||
if(theme != null) {
|
||||
let iconPath = Me.dir.get_child('icons');
|
||||
if (iconPath != null && iconPath.query_exists(null)){
|
||||
theme.append_search_path(iconPath.get_path());
|
||||
theme.append_search_path(iconPath.get_path());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,107 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-09-24 23:47+0200\n"
|
||||
"PO-Revision-Date: 2020-05-18 11:12-0300\n"
|
||||
"Last-Translator: Claudio Sanches <contato@claudiosanches.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: pt_BR\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:15
|
||||
msgid "Monochrome"
|
||||
msgstr "Monocromático"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:19
|
||||
msgid "Colored"
|
||||
msgstr "Colorido"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:23
|
||||
msgid "None"
|
||||
msgstr "Nenhum"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:100
|
||||
msgid "Hide selector if there's only one device"
|
||||
msgstr "Ocultar seletor se houver apenas um dispositivo"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:142
|
||||
msgid "Display audio profiles for selection"
|
||||
msgstr "Exibir perfis de áudio para seleção"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:175
|
||||
msgid "General Settings"
|
||||
msgstr "Configurações gerais"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:220
|
||||
msgid "Show output devices"
|
||||
msgstr "Mostrar dispositivos de saída"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:253
|
||||
msgid "Output Devices"
|
||||
msgstr "Dispositivos de saída"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:300
|
||||
msgid "Show input devices"
|
||||
msgstr "Mostrar dispositivos de entrada"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:343
|
||||
msgid "Show volume control for default device"
|
||||
msgstr "Mostrar controle de volume para o dispositivo padrão"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:376
|
||||
msgid "Input Devices"
|
||||
msgstr "Dispositivos de entrada"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:422
|
||||
msgid "Icon Theme"
|
||||
msgstr "Tema do ícone"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:472
|
||||
msgid "Display icons only in selection list"
|
||||
msgstr "Exibir ícones apenas na lista de seleção"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:504
|
||||
msgid "Icons"
|
||||
msgstr "Ícones"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:549
|
||||
msgid "Enable Log messages"
|
||||
msgstr "Ativar mensagens de log"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:588
|
||||
msgid "Enable new profile identification "
|
||||
msgstr "Ativar nova identificação de perfil "
|
||||
|
||||
#: prefs-dialog.gtkbuilder:620
|
||||
msgid "Miscellaneous"
|
||||
msgstr "Diversos"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:688
|
||||
msgid "Name"
|
||||
msgstr "Nome"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:702
|
||||
msgid "Show"
|
||||
msgstr "Exibir"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:716
|
||||
msgid "Hide"
|
||||
msgstr "Ocultar"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:730
|
||||
msgid "Default"
|
||||
msgstr "Padrão"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:756
|
||||
msgid "Port Settings"
|
||||
msgstr "Configurações de porta"
|
@ -0,0 +1,107 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-09-24 23:47+0200\n"
|
||||
"PO-Revision-Date: 2020-05-18 11:25-0300\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 2.3\n"
|
||||
"Last-Translator: Claudio Sanches <contato@claudiosanches.com>\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: pt_PT\n"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:15
|
||||
msgid "Monochrome"
|
||||
msgstr "Monocromático"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:19
|
||||
msgid "Colored"
|
||||
msgstr "Colorido"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:23
|
||||
msgid "None"
|
||||
msgstr "Nenhum"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:100
|
||||
msgid "Hide selector if there's only one device"
|
||||
msgstr "Ocultar seletor se houver apenas um dispositivo"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:142
|
||||
msgid "Display audio profiles for selection"
|
||||
msgstr "Exibir perfis de áudio para seleção"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:175
|
||||
msgid "General Settings"
|
||||
msgstr "Configurações gerais"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:220
|
||||
msgid "Show output devices"
|
||||
msgstr "Mostrar dispositivos de saída"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:253
|
||||
msgid "Output Devices"
|
||||
msgstr "Dispositivos de saída"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:300
|
||||
msgid "Show input devices"
|
||||
msgstr "Mostrar dispositivos de entrada"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:343
|
||||
msgid "Show volume control for default device"
|
||||
msgstr "Mostrar controle de volume para o dispositivo padrão"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:376
|
||||
msgid "Input Devices"
|
||||
msgstr "Dispositivos de entrada"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:422
|
||||
msgid "Icon Theme"
|
||||
msgstr "Tema do ícone"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:472
|
||||
msgid "Display icons only in selection list"
|
||||
msgstr "Exibir ícones apenas na lista de seleção"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:504
|
||||
msgid "Icons"
|
||||
msgstr "Ícones"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:549
|
||||
msgid "Enable Log messages"
|
||||
msgstr "Ativar mensagens de log"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:588
|
||||
msgid "Enable new profile identification "
|
||||
msgstr "Ativar nova identificação de perfil "
|
||||
|
||||
#: prefs-dialog.gtkbuilder:620
|
||||
msgid "Miscellaneous"
|
||||
msgstr "Diversos"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:688
|
||||
msgid "Name"
|
||||
msgstr "Nome"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:702
|
||||
msgid "Show"
|
||||
msgstr "Exibir"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:716
|
||||
msgid "Hide"
|
||||
msgstr "Ocultar"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:730
|
||||
msgid "Default"
|
||||
msgstr "Padrão"
|
||||
|
||||
#: prefs-dialog.gtkbuilder:756
|
||||
msgid "Port Settings"
|
||||
msgstr "Configurações de porta"
|
@ -10,5 +10,5 @@
|
||||
],
|
||||
"url": "https://github.com/kgshank/gse-sound-output-device-chooser",
|
||||
"uuid": "sound-output-device-chooser@kgshank.net",
|
||||
"version": 28
|
||||
"version": 31
|
||||
}
|
@ -24,6 +24,7 @@ const Gtk = imports.gi.Gtk;
|
||||
const ExtensionUtils = imports.misc.extensionUtils;
|
||||
const Me = ExtensionUtils.getCurrentExtension();
|
||||
const Lib = Me.imports.convenience;
|
||||
const _d = Lib._log;
|
||||
const SignalManager = Lib.SignalManager;
|
||||
|
||||
const Gettext = imports.gettext;
|
||||
@ -71,7 +72,7 @@ const SDCSettingsWidget = new GObject.Class({
|
||||
builder.set_translation_domain('sound-output-device-chooser');
|
||||
|
||||
if (builder.add_from_file(uiFilePath) == 0) {
|
||||
Lib.log("JS LOG: could not load the ui file: %s".format(uiFilePath));
|
||||
_d("JS LOG: could not load the ui file: %s".format(uiFilePath));
|
||||
|
||||
let label = new Gtk.Label({
|
||||
label: _("Could not load the preferences UI file"),
|
||||
@ -80,7 +81,7 @@ const SDCSettingsWidget = new GObject.Class({
|
||||
|
||||
this.pack_start(label, true, true, 0);
|
||||
} else {
|
||||
Lib.log('JS LOG:_UI file receive and load: '+uiFilePath);
|
||||
_d('JS LOG:_UI file receive and load: '+uiFilePath);
|
||||
|
||||
let mainContainer = builder.get_object("main-container");
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -10,6 +10,6 @@
|
||||
],
|
||||
"url": "https://github.com/F-i-f/tweaks-system-menu",
|
||||
"uuid": "tweaks-system-menu@extensions.gnome-shell.fifi.org",
|
||||
"vcs_revision": "v9-0-gd0c623d",
|
||||
"version": 9
|
||||
"vcs_revision": "v10-0-gd7da2d8",
|
||||
"version": 10
|
||||
}
|
Reference in New Issue
Block a user