- 1 year ago
Naming a Xming window and automatic kill
In Xming, you can name a window by setting its window title, and you can automatically close (kill) the window using the xdotool
utility. Here's how you can achieve both tasks:
- Naming a Xming window:
To set the window title for a Xming window, you can use thexdotool
utility along withwmctrl
. First, you need to installxdotool
andwmctrl
on your system. On Ubuntu or Debian-based systems, you can install them using the following command:
bashsudo apt-get install xdotool wmctrl
Once installed, you can set the window title for a Xming window using the following command:
bashxdotool search --name "Old Window Title" set_window --name "New Window Title"
Replace "Old Window Title" with the current title of the Xming window you want to rename, and "New Window Title" with the desired new title.
- Automatically closing (killing) a Xming window:
To automatically close a Xming window, you can again use thexdotool
utility. First, you need to find the window ID of the Xming window you want to close using thexdotool search
command:
bashxdotool search --name "Window Title"
Replace "Window Title" with the title of the Xming window you want to close. This command will output the window ID.
Then, use the window ID to send a close signal to the window:
bashxdotool windowclose WINDOW_ID
Replace "WINDOW_ID" with the actual window ID obtained from the previous command.
By combining these two steps, you can set the window title for a Xming window and then automatically close it. For example:
bash# Set window title
xdotool search --name "Old Window Title" set_window --name "New Window Title"
# Wait for a few seconds (optional)
sleep 5
# Close the window
xdotool search --name "New Window Title" windowclose
This script will first set the window title to "New Window Title" for the Xming window with the current title "Old Window Title," wait for 5 seconds, and then close the window.
Please note that xdotool
relies on X11 events, so it might not work with some applications or environments. Additionally, xdotool
is primarily available on Linux-based systems. If you are using Xming on a Windows system, you may need to use alternative methods or utilities to achieve similar functionality.