Score:2

How to run a script everytime the X server starts?

kh flag

I brought one of the 7 inch mini notebooks that have appeared recently (https://www.amazon.co.uk/UDKED-Notebook-MiniHDMI-Connectivity-Terminals/dp/B0C28FFYTK) Its a neat little machine and I have installed Xubuntu 23.04 on it. It has some odd quirks that Im trying to work around, one of them being that the mouse buttons are actually wired up as keyboard keys rather than being part of the mouse device! I have got them working with:

xkbset m
xmodmap -e 'keycode 135=Pointer_Button3'

I can easily run theses commands once XFCE has started but I need them to run every time the X server starts so I can use the login screen etc. I have put them in a script file and tried running them from:

/etc/X11/Xsession.d/
/etc/X11/xinit/xinitrc
~/.xsession
entries in /etc/lightdm/lightdm.conf

Unfortunately the script doesnt get run, what am I doing wrong?

Terrance avatar
id flag
You can create a `.desktop` file that will call them, make sure you use the full qualified directory name for the commands. Then you can add the `.desktop` file owned by root into the `/etc/xdg/autostart/` directory that gets called before login.
Score:0
cn flag

You can run a script before the greeter starts by adding a line in /etc/lightdm/lightdm.conf under the [Seat:*] heading:

[Seat:*]
greeter-setup-script=/path/to/script

or put it in a file 99-my.conf in the lightdm.conf.d subdirectory.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.