Skip to content

Commit

Permalink
Merge branch 'dev-6.6' of github.com:mecha-org/mecha-make into dev-6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruveshb-mecha committed Feb 11, 2025
2 parents 2094cf7 + 1d6b08b commit 4e536c5
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 31 deletions.
8 changes: 7 additions & 1 deletion debian/distro/build-debian.nu
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def main [machine: string, build_dir: string] {

configure_audio

update_os_release
#update_os_release

configure_udev

Expand All @@ -111,6 +111,12 @@ def main [machine: string, build_dir: string] {

configure_mecha_system_pref

configure_mecha_connect_desktop_file

set_config_dir_ownership

set_alacritty_config_dir_ownership

unmount_sys_proc_volumes

pack_root_fs
Expand Down
2 changes: 1 addition & 1 deletion debian/distro/conf-packages/target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ package_groups:
- dosfstools
- cpufrequtils
- upower
- libglib2.0-0-dbg
- libglib2.0-0
- name: network
packages:
- bluez
Expand Down
46 changes: 45 additions & 1 deletion debian/distro/modules/alacritty-config.nu
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export def configure_alacritty [] {
SUDO cp $alacritty_bin $alacritty_dest
log_debug "System binary installation completed successfully."

# Make the binary executable
SUDO chmod 755 $"($alacritty_dest)/alacritty"
log_debug "Alacritty binary permissions set successfully."

# User-level configuration
log_info "Setting up user alacritty configuration..."

Expand All @@ -56,5 +60,45 @@ export def configure_alacritty [] {
cp $alacritty_theme $"($theme_dest)/flat-remix.yml"
log_info "flat-remix.yml theme file copied successfully."


# Create Alacritty.desktop file
let desktop_file_path = $rootfs_dir + "/usr/share/applications/Alacritty.desktop"
let desktop_file_dir = $rootfs_dir + "/usr/share/applications"

# Check if desktop entry exists and remove it
if ($desktop_file_path | path exists) {
log_debug $"Removing existing desktop entry: ($desktop_file_path)"
SUDO rm $desktop_file_path
}

let desktop_file_content = '[Desktop Entry]
Type=Application
TryExec=alacritty
Exec=alacritty
Icon=/usr/share/mechanix/shell/launcher/assets/icons/app_drawer/terminal_icon.png
Terminal=false
Categories=System;TerminalEmulator;
Name=Alacritty
GenericName=Terminal
Comment=A fast, cross-platform, OpenGL terminal emulator
StartupNotify=true
StartupWMClass=Alacritty
Actions=New;
[Desktop Action New]
Name=New Terminal
Exec=alacritty
'

# Create desktop entry file
log_debug $"Writing desktop file to: ($desktop_file_path)"
# Write the content
echo $desktop_file_content | SUDO tee $desktop_file_path
# Set appropriate permissions
SUDO chmod 644 $desktop_file_path
log_debug "Desktop entry created successfully."


log_debug "Alacritty configuration completed successfully."
}
}
41 changes: 23 additions & 18 deletions debian/distro/modules/chromium-config.nu
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,36 @@ export def configure_chromium_preferences [] {


# Create chromium.desktop file
let desktop_file_path = "/usr/share/applications/chromium.desktop"
let desktop_file_dir = "/usr/share/applications"
let desktop_file_path = $rootfs_dir + "/usr/share/applications/chromium.desktop"
let desktop_file_dir = $rootfs_dir + "/usr/share/applications"

if not ($desktop_file_dir | path exists) {
log_debug $"Creating directory: ($desktop_file_dir)"
SUDO mkdir -p $desktop_file_dir
# Remove existing file if it exists
if ($desktop_file_path | path exists) {
log_debug $"Removing existing desktop file: ($desktop_file_path)"
SUDO rm $desktop_file_path
}

let desktop_file_content = '
[Desktop Entry]
Type=Application
TryExec=chromium
Exec=sh -c "export DISPLAY=:0 && chromium"
Icon=/usr/share/mechanix/shell/launcher/assets/icons/app_drawer/chromium_icon.png
Terminal=false
Categories=System;
Name=Chromium
GenericName=Chromium
Comment=Browser app
let desktop_file_content = '[Desktop Entry]
Type=Application
TryExec=chromium
Exec=sh -c "export DISPLAY=:0 && chromium"
Icon=/usr/share/mechanix/shell/launcher/assets/icons/app_drawer/chromium_icon.png
Terminal=false
Categories=System;
Name=Chromium
GenericName=Chromium
Comment=Browser app
'

# Create desktop entry file
log_debug $"Writing desktop file to: ($desktop_file_path)"
echo $desktop_file_content | SUDO tee $desktop_file_path
# Create empty file with sudo
SUDO touch $desktop_file_path
# Write the content
echo $desktop_file_content | SUDO tee $desktop_file_path out> /dev/null
# Set appropriate permissions
SUDO chmod 644 $desktop_file_path
log_debug "Desktop entry created successfully."


log_info "Chromium configuration completed."
Expand Down
106 changes: 96 additions & 10 deletions debian/distro/modules/system-config.nu
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ mechanix-keyboard -s /etc/mechanix/shell/keyboard/settings.yml &"
}

export def set_config_dir_ownership [] {
let config_dir = $"($env.ROOTFS_DIR)/home/mecha/.config"
let config_dir = $"/home/mecha/.config"
log_debug $"Setting ownership of ($config_dir) to mecha:mecha"

let rootfs_dir = $env.ROOTFS_DIR
Expand All @@ -287,7 +287,49 @@ export def set_config_dir_ownership [] {
CHROOT chown -R mecha:mecha $config_dir
log_info "Ownership set successfully."
} catch {
log_error $"Failed to set ownership"
|error| log_error $"Failed to set ownership : ($error)"
}

# set permissions to 700
try {
CHROOT chmod 700 $config_dir
log_info "Permissions set successfully."
} catch {
|error| log_error $"Failed to set permissions : ($error)"
}
}

export def set_alacritty_config_dir_ownership [] {
let themes_dir = $"/home/mecha/.alacritty-theme"
log_debug $"Setting ownership of ($themes_dir) to mecha:mecha"

let rootfs_dir = $env.ROOTFS_DIR

# Use chroot to execute gsettings command
alias CHROOT = sudo chroot $rootfs_dir

log_debug $"Setting ownership of ($themes_dir) to mecha:mecha"
try {
CHROOT chown -R mecha:mecha $themes_dir
log_info "Ownership set successfully."
} catch {
|error| log_error $"Failed to set ownership : ($error)"
}

# set permissions to 700
try {
CHROOT chmod 700 $themes_dir
log_info "Permissions set successfully."
} catch {
|error| log_error $"Failed to set permissions : ($error)"
}

# migrate alacritty
try {
/usr/bin/alacritty migrate
log_info "Permissions set successfully."
} catch {
|error| log_error $"Failed to set permissions : ($error)"
}
}

Expand All @@ -303,7 +345,8 @@ export def configure_mecha_system_pref [] {
CHROOT gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true
log_info "On-screen keyboard enabled system-wide."
} catch {
log_error "Failed to enable on-screen keyboard system-wide."
|error|
log_error "Failed to enable on-screen keyboard system-wide. "
}

log_debug "Removing unused desktop files"
Expand All @@ -312,17 +355,60 @@ export def configure_mecha_system_pref [] {
"/usr/share/applications/system-config-printer.desktop",
"/usr/share/applications/vim.desktop",
"/usr/share/applications/debian-uxterm.desktop",
"/usr/share/applications/debian-xterm.desktop"
"/usr/share/applications/debian-xterm.desktop",
"/usr/share/applications/mecha-connect.desktop",
]

for file in $files_to_remove {
let file_path = $"($rootfs_dir)($file)"
if ($file_path | path exists) {
log_debug $"Removing file: ($file_path)"
SUDO rm $file_path
}
for file in $files_to_remove {
let file_path = $"($rootfs_dir)($file)"
if ($file_path | path exists) {
log_debug $"Removing file: ($file_path)"
SUDO rm $file_path
} else {
log_debug "File not found: ($file_path)"
}
}

log_info "System-wide settings configuration completed."
}


export def configure_mecha_connect_desktop_file [] {
log_info "Configuring Mecha Connect desktop entry:"
let rootfs_dir = $env.ROOTFS_DIR

# Create mecha-connect.desktop file
let desktop_file_path = $rootfs_dir + "/usr/share/applications/org.mecha.connect.desktop"
let desktop_file_dir = $rootfs_dir + "/usr/share/applications"

# Remove existing file if it exists
if ($desktop_file_path | path exists) {
log_debug $"Removing existing desktop file: ($desktop_file_path)"
SUDO rm $desktop_file_path
}

let desktop_file_content = '[Desktop Entry]
Type=Application
TryExec=mecha-connect
Exec=mecha-connect
Icon=/usr/share/mechanix/shell/launcher/assets/icons/app_drawer/mecha_connect_icon.png
Terminal=false
Categories=System;
Name=Connect
GenericName=Connect
Comment=Connect app
'

# Create desktop entry file
log_debug $"Writing desktop file to: ($desktop_file_path)"
# Create empty file with sudo
SUDO touch $desktop_file_path
# Write the content
echo $desktop_file_content | SUDO tee $desktop_file_path out> /dev/null
# Set appropriate permissions
SUDO chmod 644 $desktop_file_path
log_debug "Desktop entry created successfully."

log_info "Mecha Connect desktop configuration completed."
}

0 comments on commit 4e536c5

Please sign in to comment.