How do I exit the window manager on the current X display?

August Karlstrom

Let's say I have the window manager Blackbox running on two different X displays, e.g. :0.0 and :1.0 launched from tty1 and tty2 respectively. From a terminal (emulator), how do I exit (kill) the Blackbox process that uses the current X display? The command killall blackbox does not fit since it terminates both sessions.

August Karlstrom

Here is a solution inspired by soubunmei's answer:

#!/bin/sh

ActiveWindowManagerPID()
{
    local windowManager="$1"

    local windowManagerPIDs="$(pidof "$windowManager")"

    local displayNumber="$(echo $DISPLAY \
        | awk 'BEGIN { FS = "[:.]" } { print $2 }')"

    ps e -p "$windowManagerPIDs" \
        | awk -v n="$displayNumber" \
            '$0 ~ " DISPLAY=:" n "[\n .]" { print $1 }'
}

kill "$(ActiveWindowManagerPID blackbox)"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to test X Window Manager

From Dev

How do I display current value at right side of EditTextPreference?

From Dev

how do i display search results in Python Tkinter window

From Dev

How do I set the default window manager under Fedora 21?

From Dev

How do I get a media projection manager without disturbing the current foreground process, except to ask for permission?

From Dev

How to find which display/window manager etc I am using?

From Dev

How do I restart the window manager?

From Dev

How do I make GDM the default display manager?

From Dev

How Do I install and use fluxbox window manager?

From Dev

How do I start the GUI (Window Manager?) over VNC?

From Dev

How do I remove the window manager of a single application, or open it with no window managment?

From Dev

How to find which display/window manager etc I am using?

From Dev

How do I make GDM the default display manager?

From Dev

How do I make the Xterm window title switch between the current running command and the current path?

From Dev

How do I use the awesome window manager?

From Dev

How Do I install and use fluxbox window manager?

From Dev

How do I restart the window manager?

From Dev

How do I start the GUI (Window Manager?) over VNC?

From Dev

How do I remove the window manager of a single application, or open it with no window managment?

From Dev

In irssi, how do I display previous chats of current chan, or current user if in bitblee?

From Dev

How do I fix my gnome display manager in recovery mode?

From Dev

How do I specify an IPv6 address in the X Window DISPLAY variable?

From Dev

How do I close the firefox downloads window on Mac OS X?

From Dev

How do I scale i3 window manager for my HiDPI display?

From Dev

How do I forward an X11 window as a webpage?

From Dev

How do I exit out of a display manager like Unity

From Dev

How to exit Far Manager in the current folder of the current tab?

From Dev

How do I change The Ubuntu display manager back to lightdm

From Dev

How do I get the application to display in the current session

Related Related

  1. 1

    How to test X Window Manager

  2. 2

    How do I display current value at right side of EditTextPreference?

  3. 3

    how do i display search results in Python Tkinter window

  4. 4

    How do I set the default window manager under Fedora 21?

  5. 5

    How do I get a media projection manager without disturbing the current foreground process, except to ask for permission?

  6. 6

    How to find which display/window manager etc I am using?

  7. 7

    How do I restart the window manager?

  8. 8

    How do I make GDM the default display manager?

  9. 9

    How Do I install and use fluxbox window manager?

  10. 10

    How do I start the GUI (Window Manager?) over VNC?

  11. 11

    How do I remove the window manager of a single application, or open it with no window managment?

  12. 12

    How to find which display/window manager etc I am using?

  13. 13

    How do I make GDM the default display manager?

  14. 14

    How do I make the Xterm window title switch between the current running command and the current path?

  15. 15

    How do I use the awesome window manager?

  16. 16

    How Do I install and use fluxbox window manager?

  17. 17

    How do I restart the window manager?

  18. 18

    How do I start the GUI (Window Manager?) over VNC?

  19. 19

    How do I remove the window manager of a single application, or open it with no window managment?

  20. 20

    In irssi, how do I display previous chats of current chan, or current user if in bitblee?

  21. 21

    How do I fix my gnome display manager in recovery mode?

  22. 22

    How do I specify an IPv6 address in the X Window DISPLAY variable?

  23. 23

    How do I close the firefox downloads window on Mac OS X?

  24. 24

    How do I scale i3 window manager for my HiDPI display?

  25. 25

    How do I forward an X11 window as a webpage?

  26. 26

    How do I exit out of a display manager like Unity

  27. 27

    How to exit Far Manager in the current folder of the current tab?

  28. 28

    How do I change The Ubuntu display manager back to lightdm

  29. 29

    How do I get the application to display in the current session

HotTag

Archive