Where is the cinnamenu Favorites folder

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
User avatar
majpooper
Level 8
Level 8
Posts: 2087
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Where is the cinnamenu Favorites folder

Post by majpooper »

I am writing an install bash script that will add a Shutdown and Restart buttons to Favorites in the Cinnamenu (I know a Quit button already exists that then gives these choices) It's a minor change but it is something I want to do. The problem I am finding is I can not figure out where the Favorites folder is located.

script so far

Code: Select all

COMMANDS=(
	"launcher_name='RESTART'"
	"launcher_icon="'#$HOME/.icons/reboot.png'"
	"launcher_command="'#$HOME/reboot.sh'"
	"favorites_folder='$HOME/{path to Favorites folder}'"
	"desktop_file='$favorites_folder/${RESTART}.desktop'"
I have be toying with a second approach of re-purposing the Quit and Logout button to a "Shutdown" and "Restart" buttons but that has been problematic as well and I would prefer the first approach.

The Shutdown works using the

Code: Select all

cinnamon-session-quit --power-off
command but the Restart does not with the

Code: Select all

cinnamon-session-quit --reboot
command

More info:
executing the Shutdown command adds this line to

Code: Select all

$HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js

Code: Select all

() => {
                        Util.spawnCommandLine('/home/majpooper/poweroff.sh');
                        this.appThis.menu.close();
But this line is not added when the Restart command is executed - I can add it manually with the path to the reboot.sh script and it works but the script when executing the Restart command does not. Also the system thinks both commands are executed successfully.


Here is that script

Code: Select all

#!/bin/bash

# Set log file path
LOG_FILE="/home/${USER}/install.log"

# Source log.sh file
source "$(dirname "$0")/log.sh"

# Set script name and log the start message
set_name

# change tooltips for Shutdown and change Log-out to Restart button
COMMANDS=(
    "sed -i \"s/_('Quit')/'Shutdown'/\" $HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js"
    "sed -i \"s/_('Shutdown the computer')/''/\" $HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js"
    "sed -i \"s#cinnamon-session-quit --power-off#$HOME/poweroff.sh#\" $HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js"
    "sed -i \"s/_('Logout')/'Restart'/\" $HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js"
    "sed -i \"s/_('Leave the session')/''/\" $HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js"
    "sed -i \"s#cinnamon-session-quit --reboot#$HOME/reboot.sh#\" $HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js"
    "sed -i '263,283d' $HOME/.local/share/cinnamon/applets/Cinnamenu@json/5.8/sidebar.js"
)

# Execute commands with logging and error handling
exec_cmd "${COMMANDS[@]}"

# Exit with successful message
exit_msg

exit 0
Last edited by LockBot on Thu Apr 25, 2024 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Shiva
Level 3
Level 3
Posts: 141
Joined: Thu Jul 07, 2022 11:25 am

Re: Where is the cinnamenu Favorites folder

Post by Shiva »

Hello,
The answer is simple : there is none.
The favorite-apps is a string value in dconf /org/cinnamon. You can read it with :

Code: Select all

dconf read /org/cinnamon/favorite-apps
As you'll notice, every item is a .desktop file. To put a script in the favorite-apps, the safe method is :
- create a .desktop file pointing to your script from the LM Menu right-click configure. Choose in the left panel the category you want to add an item to and in the right panel add a new element with a decent name pointing to your script.
- check it (run it).
- if it's OK, drag the desktop element you just created in the favorite-apps panel.

You may want to save your current favorite-apps first by redirecting the dconf read command to a file to able to restore it with a dconf write if things do not work as you expect..
Locked

Return to “Scripts & Bash”