1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-16 04:02:15 +00:00

Create missing atom for query (#1834)

I'm assuming sending None Atom in the request will cause an error.
I defined those properties on my platform so that's why the function
didn't fail.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
This commit is contained in:
Tin Švagelj 2024-04-17 19:40:01 +00:00 committed by GitHub
parent f9579ffce2
commit d815f9aa49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 37 additions and 50 deletions

View File

@ -108,7 +108,7 @@ Conky is licensed under the terms of the [GPLv3](LICENSE) license.
Contributions are welcome from anyone. Contributions are welcome from anyone.
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on contributing to Conky. Please read [Contributing](https://github.com/brndnmtthws/conky/wiki/Contributing) page on wiki for guidelines on contributing to Conky.
[mpd]: https://musicpd.org/ [mpd]: https://musicpd.org/
[xmms2]: https://github.com/xmms2/wiki/wiki [xmms2]: https://github.com/xmms2/wiki/wiki

View File

@ -1694,6 +1694,16 @@ bool is_on_battery() { // checks if at least one battery specified in
volatile sig_atomic_t g_sigterm_pending, g_sighup_pending, g_sigusr2_pending; volatile sig_atomic_t g_sigterm_pending, g_sighup_pending, g_sigusr2_pending;
void log_system_details() {
char *session_ty = getenv("XDG_SESSION_TYPE");
char *session = getenv("GDMSESSION");
char *desktop = getenv("XDG_CURRENT_DESKTOP");
if (desktop != nullptr || session != nullptr) {
NORM_ERR("'%s' %s session running '%s' destop", session, session_ty,
desktop);
}
}
void main_loop() { void main_loop() {
int terminate = 0; int terminate = 0;
#ifdef SIGNAL_BLOCKING #ifdef SIGNAL_BLOCKING
@ -1716,6 +1726,8 @@ void main_loop() {
sigaddset(&newmask, SIGUSR1); sigaddset(&newmask, SIGUSR1);
#endif #endif
log_system_details();
last_update_time = 0.0; last_update_time = 0.0;
next_update_time = get_time() - fmod(get_time(), active_update_interval()); next_update_time = get_time() - fmod(get_time(), active_update_interval());
info.looped = 0; info.looped = 0;

View File

@ -34,10 +34,6 @@
extern "C" { extern "C" {
#include <lua.h> #include <lua.h>
#ifdef BUILD_XINPUT
#include <X11/extensions/XInput2.h>
#endif
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
@ -316,7 +312,7 @@ bool fixed_valuator_relative(Display *display, XIDeviceInfo *device,
"ConkyValuatorScrollMode", "ConkyValuatorScrollMode",
}; };
Atom override_atom = XInternAtom(display, atom_names[valuator >> 1], True); Atom override_atom = XInternAtom(display, atom_names[valuator >> 1], False);
unsigned char *value_return; unsigned char *value_return;
Atom type_return; Atom type_return;
int format_return; int format_return;

View File

@ -44,7 +44,7 @@ extern "C" {
#ifdef BUILD_XINPUT #ifdef BUILD_XINPUT
#include <X11/extensions/XInput.h> #include <X11/extensions/XInput.h>
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
#undef COUNT // define from X11/extendsions/Xi.h #undef COUNT // define from X11/extensions/Xi.h
#endif /* BUILD_XINPUT */ #endif /* BUILD_XINPUT */
#endif /* BUILD_X11 */ #endif /* BUILD_X11 */

View File

@ -169,7 +169,7 @@ void use_xdbe_setting::lua_setter(lua::state &l, bool init) {
l.pushboolean(false); l.pushboolean(false);
} }
fprintf(stderr, PACKAGE_NAME ": drawing to %s buffer\n", NORM_ERR("drawing to %s buffer",
do_convert(l, -1).first ? "double" : "single"); do_convert(l, -1).first ? "double" : "single");
} }
@ -206,7 +206,7 @@ void use_xpmdb_setting::lua_setter(lua::state &l, bool init) {
l.pushboolean(false); l.pushboolean(false);
} }
fprintf(stderr, PACKAGE_NAME ": drawing to %s buffer\n", NORM_ERR("drawing to %s buffer",
do_convert(l, -1).first ? "double" : "single"); do_convert(l, -1).first ? "double" : "single");
} }
@ -374,7 +374,7 @@ static void init_x11() {
std::string err = std::string err =
std::string("can't open display: ") + XDisplayName(disp); std::string("can't open display: ") + XDisplayName(disp);
#ifdef BUILD_WAYLAND #ifdef BUILD_WAYLAND
fprintf(stderr, "%s\n", err.c_str()); NORM_ERR(err.c_str());
return; return;
#else /* BUILD_WAYLAND */ #else /* BUILD_WAYLAND */
throw std::runtime_error(err); throw std::runtime_error(err);
@ -479,10 +479,10 @@ static Window find_desktop_window(Window root) {
desktop = find_subwindow(desktop, workarea[2], workarea[3]); desktop = find_subwindow(desktop, workarea[2], workarea[3]);
if (desktop != root) { if (desktop != root) {
DBGP2("desktop window (0x%lx) is subwindow of root window (0x%lx)", desktop, NORM_ERR("desktop window (0x%lx) is subwindow of root window (0x%lx)",
root); desktop, root);
} else { } else {
DBGP2("desktop window (0x%lx) is root window", desktop); NORM_ERR("desktop window (0x%lx) is root window", desktop);
} }
return desktop; return desktop;
} }
@ -659,8 +659,7 @@ void x11_init_window(lua::state &l, bool own) {
XLowerWindow(display, window.window); XLowerWindow(display, window.window);
XSetClassHint(display, window.window, &classHint); XSetClassHint(display, window.window, &classHint);
fprintf(stderr, PACKAGE_NAME ": window type - override\n"); NORM_ERR("window type - override");
fflush(stderr);
} else { /* own_window_type.get(l) != TYPE_OVERRIDE */ } else { /* own_window_type.get(l) != TYPE_OVERRIDE */
/* A window managed by the window manager. /* A window managed by the window manager.
@ -754,29 +753,24 @@ void x11_init_window(lua::state &l, bool own) {
switch (own_window_type.get(l)) { switch (own_window_type.get(l)) {
case TYPE_DESKTOP: case TYPE_DESKTOP:
prop = ATOM(_NET_WM_WINDOW_TYPE_DESKTOP); prop = ATOM(_NET_WM_WINDOW_TYPE_DESKTOP);
fprintf(stderr, PACKAGE_NAME ": window type - desktop\n"); NORM_ERR("window type - desktop");
fflush(stderr);
break; break;
case TYPE_DOCK: case TYPE_DOCK:
prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK); prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK);
fprintf(stderr, PACKAGE_NAME ": window type - dock\n"); NORM_ERR("window type - dock");
fflush(stderr);
break; break;
case TYPE_PANEL: case TYPE_PANEL:
prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK); prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK);
fprintf(stderr, PACKAGE_NAME ": window type - panel\n"); NORM_ERR("window type - panel");
fflush(stderr);
break; break;
case TYPE_UTILITY: case TYPE_UTILITY:
prop = ATOM(_NET_WM_WINDOW_TYPE_UTILITY); prop = ATOM(_NET_WM_WINDOW_TYPE_UTILITY);
fprintf(stderr, PACKAGE_NAME ": window type - utility\n"); NORM_ERR("window type - utility");
fflush(stderr);
break; break;
case TYPE_NORMAL: case TYPE_NORMAL:
default: default:
prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL); prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL);
fprintf(stderr, PACKAGE_NAME ": window type - normal\n"); NORM_ERR("window type - normal");
fflush(stderr);
break; break;
} }
XChangeProperty(display, window.window, xa, XA_ATOM, 32, XChangeProperty(display, window.window, xa, XA_ATOM, 32,
@ -788,9 +782,7 @@ void x11_init_window(lua::state &l, bool own) {
/* Window decorations */ /* Window decorations */
if (TEST_HINT(hints, HINT_UNDECORATED)) { if (TEST_HINT(hints, HINT_UNDECORATED)) {
/* fprintf(stderr, PACKAGE_NAME": hint - undecorated\n"); DBGP("hint - undecorated");
fflush(stderr); */
xa = ATOM(_MOTIF_WM_HINTS); xa = ATOM(_MOTIF_WM_HINTS);
if (xa != None) { if (xa != None) {
long prop[5] = {2, 0, 0, 0, 0}; long prop[5] = {2, 0, 0, 0, 0};
@ -801,9 +793,7 @@ void x11_init_window(lua::state &l, bool own) {
/* Below other windows */ /* Below other windows */
if (TEST_HINT(hints, HINT_BELOW)) { if (TEST_HINT(hints, HINT_BELOW)) {
/* fprintf(stderr, PACKAGE_NAME": hint - below\n"); DBGP("hint - below");
fflush(stderr); */
xa = ATOM(_WIN_LAYER); xa = ATOM(_WIN_LAYER);
if (xa != None) { if (xa != None) {
long prop = 0; long prop = 0;
@ -825,9 +815,7 @@ void x11_init_window(lua::state &l, bool own) {
/* Above other windows */ /* Above other windows */
if (TEST_HINT(hints, HINT_ABOVE)) { if (TEST_HINT(hints, HINT_ABOVE)) {
/* fprintf(stderr, PACKAGE_NAME": hint - above\n"); DBGP("hint - above");
fflush(stderr); */
xa = ATOM(_WIN_LAYER); xa = ATOM(_WIN_LAYER);
if (xa != None) { if (xa != None) {
long prop = 6; long prop = 6;
@ -849,9 +837,7 @@ void x11_init_window(lua::state &l, bool own) {
/* Sticky */ /* Sticky */
if (TEST_HINT(hints, HINT_STICKY)) { if (TEST_HINT(hints, HINT_STICKY)) {
/* fprintf(stderr, PACKAGE_NAME": hint - sticky\n"); DBGP("hint - sticky");
fflush(stderr); */
xa = ATOM(_NET_WM_DESKTOP); xa = ATOM(_NET_WM_DESKTOP);
if (xa != None) { if (xa != None) {
CARD32 xa_prop = 0xFFFFFFFF; CARD32 xa_prop = 0xFFFFFFFF;
@ -873,9 +859,7 @@ void x11_init_window(lua::state &l, bool own) {
/* Skip taskbar */ /* Skip taskbar */
if (TEST_HINT(hints, HINT_SKIP_TASKBAR)) { if (TEST_HINT(hints, HINT_SKIP_TASKBAR)) {
/* fprintf(stderr, PACKAGE_NAME": hint - skip_taskbar\n"); DBGP("hint - skip taskbar");
fflush(stderr); */
xa = ATOM(_NET_WM_STATE); xa = ATOM(_NET_WM_STATE);
if (xa != None) { if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_TASKBAR); Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_TASKBAR);
@ -888,9 +872,7 @@ void x11_init_window(lua::state &l, bool own) {
/* Skip pager */ /* Skip pager */
if (TEST_HINT(hints, HINT_SKIP_PAGER)) { if (TEST_HINT(hints, HINT_SKIP_PAGER)) {
/* fprintf(stderr, PACKAGE_NAME": hint - skip_pager\n"); DBGP("hint - skip pager");
fflush(stderr); */
xa = ATOM(_NET_WM_STATE); xa = ATOM(_NET_WM_STATE);
if (xa != None) { if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER); Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER);
@ -902,10 +884,7 @@ void x11_init_window(lua::state &l, bool own) {
} }
} }
fprintf(stderr, PACKAGE_NAME ": drawing to created window (0x%lx)\n", NORM_ERR("drawing to created window (0x%lx)", window.window);
window.window);
fflush(stderr);
XMapWindow(display, window.window); XMapWindow(display, window.window);
} else } else
#endif /* OWN_WINDOW */ #endif /* OWN_WINDOW */
@ -919,7 +898,7 @@ void x11_init_window(lua::state &l, bool own) {
window.height = attrs.height; window.height = attrs.height;
} }
fprintf(stderr, PACKAGE_NAME ": drawing to desktop window\n"); NORM_ERR("drawing to desktop window");
} }
/* Drawable is same as window. This may be changed by double buffering. */ /* Drawable is same as window. This may be changed by double buffering. */