How to switch to another menu through a line command or a script?

Hi everybody,

I would like to be able to change the menu in KDE using a command line or via a script (ex: default z menu -> launchpad plasma and launchpad plasma -> menu z).

Is it possible ?

Thank you.

This is best illustrated with an example:

  1. Take the simplest C program in the world:

    #include <stdio.h>
    main()
    {
      printf("Hello World!");
    }
    
  2. Take the simplest bash program in the world:

    #!/usr/bin/env bash          
    echo "Hello World!"
    

Now place both programs on an icon on the launcher.

Although both programs have the exact same effect on your system, in the second case, we can say that the terminal command being executed is echo "Hello World!" .

However, in the first case, there just is no terminal command being executed as the terminal isn’t involved at all! Unfortunately for you, most of the stuff inside Manjaro (drawing menus, drawing icons, displaying a cell in a spreadsheet, right-clicking a word in a document, …) doesn’t involve the terminal at all.

So if you want to change the menu of a command line program, just edit it, but to add / delete to the menu of any KDE program, you need to change that in the source code.¹

:innocent:

Note 1: Resource files are still source code, not shell code…

Hello,

I made some search on the net, and the settings can be changed with kwriteconfig and qdbus but I don’t know what command line I must use to change the application launcher via a bash script.

Can you explain with a screenshot what you’re trying to accomplish?

use https://paste.pics and then just post the ID here as you’re a Trust Level 0 user who (in principle) cannot post screenshots)

:innocent:

you want change kde menu application without gui menu “Alternative” but run a script ?
$ changemenu.sh other

yes, you can use kwriteconfig5 for change .config/k*

1 Like

You can, use KDE scripting instructions on their website
(Cannot link it cause this is my first post )
Just search Google KDE panel scripting it is the first option.

You can try editing the file .config/plasma-org.kde.plasmadesktop-appletsrc

That is is incharge of the loaded panel layout and their location.

It is under [containment] [26] [general] the layout of the bottom panel.

Under appletorder goes from left to right
i.e the first applet/widget = first no etc

If you get the applet no you can then add it to the applet list and add also its settings in

[Containment] [26] [applets] [appletNo]
The setting here .

You can use the above link for more details

Would have written a script but I am kinda busy rn
May write one later

Hope it helps
( Just joined Manjaro forum to make this post )

2 Likes
  • Thank you for joining
  • Excellent first post
  • no links is to keep the SPAMmers out.

:innocent:

Thanks for your answers. :wink:

@papajoke: yes, I want to change kde menu application without gui menu “Alternative” but with a script.

@AlanP do know the name of the widget you want to switch
i wrote something it is not perfect but would do the job a little,

@da-viper: Thanks for your help. :wink:

I just need the kwriteconfig5 line which allows to define the desired menu, as well as the qdbus line which allows to apply it. For the script, I can do it without problem.

Regards.