You are not logged in.

#1 2020-07-22 15:58:24

juancuyo
Member
Registered: 2017-11-17
Posts: 14

[SOLVED] How to move a conky?

--- Moved from "The great yad hacking thread" ---

https://imgur.com/QXpvkBR  https://imgur.com/Lpzk8kI   https://imgur.com/ZA524gk  I can't move the conky, to make space and place another one where I want. I don't realize how the tool works. Can you help me?

Offline

#2 2020-07-22 16:09:02

damo
....moderator....
Registered: 2015-08-20
Posts: 6,118

Re: [SOLVED] How to move a conky?

You probably need your conky set with

own_window_type = 'desktop',

Then bl-conkymove (bl-conkypin on Helium) can see it and you can move it with "Alt+LMB Drag", as shown in a yad dialog


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2020-07-22 19:21:41

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 551

Re: [SOLVED] How to move a conky?

damo wrote:
own_window_type = 'desktop',

With that setting, you can not klick on the conky and get the jgmenu. You must move the mouse pointer outside the conky before the mouse can call jgmenu.

Sometimes it is more easy and accurate with editing config files instead of using graphical programs.

You can keep the setting

own_window_type = 'normal',

and instead manualy edit the placement of the conky.

	gap_x = 15,-- l|r
	gap_y = 35,-- u|d
	alignment = 'top_right',

Maybe works ok?


// Regards rbh

Offline

#4 2020-07-22 19:59:25

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

damo wrote:

You probably need your conky set with

own_window_type = 'desktop',

Then bl-conkymove (bl-conkypin on Helium) can see it and you can move it with "Alt+LMB Drag", as shown in a yad dialog

I may be wrong, I'm still using v1.9 where. [Alt]+[left Mouse button] & drag works, but maybe:

own_window_type = 'normal',

might be better.

Desktop windows are special windows that have no window decorations; are always visible on your desktop; do not appear in  your pager or taskbar and are sticky across all workspaces.

One cannot drag a "desktop" conky in v1.9 so probably not in 1.10+ either I would think.

Of course I may be wrong, it has happened a few times (in the past couple of minutes even).

Last edited by Sector11 (2020-07-22 20:03:14)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#5 2020-07-22 20:08:19

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

@ rbh

bl-conkymove & bl-conkypin are two scripts written my damo to move v1.10+ conkys with the click of a mouse as the original method described above did not change the code.

So restarting a moved conky would default back to the original position.
ie:

alignment ml
gap_x 03  ## ←|→
gap_y 00  ## ↑|↓

With damo's little scrip, you can move a conky and it stays moved even over reboots as it teaks the code.

Last edited by Sector11 (2020-07-22 20:12:07)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#6 2020-07-22 20:11:18

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 551

Re: [SOLVED] How to move a conky?

My conky (Lithium) is 1.10.8-1+b1.

And yes, I can move a conky with bl-conkymove. Things evolve...

Last edited by rbh (2020-07-22 20:11:34)


// Regards rbh

Offline

#7 2020-07-22 20:17:56

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

conkys were always able to be moved.  It changed with v1.10+

--->> but damo found a way.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#8 2020-07-22 21:16:36

damo
....moderator....
Registered: 2015-08-20
Posts: 6,118

Re: [SOLVED] How to move a conky?

I may have made the first script, but it is unrecognizable since the talented @johnraff put his mind to it wink


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#9 2020-07-22 23:15:05

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

You and it was cool.

So, a sign of teamwork in progress.

My dinosaur "SSC" YAD script conky starter is still here as well.
Probably does not look anything like what exists today.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#10 2020-07-23 02:09:14

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,135
Website

Re: [SOLVED] How to move a conky?

Conkymove was definitely a team job as I remember it. Damo and I both had the idea that a conky mover would be nice to have, and started working about the same time, then shared ideas and code. (It was quite tricky at first.)


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#11 2020-07-23 02:57:33

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

Actually, moving a conky was already established, you and damo worked on the idea that it "stay put" between reboots or restarts.   big_smile

#!/bin/bash
##
#    bl-conkypin: a script to set the position of a moveable Conky
#    Copyright (C) 2015-2017 damo    <damo@bunsenlabs.org>
#    Copyright (C) 2015-2017 John Crawley <john@bunsenlabs.org>
#    Copyright (C) 2016 xaos52  <xaos52@gmail.com>

Then you changed conkys from "normal" to "desktop" as almost none of my conkys are "sticky across desktops" - which "desktop" sets, I prefer:

own_window_type normal
own_window_hints below,skip_taskbar,skip_pager,undecorated #,sticky

When it comes to conkys and abnormal - I'm the guy.

It's not that I "don't like it" - it just doesn't work for me.
BUT; it's a script that put BL conkyness on the map!

Last edited by Sector11 (2020-07-23 03:01:33)


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#12 2020-07-23 03:07:13

misko_2083
Member
Registered: 2016-05-24
Posts: 367

Re: [SOLVED] How to move a conky?

Hey this is a quick hack of https://github.com/Faison/xlib-learning … dow/main.c
Needs libx11-dev to compile:

gcc  move-window.c -o move-window -lX11

How to use:

./move-window $(xdotool selectwindow)

or with xwininfo

./move-window $(xwininfo | grep -oE "0x[a-z0-9]{7}")

then click on conky and use the arrow keys.
Press escape to exit.
*Note: conky has to be in focus  to send keys to it.

move-window.c

/**
 * move-window - Make the window move when you press the arrow keys, just because.
 *
 * This code won't be structured very well, just trying to get stuff working.
 */
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

// ~16.6 ms between frames is ~60 fps.
#define RATE_LIMIT 16.6

#define _NET_WM_STATE_TOGGLE 2
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10
// Forward declaration of this function so we can use it in main().
double timespec_diff(struct timespec *a, struct timespec *b);

int main(int argc, char *argv[])
{
  Window win;
  // Create application display.
  Display *dpy = XOpenDisplay(NULL);

  if (dpy == NULL) {
    return EXIT_FAILURE;
  }

  win = 0;
  if (argc > 0)
    {
      sscanf (argv[1], "0x%lx", &win);

      if (win == 0)
        sscanf (argv[1], "%lu", &win);
    }

  if (win == 0)
    return 1;
  // Focus window
  XSetInputFocus(dpy, win, RevertToNone, CurrentTime);

  // Tell X that we want to be notified of the Exposure event, so we can know when our window is initially visible.
  XSelectInput(dpy, win, ExposureMask);

  // Grab a copy of X's representation of WM_PROTOCOLS, used in checking for window closed events.
  Atom wm_protocol = XInternAtom(dpy, "WM_PROTOCOLS", True);
  // Let the Window Manager know that we want the event when a user closes the window.
  Atom wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", True);
  XSetWMProtocols(dpy, win, &wm_delete, 1);


  // This variable will be used to examine events thrown to our application window.
  XEvent e;

  // Block execution until the window is exposed.
  XWindowEvent(dpy, win, ExposureMask, &e);

  // Variables needed to get the window's starting position.
  int pos_x = 0;
  int pos_y = 0;
  // This is needed for some reason, not sure what though.
  Window child;
  // This translates the 0,0 position of the window to a screen position.
  XTranslateCoordinates(dpy, win, DefaultRootWindow(dpy), 0, 0, &pos_x, &pos_y, &child);

  // Output the initial x and y position.
  printf("x: %d, y: %d\n", pos_x, pos_y);

  // After being exposed, we'll tell X what input events we want to know about here.
  XSelectInput(dpy, win, KeyPressMask);

  // The loop
  // @TODO: Use sleeping to avoid taking up all CPU cycles.
  Bool done = False;

  // We need to track very small periods of time (nanoseconds), so we use the struct timespec.
  struct timespec prev, curr;

  /*
   * Get the current time with CLOCK_MONOTONIC_RAW, which gets the time past since a certain time.
   * CLOCK_MONOTONIC_RAW is not subject to adjustments to the system clock.
   */
  clock_gettime(CLOCK_MONOTONIC_RAW, &curr);
  // Initialize the previous time with the current time, that way our current vs. previous comparison is valid.
  prev.tv_sec = curr.tv_sec;
  prev.tv_nsec = curr.tv_nsec;

  // This variable will be used to normalize our loop to a specific rate.
  double mill_store = 0;

  // A couple of variables used to deal with KeyPress and KeyRelease events.
  KeySym event_key_0, event_key_1, lookup_keysym;
  char *key_0_string = NULL, *key_1_string = NULL, lookup_buffer[20];
  int lookup_buffer_size = 20, charcount = 0;
  Bool chatting = False;

  while(!done) {
    // Get the current time.
    clock_gettime(CLOCK_MONOTONIC_RAW, &curr);
    // Store the difference in ms between curr and prev, store it in mill_store for use later.
    mill_store += timespec_diff(&curr, &prev);

    // @TODO: Determine if this should happen before updating curr.
    // Handle events in the event queue.
    while(XPending(dpy) > 0) {
      XNextEvent(dpy, &e);
      switch(e.type) {
        case ClientMessage:
          // This client message is a window manager protocol.
          if (e.xclient.message_type == wm_protocol) {
            // Somehow this checks if the protocol was a WM_DELETE protocol, so we can exit the loop and be done.
            if (e.xclient.data.l[0] == wm_delete) {
              done = True;
            }
          }
          break;
        case KeyPress:
          /*
           * So there are two ways to deal with keypress events that I can find:
           *
           * 1. Use XLookupString to get the "string" value of the keypress. That will return the proper value
           *    when considering things like holding shift, caps lock enabled, numlock enabled, etc.
           *    It will not return a string value if you do a keypress combination that doesn't type a "character".
           *    This method probably works great for when you need a user to enter text.
           * 2. Use XLookupKeysym to get two Keysyms for index 0 and 1 (0 is normal click, 1 is shift or caps lock).
           *    Then, based on the key mask in e.xkey.state determine what was pressed (Like Ctrl + Shift + Up).
           *    This method wouldn't work well for when a user is entering text.
           *    This method probably works best for game controls.
           */
          // Handle KeyPress events.
          // @TODO: set the second value (index) properly
          charcount = XLookupString(&(e.xkey), lookup_buffer, lookup_buffer_size, &lookup_keysym, NULL);

          event_key_0 = XLookupKeysym(&(e.xkey), 0);
          event_key_1 = XLookupKeysym(&(e.xkey), 1);
          key_0_string = XKeysymToString(event_key_0);
          key_1_string = XKeysymToString(event_key_1);

          if (XK_Return == event_key_0) {
            if (chatting) {
              printf("\n-Done Chatting-\n");
              chatting = False;
            } else {
              printf("Message: \n");
              chatting = True;
            }
          } else if (event_key_0 == XK_Escape ) {
            done = True;
            printf("Pressed Escape, quitting.\n");
            continue;
          } else if (XK_q == event_key_0 && e.xkey.state & ControlMask) {
            done = True;
            printf("Pressed Ctrl+q, quitting.\n");
            continue;
          } else if (XK_Left == event_key_0) {
            pos_x -= 20;
            XMoveWindow(dpy, win, pos_x, pos_y);
          } else if (XK_Right == event_key_0) {
            pos_x += 20;
            XMoveWindow(dpy, win, pos_x, pos_y);
          } else if (XK_Up == event_key_0) {
            pos_y -= 20;
            XMoveWindow(dpy, win, pos_x, pos_y);
          } else if (XK_Down == event_key_0) {
            pos_y += 20;
            XMoveWindow(dpy, win, pos_x, pos_y);
          }

          if (chatting) {
            printf("%s", lookup_buffer);
          } else {
            printf("Key pressed: %s - %s", key_0_string, key_1_string);
            if (e.xkey.state & ShiftMask) {
              printf(" | Shift");
            }
            if (e.xkey.state & LockMask) {
              printf(" | Lock");
            }
            if (e.xkey.state & ControlMask) {
              printf(" | Ctrl");
            }
            if (e.xkey.state & Mod1Mask) {
              printf(" | Alt");
            }
            if (e.xkey.state & Mod2Mask) {
              printf(" | Num Lock");
            }
            if (e.xkey.state & Mod3Mask) {
              printf(" | Mod3");
            }
            if (e.xkey.state & Mod4Mask) {
              printf(" | Mod4");
            }
            if (e.xkey.state & Mod5Mask) {
              printf(" | Mod5");
            }

            if (IsCursorKey(event_key_0)) {
              printf(" | Cursor Key (0)");
            }
            if (IsCursorKey(event_key_1)) {
              printf(" | Cursor Key (1)");
            }
            if (IsFunctionKey(event_key_0)) {
              printf(" | Function key (0)");
            }
            if (IsFunctionKey(event_key_1)) {
              printf(" | Function key (1)");
            }
            if (IsKeypadKey(event_key_0)) {
              printf(" | keypad (0)");
            }
            if (IsKeypadKey(event_key_1)) {
              printf(" | keypad (1)");
            }
            if (IsMiscFunctionKey(event_key_0)) {
              printf(" | Fn (0)");
            }
            if (IsMiscFunctionKey(event_key_1)) {
              printf(" | Fn (1)");
            }
            if (IsModifierKey(event_key_0)) {
              printf(" | Modifier (0)");
            }
            if (IsModifierKey(event_key_1)) {
              printf(" | Modifier (1)");
            }
            printf("\n");
          }
          break;
      }
    }

    // Only do stuff if the ms passed is greater than our rate limit.
    if (mill_store > RATE_LIMIT && !done) {
      /*
       * This loop counts down the mill_store, so if we have more ms stored than the Rate limit,
       * we run all the processes once. If we have three times the rate limit, we run all the
       * processes thrice. If the mill_store is less than the rate limit, then we pass on
       * processing for this time around the loop (which shouldn't really happen).
       *
       * This helps us have predictable numbers when we do things dependent on numbers, like physics.
       */
      for (; mill_store > RATE_LIMIT && ! done; mill_store -= RATE_LIMIT) {
        // Things that should run once per tick/frame will go here.
      }
    }

    // Update the previous timespec with the most recent timespec so we can calculate the diff next time around.
    prev.tv_sec = curr.tv_sec;
    prev.tv_nsec = curr.tv_nsec;

    /**
     * Make our process sleep to avoid locking up the CPU.
     *
     * From what I understand, the following sleep code will not work on Windows.
     * It works on Linux, it probably works on OSX, but a different approach is needed
     * for Windows.
     */
    if (mill_store < RATE_LIMIT && !done) {
      // We'll need a couple of timespecs, and an int to check for errors.
      struct timespec sleep_required, sleep_remaining;
      int was_error = 0;

      // initialize the remaining sleep time with the value in mill_store.
      sleep_remaining.tv_sec = mill_store / 1000.0;
      sleep_remaining.tv_nsec = ((int)mill_store % 1000) * 1000000;

      do {
        // Set the required sleep time using the remaining time, so we can continue sleeping if nanosleep is interrupted.
        sleep_required.tv_sec = sleep_remaining.tv_sec;
        sleep_required.tv_nsec = sleep_remaining.tv_nsec;

        // Clear out the errno variable before calling nanosleep so we can catch errors.
        errno = 0;
        // Try sleeping for the required time, if nanosleep is interrupted, sleep_remaining will have the time left to sleep.
        was_error = nanosleep(&sleep_required, &sleep_remaining);
        // Keep looping if nanosleep was interrupted and there is some sleep time remaining.
      } while (was_error == -1 && errno == EINTR);
    }
  }


  XCloseDisplay(dpy);
  dpy = NULL;

  return EXIT_SUCCESS;
}

/**
 * This returns the difference between the values of two timespecs.
 */
double timespec_diff(struct timespec *a, struct timespec *b)
{
	return (((a->tv_sec * 1000000000) + a->tv_nsec) - ((b->tv_sec * 1000000000) + b->tv_nsec)) / 1000000.0;
}

P.S. I've set it to 20 pixels per key press
This does not save the Conky position. Perhaps it can be combined with bl-conkymove...

Last edited by misko_2083 (2020-07-23 03:15:17)


Што ни оштровиди ум сагледати не може - љубав превазилази.

Offline

#13 2020-07-23 03:59:18

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

misko_2083 wrote:

Hey this is a quick hack of https://github.com/Faison/xlib-learning … dow/main.c
Needs libx11-dev to compile:

{snip}

P.S. I've set it to 20 pixels per key press
This does not save the Conky position. Perhaps it can be combined with bl-conkymove...

I look and around line 21/22 I feel a migraine coming on ...

interesting though.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#14 2020-07-23 04:14:08

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,135
Website

Re: [SOLVED] How to move a conky?

Sector11 wrote:

Then you changed conkys from "normal" to "desktop" as almost none of my conkys are "sticky across desktops" - which "desktop" sets

That was so that when users press Win+d to show the desktop the conkys would stay up. In fact the conkymover script temporarily changes the window type to "normal" so that the conky can be moved, then back to whatever it was before.

It's not that I "don't like it" - it just doesn't work for me.

So if the conkymover doesn't work for you it must be for a different reason. Some other "unusual" setting or filepath?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#15 2020-07-23 13:34:46

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

The configuration of:

own_window_type normal
own_window_hints below,skip_taskbar,skip_pager,undecorated #,sticky

is a "user definable" choice!

Win-D(esktop) has always done what it does.  Clears ALL open applications, firefox, claws-mail, thunar, terminator AND non "desktop/dock/panel" conkys from view - to show the desktop with just the panels.

"desktop" removes the ability to click on the conky to get the "menu" to appear.
Another reason I stayed with conky v1.9.

The script changes a users "usual" not "unusual" setting that happens to be a conky default.

manpage from both conky v1.9 and 1.10 are the same on that:

own_window_type
              if own_window is yes, you may specify type normal, desktop, dock, panel or  override  (default: normal).

13 conkys spread out on 5 desktops. None of them are "sticky".  Last time I used the script it put all of the conkys on the same desktop.

or: I simply like to have things my way and use conky the way it was designed to be used with "user definable" configurations.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#16 2020-07-23 13:54:38

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 551

Re: [SOLVED] How to move a conky?

johnraff wrote:

Conkymove was definitely a team job as I remember

Nice tool when you have several conkys you will place in an for the eye apealing pattern, considering the wallpaper picture...

But an overkil if you only want to align one conky from the upper right corner...

Last edited by rbh (2020-07-23 13:55:10)


// Regards rbh

Offline

#17 2020-07-23 14:49:15

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

Not if you want that conky to remain there over a reboot.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#18 2020-07-23 16:35:51

juancuyo
Member
Registered: 2017-11-17
Posts: 14

Re: [SOLVED] How to move a conky?

solved

own_window_type = 'normal',

[Alt]+[left Mouse button] & drag works

it work,  I move the conky

Offline

#19 2020-07-23 16:59:38

misko_2083
Member
Registered: 2016-05-24
Posts: 367

Re: [SOLVED] How to move a conky?

And I just made an app to drag it no matter what own window type is. smile
BTW, This Xlib a huge headake.
Depends on libx11-dev and libxtst-dev (because it need that extension to emulate left mouse click).
How does it works?
On launch grabs the window, sets the X Font cursor.
User moves the window along with the mouse pointer and on click the app prints coordinates before exit.
Compiles with:

gcc move-window.c -Wall -o move-window `pkg-config --cflags --libs x11 xtst`

move-window.c

#include<stdio.h>
#include<stdlib.h>
#include<X11/Xlib.h>
#include<X11/cursorfont.h>
#include<malloc.h>
#include<unistd.h>
#include <stdbool.h>
#include <X11/extensions/XTest.h>

/* Move a window.
 Depends: lidx11-dev libxtst-dev
compile with:
   gcc move-window.c -Wall -o move-window `pkg-config --cflags --libs x11 xtst`
*/

int main(int argc, char** argv)
{
  XWindowAttributes xw_attrs;
  Window win;
  Window *root_windows;
  unsigned int mask_return;
  int i;
  int number_of_screens;
  Bool result;
  int root_x, root_y;
  int win_x, win_y;
  int rx = 0, ry = 0;
  int rect_x = 0, rect_y = 0, rect_w = 0, rect_h = 0;
  int btn_pressed = 0, done = 0;

  XEvent ev;
  Display *disp = XOpenDisplay(NULL);

  if(!disp)
    return EXIT_FAILURE;


  Window root = 0;
  number_of_screens = XScreenCount(disp);
  root_windows = malloc(sizeof(Window) * number_of_screens);
  for (i = 0; i < number_of_screens; i++) {
    root_windows[i] = XRootWindow(disp, i);
  }
  for (i = 0; i < number_of_screens; i++) {
    result = XQueryPointer(disp, root_windows[i], &root,
         &win, &root_x, &root_y, &win_x, &win_y,
         &mask_return);
    if (result == True) {
        break;
    }
  }
  if (result != True) {
     fprintf(stderr, "No mouse found.\n");
     return -1;
  }

  XGetWindowAttributes(disp, win, &xw_attrs);

  Cursor cursor;
  cursor = XCreateFontCursor(disp, XC_fleur);

  /* this XGrab* stuff makes XPending true ? */
  if ((XGrabPointer
       (disp, root, False,
        ButtonMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync,
        GrabModeAsync, root, cursor, CurrentTime) != GrabSuccess))
    printf("couldn't grab pointer:");

  if ((XGrabKeyboard
       (disp, root, False, GrabModeAsync, GrabModeAsync,
        CurrentTime) != GrabSuccess))
    printf("couldn't grab keyboard:");

  XTestFakeButtonEvent(disp, 1, True, CurrentTime);
  XFlush(disp);

  while (!done) {
    if (!XPending(disp)) { usleep(1000); continue; } // fixes the 100% CPU hog issue
    if ( (XNextEvent(disp, &ev) >= 0) ) {
      switch (ev.type) {
        case MotionNotify:
          if (btn_pressed) {
            rect_x = rx;
            rect_y = ry;
            rect_w = ev.xmotion.x - rect_x;
            rect_h = ev.xmotion.y - rect_y;
            rect_x += rect_w;
            rect_y += rect_h;
            XMoveWindow(disp, win, rect_x - root_x + xw_attrs.x, rect_y - root_y + xw_attrs.y);
            XFlush(disp);
          }
          continue;
        case ButtonPress:
          btn_pressed = 1;
          rect_x = xw_attrs.x;
          rect_y = xw_attrs.y;
          break;
        case ButtonRelease:
          done = 1;
          break;
      }
    }
  }

  printf("x=%d\ny=%d\n", rect_x - root_x + xw_attrs.x, rect_y - root_y + xw_attrs.y);
  free(root_windows);
  XCloseDisplay(disp);

  return EXIT_SUCCESS;
}

Edit fixed a bug, wrong window position reported.

Last edited by misko_2083 (2020-07-23 17:04:36)


Што ни оштровиди ум сагледати не може - љубав превазилази.

Offline

#20 2020-07-23 17:36:43

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,225

Re: [SOLVED] How to move a conky?

juancuyo wrote:

solved

own_window_type = 'normal',

[Alt]+[left Mouse button] & drag works

it work,  I move the conky

Please go to the firstr post - edit it and Add [Solved] to the Subject

[Solved] How to move a conky?


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#21 2020-07-23 23:29:11

hhh
Meep!
Registered: 2015-09-17
Posts: 10,219
Website

Re: [SOLVED] How to move a conky?

Sector11 wrote:

Please go to the first post - edit it and Add [Solved] to the Subject

[Solved] How to move a conky?

No need, I took care of it.

Offline

#22 2020-07-24 01:25:42

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,135
Website

Re: [SOLVED] How to move a conky?

Sector11 wrote:

Win-D(esktop) has always done what it does.  Clears ALL open applications, firefox, claws-mail, thunar, terminator AND non "desktop/dock/panel" conkys from view - to show the desktop with just the panels.
"desktop" removes the ability to click on the conky to get the "menu" to appear.

Personally, I use window type "normal" on all my conkys, for the kind of reasons you mention.

But there was a request from another dev to change the default conky window types to "desktop" so that Win+D would show the conkys. I think some users brought that issue up too. When you think about it, just being able to see the wallpaper doesn't seem all that useful, and panels are visible anyway.

The script changes a users "usual" not "unusual" setting that happens to be a conky default.

Did you read my post above?

johnraff wrote:

the conkymover script temporarily changes the window type to "normal" so that the conky can be moved, then back to whatever it was before.

So bl-conkymove shouldn't alter any of the user's settings, except the x and y figures that define the exact position. Nothing else. If it's changing the stickiness then it's a bug.

13 conkys spread out on 5 desktops. None of them are "sticky".  Last time I used the script it put all of the conkys on the same desktop.

I'll have to try this. It shouldn't be happening. For a start, the script should only be operating on one conky, not a whole set. And I'd expect the moved conky to be started on whatever the current desktop is. It surely shouldn't be possible even to see a non-sticky conky that's on a different desktop?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#23 2020-07-24 02:59:07

hhh
Meep!
Registered: 2015-09-17
Posts: 10,219
Website

Re: [SOLVED] How to move a conky?

johnraff wrote:

But there was a request from another dev to change the default conky window types to "desktop" so that Win+D would show the conkys. I think some users brought that issue up too. When you think about it, just being able to see the wallpaper doesn't seem all that useful, and panels are visible anyway.

That was me. And if I recall correctly, my issue wasn't so much that Super-d cleared conky from the desktop, but that re-issuing Super-d didn't restore the conky along with already opened apps, even though conky was still running. So, conky running but no conky readout seemed weird to me.

Offline

#24 2020-07-24 05:47:09

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,135
Website

Re: [SOLVED] How to move a conky?

hhh wrote:

if I recall correctly, my issue wasn't so much that Super-d cleared conky from the desktop, but that re-issuing Super-d didn't restore the conky along with already opened apps, even though conky was still running.

Just tested, and with window_type "normal" conkys they disappear with Win+D and then return, just like other windows. I thought the issue was that users wanted to use Win+D in order to see their conkys when covered by apps?

I get round it by having a system-data conky that toggles on and off with a keybind, and sits on top of everything when it's called, with no transparency.
q9yxxAfl.png
Not pretty but it does the job.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#25 2020-07-24 06:34:36

hhh
Meep!
Registered: 2015-09-17
Posts: 10,219
Website

Re: [SOLVED] How to move a conky?

johnraff wrote:
hhh wrote:

if I recall correctly, my issue wasn't so much that Super-d cleared conky from the desktop, but that re-issuing Super-d didn't restore the conky along with already opened apps, even though conky was still running.

Just tested, and with window_type "normal" conkys they disappear with Win+D and then return, just like other windows. I thought the issue was that users wanted to use Win+D in order to see their conkys when covered by apps?

Most likely, I'm a very passive conky user.

Offline

Board footer

Powered by FluxBB