adding freecad desktop launcher

This commit is contained in:
OddlyTimbot 2024-09-20 12:16:58 -04:00
parent 963f065bfc
commit 925fcf770a
3 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,17 @@
## Software
### FreeCAD
FreeCAD stores config in two places on Ubuntu:
* ~/.config/FreeCAD
* ~/.local/share/FreeCAD
The desktop launcher expects to find FreeCAD in `/home/user/Documents/Software/freecad/RC1/FreeCAD_RC1.AppImage`
Desktop Launcher
To make the appimage show up and launch from the desktop launcher, a .desktop file needs to be created in the location `~/.local/share/applications`
1. Do a git pull into that folder
2. Run the python script that updates all the desktop launcher files to use the current logged-in user

7
freecad.desktop Normal file
View File

@ -0,0 +1,7 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=FreeCAD
Exec=/home/userhere/Documents/Software/freecad/rc1/FreeCAD_RC1.AppImage
Icon=/home/userhere/.local/share/applications/freecad.png
Terminal=false

29
user_updater.py Normal file
View File

@ -0,0 +1,29 @@
import os
import getpass
def replace_word_in_files(target_word, replacement_word, folder_path="."):
# Loop through all files in the specified folder
for filename in os.listdir(folder_path):
if filename.endswith(".desktop"): # Only process text files
file_path = os.path.join(folder_path, filename)
with open(file_path, 'r') as file:
file_content = file.read()
# Replace the target word with the replacement word
new_content = file_content.replace(target_word, replacement_word)
# Write the new content back to the file
with open(file_path, 'w') as file:
file.write(new_content)
print(f"Replaced '{target_word}' with '{replacement_word}' in {filename}")
if __name__ == "__main__":
# Get the current Ubuntu username
username = getpass.getuser()
# Replace 'TARGET_WORD' in all text files with the username
target_word = "userhere"
replace_word_in_files(target_word, username)