How to open extension prefs with DBus? - gnome-shell-extensions

$ gnome-shell --version
GNOME Shell 40.2
I'm trying to open extension prefs in gjs-console.
I found a way how to open prefs with dbus-send
dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions.LaunchExtensionPrefs string:'text-translator'
But I stuck with gjs
Run gjs-console
Connect to bus proxy and call the method. PS you can try open prefs for any other extension you want, replace "text-translator" with you extension uuid
"
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
dbus = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SESSION, Gio.DBusProxyFlags.NONE, null, "org.gnome.Shell", "/org/gnome/Shell/Extensions", "org.gnome.Shell.Extensions", null);
dbus.call_sync("LaunchExtensionPrefs", new GLib.Variant("(s)", [ "text-translator" ]), 0, -1, null);
But got this error:
typein:4:6 uncaught exception: Object
#typein:4:6
#<stdin>:1:42
Аnd I have no idea how to debug this.
My problem is to open my extension prefs from inside my extension. I'd be open to any help if there is any other way to do this.

My problem is to open my extension prefs from inside my extension.
You can open it directly:
Main.extensionManager.openExtensionPrefs('your-extension-uuid', '', {});

Well, now I see the error was in object_path parameter to new_for_bus_sync. I used /org/gnome/Shell/Extensions while /org/gnome/Shell was expected
This script works fine
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
dbus = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SESSION, Gio.DBusProxyFlags.NONE, null, "org.gnome.Shell", "/org/gnome/Shell", "org.gnome.Shell.Extensions", null);
dbus.call_sync("LaunchExtensionPrefs", new GLib.Variant("(s)", [ "text-translator" ]), 0, -1, null);

Related

Box node sdk on Deno throws "Not implemented: crypto.Sign" error

I want to use Box Node SDK on Deno (v1.30.3) . here is a simple example.
import BoxSDK from "npm:box-node-sdk#2.8.1";
import conf from "/path/to/config.json" assert {type: "json"};
const sdk = BoxSDK.getPreconfiguredInstance(conf);
const client = sdk.getAppAuthClient("enterprise");
client.users.get(client.CURRENT_USER_ID).then((me: any) => {
console.log(me); // should print user’s name
})
This is what I get.
error: Uncaught Error: Not implemented: crypto.Sign
throw new Error(message);
^
at notImplemented (https://deno.land/std#0.177.0/node/_utils.ts:23:9)
at new Sign (https://deno.land/std#0.177.0/node/internal/crypto/sig.ts:45:5)
at Object.createSign (https://deno.land/std#0.177.0/node/crypto.ts:268:10)
at Object.sign (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/jwa/1.4.1/index.js:151:25)
at Object.jwsSign \[as sign\] (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/jws/3.2.2/lib/sign-stream.js:32:24)
at Object.module.exports \[as sign\] (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/jsonwebtoken/8.5.1/sign.js:204:16)
at TokenManager.getTokensJWTGrant (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/box-node-sdk/2.8.1/lib/token-manager.js:286:48)
at AppAuthSession.\_refreshAppAuthAccessToken (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/box-node-sdk/2.8.1/lib/sessions/app-auth-session.js:79:18)
at AppAuthSession.getAccessToken (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/box-node-sdk/2.8.1/lib/sessions/app-auth-session.js:124:25)
at BoxClient.\_makeRequest (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/box-node-sdk/2.8.1/lib/box-client.js:300:18)
at BoxClient.get (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/box-node-sdk/2.8.1/lib/box-client.js:452:21)
at wrappedClientMethod (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/box-node-sdk/2.8.1/lib/box-client.js:589:30)
at Users.get (file:///Users/hkobayashi/Library/Caches/deno/npm/registry.npmjs.org/box-node-sdk/2.8.1/lib/managers/users.js:42:67)
at file:///Users/hkobayashi/dev/poc/poc24-deno/2023-02/box-hello.ts:8:14
Does this mean deno's crypto library hasn't yet fully implemented?
is there any workaround?

nix-shell script does nothing when using script

I'm quite new to Nix and I'm trying to create a very simple shell.nix script file.
Unfortunately I need an old package: mariadb-10.4.21. After reading and searching a bit I found out that version 10.4.17 (would've been nice to have the exact version but I couldn't find it) is in channel nixos-20.09, but when I do
$ nix-shell --version
nix-shell (Nix) 2.5.1
$ cat shell.nix
let
pkgs = import <nixpkgs> {};
# git ls-remote https://github.com/nixos/nixpkgs nixos-20.09
pkgs-20_09 = import (builtins.fetchGit {
name = "nixpks-20.09";
url = "https://github.com/nixos/nixpkgs";
ref = "refs/heads/nixos-20.09";
rev = "1c1f5649bb9c1b0d98637c8c365228f57126f361";
}) {};
in
pkgs.stdenv.mkDerivation {
pname = "test";
version = "0.1.0";
buildInputs = [
pkgs-20_09.mariadb
];
}
$ nix-shell
it just waits indefinitely without doing anything. But if I do
$ nix-shell -p mariadb -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/1c1f5649bb9c1b0d98637c8c365228f57126f361.tar.gz
[...]
/nix/store/yias2v8pm9pvfk79m65wdpcby4kiy91l-mariadb-server-10.4.17
[...]
copying path '/nix/store/yias2v8pm9pvfk79m65wdpcby4kiy91l-mariadb-server-10.4.17' from 'https://cache.nixos.org'...
[nix-shell:~/Playground]$ mariadb --version
mariadb Ver 15.1 Distrib 10.4.17-MariaDB, for Linux (x86_64) using readline 5.1
it works perfectly.
What am I doing wrong in the script for it to halt?
EDIT: I got a bit more info by running
$ nix-shell -vvv
[...]
did not find cache entry for '{"name":"nixpks-20.09","rev":"1c1f5649bb9c1b0d98637c8c365228f57126f361","type":"git"}'
did not find cache entry for '{"name":"nixpks-20.09","ref":"refs/heads/nixos-20.09","type":"git","url":"https://github.com/nixos/nixpkgs"}'
locking path '/home/test/.cache/nix/gitv3/17blyky0ja542rww32nj04jys1r9vnkg6gcfbj83drca9a862hwp.lock'
lock acquired on '/home/test/.cache/nix/gitv3/17blyky0ja542rww32nj04jys1r9vnkg6gcfbj83drca9a862hwp.lock.lock'
fetching Git repository 'https://github.com/nixos/nixpkgs'...
Is it me or it seems like it's trying to fetch from two different sources? As far as I understood all three url, rev and ref are needed for git-fetching, but it looks like if it's splitting them.
EDIT2: I've been trying with fetchFromGitHub
pkgs-20_09 = import (pkgs.fetchFromGitHub {
name = "nixpks-20.09";
owner = "nixos";
repo = "nixpkgs";
rev = "1c1f5649bb9c1b0d98637c8c365228f57126f361";
sha256 = "0f2nvdijyxfgl5kwyb4465pppd5vkhqxddx6v40k2s0z9jfhj0xl";
}) {};
and fetchTarball
pkgs-20_09 = import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/1c1f5649bb9c1b0d98637c8c365228f57126f361.tar.gz") {};
and both work just fine. I'll use fetchFromGitHub from now on but it'd be interesting to now why fetchGit doesn't work.

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'

My Deno version.
D:\deno\deno-project\deno-todo-app-master>deno --version
deno 1.2.1
v8 8.5.216
typescript 3.9.2
Command To Run The Project
deno run --allow-net --allow-read --allow-write --allow-plugin --unstable app.ts
And give this error
Use latest std version. v0.62.0 instead of 0.50.0 & 0.57.0.
Please try this.
Downgrade: deno upgrade --version 1.1.3 and wait for all the sub-modules to change the versions.
ref :
https://dev.to/srnv/deno-1-2-0-url-argument-type-solutions-37m0
use https://deno.land/std#0.79.0
example:-
import { serve } from "https://deno.land/std#0.79.0/http/server.ts";
const port = 3000;
const s = serve({ port });
console.log(`server running on port ${port}`);
for await (const req of s) {
req.respond({ body: 'hello' });
}

Cake build NuGetPush throws permission denied

I'm building my .NET Core app in Travis CI using Cake script, when it comes to
var d = new DirectoryInfo(packageOutputPath.ToString());
var Files = d.GetFiles("*.nupkg").Select(x => new FilePath(x.FullName));
var key = EnvironmentVariable("NugetKey");
NuGetPush(Files, new NuGetPushSettings {
Source = Variables.NugetSource,
ApiKey = key
command I get:
An error occurred when executing task 'PushPackage'.
Error: One or more errors occurred. (Permission denied)
Permission denied
My .travis.yml file:
sudo: required
language: csharp
mono: none
dotnet: 2.1.402
before_install:
- chmod +x build.sh
script:
- ./build.sh --Target="PushPackage"
I have tried replacing - ./build.sh --Target="PushPackage" with - sudo bash build.sh --Target="PushPackage" but this did not help. Any suggestions why I'm getting this error?
build.sh file was builded according to this. Whole repo is here.
You should be using the DotNetCoreNuGetPush alias when using the .NET CLI, NuGetPush requires nuget.exe.
Example:
DirectoryPath packageOutputPath = MakeAbsolute(Directory("./nuget/"));
var settings = new DotNetCoreNuGetPushSettings
{
Source = "https://www.example.com/nugetfeed",
ApiKey = "4003d786-cc37-4004-bfdf-c4f3e8ef9b3a"
};
foreach(var file in GetFiles($"{packageOutputPath}/*.nupkg"))
{
DotNetCoreNuGetPush(file.FullPath, settings);
}

jsdom virtual console: TypeError: jsdom.createVirtualConsole is not a function

In:
const jsdom = require("jsdom");
const initialVirtualConsole = jsdom.createVirtualConsole();
I get:
TypeError: jsdom.createVirtualConsole is not a function
at Query.<anonymous> (/my_jsdom_script.js:112:55)
at emitNone (events.js:72:20)
at Query.emit (events.js:166:7)
at Query.Sequence.end (/Users/xxx/Sites/node_modules/mysql/lib/protocol/sequences/Sequence.js:99:12)
at Query._handleFinalResultPacket (/Users/xxx/Sites/node_modules/mysql/lib/protocol/sequences/Query.js:144:8)
at Query.EofPacket (/Users/xxx/Sites/node_modules/mysql/lib/protocol/sequences/Query.js:128:8)
at Protocol._parsePacket (/Users/xxx/Sites/node_modules/mysql/lib/protocol/Protocol.js:280:23)
at Parser.write (/Users/xxx/Sites/node_modules/mysql/lib/protocol/Parser.js:73:12)
at Protocol.write (/Users/xxx/Sites/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/Users/xxx/Sites/node_modules/mysql/lib/Connection.js:96:28)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
I would like to run the tests for jsdom on my local machine to see how jsdom performs in my local environment.
Could anyone be so good as to guide a noob in running the tests in https://github.com/tmpvar/jsdom/tree/master/test ?
Here's what's in my beforeEach() block (I'm using mocha over node.js to test)
import jsdom from 'jsdom'
const virtualConsole = jsdom.createVirtualConsole()
const document = jsdom.jsdom(undefined, {
virtualConsole: virtualConsole.sendTo(console)
})
virtualConsole.on('log', (...args) => {
// do something with `args` sent to logs
// e.g, assign result to a variable and run your assertions over it
})
window = document.defaultView
global.window = window
global.document = document
Check out the tests for further examples: https://github.com/tmpvar/jsdom/blob/master/test/jsdom/virtual-console.js

Resources