Peppermint OS Community Forum

Support => New Users => Topic started by: irv on May 05, 2019, 04:32:14 pm

Title: Run commands at startup
Post by: irv on May 05, 2019, 04:32:14 pm
I have been running  Ubuntu for many years now, and have moved on to Peppermint.
Ubuntu has a program to enter commands to start when the computer starts up Does Peppermint have such a program.
The commands I want to run are

Code: [Select]
xinput set prop 16 "Device Disable" 0[ 
and
Code: [Select]
xinput set prop 13 "Device Disable" 0[

These commands turn off my touchpad and touch screen which I do not use.
I can do this in a terminal but I want it to happen automaticly when I reboot
Title: Re: Run commands at startup
Post by: PCNetSpec on May 05, 2019, 05:58:12 pm
Hi irv, and welcome to the forum :)

[EDIT]

WARNING - Only carry on below if you're 100% sure the device ID's are correct IN PEPPERMINT, they may have changed if you're just copying these from a different install, and if you disable the wrong device ID's you may end up disabling your keyboard..
(in fact it'd still probably be best to disable by deviceNAME rather than deviceID .. so probably safest to post the output from the below command firsts)

If unsure, post the output from
Code: [Select]
xinput --list
and I'll amend the commands in the script below.

[END EDIT]

If you KNOW those 2 commands work, place them in a script, then autostart the script

Run:
Code: [Select]
xed ~/.disable-input-devices
make it read
Code: [Select]
#!/bin/bash
xinput set prop 16 "Device Disable" 0[
xinput set prop 13 "Device Disable" 0[
SAVE the file and exit the text editor.

Back in the terminal, make that script executable
Code: [Select]
chmod +x ~/.disable-input-devices
ok now go to:-

Menu > Settings > Default Applications for LXSession > Autostart (tab)

In the box just to the right of the [+ Add] button, enter:
Code: [Select]
/home/<username>/.disable-input-devices
(replacing <username> with your actual username)

and click the [+Add] button.

Log off/on to test.



Personally I thing the script should probably read
Code: [Select]
#!/bin/bash
xinput disable 16
xinput disable 13
or at least
Code: [Select]
#!/bin/bash
xinput set-prop 16 "Device Enabled" 0
xinput set-prop 13 "Device Enabled" 0
but you're the one that's saying those commands work ???
Title: Re: Run commands at startup
Post by: az2020 on May 05, 2019, 06:00:57 pm
Code: [Select]
xinput set prop 16 "Device Disable" 0[ 
and
Code: [Select]
xinput set prop 13 "Device Disable" 0[

These commands turn off my touchpad and touch screen which I do not use.
I can do this in a terminal but I want it to happen automaticly when I reboot

You should be able to put that in your ~/.profile

I have a script that determines the current state of my touchpad, and will toggle it to the opposite state. I ran that from my .profile when I was using Lubuntu, and added it as a keyboard shortcut so I can toggle the touchpad on/off with windows-key+space bar.

There is a package you can install (touchpad-indicator) which gives you a nice interface to do this stuff. It will sit in you taskbar. (I haven't installed it in Peppermint. But, I would expect that it works.).

EDIT: PcNetSpec's solution may be better. The above is how I did it on a different distro. (I'm not currently on Peppermint.).
Title: Re: Run commands at startup
Post by: az2020 on May 05, 2019, 08:53:25 pm

WARNING - Only carry on below if you're 100% sure the device ID's are correct ..


I saw your warning. I should have posted my script:

        https://pastebin.com/a31rc3SF

It doesn't use a hardcorded device ID. (It discovers it). You can pass (0 or 1) to disable/enable the touchpad. Or, pass nothing (toggles the current state). That last part is handy to assign to a keyboard shortcut. Then you can toggle it on or off from the keyboard (those unexpected events when you say "that touchpad would be handy right now."

I used the windows-key + space-bar in Lubuntu. (I haven't set that part up yet where I'm at.). It has to be something you'll remember. I chose those keys because anything that's a pain in the *** makes me think of Microsoft. And, the space bar is the closest key to the touchpad. Natural combination for me.

The script has some debugging lines. A person can create the file, paste that script into it, make the file executable, and run it from the terminal command line. They can expand upon the debugging, or comment those lines out. It's nothing fancy. It should be a good starting point.

BTW: another command called "synclient" does the same thing, and looks easier to use. I did my thing before I knew of synclient.

Code: [Select]
synclient touchpadoff=1 [or 0 for off]