Cannot launch script on KDE startup

Forum rules
Before you post please read how to get help
Post Reply
compiler
Level 1
Level 1
Posts: 6
Joined: Sat Oct 13, 2012 12:15 pm

Cannot launch script on KDE startup

Post by compiler » Fri Sep 28, 2018 1:49 pm

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

compiler
Level 1
Level 1
Posts: 6
Joined: Sat Oct 13, 2012 12:15 pm

Re: Cannot launch script on KDE startup

Post by compiler » 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?

Hoser Rob
Level 12
Level 12
Posts: 4464
Joined: Sat Dec 15, 2012 8:57 am

Re: Cannot launch script on KDE startup

Post by Hoser Rob » Sat Sep 29, 2018 9:54 am

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.

compiler
Level 1
Level 1
Posts: 6
Joined: Sat Oct 13, 2012 12:15 pm

Re: Cannot launch script on KDE startup

Post by compiler » Sat Sep 29, 2018 10:35 am

Hoser Rob wrote:
Sat Sep 29, 2018 9:54 am
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.
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
Level 13
Level 13
Posts: 4719
Joined: Thu Jun 21, 2018 5:11 pm

Re: Cannot launch script on KDE startup

Post by gm10 » Sat Sep 29, 2018 11:17 am

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
Level 1
Level 1
Posts: 6
Joined: Sat Oct 13, 2012 12:15 pm

Re: Cannot launch script on KDE startup

Post by compiler » Sat Sep 29, 2018 11:41 am

gm10 wrote:
Sat Sep 29, 2018 11:17 am
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
Tested. Didn't work. It doesn't make any sense :(

gm10
Level 13
Level 13
Posts: 4719
Joined: Thu Jun 21, 2018 5:11 pm

Re: Cannot launch script on KDE startup

Post by gm10 » Sat Sep 29, 2018 11:44 am

compiler wrote:
Sat Sep 29, 2018 11:41 am
gm10 wrote:
Sat Sep 29, 2018 11:17 am
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
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
Level 1
Level 1
Posts: 6
Joined: Sat Oct 13, 2012 12:15 pm

Re: Cannot launch script on KDE startup

Post by compiler » Sun Sep 30, 2018 3:47 pm

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...

rossdv8
Level 1
Level 1
Posts: 28
Joined: Wed Apr 23, 2014 4:48 am

Re: Cannot launch script on KDE startup

Post by rossdv8 » Thu Dec 13, 2018 10:11 pm

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

redlined
Level 4
Level 4
Posts: 408
Joined: Wed Jun 06, 2018 8:12 pm
Location: Mile High, Green State (Denver, CO:)

Re: Cannot launch script on KDE startup

Post by redlined » Thu Dec 13, 2018 11:17 pm

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:
Moem kōan 42: Should tool manufacturers be required to fix their products so that you cannot use their saws to cut the tree branch that you're sitting on?

(The answer to the ultimate question of life, the universe and everything is... 42!!;)

Post Reply

Return to “KDE”