Guide to initiating a GtkApplication within a gnome-shell-extension

One of my objectives is to launch a new GtkApplication when the user clicks a button in the topbar of Gnome. I am able to create the button using a gnome-shell-extension, but encountering difficulties in initializing the GtkApplication itself.

As a result, the code provided below should simply trigger the start of the GtkApplication.

After placing the code inside

~/.local/share/gnome-shell/extensions/test@test/extension.js
and activating the extension, it consistently leads to a SIGSEGV signal from gnome-shell.

const Lang = imports.lang;
const Gtk = imports.gi.Gtk;
const TestApp = new Lang.Class({
    Name: 'TestApp',
    Extends: Gtk.Application,
    _init: function() {
        this.parent({ application_id: 'testapp.apptesttt' });
    },
    vfunc_activate: function() {
        //this.window.present();
    },
});
function init() {
}
let _app;
function enable() {
    _app = new TestApp();
    _app.register(null);
}
function disable() {
    _app.quit();
}

Answer №1

Although I may be arriving tardy to the gathering, in the event that another individual stumbles upon this:

The solution can likely be found within imports.misc.util:

const Util = imports.misc.util;
Util.spawn()

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can the merging of this service be possible in AngularJS?

Currently, I am loading two JSON files using separate services in the following manner: app.factory('AventosService', function($rootScope, $http) { var data = []; return { promise: null, loadAventosJson: function() { this.p ...

Error encountered while attempting to import the mongoose npm module into a React application

I'm encountering an issue in my React project where I am trying to include an npm module within a component. Here's an example: var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/test', {useNewUrlParser ...

Sometimes Google Maps API doesn't load properly on my page until I hit the refresh button

Occasionally, I encounter a problem where my Google Map fails to load when the webpage is first opened, resulting in a blank map. However, upon refreshing the page, the map loads correctly. The error message appearing in the Chrome console reads as follow ...

Exploring the world of design patterns using three.js and webpack

Looking to improve the organization of my code with three.js and webpack rather than having everything in a single file (like camera, meshes, lights, postprocessing, etc). I had the idea of using "manager modules" such as a LightManager class or a PostPro ...

Guide to developing a personalized useReducer with integrated decision-making and event activation

I am interested in creating a custom hook called useTextProcessor(initialText, props). This hook is designed for managing and manipulating text (string) within a React state. It utilizes useReducer to maintain a cumulative state. Here is the implementation ...

Sharing and showcasing files directly from a local directory

Recently diving into NodeJS and web development, I've successfully used multer to upload a single file within my web application. The file gets uploaded to my "uploads" folder flawlessly, and now I'm planning on storing the file path in my databa ...

Trouble with unproductive downtime in ReactJS and JavaScript

I'm looking for a way to detect idle time and display a dialog automatically after a certain period of inactivity. The dialog should prompt the user to click a button to keep their session active. Currently, when the user clicks the button it doesn&a ...

Troubleshooting: Angular.js error when Typescript class constructor returns undefined

I'm currently trying to create a simple TypeScript class, however I keep encountering an error stating this is undefined in the constructor. Class: class MyNewClass { items: string; constructor(){ this.items = 'items'; ...

Is there a way to deactivate dates that are more than 14 days ahead of the current date in Vue Datepicker?

Although I've seen similar inquiries, none of them address my specific issue. I am working with a Vue.js datepicker and I want to restrict the user from selecting a date that is less than 2 weeks ahead of the current date. Essentially, I need all date ...

Node.js with Socket.io causes multiple events to be triggered

Currently, I am in the process of developing a rochambo game using node.js and socket.io. The game works as follows: A player places a bet, which is then sent to all other players. These players can choose a sign and click on 'challenge'. Howeve ...

A JavaScript popup displaying selectable options and a callback function

Is there a feature in Javascript that is similar to Java's alert builder? I need a button that, when clicked, will display an alert with various options. When an option is selected, it should trigger a callback function passing the chosen option along ...

Incorporating Hyperlinks into Text using React I18next

I'm facing an issue with I18next. I can't seem to make links to websites work correctly using the following code: import React, { Suspense } from "react"; import i18n from "i18next"; import { initReactI18next, useTranslation, ...

I need help with customizing the progress bar in HTML and CSS

How can I create a progress bar like the one shown below: https://i.sstatic.net/BFv87.png .detail-load { height: 42px; border: 1px solid #A2B2C5; padding: 1px; border-radius: 10px; } .detail-load > .detail-loading { ...

Creating a Vue Directive in the form of an ES6 class: A step-by-step

Is it possible to make a Vue directive as an ES6 Class? I have been attempting to do so, but it doesn't seem to be working correctly. Here is my code snippet: import { DirectiveOptions } from 'vue'; interface WfmCarriageDirectiveModel { ...

Allowing the contenteditable attribute to function only on a single line of

My app allows users to create different lists, with the ability to edit the name. However, I am facing an issue where if a user types a new name, it should remain on only one line. I tried adding max height and overflow hidden properties, but it only hides ...

three.js: shadows created by a mesh with varying levels of transparency

My model has a texture with certain transparent areas (alpha equals zero). But when the model casts a shadow, it looks like it's solid. Is there a way to solve this issue? ...

Is it possible to determine if a variable is unset using isset?

Currently, I am utilizing the following code snippet to verify if isset is not set. For instance: if(!isset($_REQUEST['search'])) { } else if(!isset($_REQUEST['submit'])) {} I would like clarification on whether !isset is considered ...

Retrieve data by sorting based on the count column in a joined table with Sequelize

I've been struggling to make this work for some time and was hoping for some guidance. OBJECTIVE: I'm attempting to sort the posts by the number of likes they currently have. CURRENT: const posts = await db.post.findAll({ include: [ db.user ...

Tips for modifying the icon of a div with a click event using vanilla JavaScript

My goal is to create a functionality where clicking on a title will reveal content and change the icon next to the title. The concept is to have a plus sign initially, and upon clicking, the content becomes visible and the icon changes to a minus sign. C ...

Issues in retrieving meaningful output from an external function

My goal is to render a div component with a dynamic class. In order to later evaluate it in the object's state, I am setting the div's class to match the "piece" state. To update the state, I have created an external JS function that returns a ra ...