How to execute a command when GUI is loaded?
by ddenial from LinuxQuestions.org on (#562HM)
Hello All
How do you run a command/script after the Linux is booted and GUI is loaded?
I have this script that should run once after every boot when GUI is loaded
Code:$ cat asz.sh
#!/bin/bash
SCREEN=$(xrandr | grep primary | awk '{print $1}')
xrandr --output $SCREEN --autoI tried in crontab with @reboot, but doesn't work as the GUI has not yet loaded and the 'Virtual-?' number is not yet assigned.
I put in /etc/bash.bashrc, but nothing happens. But it will execute as soon as I open terminal window. I don't want this to happen.
So where do I put the script which makes it executed after the GUI is loaded?
The distro is Kali Linux XFCE in KVM as a virtual guest.
Thanks


How do you run a command/script after the Linux is booted and GUI is loaded?
I have this script that should run once after every boot when GUI is loaded
Code:$ cat asz.sh
#!/bin/bash
SCREEN=$(xrandr | grep primary | awk '{print $1}')
xrandr --output $SCREEN --autoI tried in crontab with @reboot, but doesn't work as the GUI has not yet loaded and the 'Virtual-?' number is not yet assigned.
I put in /etc/bash.bashrc, but nothing happens. But it will execute as soon as I open terminal window. I don't want this to happen.
So where do I put the script which makes it executed after the GUI is loaded?
The distro is Kali Linux XFCE in KVM as a virtual guest.
Thanks