Cannot launch script on KDE startup

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
compiler

Cannot launch script on KDE startup

Post by compiler »

Hi all.

I'm trying to launch a shell script when KDE launches, and none of the methods suggested in other posts work. I'm not a newbie user (Linux user since 1996) and I'm starting to think something's broken in KDE startup, or there's some concept here that I don't understand.

System: Linux Mint 18 with KDE 4.

The script is just:

Code: Select all

compiler@laptop: ~/Desktop  $ cat ~/bin/xmodmap_laptop.sh 
#!/bin/bash
xmodmap ~/.Xmodmap-hplaptop

compiler@laptop: ~/Desktop  $ ls -l ~/bin/xmodmap_laptop.sh
-rwxrwxr-x 1 compiler compiler 40 Sep 28 19:42 /home/compiler/bin/xmodmap_laptop.sh
What I tested and didn't work:

- Created symlink in ~/.config/autostart (this is the path configured in System Settings -> Applications -> Locations -> Autostart path).

- Copied the script with +x permissions inside ~/.config/autostart/

- Performed the same operations in ~/.kde/Autostart/ .

- Added the script to autostart in System Settings -> Startup and Shutdown -> Add Program.

- Added the script to autostart in System Settings -> Startup and Shutdown -> Add Program (run in terminal).

- Added the script to autostart in System Settings -> Startup and Shutdown -> Add Script (with symlink checkbox checked).

- Added the script to autostart in System Settings -> Startup and Shutdown -> Add Script (without symlink checkbox checked).

- Tested also to put absolute paths inside the script (/usr/bin/xmodmap /home/compiler/bin/...).

- Replaced the xmodmap command with "touch /tmp/testfile" (and it's never created).


I don't know what I'm doing wrong so I'd appreciate any help on this.

Thanks and best regards
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
compiler

Re: Cannot launch script on KDE startup

Post by compiler »

While writing this question, I noticed this:

Code: Select all

ii  kde-baseapps-bin                                4:16.04.3-0ubuntu1~ubuntu16.04~ppa63
Is this the official KDE shipped with Linux Mint 18? Should be KDE 5.6?
Hoser Rob
Level 20
Level 20
Posts: 11806
Joined: Sat Dec 15, 2012 8:57 am

Re: Cannot launch script on KDE startup

Post by Hoser Rob »

compiler wrote: Fri Sep 28, 2018 1:56 pm While writing this question, I noticed this:

Code: Select all

ii  kde-baseapps-bin                                4:16.04.3-0ubuntu1~ubuntu16.04~ppa63
Is this the official KDE shipped with Linux Mint 18? Should be KDE 5.6?
Was thinking much the same thing. Mint 18 KDE comes with PLasma 5, and I wouldn't run KDE Plasma 4 in anything newer than Mint 17.3. General lack of backwards compatibility in Linux and all. And 17.3 going EOL next year.
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
compiler

Re: Cannot launch script on KDE startup

Post by compiler »

Hoser Rob wrote: Sat Sep 29, 2018 9:54 amWas thinking much the same thing. Mint 18 KDE comes with PLasma 5, and I wouldn't run KDE Plasma 4 in anything newer than Mint 17.3. General lack of backwards compatibility in Linux and all. And 17.3 going EOL next year.
But ... I installed this laptop using Linux Mint 18 KDE edition. But it doesn't have KDE 5, it ships with KDE 4 (and I didn't setup any PPA to go back to KDE 4, so I'm surprised with the versions).

Maybe if I was able to install KDE Plasma 5, this would fix my problem...

Any idea on how to install KDE5 ? :?
gm10

Re: Cannot launch script on KDE startup

Post by gm10 »

compiler wrote: Fri Sep 28, 2018 1:49 pm System: Linux Mint 18 with KDE 4.

The script is just:

Code: Select all

compiler@laptop: ~/Desktop  $ cat ~/bin/xmodmap_laptop.sh 
#!/bin/bash
xmodmap ~/.Xmodmap-hplaptop
- Added the script to autostart in System Settings -> Startup and Shutdown -> Add Program.
How did you add it? Probably the wrong command line. But why a script at all? It's just a single command you're trying to run... Just add this command as a startup application:

Code: Select all

xmodmap /home/compiler/.Xmodmap-hplaptop
compiler

Re: Cannot launch script on KDE startup

Post by compiler »

gm10 wrote: Sat Sep 29, 2018 11:17 amBut why a script at all? It's just a single command you're trying to run... Just add this command as a startup application:

Code: Select all

xmodmap /home/compiler/.Xmodmap-hplaptop
Tested. Didn't work. It doesn't make any sense :(
gm10

Re: Cannot launch script on KDE startup

Post by gm10 »

compiler wrote: Sat Sep 29, 2018 11:41 am
gm10 wrote: Sat Sep 29, 2018 11:17 amBut why a script at all? It's just a single command you're trying to run... Just add this command as a startup application:

Code: Select all

xmodmap /home/compiler/.Xmodmap-hplaptop
Tested. Didn't work. It doesn't make any sense :(
Well, does it run when you run it manually? In particular, does that /home/compiler/.Xmodmap-hplaptop file even exist?
compiler

Re: Cannot launch script on KDE startup

Post by compiler »

gm10 wrote: Sat Sep 29, 2018 11:44 am Well, does it run when you run it manually? In particular, does that /home/compiler/.Xmodmap-hplaptop file even exist?
Yes, of course, the script works perfectly when launched manually.

In fact, if I change the script contents with "touch /tmp/testfile", the file is never created. The script has +x and works from the terminal so...
User avatar
rossdv8
Level 7
Level 7
Posts: 1737
Joined: Wed Apr 23, 2014 4:48 am
Location: Within 2,000 kilometres of Alice Springs, Australia
Contact:

Re: Cannot launch script on KDE startup

Post by rossdv8 »

I had this problem with Mint 19 KDE. I run a simple shell script after my network has started to send a test print to my printer on boot or reboot (to keep the inkjet nozzles clear in our local weather).

The command in the script worked from a terminal. The shell script worked if I clicked on it, and in Mint 17.3 KDE it worked fine by either copying it to the autostart folder, linking it to the autostart folde, radding it in System Settings>Startup and shutdown, or simply clicking on an icon of it in the panel.

But with Mint 19 and Plasma 5, while clicking its icon in the panel, or in a folder worked, it would not start at or after boot!

I got around the problem by copying it (as ROOT) to the /etc/network/if-up.d folder.
The reason I put it there is because I use a wireless printer and need to wait for the network to be 'up' before it can print.

However, more or less any script should run if made executable and placed in that folder. There are other dolders in /etc/network/ and their names are self explanatory. Any executable script placed in /etc/network/if-up.d should run as soon as the network is active - even if it doesn't need a network connection. It might not be the perfect solution, but it might solve your problem.

Cheers,
RossD
Current main OS: MInt 21.3 with KDE Plasma 5.27 (using Compiz as WM) - Kernel: 6.5.0-15 on Lenovo m900 Tiny, i5-6400T (intel HD 530 graphics) 16GB RAM.
Sharks usually only attack you if you are wet
redlined

Re: Cannot launch script on KDE startup

Post by redlined »

hi compiler!

I'm new to Linux, however this made me curious so I did a little search on 4:16.04.3-0ubuntu1~ubuntu16.04~ppa63 from your mention and get 3 hits, two to Kubuntu backports at launchpad and one at distrowatch which does list it as package on that 18.3 version description, about 1/3 way down> kde-baseapps-bin 4:16.04.3-0ubuntu1~ubuntu16.04~ppa63

although, LM18 release notes do mention "The APT sources include the Kubuntu Backports PPA, which provides updates to newer versions of the Plasma desktop." as well mention This edition of Linux Mint features the KDE Plasma 5.6 desktop environment with a link to more info and a vid showing it off. As long as your kubuntu backports ppa is valid and active then I imagine you have the latest version of the plasma5 environment files.

I would still upgrade to 18.3 if you are indeed on 18 (.0) initial release using upgrade path guides provided by LM team and often mirrored here in tutorials subforum. There is/are also good tutorials and discussions about upgrading to LM19 KDE by local forum experienced users that I've read. a quick search will help find that if interested, such as this one: Want Mint 19 but still want KDE? Have 18.3 KDE installed? Read on!

I realize this doesn't necessarily help with your main issue of script run on startup, unless of course LM19 has the secret sauce, so I leave that to the experienced and local forum experts way above my paygrade for sure :mrgreen:
compiler

Re: Cannot launch script on KDE startup

Post by compiler »

Thanks a lot for your response!

I probably installed in the past a newer KDE version and that's the problem.

best regards
User avatar
rossdv8
Level 7
Level 7
Posts: 1737
Joined: Wed Apr 23, 2014 4:48 am
Location: Within 2,000 kilometres of Alice Springs, Australia
Contact:

Re: Cannot launch script on KDE startup

Post by rossdv8 »

I noticed that I wrote this in my KDE and Plasma 'Fixes' file when I could not autostart some of my scripts that were on external drives.

auto run script on an external drive use bash scriptname

Now I know you are NOT on an external drive. But have you tried adding the bash command to run the script in Autostart or wherever?

I can't remember exactly where i had to put it, I've had some brain damage since then.
Current main OS: MInt 21.3 with KDE Plasma 5.27 (using Compiz as WM) - Kernel: 6.5.0-15 on Lenovo m900 Tiny, i5-6400T (intel HD 530 graphics) 16GB RAM.
Sharks usually only attack you if you are wet
Locked

Return to “Software & Applications”