Results 1 to 9 of 9

Thread: How to Add a Command at KDE Startup

  1. #1
    Join Date
    May 2022
    Location
    Matão-SP/Brazil
    Posts
    7

    Question How to Add a Command at KDE Startup

    Hi
    Switching from Ubuntu Gnome to OpenSuse Tumbleweed, with KDE GUI.
    I have a backlit keyboard, which using Xorg, I can use the command
    Code:
    xset led 3
    to activate the lighting.

    In gnome, I usually add the command
    Code:
    /bin/usr/xset led 3
    at startup, so that every time I log in, the lighting activates automatically.

    But I'm not getting the same with the KDE interface.

    I would like to know how to add this command to boot with the system or on login, as in gnome.

  2. #2
    Join Date
    Mar 2011
    Location
    Sauerland
    Posts
    7,072

    Default AW: How to Add a Command at KDE Startup

    You can pack it as Script, make it excutable and use this Script in systemsettings5-----Startup and Shutdown------Autostart

    My Script for starting akonadi not so fast:
    Code:
    #!/bin/bash
    sleep 30
    /usr/bin/akonadictl restart
    Last edited by Sauerland; 20-May-2022 at 17:16.

  3. #3
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    3,837

    Default Re: How to Add a Command at KDE Startup

    Quote Originally Posted by patrikrufino View Post
    Hi
    Switching from Ubuntu Gnome to OpenSuse Tumbleweed, with KDE GUI.
    I have a backlit keyboard, which using Xorg, I can use the command
    Code:
    xset led 3
    to activate the lighting.

    In gnome, I usually add the command
    Code:
    /bin/usr/xset led 3
    at startup, so that every time I log in, the lighting activates automatically.

    But I'm not getting the same with the KDE interface.

    I would like to know how to add this command to boot with the system or on login, as in gnome.
    I presume you want to run the above command regardless which system you are booting into. Use a systemd service. It will work with any GUI and any distribution:
    Code:
    karl@erlangen:~> systemctl cat --user save-jalbum-settings.service  
    # /home/karl/.config/systemd/user/save-jalbum-settings.service
    
    [Unit] 
    Description=Save jAlbum Project Files 
    
    [Service] 
    ExecStart=/bin/bash /home/karl/bin/save-jalbum-settings.sh 
    
    [Install] 
    WantedBy=default.target 
    karl@erlangen:~>
    Code:
    karl@erlangen:~> systemctl status --user save-jalbum-settings.service  
     save-jalbum-settings.service - Save jAlbum Project Files 
         Loaded: loaded (/home/karl/.config/systemd/user/save-jalbum-settings.service; enabled; vendor preset: disabled) 
         Active: active (running) since Sat 2022-05-21 08:31:38 CEST; 3h 9min ago 
       Main PID: 1277 (bash) 
          Tasks: 2 (limit: 4915) 
         Memory: 1.5M 
            CPU: 409ms 
         CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/save-jalbum-settings.service 
                 ├─  1277 /bin/bash /home/karl/bin/save-jalbum-settings.sh
                 └─ 12620 sleep 60
    
    Mai 21 08:31:38 erlangen systemd[1267]: Started Save jAlbum Project Files. 
    karl@erlangen:~> 
    i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), 5600X (2022) openSUSE Tumbleweed, KDE Plasma

  4. #4
    Join Date
    Jun 2008
    Location
    East of Podunk
    Posts
    33,091
    Blog Entries
    15

    Default Re: How to Add a Command at KDE Startup

    Quote Originally Posted by patrikrufino View Post
    Hi
    Switching from Ubuntu Gnome to OpenSuse Tumbleweed, with KDE GUI.
    I have a backlit keyboard, which using Xorg, I can use the command
    Code:
    xset led 3
    to activate the lighting.

    In gnome, I usually add the command
    Code:
    /bin/usr/xset led 3
    at startup, so that every time I log in, the lighting activates automatically.

    But I'm not getting the same with the KDE interface.

    I would like to know how to add this command to boot with the system or on login, as in gnome.
    Hi and welcome to the Forum
    Is this a laptop, normally there is a function key for this? If a laptop, then something is not working properly..... I have a HP here and Fn+F5 turns the backlight off and on...
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  5. #5
    Join Date
    May 2022
    Location
    Matão-SP/Brazil
    Posts
    7

    Thumbs up Re: AW: How to Add a Command at KDE Startup

    Quote Originally Posted by Sauerland View Post
    You can pack it as Script, make it excutable and use this Script in systemsettings5-----Startup and Shutdown------Autostart

    My Script for starting akonadi not so fast:
    Code:
    #!/bin/bash
    sleep 30
    /usr/bin/akonadictl restart

    Thank you very much.

    This worked perfectly for me.

    I created a file called .turn_backlight_at_keyboard.sh with the following content:

    Code:
    #!/bin/bash
    usr/bin/xset led 3
    I added it to KDE Autostart as in the suggested path and as soon as I logged in the LEDs lit up. It was exactly what I needed.

  6. #6
    Join Date
    May 2022
    Location
    Matão-SP/Brazil
    Posts
    7

    Question Re: How to Add a Command at KDE Startup

    Quote Originally Posted by karlmistelberger View Post
    I presume you want to run the above command regardless which system you are booting into. Use a systemd service. It will work with any GUI and any distribution:
    Code:
    karl@erlangen:~> systemctl cat --user save-jalbum-settings.service  
    # /home/karl/.config/systemd/user/save-jalbum-settings.service
    
    [Unit] 
    Description=Save jAlbum Project Files 
    
    [Service] 
    ExecStart=/bin/bash /home/karl/bin/save-jalbum-settings.sh 
    
    [Install] 
    WantedBy=default.target 
    karl@erlangen:~>
    Code:
    karl@erlangen:~> systemctl status --user save-jalbum-settings.service  
     save-jalbum-settings.service - Save jAlbum Project Files 
         Loaded: loaded (/home/karl/.config/systemd/user/save-jalbum-settings.service; enabled; vendor preset: disabled) 
         Active: active (running) since Sat 2022-05-21 08:31:38 CEST; 3h 9min ago 
       Main PID: 1277 (bash) 
          Tasks: 2 (limit: 4915) 
         Memory: 1.5M 
            CPU: 409ms 
         CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/save-jalbum-settings.service 
                 ├─  1277 /bin/bash /home/karl/bin/save-jalbum-settings.sh
                 └─ 12620 sleep 60
    
    Mai 21 08:31:38 erlangen systemd[1267]: Started Save jAlbum Project Files. 
    karl@erlangen:~> 
    Well, this solution seems even more elegant than the one I currently use.

    But I didn't understand how I would create this service in systemd.

    Do you have an article on the subject, or a step by step?

    I appreciate the suggestion.

  7. #7
    Join Date
    May 2022
    Location
    Matão-SP/Brazil
    Posts
    7

    Red face Re: How to Add a Command at KDE Startup

    Quote Originally Posted by malcolmlewis View Post
    Hi and welcome to the Forum
    Is this a laptop, normally there is a function key for this? If a laptop, then something is not working properly..... I have a HP here and Fn+F5 turns the backlight off and on...
    Thanks.

    Well, in fact I use a laptop, but I use it connected to the mouse and keyboard.

    The lights are from this keyboard in question, and yes, it has an on and off key. The Scroll Lock.

    What happens is that when activating the leds by the key, it blocks some functions, in some applications.

    An example is LibreOffice Calc.

    I work with some sheets and it's hard to move around them with Scroll Lock on.

    So I looked for a way to activate without the need for the key.

  8. #8
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    3,837

    Default Re: How to Add a Command at KDE Startup

    Quote Originally Posted by patrikrufino View Post
    But I didn't understand how I would create this service in systemd. Do you have an article on the subject, or a step by step?
    User services go to $HOME/.config/systemd/user: https://www.digitalocean.com/communi...and-unit-files
    i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), 5600X (2022) openSUSE Tumbleweed, KDE Plasma

  9. #9
    Join Date
    May 2022
    Location
    Matão-SP/Brazil
    Posts
    7

    Wink Re: How to Add a Command at KDE Startup

    Quote Originally Posted by karlmistelberger View Post
    User services go to $HOME/.config/systemd/user: https://www.digitalocean.com/communi...and-unit-files
    Thanks, I'll try to embed this in my system.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •