Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-05-10 21:15:59

babag
Member
Registered: 2018-01-21
Posts: 24

wmctrl - what causes identifier number to change?

being driven crazy by desktop icon position issues and am looking at wmctrl as a way of creating workarounds. i find that i can use panels to lock icons in place which is great except panels are 'always on top.' wmctrl lets me send them below which is also great. i made a script which runs at logon, sending my icon panels below. that worked fairly well but is contingent on having each panel identifier remain constant through reboots and login/outs. that seemed to be the case until i played with the system (currently just testing and looking for oddities like this to resolve before i commit) and the identifiers changed.

what causes the wmctrl identifiers to change?
can they be locked in?

here's an example:

babag@RackPC:~$ wmctrl -l
0x00e00004 -1 RackPC xfce4-panel
0x00e00039 -1 RackPC xfce4-panel
0x00e0003c -1 RackPC xfce4-panel
0x00e0003f -1 RackPC xfce4-panel

i guess those are hex numbers at the beginning of each line. they are the identifiers i'm talking about. if i'm going to be able to script these i think i need to be able to rely on the values remaining constant.

i also notice that all four of my panels are generically labeled as 'xfce4-panel'. is there a way to name each panel? i believe wmctrl would be able to work based on names if i could figure out how to assign them.

thanks for any info,
BabaG

Last edited by babag (2018-05-10 21:36:44)

Offline

#2 2018-05-11 00:17:21

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: wmctrl - what causes identifier number to change?

I am unaware of a way to change the individual panel names. However, if you use "wmctrl -lG", you will also get geometry information (x,y,height,width). You can then use that data to identify which panel is the correct panel.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2018-05-11 00:28:26

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

thanks, ToZ. i've actually seen that but thought names would be much simpler. guess not. will give this a try.

thanks again,
BabaG

Offline

#4 2018-05-11 16:20:38

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

well... guess i can't figure it out. i found this thread:

https://forum.xfce.org/viewtopic.php?id=11861

which shows the -lG option but i couldn't figure out how to use it to replace the hex identifier in this command:

wmctrl -ir 0x00a00039 -b add,below

how would i change the above to use the -lG option and call the panel via geometry?

thanks,
BabaG

Offline

#5 2018-05-11 17:22:20

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

got this to work to send three panels to the back:

#!/bin/sh
#
wmctrl -i -r $(wmctrl -lG | grep xfce4-panel | grep "4306 2435 201  32" | awk '{print $1}') -b add,below
wmctrl -i -r $(wmctrl -lG | grep xfce4-panel | grep "4308 2368 420  32" | awk '{print $1}') -b add,below
wmctrl -i -r $(wmctrl -lG | grep xfce4-panel | grep "4047 2160 168  32" | awk '{print $1}') -b add,below

only problem i see with this approach is that changes (accidentally moving, adding icons) to the panels will mean having to alter all scripts that use this. if there was an option to name xfce panels that wouldn't be required.

another question, though. how would i simplify the above script to say 'send all panels to the back EXCEPT this one: 0x00c00004 -1 3360 3185 1680 25   RackPC xfce4-panel'

thanks again,
babag

Offline

#6 2018-05-11 20:12:26

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: wmctrl - what causes identifier number to change?

babag wrote:

only problem i see with this approach is that changes (accidentally moving, adding icons) to the panels will mean having to alter all scripts that use this.

Yes. You seem to have 3 overlapping panels? If the panels were positioned in separate areas (e.g. top, left, right) you could use more logic to identify them.

if there was an option to name xfce panels that wouldn't be required.

I agree. I recall looking at this but wasn't able to find a way to make this work. You might want to consider creating an enhancement request to see if the developer would consider adding it.

another question, though. how would i simplify the above script to say 'send all panels to the back EXCEPT this one: 0x00c00004 -1 3360 3185 1680 25   RackPC xfce4-panel'

How about something like:

#!/bin/bash

for WINS in "$(wmctrl -lG | grep xfce4-panel | grep -v "\-9999" | grep -v "3360 3185 1680 25")"
do
	wmctrl -i -r $(echo $WINS | awk '{print $1}') -b add,below
done

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2018-05-11 22:53:11

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: wmctrl - what causes identifier number to change?

This has bothered me for some time.
If xfce loads the panels in the exact same order on each startup, panel-1, panel-2, panel-3, ...
then there is a way to name them.

We can tag them with _NET_WM_NAME Xwindow property.

#!/bin/bash
i=0

for WINS in $(wmctrl -lG | grep -v "\-9999" | grep xfce4-panel | awk '{print $1}')
   do
     i=$(($i+1)) 
     xprop -id $WINS -format _NET_WM_NAME  8u -set _NET_WM_NAME "xfce4-panel-$i"
done

After that wmctrl will list the panels:

$ wmctrl -l
0x01700005 -1 p64 xfce4-panel-1
0x01700037 -1 p64 xfce4-panel-2

Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#8 2018-05-11 23:45:45

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: wmctrl - what causes identifier number to change?

Nice. I knew there had to be a way.
Thanks for sharing.

*adds snippet to library...


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#9 2018-05-12 00:11:51

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: wmctrl - what causes identifier number to change?

ToZ wrote:

*adds snippet to library...

Man, that library... ToZ you're the human Xfce wiki!

I've thought sometimes that there should be a direct interface or a dual view or something straight from the forum posts to encourage additions and corrections to the wiki (which doesn't reflect all of the knowledge you and others -hi Misko!- show here & on the mailing lists...).

Sorry for the derail wink

PS: kudos to the MX-Team: https://mxlinux.org/wiki/xfce/xfce-comm … eful-stuff

and Arch Linux: https://wiki.archlinux.org/index.php/Xfce

Last edited by alcornoqui (2018-05-12 00:17:06)

Offline

#10 2018-05-12 01:54:43

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: wmctrl - what causes identifier number to change?

^Hi alcornoqui

ToZ wrote:

Nice. I knew there had to be a way.
Thanks for sharing.

*adds snippet to library...

Hi ToZ,
On second thought, there is no need to change the Xwindow property,
since there is always a way to find out which panel it is in the script smile
Only need to fetch the panel numbers with xfconf-query, because panels can be 1, 3, 4, 7 if there are deleted panels.
+ This way we find out real panel ID's.

#!/bin/bash
i=0

# Find xfce4-panel numbers
XFCE4_PANELS=($(xfconf-query -c xfce4-panel -p /panels | tail -n+3))

for WINS in $(wmctrl -lG | grep -v "\-9999" | grep xfce4-panel | awk '{print $1}')
   do
     echo "Do something with panel-${XFCE4_PANELS[$i]}"
     echo "Panel ${XFCE4_PANELS[$i]} has a window id: $WINS"
     i=$(($i+1))
done

Now when I look at it, it's so simple.

babag All you have to do is to open the panel preferences and find out panel numbers and apply some if; elif, in the "for" loop
for example:

#!/bin/bash
i=0
# Find xfce4-panel numbers
XFCE4_PANELS=($(xfconf-query -c xfce4-panel -p /panels | tail -n+3))

for WINS in $(wmctrl -lG | grep -v "\-9999" | grep xfce4-panel | awk '{print $1}')
   do
     if [[ "${XFCE4_PANELS[$i]}" -eq 1 ]]; then
         wmctrl i -r "$WINS" -b add,below
     fi
     i=$(($i+1))
done

Last edited by Misko_2083 (2018-05-12 02:12:33)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#11 2018-05-13 18:36:33

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

thank you all for all the wonderful info. very helpful. i find myself continually frustrated, though. here's todays xfce nightmare:

did a fresh install of ubuntu studio after getting all the help here. figured i'd set up a grid of panels to use to keep desktop icons aligned. problem arose as soon as i put the first panel in place, though. when created, the panel goes to the top left of my workspace. that's fine as i expect to move it. tried each of these commands to put the panel in a specific location:

babag@RackPC:~$ xdotool windowmove 0x00c0ab61 4250 2210
babag@RackPC:~$ wmctrl -ir 0x00c0ab61 -e 0,4250,2210,-1,-1

that worked fine. then came the problem.

as soon as i tried to lock the panel to keep it aligned where i want it, it jumps to its previous position. the only thing i seem to be able to do that respects the positioning is to manually drag the panel to where i want it. if i drag it manually, it locks without jumping. what's going on here? is there no way to give it a precise position AND have it lock?

thanks once again,
babag

Last edited by babag (2018-05-13 18:36:52)

Offline

#12 2018-05-14 10:09:33

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: wmctrl - what causes identifier number to change?

babag wrote:

thank you all for all the wonderful info. very helpful. i find myself continually frustrated, though. here's todays xfce nightmare:

did a fresh install of ubuntu studio after getting all the help here. figured i'd set up a grid of panels to use to keep desktop icons aligned. problem arose as soon as i put the first panel in place, though. when created, the panel goes to the top left of my workspace. that's fine as i expect to move it. tried each of these commands to put the panel in a specific location:

babag@RackPC:~$ xdotool windowmove 0x00c0ab61 4250 2210
babag@RackPC:~$ wmctrl -ir 0x00c0ab61 -e 0,4250,2210,-1,-1

that worked fine. then came the problem.

as soon as i tried to lock the panel to keep it aligned where i want it, it jumps to its previous position. the only thing i seem to be able to do that respects the positioning is to manually drag the panel to where i want it. if i drag it manually, it locks without jumping. what's going on here? is there no way to give it a precise position AND have it lock?

thanks once again,
babag

You can move the panel as any window with xdotool or wmctrl but the xfce4-panel stores it's configuration in Xfconf.
That's why the panel resets position if you restart the panel or when you open the panel preferences.

The panel preferences are listed with xfconf-query command. https://docs.xfce.org/xfce/xfconf/xfconf-query

xfconf-query -c xfce4-panel -p /panels -lv

To get the cerartain panel position, let's say panel-1:

 xfconf-query -c xfce4-panel -p /panels/panel-1/position

The output is like this p=8;x=960;y=1064

This is the horizontal panel, 100% in length, on a 1920x1080 screen positioned on the bottom.

How does the positioning works?

This is the same panel. now 6, 7, 8 are representing the left side of the screen, 2, 3, 4 the right.
6             9              2

7                             3

8            10             4

Let's move the panel to the top, we change the position

xfconf-query -c xfce4-panel -p /panels/panel-1/position -s 'p=6;x=960;y=1064'

Notice that the x and Y have no influence here.

Next command will also position the panel to the top.

xfconf-query -c xfce4-panel -p /panels/panel-1/position -s 'p=2;x=960;y=1064'

The difference is only noticed when the panel length is reduced let's say 60%.
Then you notice the panel with postion 6 is on the left side
and the same panel with the positioning value 2 is on the right side of the screen.

If you change the position to 9 the panel will be centered on top and 10 it will be centered on the bottom.

Those are the cases when the horizontal panel is connected to the screen corners.

When the horizontal panel is floating away from the screen edges there are more screen positions.

6        11        9        11         2

5                                        1

7                   0                   3

5                                        1

8        12       10        12        4

If you want to position the horizontal panel between the bottom left (8) and center position (7),
you will set the position to 5 and also change the y to desired coordinate.
x coorditates have no meaning here.

xfconf-query -c xfce4-panel -p /panels/panel-1/position -s 'p=5;x=960;y=800'

The same panel to the right screen edge:

xfconf-query -c xfce4-panel -p /panels/panel-1/position -s 'p=1;x=960;y=800'

To position the panel with y set to 200 will be closer to the top.

For the vertical panels the same rules apply just with x coordinates.

Panels that are not conntected to any screen edge (floating) have position set to 0 but then both x and y coordinates apply.

Last edited by Misko_2083 (2018-05-14 18:54:41)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#13 2018-05-14 17:49:20

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

edit: is it true that all of these examples will snap to some screen edge? that's what happened in the couple of tests i did so far. it looks like it always ignores one coordinate, snapping to that edge based on the p= setting, and positioning to the other coordinate. what i'm looking for is to freely define position within the screen area. no edge snapping.

wow. this is kind of amazing. who'd a thunk putting icons on your desktop could get so deep? will take me some time to get into this. spent all day yesterday setting up panels. this seems like it would make it a lot easier once i decipher it. thanks so much.

btw, i used your wmctrl script above and was able to get it to do what i needed. just changed:

if [[ "${XFCE4_PANELS[$i]}" -eq 1 ]]; then

to

if [[ "${XFCE4_PANELS[$i]}" -gt 0 ]]; then

and it now sends all but my bottom taskbar to 'below' just as i wanted so...

thanks again!
babag

Last edited by babag (2018-05-14 18:31:18)

Offline

#14 2018-05-14 19:10:01

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: wmctrl - what causes identifier number to change?

There is an easier way.
When you create a new panel, you can move it by holding the left mouse button and dragging it wherever you like.
https://www.youtube.com/watch?v=a6VenH3lNFM
There is a handle near the corner of each side the panel when it's unlocked.
You can use that  for moving the panel and ten lock it.

The command line way:
I'm not sure what's the panel you are refering to so replace panel-1 in the command with the panel you would like to move.

xfconf-query -c xfce4-panel -p /panels/panel-1/position -s 'p=0;x=4250;y=2210'

Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#15 2018-05-14 21:06:12

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

thanks again, Misko_2083. i guess it's the p=0 that i got wrong. i'm guessing that setting p=0 allows both x and y coordinates to be used? will try that when i get back to the studio.

i have something like 46 panels so being able to script their setup would be helpful, not to mention that it would allow for precise positioning. that's something that dragging, which is what i did yesterday, doesn't. 46 panels look a lot better when not positioned by hand.

babag

Last edited by babag (2018-05-14 21:08:58)

Offline

#16 2018-05-14 21:59:03

tbqhmhsfamilam
Member
Registered: 2018-05-10
Posts: 20

Re: wmctrl - what causes identifier number to change?

Why do you have 46 panels?

Offline

#17 2018-05-14 22:19:33

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

they form rows and columns of launchable link icons for locations, applications, and often used files on the lower right of my four monitors. i wouldn't have added any panels except it's the only way i've found that reliably respects the positioning of the icons given my display setup.

i work at a console, sitting mostly in front of the lower right display. if anyone is sitting next to me they're in front of the lower left display. that's why i want my launchers on the lower right. xfce wants to put all of my icons on the upper monitor and seems extremely picky about that. might not be an issue except that the upper monitor is for video output which means that whatever icons might be up there are often covered by a dedicated video playback.

thanks,
babag

Offline

#18 2018-05-15 04:26:43

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

since i was asked, i'll give a little summary of what's brought me to this point. here's a screenshot of my display layout as i normally work.
25954846868_8abfd03b7f_b.jpg

i couldn't work that way because new desktop icons would be placed in the empty are above the display labeled #4. i had to move the display over so the upper display's left edge aligned with the #4 display's left edge.

41020039505_45b90a8eeb_b.jpg

then i did a test where i placed lots of icons so i could see if i could force new ones to another screen. i thought that, since xfce seems to treat the entire display area as one big display, maybe i could use dummy icons, placing lots of them, making them invisible. i thought that, once i got to the bottom of the screen they'd start to show up on display #4. nope. instead, xfce seems to have used display #3 as a location for the icons but the dimensions from each display separately. the two rectangles of icons correspond to displays #1 and #2, then #3 starts filling in. when i saw that i realized there was a dissonance between the ways xfce was working with the desktop.

42073827742_b3378076ae_b.jpg

this is where i am now. the frazzy looking area at the top right is dead space not covered by a display. the #3 and #4 displays area aligned along the left edge now so new icons appear and are visible. the area at the lower right shows the panels i've placed and their patterning. the panels that i'm done filling with icons have been made transparent. others will follow as they get populated. some panels may never be used but are there in case i need them. most will carry at least some icons.

anyway, off to try out Misko_2083's latest info.

thanks,
babag

Last edited by babag (2018-05-15 05:20:23)

Offline

#19 2018-05-15 05:13:52

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

xfconf-query -c xfce4-panel -p /panels/panel-1/position -s 'p=0;x=4250;y=2210'

yup. that was it. p=0 allows respect for both x and y. thanks!

now i should be able to modify this:

#!/bin/bash
i=0
# Find xfce4-panel numbers
XFCE4_PANELS=($(xfconf-query -c xfce4-panel -p /panels | tail -n+3))

for WINS in $(wmctrl -lG | grep -v "\-9999" | grep xfce4-panel | awk '{print $1}')
   do
     if [[ "${XFCE4_PANELS[$i]}" -eq 1 ]]; then
         wmctrl i -r "$WINS" -b add,below
     fi
     i=$(($i+1))
done

to replace the wmctrl command in the do loop with the xfconf-query command, incrementing the y position to create a column of perfectly aligned panels.

thanks again!
BabaG

Last edited by babag (2018-05-15 05:14:44)

Offline

#20 2018-05-15 09:42:42

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: wmctrl - what causes identifier number to change?

babag wrote:

i have something like 46 panels so being able to script their setup would be helpful, not to mention that it would allow for precise positioning. that's something that dragging, which is what i did yesterday, doesn't. 46 panels look a lot better when not positioned by hand.

babag

That's a lot of panels and probably takes a lot of time to configure.
Have you considered using a small python3 app called "xfce panel switch"?
It can save and export the panel layouts and later you can import them back and apply them.

https://launchpad.net/xfpanel-switch

Lenny describes how it works here:
https://www.youtube.com/watch?v=q-P5cdEf9Fw


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#21 2018-05-15 17:08:15

babag
Member
Registered: 2018-01-21
Posts: 24

Re: wmctrl - what causes identifier number to change?

edit: lol. well, there you go. knew i'd seen it somewhere. just added some new icons to my panels and, when i went to back them up as described below, turns out xfpanel-switch is what's being used to do the backup!

thanks for that, Misko_2083. i think i saw that somewhere but wasn't sure how it worked. wasn't ready to make use of it anyway. there's something similar, a backup and restore function, in the panel preferences. haven't tried it other than doing a backup and looking at the file. seemed to have everything but i didn't try restoring it.

thanks again,
babag

Last edited by babag (2018-05-15 18:34:56)

Offline

Board footer

Powered by FluxBB