Open windows in the background without them be focused

Hi there :slight_smile:,

Everytime I turn my pc on, I usually open IntelliJ IDEA, Discord and Brave but after the first window, all the subsequent ones get focused and I have to manually minimize them.
How can I have them minimized in the background already so I don’t have to be bothered about that?

My specs:

➤ inxi -v 1                                                                   21:04:55
System:
  Host: blyatmobilebr-pc Kernel: 5.7.17-2-MANJARO x86_64 bits: 64 
  Desktop: Xfce 4.14.2 Distro: Manjaro Linux 
CPU:
  Dual Core: Intel Core i5 M 460 type: MT MCP speed: 1334 MHz 
  min/max: 1199/2534 MHz 
Graphics:
  Device-1: Intel Core Processor Integrated Graphics driver: i915 v: kernel 
  Device-2: Silicon Motion - Taiwan (formerly Feiya ) type: USB driver: uvcvideo 
  Display: server: X.Org 1.20.8 driver: intel resolution: 1366x768~60Hz 
  OpenGL: renderer: Mesa DRI Intel HD Graphics (ILK) v: 2.1 Mesa 20.1.6 
Drives:
  Local Storage: total: 298.09 GiB used: 34.20 GiB (11.5%) 
Info:
  Processes: 206 Uptime: 13m Memory: 5.61 GiB used: 2.16 GiB (38.5%) Shell: fish 
  inxi: 3.1.05 

Thanks in advance!

You could use something like this (not tested):

sleep 10 && \
if [[ $(pgrep -x Discord) == 0 ]];then exit 1;
else
xdotool windowminimize $(xdotool search --onlyvisible --name discord)
fi

and put it into the ~/.profile file.

1 Like

I’m gonna try that, thank you :slight_smile:

1 Like

It didn’t work, unfortunately :c

Yes i guess so. you need to pick the correct number. If you are familiar with bash write a “for loop” for example.

For example this is the output of firefox:

xdotool search --onlyvisible --name firefox
46137546
46137572
46137347
132120579

Here is a tested “for loop”:

for x in $(xdotool search --onlyvisible --name firefox); do xdotool windowminimize $x; done
1 Like

I’m gonna google the syntax, thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.