Need help replacing panel launchers

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
crazyjust

Need help replacing panel launchers

Post by crazyjust »

I made a post install script to make my installation easier, but i'm having trouble figuring out how to replace a panel launcher in cinnamon with bash. I would like to delete the firefox launcher and replace it with chrome launcher. Anyone know?
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.
User avatar
xenopeek
Level 25
Level 25
Posts: 29459
Joined: Wed Jul 06, 2011 3:58 am

Re: Need help replacing panel launchers

Post by xenopeek »

A small trick to find what file to change is using touch and find. I'll explain shortly. Open a terminal and run the command touch a, which creates a file called "a" (you can use whatever name you want). Now make your changes to the panel launchers (or whatever else you want to figure out is stored where). Immediately afterwards run the command find ~ -newer a which finds any files that have been modified after you created the "a" file.

For your question I added the Thunderbird launcher to the panel and with above trick found that this information is stored (on my Linux Mint 18.2 Cinnamon) in the .cinnamon/configs/panel-launchers@cinnamon.org/3.json in my home directory.

I've copied the contents of that file below. You can see in the "launcherList" section there is a section "value" within that and that lists the desktop files to include on the panel (in order). Here it is Firefox, Gnome Terminal, Nemo and Thunderbird. You could just overwrite an existing file with your preconfigured file. If you want to modify the existing file likely use a progam like jq (a command line tool to work with JSON files) will be helpful here.

I note at the end there is a __md5__ string which is a hash value, but I don't know what this is used for?

Code: Select all

{
    "section1": {
        "type": "section",
        "description": "Behavior"
    },
    "launcherList": {
        "type": "generic",
        "default": [
            "firefox.desktop",
            "gnome-terminal.desktop",
            "nemo.desktop"
        ],
        "value": [
            "firefox.desktop",
            "gnome-terminal.desktop",
            "nemo.desktop",
            "thunderbird.desktop"
        ]
    },
    "allow-dragging": {
        "type": "switch",
        "default": true,
        "description": "Allow dragging of launchers",
        "value": true
    },
    "__md5__": "11474ba983ca660d140dedf9e087884c"
Image
crazyjust

Re: Need help replacing panel launchers

Post by crazyjust »

Thank you very much xenopeek. ".cinnamon/configs/panel-launchers@cinnamon.org/3.json" is exactly what I was looking for. I can replace that file with my script.
Locked

Return to “Scripts & Bash”