Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3287638
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:30:56+00:00 2026-05-17T20:30:56+00:00

I’m writing a application that put docks in the right side of the screen,

  • 0

I’m writing a application that put docks in the right side of the screen, like this:

Image

I can reserve space in the side of the screen by using the _NET_WM_STRUT_PARTIAL, so that the maximized windows won’t overlap the docks.

In the image, you can see that there is a top panel. The problem is that the docks will overlap the panel. Is there a way to either find out the size of the panel, or to make a way that the panel will reduce to open space to the docks?

I’m using Xlib, by the way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:30:57+00:00Added an answer on May 17, 2026 at 8:30 pm

    By using the good hint given by Havoc P, I was able to formulate this code, that returns the height of a top docking panel:

    #include <X11/Xlib.h>
    #include <X11/Xatom.h>
    #include <limits.h>
    #include <stdlib.h>
    #include <stdio.h>
    
    static Display* display;
    
    // looks for the maximum "docking height" of all children of this window
    static int top_panel_height(Window window)
    {
        int height = 0;     // maximum height
        Window w;
        Window* children;
        unsigned int n_children;
    
        XQueryTree(display, window, &w, &w, &children, &n_children);
    
        // looks for each one of the children
        int i;
        for(i=0; i<n_children; i++)
        {
            // this is the property we're looking for
            Atom strut = XInternAtom(display, "_NET_WM_STRUT_PARTIAL", 
                    False);
            Atom type_return;
            int actual_type;
            unsigned long nitems, bytes;
            unsigned char* data = NULL;
    
            // load window attributes (we only want to know about the
            //                         windows where y = 0)
            XWindowAttributes xwa;
            XGetWindowAttributes(display, window, &xwa);
    
            // load the property _NET_WM_STRUT_PARTIAL
            int s = XGetWindowProperty(display, window, strut, 0, LONG_MAX, 
                    False, 
                    XA_CARDINAL, &type_return, &actual_type,
                    &nitems, &bytes, (unsigned char**)&data);
            if(s == Success)
            {
                Atom *state = (Atom *) data;
                // state[2] contains the "dock height"
                if(xwa.y == 0 && nitems > 0 && state[2])
                    if(state[2] > height)
                        height = state[2];
            }
    
            // recursively, traverse the tree of all children of children
            int children_max_height = top_panel_height(children[i]);
            if(children_max_height > height)
                height = children_max_height;
        }
    
        return height;
    }
    
    
    int main()
    {
        display = XOpenDisplay(NULL);
        Window root = RootWindow(display, DefaultScreen(display));
    
        printf("%d\n", top_panel_height(root));
    
        return 0;
    }
    

    It might not be pretty, but it works 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I know there's a lot of other questions out there that deal with this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.