in a program I need to figure out the WM_CLASS property of the window currently in focus. This works fine using XGetInputFocus() and XGetClassHint() as long as the focused window is not a gtk application.
I wrote the following minimal example program wmclass.c:
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main(int argc, char** argv)
{
Window win;
Display *d;
XClassHint *clh;
int rev;
int status;
clh = XAllocClassHint();
d = XOpenDisplay(0);
for(;;) {
XGetInputFocus(d, &win, &rev);
status = XGetClassHint(d,win,clh);
if (status)
printf("name: %s, class: %s\n", clh->res_name,clh->res_class);
else
printf("failed\n");
sleep(1);
}
XFree(clh);
}
This program prints:
name: xterm, class: XTerm
name: xterm, class: XTerm
failed
failed
failed
name: xterm, class: XTerm
name: xterm, class: XTerm
name: okular, class: Okular
name: okular, class: Okular
failed
failed
name: xterm, class: XTerm
name: xterm, class: XTerm
name: xterm, class: XTerm
failed comes if a gtk app is focused. I tested emacs, gimp, chromium and ardour.
Why is that? How do I get WM_CLASS of gtk-windows?
Focus is not necessarily set to a top-level window. In particular, Gtk tends to set it to a child of such window.
You need to walk the window tree up.
Related
I am using Nvim to try and develop a Mac application. I have just imported AppKit.h to instantiate a sharedApplication.
I am using coc-clangd for autocompletion. I am getting the following error when I import AppKit.h.
In included file: function does not return NSString
[clang: format_attribute_result_not]
The code:
#include <stdio.h>
#include <AppKit/AppKit.h>
int main(int argc, const char * argv[])
{
printf("Hello world");
return 0;
}
I should also mention that the code is compiling just fine. I have tried the following compile commands and both of them have worked.
clang -framework AppKit -o a osx_main.mm
clang -Wall -o a osx_main.mm
You should choose command line tool version,
Xcode ▶ Preferences ▶ Location ▶ Command Line Tool ▶
then choose appropriate command line tool version.
I installed the relay for my react-native project following the steps on relay.dev. Running the compiler works fine when I have an empty schema file. Putting schema to the file starts throwing me this error:
thread 'main' panicked at 'Expect GraphQLAsts to exist.', /home/runner/work/relay/relay/compiler/crates/relay-compiler/src/compiler.rs:335:14
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
My schema file is
// relay_schema.graphql
type Query {
tasks: [TaskNode]
}
type TaskNode {
id: ID!
}
and my relay config is:
module.exports = {
// ...
// Configuration options accepted by the `relay-compiler` command-line tool and `babel-plugin-relay`.
src: './src/',
language: 'flow',
schema: './relay_schema.graphql',
exclude: ['**/node_modules/**', '**/__mocks__/**', '**/__generated__/**'],
};
I'm completely lost on what to do here
Started working after updating src to src: './'. It's better to verify the paths such as src and schema. Error messages shown by the compiler are not much help when stuck here.
I am experimenting with kotlin multiplatform in this chess app. I have c++ code for the chess engines in the app. For each engine, I want to create a kmm module. Since kotlin native does not yet interop with c++, I have to create wrappers around the c++ code. In each androidMain, I have the JNI class that interface with c++, and this works. ios is where I am not clear. I believe I have to create an obj-c++ wrapper (.mm file) around the c++ code, then do cinterop for the wrapper.
iosTarget("ios") {
compilations.getByName("main") {
val jwtc by cinterops.creating {
defFile(project.file("src/iosMain/cpp/jwtc.def"))
packageName("com.cinterop.jwtc")
}
}
}
Is this right? When I try to build it, gradle sync fails with this error:
Execution failed for task ':jwtc:cinteropJwtcIos'.
> Process 'command '/Applications/Android Studio Preview.app/Contents/jre/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jwtc:cinteropJwtcIos'. <36 internal calls>
Caused by: org.gradle.process.internal.ExecException: Process 'command '/Applications/Android Studio Preview.app/Contents/jre/Contents/Home/bin/java'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414)
at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:52)
at org.gradle.process.internal.DefaultExecActionFactory.javaexec(DefaultExecActionFactory.java:198)
at org.gradle.api.internal.project.DefaultProject.javaexec(DefaultProject.java:1145)
at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.runViaExec(KotlinToolRunner.kt:98)
at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.run(KotlinToolRunner.kt:73)
at org.jetbrains.kotlin.gradle.tasks.CInteropProcess.processInterop(KotlinNativeTasks.kt:1035) <122 internal calls>
I have cleaned and restarted android studio severally, and also tried java 8 instead of 11.
I would also appreciate links to more info about the def file. There is not much about it in the kotlin docs.
My jwtc.def:
headers = GameWrapper.h
headerFilter = GameWrapper.h
GameWrapper.h:
#interface GameWrapper
- (void) getBestMove;
#end
GameWrapper.mm:
#include "GameWrapper.h"
#include "Game.h"
#implementation GameWrapper
- (void) getBestMove {
Game game;
game.getBestMove();
}
#end
I finally found that the real error message:
Exception in thread "main" java.lang.Error: /var/folders/17/14lmpq652zn5h_cy_h51z7yr0000gr/T/8492320185156128475.c:1:10: fatal error: 'GameWrapper.h' file not found
and fixed it by adding compilerOpts to point to the location of my src files:
iosTarget("ios") {
compilations.getByName("main") {
val jwtc by cinterops.creating {
defFile(project.file("src/iosMain/cpp/jwtc.def"))
packageName("com.cinterop.jwtc")
compilerOpts ("-Isrc/iosMain/cpp/")
}
}
}
I want to add the -p flag in order to generate documentation for private methods using grunt-jsdoc. How can I do that?
According to the documentation at grunt-jsdoc they state that we can use any of the options specified in the useJsDocCli, however do not know how they should be specified in the grunt task. Here is my current grunt task:
jsdoc : {
dist : {
src: ['app/scripts/directives/*.js','README.md'],
options: {
destination: 'doc'
}
}
}
How can I specify that I want the task to run with the -p flag (or any other flags)?
There's an example in the documentation under the template section https://github.com/krampstudio/grunt-jsdoc#templates
Just use the flag name without the dash, for example:
dist : {
src: ['app/scripts/directives/*.js','README.md'],
options: {
destination: 'doc',
private: true
}
}
}
I'm trying to declare a series of back button.
My goal is to do
ui: 'back-black'
ui: 'back-red'
ui: 'back-green'
and it changes the style but it keeps the arrow shape
so far I've only managed to change all the ui:'back' buttons
.x-button-back, .x-button-back:after {
background:#ff0000 none !important;
}
any ideas ?
Why don't you try ui:'normal-black' or ui:'round-black'?
UPDATE
For that you need to edit your project's Sass files. Add this line to the scss file for each color you want
#include sencha-button-ui('orange',#ff8000,'glossy');
and similar
#include sencha-button-ui('red',#ff0000,'matte');
Check this videos for more info:
http://vimeo.com/33298159 (the example is at 17:00)
http://vimeo.com/17879651
http://www.sencha.com/learn/theming-sencha-frameworks-with-sass-and-compass/
And the CSS3 cheat sheet
http://downloads.sencha.com/extras/css3-cheat-sheet.pdf
On the card:
config: {
defaultBackButtonText: '',
navigationBar: {
backButton: {
iconCls: 'back',
ui: 'plain'
}
}
}
On the CSS:
//Back
.x-button-icon.back {
background-image: url(../../resources/images/bt_seta.png);
background-repeat: no-repeat;
}
The chosen answer is probably wrong or does not applicable to Sencha 2.0.1. I tried the anwer but it doesn't work in Sencha Touch 2.0.1. However, the following method works:
(Optional) Import your favourite color via sass in your sass:
#include sencha-button-ui('orange',#ff8000,'glossy');
Put it in ui like
ui: "orange-back"
or
ui: "red-back"
... etc.