Need help replacing panel launchers

Forum rules
Before you post please read how to get help
crazyjust
Level 1
Level 1
Posts: 13
Joined: Sat Sep 08, 2012 3:01 pm

Need help replacing panel launchers

Postby crazyjust » Sat Sep 09, 2017 1:28 pm

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?

User avatar
xenopeek
Level 24
Level 24
Posts: 21468
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Need help replacing panel launchers

Postby xenopeek » Sat Sep 09, 2017 2:14 pm

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
Level 1
Level 1
Posts: 13
Joined: Sat Sep 08, 2012 3:01 pm

Re: Need help replacing panel launchers

Postby crazyjust » Sat Sep 09, 2017 2:21 pm

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.


Return to “Scripts & Bash”