Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-03-28 02:14:47

smontanaro99
Member
Registered: 2022-03-28
Posts: 2

How to configure window attributes from config file?

I have a program that puts up a small window that should follow me around, always be on the visible workspace. For the moment, when I start it, I use the title bar menu to select "Always on Visible Workspace". Is there some way to specify that attribute from a config file so that xfwm4 automatically sets that attribute? It's been ages since I tried configuring a window manager from a file. Everything I've found seems to be done via dialog boxes and I found nothing obviously appropriate. `xwininfo` gives me this output:

xwininfo: Window id: 0x5a0001e "Typing Watcher"

  Absolute upper-left X:  2
  Absolute upper-left Y:  43
  Relative upper-left X:  2
  Relative upper-left Y:  18
  Width: 178
  Height: 126
  Depth: 24
  Visual: 0x21
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +2+43  -1740+43  -1740-911  +2-911
  -geometry 178x126+0+25

I can name the window anything which works as a reference in the config file.

Offline

#2 2022-03-28 05:41:24

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: How to configure window attributes from config file?

Hello and welcome.

I think devilspie should be able to do that, but I'm not familiar with it.

What I can suggest, however, is using wmctrl. If you're on a Debian-based system and your program is installed in either /usr/bin or /usr/local/bin, create a bin directory in your home directory, i.e.:

mkdir $HOME/bin

Next, create an empty file with the name of your program and temporarily prepend the .sh extension. The content of that shell script should look like this:

#!/bin/sh
/path/to/your/program&pid=$!
until [ -n "${wid}" ]
do wid="$(wmctrl -lp | awk -v pid="${pid}" '$3 ~ pid { print $1 }')"
done
wmctrl -ir "$wid" -b add,sticky

Finally, rename it to the name of your program exactly and allow its execution (could be done via GUI as well):

cd ~/bin; mv your_program.sh your_program; chmod +x your_program

On Debian-based systems (I might be wrong here), ~/bin and ~/.local/bin take precedence over standard binary subdirectories because they are prepended to $PATH in .profile. So now whenever you launch your program, the shell script is executed, which runs the commands in it line by line.

It's kind of a wrapper for your program.

If it doesn't work for whatever reason, please provide additional information about your program, such as its location:

command -v your_program
echo "$PATH"

Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#3 2022-04-01 00:06:25

smontanaro99
Member
Registered: 2022-03-28
Posts: 2

Re: How to configure window attributes from config file?

Thanks for the response. I discovered wmctrl elsewhere and simply call it from my program just after the widgets are rendered. Crude but effective:

os.system("wmctrl -r 'Typing Watcher' -b add,sticky")

Offline

#4 2022-04-01 14:54:24

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: How to configure window attributes from config file?

Is that in Python?


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 544.77 KiB (Peak: 545.39 KiB) ]