Author Topic: how to run scripts at startup?  (Read 861 times)

Offline fanis

  • Newbie
  • *
  • Posts: 14
how to run scripts at startup?
« on: January 20, 2014, 03:48:09 pm »
Hi, I installed sparky ultra on an old pc and I am very pleased with the performance. My problem is I can not find how to set multiple layouts. At "Keyboard layouts settings" I am not able to see that option. I could set my preffered layout but I see noway to set multiple layouts. This is quite bad for openbox I think.



luckily I know a way around!

I can simply run this script using setxkbmap

Code:

#! /bin/bash
setxkbmap "us,gr" -option "grp:caps_toggle"
setxkbmap -option grp_led:scroll us,gr


and this does exactly what I want.



My problem is I can find no way to run it automatically on start. If I can not find that the best I can do is to put that in .bashrc so at least I can have my multiple layouts as soon as I open a terminal. I am not pleased with this.



So how can I do it properly? Thank you.
« Last Edit: January 20, 2014, 03:48:09 pm by 256 »

Offline pavroo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1465
    • SparkyLinux
Re: how to run scripts at startup?
« Reply #1 on: January 20, 2014, 05:49:22 pm »
You can create a new file in your home directory, for example: .mykeyboard

Place the three line of the text to the file and set execute right for it:

Code:

chmod a+x /home/your-nick/.mykeyboard


Then add the file to the OpenBox startup - edit the file: /home/your-nick/.config/openbox/autostart.sh and add a new line to it:

Code:

/home/your-nick/.mykeyboard &


« Last Edit: June 30, 2014, 05:56:12 pm by 14 »
Nothing is easy as it looks.

Offline fanis

  • Newbie
  • *
  • Posts: 14
Re: how to run scripts at startup?
« Reply #2 on: January 20, 2014, 06:47:28 pm »

Quote:

Quote from pavroo on January 20, 2014, 17:49

/home/your-nick/.config/openbox/autostart.sh


thank you, that was what I was asking for.
« Last Edit: June 30, 2014, 05:55:58 pm by 256 »

Offline dhinds

  • Full Member
  • ***
  • Posts: 154
Re: how to run scripts at startup?
« Reply #3 on: January 28, 2014, 12:34:09 am »
I installed Ultra on a ThinkPad W520 yesterday and am facing this issue myself but with one or two complications:



I need to toggle between two different keyboard layouts (US English and Latin American Spanish).  I was able to do that in Sparky Mate and in Gnome, but not yet in Ultra.



I am assuming it can be done.  But how?  (I configured my Mate installation to toggle from one to the other using both shift keys at once - a fast and easy way to accomplish that goal).



Since I require the Spanish Keyboard for drafting documents in Spanish (for Ñ, ¿, ¡, accents etc.) I have changed to the Spanish configuration but this computer was purchased in the USA and has an English keyboard).



TIA



Another thing:



Usually, I configure the energy consumption to suspend when the lid of the laptop is closed, but I haven't found a way to do that either.  (This is my first installation of ultra on a laptop).



« Last Edit: June 30, 2014, 05:55:41 pm by 25 »

Offline pavroo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1465
    • SparkyLinux
Re: how to run scripts at startup?
« Reply #4 on: January 28, 2014, 05:00:41 pm »
There is a nice app for keyboard called 'fcitx'.

It'll be loaded to the panel's tray after installing and rebooting.

To manage energy run:

Code:

xfce4-power-manager-settings


« Last Edit: June 30, 2014, 05:55:27 pm by 14 »
Nothing is easy as it looks.

Offline dhinds

  • Full Member
  • ***
  • Posts: 154
Re: how to run scripts at startup?
« Reply #5 on: January 28, 2014, 07:09:38 pm »
Thanks Parvoo.



One more question:



Is there a way to back up the icedove settings configured to a root account?  (Using SparkyBackup-Apps from root the only options are for the user accounts and the account with the email settings is inaccessible and the SparkyBackup-Apps file generated is empty - but I re-did them on the root account, so if they can be copied, that would save the time it would take to redo 15 of them).



TIA
« Last Edit: June 30, 2014, 05:55:04 pm by 25 »

Offline pavroo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1465
    • SparkyLinux
Re: how to run scripts at startup?
« Reply #6 on: January 28, 2014, 08:49:29 pm »
Yes, you can do it.

Remove existing icedove settings from /home/you/.icedove

Then copy /root/.icedove folder to your /home/you/ directory.

The .icedove folder belongs to root user so change rights to it as root after copying:

Code:

chown you /home/you/.icedove
chmod -R 755 /home/you/.icedove


« Last Edit: June 30, 2014, 05:54:48 pm by 14 »
Nothing is easy as it looks.

Offline dhinds

  • Full Member
  • ***
  • Posts: 154
Re: how to run scripts at startup?
« Reply #7 on: January 29, 2014, 02:43:54 am »
Thanks again.  You are a true guru.



What I want to do is install the icedove configuration from my Sparky Mate root account to the user account of Sparky Ultra, on a different partition.  (In any case, I assume the principle is the same).  And I could also use the same procedure to transfer the accounts to a user account on Sparky Mate.
« Last Edit: June 30, 2014, 05:54:32 pm by 25 »

Offline dhinds

  • Full Member
  • ***
  • Posts: 154
Re: how to run scripts at startup?
« Reply #8 on: January 30, 2014, 10:36:29 am »

Quote:

Quote from pavroo on January 28, 2014, 17:00

There is a nice app for keyboard called 'fcitx'.

It'll be loaded to the panel's tray after installing and rebooting.

To manage energy run:

Code:

xfce4-power-manager-settings






fcitx did the trick. As you said, it's a nice little app, which let me add a second keyboard and then type the combination I want to use to toggle between them.  So ";;;;;" and "ñññññ" are 2 differrent results from hitting the same key, after pressing both shift keys simultaneously.



As for the xfce4-power-manager, an icon for it was installed automatically on the desktop during an Sparky APTus update / ugrade of either the system or distro and opening it's preferences allowed me to configure this laptop computer to suspend on closing the lid.



I was also able to install my icedove configuration from Sparky Mate to Ultra, so everything is fine now with the latter, which I am using at this moment.



So thanks again, pavroo.  Sparky users don't have to suffer.  :D



I will also mention a rather weird thing that happened:  After rebooting recently into Sparky Ultra, I was unable to enter my user account so I logged on as root.  On opening gparted I noticed that the /home partition had not been mounted and figured I would have to edit the fstab file (which you had explained how to do earlier).  However:  I also noticed that an external USB3 hard drive that was connected had replaced the drive Sparky is on as sda (it became sdb).  So all I had to do was reboot, removing the external drive in the process.  I can connect it later, if needed.



xfce's being a modular DE means I can add only those elements I need to Ultra in order to have a fully functioning system. (I also discovered XKill is effective when needed).



The power supply of the large desktop machine failed recently, and having adding Ultra to the laptop let me continue working while identifying the source of the problem and replacing it later this week with one of a different brand.  (The failed unit was a Cooler Master, which lasted 3.5 years.  I intend to replace it with a Corsair of the same size - 600 watts).
« Last Edit: June 30, 2014, 05:54:16 pm by 25 »

Offline fanis

  • Newbie
  • *
  • Posts: 14
Re: how to run scripts at startup?
« Reply #9 on: February 08, 2014, 12:19:49 pm »

Quote:

Quote from fanis on January 20, 2014, 18:47

Quote:

Quote from pavroo on January 20, 2014, 17:49

/home/your-nick/.config/openbox/autostart.sh


thank you, that was what I was asking for.




I tried JWM instead of openbox and has even better performance. How can I do the same on JWM?
« Last Edit: June 30, 2014, 05:53:58 pm by 256 »

Offline pavroo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1465
    • SparkyLinux
Re: how to run scripts at startup?
« Reply #10 on: February 08, 2014, 02:04:39 pm »

Code:

/home/you/.jwmrc


Find & use:

Code:

<StartupCommand>your-application</StartupCommand>


« Last Edit: June 30, 2014, 05:53:40 pm by 14 »
Nothing is easy as it looks.