Creation of a distro for college project!

I will…but thatll be my last step…

1 Like

College project or not, impress, recognition of the work always pays in the end. Better marks better recommendations

1 Like

An issue. I made a script with the help of GPT to make a layout switcher.

The user enters the number displayed on the screen besides his desired layout and the layout gets applied.

This was the expected task. But it simply doesnt work. any solutions?
This is the script btw(macos layout not added yet)

#!/bin/bash

# Base directory for layouts
BASE_DIR="/usr/share/layouts"

# Function to switch layout
switch_layout() {
    local layout=$1
    local layout_dir="$BASE_DIR/$layout"

    if [ -d "$layout_dir" ]; then
        echo "Switching to layout: $layout..."
        # Copy panel and settings configurations
        cp "$layout_dir/xfce4-panel.xml" ~/.config/xfce4/panel/xfce4-panel.xml
        cp "$layout_dir/xsettings.xml" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml
        # Set wallpaper
        if [ -f "$layout_dir/wallpaper.jpg" ]; then
            cp "$layout_dir/wallpaper.jpg" ~/Pictures/
            xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ~/Pictures/wallpaper.jpg
        fi
        # Restart panel to apply changes
        xfce4-panel -r
        echo "Layout switched to $layout."
    else
        echo "Error: Layout '$layout' not found!"
    fi
}

# Display menu
echo "Choose a layout:"
echo "1) macOS-like"
echo "2) Windows 10/7-like"
echo "3) Windows 11-like"
read -p "Enter your choice [1-3]: " choice

case $choice in
    1) switch_layout "macos" ;;
    2) switch_layout "win10" ;;
    3) switch_layout "win11" ;;
    *) echo "Invalid choice. Exiting."; exit 1 ;;
esac
1 Like

To debug it, you need to trace what it is doing.
The old fashioned method is to insert some printout statements in the script so you can see where it is executing down to.

Running it with sh -ex may help.

You will hardly ever debug a program by looking at it. You need to run it with extra output… probably many times.

3 Likes

Okay, will try it…

2 Likes

I messed it up…
I accidentally tried the script on my main user account instead of the testing user i created.

And using the sh -ex didnt do anything.
Also it worked for win10 to win11 layout but when im trying to go from win11 to win10 its just not working…

Any more ideas on how to get it to work?

Seems like i have to drop this idea…(Of the layout switcher)

1 Like

Put some printouts in… see where it is stopping
eg echo "mark 1"
after the first line.
Then more further down
I assume it is stopping before the end?

2 Likes

Okay will try…

2 Likes

This! Or echo those “#” lines like #Copy panel #set wallpaper etc

3 Likes

So I added the echo commands and it successfully completes all marks. One problem though, the xfce4 panel doesnt restart. So a complete restart is required so as to get the panel back on again. I use the init 6 command to do it.

1 Like

So the script is not stopping. I just doesnt do everything required?

That restarts all the daemons.
The old fashioned way was to kill process #1

2 Likes

Exactly…

I only thought of it as an alternative for the reboot command!

2 Likes

You need to do xfce-panel -r &. This command makes sure to keep the panel actually running when the script exits.

2 Likes

Not working @xahodo !

Has anyone here tried to make a layout switcher like this before. If yes then can you please share your script

1 Like

Do you have a date time line for when your project needs to be finished ?

1 Like

Yeah 3rd of December

1 Like

I fixed the problem.

I completely forgot about the xfce4 panel profiles app. I just used it and it works very well!

Just for the mac os layout ill add a script. Ill make a documentation file if my distro where ill state how to use the macos layout…

1 Like

@TypeHrishi I made some suggestion for you in this post: Cinelerra-gg AppImage doesn't show my mounted drives - #83 by Skywalker71. You can read that if you wish. :slightly_smiling_face:

So my project is actually done. Just completing the ppt!
Wanted to share this slide. Thank you soo soo much to all the members!

6 Likes