Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 341  / 2 Years ago, thu, june 16, 2022, 6:40:05

Background:



On start-up, I have this empty window showing up.



Screenshot:



Empty window



Question:



How can I identify what produces this empty window and how can I remove it?


More From » unity

 Answers
0

In far most cases, opening a terminal window, run the command



xprop WM_CLASS


..and subsequently click on the window will give you sufficient information on the process that owns the window.



If not, run the command (assuming you have wmctrl installed):



wmctrl -lp


Make an educated guess on the window from the list, copy the string in third column (its pid) and run:



ps -p 1337 -o comm=


where 1337 is the pid you just copied. The output will be the process that owns the window.



If you cannot use the terminal



..You could keep a log file, keeping track of:




  • appearing new windows ("NEW")

  • closing windows ("OUT")

  • the pid new windows belong to and the application, as it appears in the output of ps -e

  • the time of appearing/closing



#!/usr/bin/env python3
import subprocess
import time

#---set the path to the log file below
logfile = "window_log"
#---

# clear the file from previous runs
open(logfile, "wt").write("")

def get_wlist():
try:
return subprocess.check_output(["wmctrl", "-lp"]).decode("utf-8").strip()
except subprocess.CalledProcessError:
pass

def get_wids(currlist):
return [l.split()[0] for l in currlist.splitlines()]

def stamp(s):
t = time.ctime()
return (len(t)*"-")+"
"+s+" "+t+("
"+len(t)*"-")

def update_log(data):
with open(logfile, "a+") as log:
for l in data:
log.write(str(l)+"
")
log.write("
")

while True:
# wait until the desktop is ready to run wmctrl
wdata1 = get_wlist()
if wdata1:
break
time.sleep(1)

# and then...
wlist1 = get_wids(wdata1)

while True:
time.sleep(1)
wdata2 = get_wlist()
if wdata2:
wlist2 = get_wids(wdata2)
new = [w for w in wlist2 if not w in wlist1]
for item in new:
tstamp = stamp("NEW")
line = wdata2.splitlines()[wlist2.index(item)]
pid = line.split()[2]
match = [p for p in subprocess.check_output(
["ps", "-e"]
).decode("utf-8").splitlines()
if pid in p][0]
update_log([tstamp, line, match])
out = [w for w in wlist1 if not w in wlist2]
for item in out:
tstamp = stamp("OUT")
line = wdata1.splitlines()[wlist1.index(item)]
pid = line.split()[2]
update_log([tstamp, line])
wlist1 = wlist2; wdata1 = wdata2



  • Make sure wmctrl is installed



    sudo apt-get install wmctrl

  • Copy the script into an empty file, save it as logwindows.py


  • Set the path to the log file in the head of the script

  • Run the script by the command:



    python3 /path/to/logwindows.py

  • If necessary, add it to startup applications if the window only appears shortly after startup



The script produces a log file like:



------------------------
NEW Tue Oct 4 17:14:12 2016
------------------------
0x04400007 0 8427 jacob-System-Product-Name Ubuntu
8427 ? 00:00:01 apport-gtk

------------------------
NEW Tue Oct 4 17:14:28 2016
------------------------
0x04e00084 0 8530 jacob-System-Product-Name Niet-opgeslagen document 1 - gedit
8530 ? 00:00:00 gedit

------------------------
NEW Tue Oct 4 17:14:31 2016
------------------------
0x0108deb3 0 2013 jacob-System-Product-Name Persoonlijke map
2013 ? 00:04:20 nautilus

------------------------
NEW Tue Oct 4 17:14:39 2016
------------------------
0x05200085 0 0 N/A QLE Quicklist Editor
1 ? 00:00:02 systemd

------------------------
OUT Tue Oct 4 17:14:55 2016
------------------------
0x05200085 0 0 N/A QLE Quicklist Editor


Since you cannot control the time the window appears, but you can control the time it closes, this should give you sufficient information on the window in any situation.


[#13500] Saturday, June 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
scusaper

Total Points: 335
Total Questions: 111
Total Answers: 119

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
;