Bash script to change Applet settings

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Post Reply
5555dimitri
Level 1
Level 1
Posts: 1
Joined: Sun Nov 19, 2023 7:43 pm

Bash script to change Applet settings

Post by 5555dimitri »

hello dear friends,
I'm curious if I could get help finding a way to quickly change Taskbar’s standard Applet settings in Cinnamon ('Grouped window list' Applet, to be exact).

Basically, having switched to Mint from KDE, I am very used to the way you can cycle through open windows by left clicking the app icon. Also, launching a new instance of an app by clicking the mouse wheel.

In Mint, luckily, this is configured by right clicking any app icon in your Taskbar -> pick 'Applet preferences' -> then 'Configure' -> find 'Left click action' , change to 'Cycle windows' . Then I always change 'Middle click action' to 'Launch new app instance'.

The question is - what would be a Bash script to change these settings for me?
*I am not an advanced user and will appreciate any help.
justanotherguy
Level 1
Level 1
Posts: 17
Joined: Wed Mar 23, 2016 4:32 pm

Re: Bash script to change Applet settings

Post by justanotherguy »

Based on your expectations from KDE and being able to left-click each app icon, I would just replace the Grouped Window List applet with the Window List applet. That gives you a new app icon in the taskbar/panel for each instance of every app opened.

I am not sure why you wish to do this in Bash, except for the case of a post-install script where you might be interested in changing the settings just once for a user on a particular computer. If this is the case, you would just need to configure your desktop elements as you wish, then export to a text file using:

Code: Select all

dconf dump / > full-dconf-dump
Then open up that resulting file, find just the section you want with the panel applets, and copy and paste that to a new file of specific settings for later use. Upon restoring this new file to a different user account or a different machine, it would only change just that part of your user settings in Cinnamon:

Code: Select all

dconf load / < partial-dconf-dump
This will work for much of Cinnamon, except for a handful of items that are stored in other ways, due to different packages employed and the ways they store data.
User avatar
majpooper
Level 8
Level 8
Posts: 2087
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: Bash script to change Applet settings

Post by majpooper »

BLUF - yes a simple bash script can do this.
By editing the settings-schema.json for the grouped-window-list@cinnamon.org applet you can change the preferences you want to change. But why do you want to do this using a bash script rather than just making the change to the applet on the panel ?

Anyway:
(1) I copied the grouped-window-list applet from here (you will have to do this with root privileges)

Code: Select all

/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org
to here

Code: Select all

/home/majpooper/.local/share/cinnamon/applets
replace majpooper with your user_name

(2) in the /home/majpooper/.local/share/cinnamon/applets/grouped-window-list@cinnamon.org directory I did a copy of settings-schema.json and then a paste so I had a copy of the original (just a good habit in case you jack up the original somehow) so I now have a copy named settings-schema (copy).json

(3) Here is a very simple script that will edit the settings-schema.json file - I called it grplist.sh

Code: Select all

#!/bin/bash

sed -i '120s/2/3/'  ~/.local/share/cinnamon/applets/grouped-window-list@cinnamon.org/settings-schema.json
sed -i '130s/3/2/'  ~/.local/share/cinnamon/applets/grouped-window-list@cinnamon.org/settings-schema.json

exit 0
I create a directory in home named bin in which I keep my bash scripts but you can run it from a directory that you prefer. I always use the file extension .sh - just a preference on my part but not required in linux. Last make the script executable

Code: Select all

chmod +x grplist.sh
As far as dconf is concerned - first you have to make sure you have dconf-editor (you may have by default - if not you will have to install it). I looked at a dconf dump and could not find the grouped-window-list applet settings. So not sure dconf would work.
Post Reply

Return to “Scripts & Bash”