WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: how to hide window from window manager?  (Read 2997 times)

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
how to hide window from window manager?
« on: November 06, 2019, 09:16:07 AM »
I would like to figure out how to completely hide a window from my window manager, so that the window doesn't show up in the iconbar/taskbar/"Window List" (see top of the provided screenshot). My WM is fluxbox but I'm looking for a WM-agnostic way of doing this.

The purpose is that I'm trying to create a poor-man's notification tool using only aterm. I'm almost there, but it's annoying that an icon for the window shows up in my iconbar.

Code: [Select]
#!/bin/sh

# this script is in my PATH and is named "notify-send"

# user variables:
width=40 # in character columns
x_pos=980
y_pos=35

main()
{
get_commandline_args "$@"
create_miniscript
execute_miniscript_in_terminal
}

get_commandline_args()
{
# two mandatory args (title and message), third optional arg (time in seconds)
title="$1"
message="$2"
[ $# -eq 3 ] && seconds="$3" || seconds=2
}

create_miniscript()
{
cat << EOF > $miniscript
#!/bin/sh
printf "\033[?25l" # hide the cursor
echo "  :: $title ::"
echo ""
echo "$message" | fold -s -w $width; sleep $seconds; exit
EOF
chmod a+x $miniscript
}

execute_miniscript_in_terminal()
{
aterm -title "$title" +scrollBar -borderLess -geometry ${width}x6+${x_pos}+${y_pos} -e "$miniscript"
}

# internal variables
miniscript=/tmp/.notify-script

main "$@"

Code: [Select]
$ notify-send "testing" "hello world" 10


I already tried this but it had no effect and I can't find any other leads. Does anyone know a WM-agnostic way of hiding a window from the window manager (or at least from the iconbar/taskbar/"Window List")?

« Last Edit: November 06, 2019, 09:38:33 AM by GNUser »

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: how to hide window from window manager?
« Reply #1 on: November 06, 2019, 10:59:56 AM »
Getting warmer:

This works in Debian with MATE, but does not work in TC Pure64 with fluxbox:

Code: [Select]
$ aterm &
$ xprop -name aterm -f _NET_WM_STATE 32a -set _NET_WM_STATE _NET_WM_STATE_SKIP_TASKBAR

I'm at a loss. Why doesn't the above command make aterm's icon disappear from the taskbar in TCL?

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: how to hide window from window manager?
« Reply #2 on: November 06, 2019, 11:15:51 AM »
Interestingly, the xprop command does change the properties of the aterm window, it's just that the change has no effect (an icon for aterm remains on the taskbar).

Here are the properties of the aterm window before:

Code: [Select]
$ xprop # I click on the aterm window to select it
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
---snip---

Then I run this command:
Code: [Select]
$ xprop -name aterm -f _NET_WM_STATE 32a -set _NET_WM_STATE _NET_WM_STATE_SKIP_TASKBAR

Now notice the first line of output when I view the xproperties of aterm again...
Code: [Select]
$ xprop # I click on the aterm window to select it
_NET_WM_STATE(ATOM) = _NET_WM_STATE_SKIP_TASKBAR
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
---snip---

...yet an icon for aterm remains on the taskbar.

Bottomline is that the xprop command successfully changes the relevant window's relevant property, but the change has no effect. Why not?
« Last Edit: November 06, 2019, 11:20:41 AM by GNUser »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: how to hide window from window manager?
« Reply #3 on: November 06, 2019, 01:31:17 PM »
There are multiple ways to signal that, and it depends on the WM which ways they implement. You'd need to look at the WM's sources to see which apply to that particular WM, if any.
The only barriers that can stop you are the ones you create yourself.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: how to hide window from window manager?
« Reply #4 on: November 06, 2019, 02:11:17 PM »
it depends on the WM which ways they implement...if any.

Thanks, curaga. That's what I was afraid of.

I was hoping for a WM-agnostic solution using only tools that come with X. I guess there might be no such solution.

However, I did find that wmctrl (not currently in the Pure64 repository) does do what I want:

Code: [Select]
wmctrl -r :ACTIVE: -b add,skip_taskbar
Running the above command in an instance aterm makes its taskbar icon disappear :)