Hello everyone, I was wondering if someone could help me correct this stupid issue I am having. Well its really not an issue, its more annoying, ok let me explain.
So when I login my primary monitor does not get set, I have to rerun the script once more and woila, primary monitor gets set…which leads me to believe its not the script but how I have it running/autostarting
I’ve made it hidden in my home folder but appending a . at the beginning of the filename and I have added it to BOTH my autostart file for openbox which looks like this:
al-compositor --start &
# enable numlock, commented out for laptop users
# numlockx &
# restore wallpaper
nitrogen --restore &
# required for xfce settings to work
# fancy window switcher
skippy-xd --config ~/.config/skippy-xd/skippy-xd.rc --start-daemon &
# desktop resolution
# start polybar
#XFCE Power manager
and like I said I also added the file to my autostart folder, which I think gets run once I login…but again for some strange reason, which I cant seem to figure out is that it doesnt set the primary monitor until I run the script once more in the terminal and within less than a milisecond it completes. I rerun xrandr, and see that my primary has been set…
If anyone can help me, I would really REALLY appreciate it!
Hey, sorry been busy with work and hadn’t had a chance to login to the forum. Yes I made the script executable. I will need to play around with the sleep option as I think that may work. I had also configured my autostart to run it twice before but that didn’t help in the past. Unfortunately I dont have xinitrc, i’m using lightdm. Lastly, yes, I have 2x240hz monitors and absolutely love them. I use to have 144hz ones before, just recently got these bad boys! This is my first 240hz monitor/s and I wasn’t sure if I would see a difference, but you definitely notice it, everything is just a bit smoother. Its great for gaming, which I love to do as well
Thanks mate, I’ve literally havent even messed with it. I will try your suggestions though and place my xrandr command in .xprofile! I love 4k but the refresh rate is just a bummer, and Im not willing to pay $1700 for 4k at 120hz, thats just cray cray! Anyways, Im actually quite happy with 1080p at 240hz, dont miss 4k or higher res at all!
On a side note, have you ever messed around with artix linux?? I was messing around with void for a bit, but I’m not sure I want to go down the path of learning another package manager especially considering how well pacman works. Artix is Arch based but uses runit instead of openrc/systemd / sysv…
Let me know your thoughts…sorry totally unrelated to this topic…
@natemaia Hey I just wanted to say thank you again for helping me with this ‘issue’. I tried the sleep option within my autostart and that seemed to do the trick!
I do have one other question, sort of related, whats the difference between separating commands with ; and &?? I know that to make a program run in the background you provide this &&, but wasnt sure about the other two. So I think if I use & between my commands, it runs them parallel without waiting for one to finish, but if I use ; it runs them consecutively/sequentially, right??
Thanks for your insights and guidance, I really appreciate them!!!
Essentially in shell there’s 4 command separators ;, &, &&, and ||
& executes the preceding command in the background in a subshell, the shell doesn’t wait for exit status and continues execution.
; just acts as a delimiter to commands same as a newline would, it does not affect control flow and will execute whatever comes after it regardless of the exit status of the previous command (when used on the same line)
&& is basically a short-circuit if, meaning it will execute the right side of && if the left side’s exit status was zero (success)
|| is a negation of &&, meaning the right will get executed when the left exits non-zero (failure)
& when used after a command will be executed in the background, in a subshell. From the bash manpage
If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0. These are referred to as asynchronous commands. Commands separated by a ; are executed sequentially; the shell waits for each command to terminate in turn. The return status is the exit status of the last command executed.
You can learn more by reading the shell grammar section of the bash manpage.