├── 2020-11-18 01-01-21.mkv ├── README.md ├── app ├── install.py ├── toolbox-desktop-integration.desktop ├── toolbox-desktop-integration.png └── update.py ├── old ├── install-uninstall.sh └── podman-desktop-file-copy-to-user.sh └── translations └── Leia-me (pt-br) /2020-11-18 01-01-21.mkv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realgrm/toolbox-desktop-integration/d57fbc1262c65a5b13735b8ae23d103ee4de6b93/2020-11-18 01-01-21.mkv -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # toolbox-desktop-integration 2 | 3 | # Summary 4 | [Preface](./README.md#Preface) 5 | [Goal](./README.md#Goal) 6 | [Using with podman](./README.md#Using-with-podman) 7 | [Results](./README.md#Results) 8 | [How it works](./README.md#How-it-works) 9 | [Installation](./README.md#Installation) 10 | [Usage](./README.md#Usage) 11 | [Manual Process](./README.md#Manual-Process) 12 | 13 | [![toolbox-desktop-integration_gif](https://user-images.githubusercontent.com/23300290/99897700-9d341300-2c7a-11eb-8a08-34718dc26734.gif)](https://youtu.be/dKwHdcPl0cE) 14 | 15 | # Preface 16 | 17 | Currently, to install something in Silverblue, the main options are (with its main drawbacks): 18 | - rpm-ostree 19 | It have to reboot to login with the image that contains the new installed packages 20 | - flatpak 21 | Many apps are not ported to this format yet 22 | - inside podman container trough toolbox 23 | Is design to install CLI programs and not GUI programs. So when a GUI app is installed, it is not fully integrated to the system. For example: 24 | - there's no app shortcut in the App Grip. In other words, the desktop file is not present in the correct location to be visible 25 | - if you use a different theme from the default, it is ignored 26 | 27 | All the drawbacks listed are my opinion, based on my current use of Silverblue. 28 | 29 | # Goal 30 | This project aims to integrate the toolboxes installed with the desktop, by: 31 | - making avaliable to the host, shortcuts of GUI applications installed inside all toolbox containers 32 | - making these apps run with applied theme by default 33 | 34 | # Using with podman 35 | 36 | ~~Although this was created with toolbox in mind, it was tested with some containers created with podman and it worked the same way.~~ 37 | EDIT: Currently, it only works with the default toolbox 38 | 39 | # Results 40 | 41 | Activities Overview: App is running and the system adds "(on toolbox)" in the title 42 | ![image](https://user-images.githubusercontent.com/23300290/98615310-0ca01f00-22d9-11eb-853a-f9b45b307b42.png) 43 | 44 | Show Applications: App icon in Dash indicates that it is running, however in the App Grid there is no indicator below the icon 45 | ![image](https://user-images.githubusercontent.com/23300290/98615618-d616d400-22d9-11eb-8fce-3e3d3c09ffaa.png) 46 | 47 | Menu Editor: The app shortcut is now visible to menu editors, such as Menulibre 48 | 49 | # How it works 50 | script `install.py` 51 | - Checks if a container is created. If it is: 52 | - Create a desktop file to trigger the `update.py` script 53 | - run the script `update.py` 54 | 55 | 56 | script `update.py` 57 | 58 | - Search for ".desktop" files inside specific folders 59 | - Get overlay_id of these folders 60 | - Create a backup folder inside the app's folder 61 | - Create link in `~/.local/share/applications` 62 | - Create link in `~/.local/share/icons` 63 | - Verify if the desktop file is already modified 64 | - get icon path for the unmodified ones 65 | - create a backup of original desktop file 66 | - save modified content 67 | - Copy themes from `/usr/share/themes` to `~/.themes`, where is visible to all toolboxes 68 | - Update app grid 69 | 70 | # Installation 71 | 72 | To install you can run these comands in terminal: 73 | 74 | ``` 75 | # declaring constants 76 | app_folder="$HOME/.local/scripts/toolbox-desktop-integration/" 77 | github_applink="https://raw.githubusercontent.com/realgrm/toolbox-desktop-integration/main/app/" 78 | 79 | # creating folder where the app will be installed 80 | mkdir -p $app_folder 81 | cd $app_folder 82 | 83 | # downloading the files 84 | wget ${github_applink}install.py 85 | wget ${github_applink}update.py 86 | wget ${github_applink}toolbox-desktop-integration.png 87 | wget ${github_applink}toolbox-desktop-integration.desktop 88 | 89 | # making files executable 90 | chmod +x ${app_folder}/install.py 91 | chmod +x ${app_folder}/update.py 92 | 93 | # runing the installation script 94 | ${app_folder}install.py 95 | ``` 96 | # Usage 97 | 98 | When the `install.py` is executed: 99 | - automatically the script `update.py` is also executed, so your GUI apps installed from toolbox should appear ins the app grid (may takes a few seconds to update the icon in the app grid) 100 | - it creates an shortcut in AppGrid called Update toolbox, that can run the script `update.py` again. 101 | ![image](https://user-images.githubusercontent.com/23300290/99393880-c2accf80-28bc-11eb-8815-8b063d499fb7.png) 102 | 103 | So every time you install a GUI app inside a toolbox, you can use this shortcut. 104 | 105 | # Manual Process 106 | 107 | The manual process below was used as the basis to the creation of these scripts. It is an example. 108 | 109 | It is avaliable here if someone wishes to do the work manually instead of using scripts. 110 | 111 | ## Make shortcut from toolbox avaliable to the host 112 | Action: make a copy of the desktop file and icon to the home folder: 113 | 114 | | Description | Copy (container) | Paste (Silverblue) | 115 | |- |- |- | 116 | | Desktop File Location | `~/.local/share/containers/storage/overlay/{overlay-id}/diff/usr/share/applications/blender.desktop` | `~/.local/share/applications/toolbox-blender.desktop` | 117 | | Icon File Location | `~/.local/share/containers/storage/overlay/{overlay-id}/diff/usr/share/icons/hicolor/scalable/apps/blender.svg` | `~/.local/share/icons/hicolor/scalable/apps/toolbox/blender.svg` | 118 | 119 | Replace {overlay-id} with the folder created to your container. Mine was "d0ed434fec06789afb233cd607dee2572efe8f30bf816c7edddc9372b4bd668f" folder. 120 | I discover the correct folder by installing an app and searching for the app's desktop file inside `~/.local/share/containers/storage/overlay/` 121 | 122 | ## Make the shortcut point to the correct executable 123 | Action: Edit the content of `~/.local/share/applications/toolbox-blender.desktop`: 124 | 125 | | Description | Before (container) | After (Silverblue) | 126 | |- |- |- | 127 | | Name Line | Name=Blender | Name=Blender (container) | 128 | | Exec Line | Exec=blender% f | Exec=toolbox run blender% f | 129 | 130 | ## Make app from toolbox to use applied theme 131 | Action: Copy the themes from `/usr/share/thems` to `~/.themes` s 132 | -------------------------------------------------------------------------------- /app/install.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from pathlib import Path 4 | import os 5 | import subprocess 6 | import sys 7 | 8 | # _______________________________________________________________ 9 | 10 | # declaring some inicial variables 11 | 12 | # folder of this script 13 | app_folder=os.path.dirname(os.path.realpath(__file__)) 14 | 15 | c_overlay=os.environ['HOME']+"/.local/share/containers/storage/overlay" 16 | 17 | # _______________________________________________________________ 18 | 19 | # -----------------------Auxiliar functions--------------------- 20 | 21 | # _______________________________________________________________ 22 | 23 | def msg_show_title(): 24 | print("_____________________") 25 | print("_____________________") 26 | print("\nINSTALL DESKTOP FILES SCRIPT") 27 | print("_____________________") 28 | print("_____________________") 29 | 30 | def msg_container_nok(): 31 | print("\nContainer not found.\nCreate one with the command \"toolbox create\" in the terminal") 32 | 33 | # _______________________________________________________________ 34 | 35 | # ---------------------------Main code--------------------------- 36 | 37 | # _______________________________________________________________ 38 | msg_show_title() 39 | 40 | #check if a container is created 41 | if not Path(c_overlay).is_dir(): 42 | sys.exit(msg_container_nok()) 43 | 44 | # create a shortcut in app grip for update desktop files 45 | desktop_localshare=os.environ['HOME']+"/.local/share/applications/toolbox-desktop-integration.desktop" 46 | 47 | desktop_appfolder=app_folder+"/toolbox-desktop-integration.desktop" 48 | fileHandler = open(desktop_appfolder, "r") 49 | replaced_content = "" 50 | 51 | # _______________________________________________________________ 52 | 53 | # adapt file to the user directory 54 | for line in fileHandler: 55 | 56 | line = line.strip() 57 | new_line=line 58 | 59 | # _______________________________________________________________ 60 | 61 | if line.startswith("Exec="): 62 | if "bash" in line: break 63 | else: 64 | new_line = line.replace("Exec=","Exec=bash -c 'cd "+app_folder) 65 | 66 | elif line.startswith("Icon="): 67 | new_line = line.replace("Icon=", "Icon="+app_folder+"/") 68 | 69 | replaced_content = replaced_content + new_line + "\n" 70 | 71 | 72 | fileHandler.close() 73 | 74 | #copy desktop file in .local/share 75 | sts = subprocess.Popen("cp" + " -n '"+desktop_appfolder+"' '"+desktop_localshare+"'", shell=True).wait() 76 | 77 | #update the adapted version in .local/share 78 | write_file = open(desktop_localshare, "w") 79 | write_file.write(replaced_content) 80 | write_file.close() 81 | print("\n") 82 | 83 | 84 | print("desktop file placed in: \n"+desktop_localshare) 85 | print("\n") 86 | 87 | 88 | # _______________________________________________________________ 89 | 90 | # start the main script 91 | import importlib 92 | foobar = importlib.import_module("update") -------------------------------------------------------------------------------- /app/toolbox-desktop-integration.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.1 3 | Type=Application 4 | Name=Update toolbox 5 | Comment=Update toolbox integration with desktop 6 | Icon=toolbox-desktop-integration.png 7 | Exec= && ./update.py;$SHELL' 8 | Terminal=true 9 | Actions= 10 | Categories=Utility; 11 | -------------------------------------------------------------------------------- /app/toolbox-desktop-integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realgrm/toolbox-desktop-integration/d57fbc1262c65a5b13735b8ae23d103ee4de6b93/app/toolbox-desktop-integration.png -------------------------------------------------------------------------------- /app/update.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | from pathlib import Path 5 | import shutil 6 | import subprocess 7 | import sys 8 | 9 | # _______________________________________________________________ 10 | 11 | # declaring some inicial variables 12 | 13 | # folder of this script 14 | app_folder=os.path.dirname(os.path.realpath(__file__)) 15 | 16 | usrshare=os.environ['HOME']+"/.local/share" 17 | c_overlay=os.environ['HOME']+"/.local/share/containers/storage/overlay" 18 | c_usrshare="diff/usr/share" 19 | print(app_folder) 20 | backups_folder=app_folder+"/applications_backup" 21 | 22 | 23 | # _______________________________________________________________ 24 | 25 | # -----------------------Auxiliar functions--------------------- 26 | 27 | # _______________________________________________________________ 28 | 29 | #Print title of the script 30 | def msg_title(): 31 | print("_____________________") 32 | print("_____________________") 33 | print("\nUPDATE DESKTOP FILES SCRIPT") 34 | print("_____________________") 35 | print("_____________________") 36 | print("") 37 | 38 | def msg_title_symlink(): 39 | print("\n_____________________") 40 | print("\nVERIFYING SYMLINKS") 41 | print("_____________________\n") 42 | 43 | def msg_title_summary(): 44 | print("\n\n_____________________") 45 | print("\nSUMMARY") 46 | print("_____________________\n") 47 | 48 | def msg_verifying_files(): 49 | print("\n_____________________") 50 | print("\nVERIFYING FILES") 51 | print("_____________________\n") 52 | 53 | def msg_link_created(click,havetolink): 54 | print("created symlink:\n" \ 55 | +click+"\n\nthat redirects to:\n" \ 56 | +havetolink+"\n") 57 | 58 | 59 | def msg_link_ok(click,linksto): 60 | print("all ok, symlink already exists:\n" \ 61 | +click+"\n\nit redirects to:\n" \ 62 | +linksto+"\n") 63 | 64 | 65 | def msg_link_nok(click,linksto,havetolink): 66 | print("can't create symlink, because another symlink already exists:\n" \ 67 | +click+"\n\nit redirects to:\n" \ 68 | +linksto+"\n\nit shoud be:\n" \ 69 | +havetolink+"\n") 70 | 71 | 72 | def msg_file_nok(click): 73 | print("can't create symlink, because file/folder already exists\n" \ 74 | +click+"\n\nplease delete (with backup?) or rename it, then try again.") 75 | 76 | 77 | def msg_container_nok(): 78 | print("Container not found.\n \ 79 | Create one with the command \"toolbox create\" in the terminal") 80 | 81 | 82 | def msg__invalid_link(click,linksto,havetolink): 83 | print("deleted link:\n" \ 84 | +click+"\n\n \ 85 | it was redirecting to a non existing location:\n" \ 86 | +linksto \ 87 | +"\n\nnow it redirects to:\n" \ 88 | +havetolink) 89 | 90 | 91 | def msg_backup(backup_folder): 92 | print("\nbackup of file created in:\n"+backup_folder+"\n") 93 | 94 | 95 | # to show debug info 96 | def msg_debug(click,linksto,havetolink): 97 | print("\n_____________________") 98 | print("debug locations:") 99 | print("where do i click (exists: "+str(Path(click).exists())+" is symlink: "+str(Path(click).is_symlink())+")\n"+click) 100 | print("have to link:\n"+havetolink) 101 | print("currently links to:\n"+linksto) 102 | print("click=link: "+str(click==linksto)) 103 | print("link ok: "+str(havetolink==linksto)) 104 | print("_____________________\n") 105 | 106 | #all symlinks 107 | def msg_symlink_list(symlink_list): 108 | symlink_list=sorted(list(dict.fromkeys(symlink_list))) 109 | print("all symlink ("+str(len(symlink_list))+"):\n") 110 | 111 | for i in symlink_list: 112 | print(str(i)) 113 | 114 | # symlinks with errors 115 | def msg_symlink_l_nok(symlink_l_nok): 116 | print("_____________________") 117 | symlink_l_nok=sorted(list(dict.fromkeys(symlink_l_nok))) 118 | print("\nsymlink with error ("+str(len(symlink_l_nok))+"):\n") 119 | 120 | for i in symlink_l_nok: 121 | print(str(i)) 122 | 123 | #show all desktop files 124 | def msg_all_desktop(all_files): 125 | print("_____________________") 126 | print("\nall .desktop files from toolbox folder ("+str(len(all_files))+"):\n") 127 | 128 | for i in all_files: 129 | print(str(i)) 130 | 131 | 132 | #show all desktop files that needs to be altered 133 | def msg_desktop(files_nok): 134 | print("_____________________") 135 | print("\ndesktop files changed ("+str(len(files_nok))+"):\n") 136 | 137 | for i in files_nok: 138 | print(str(i)) 139 | 140 | 141 | #show changes in each line 142 | def msg_changes(line,new_line): 143 | if not new_line==line: 144 | print(line+" [old]") 145 | print(new_line+" [new]") 146 | 147 | 148 | def msg_search_icon_svg(icon_name,icons_folder): 149 | print("\nSearching for icon \""+icon_name+"\" in: \n"+ icons_folder) 150 | print("\nSearching for svg file") 151 | 152 | 153 | # show messages about icon 154 | def msg_user_icon(icon, icons, string): 155 | print("\n"+string+ " found (" +str(len(icons))+") and its size:") 156 | print(icons) 157 | print("\nchosen icon (larger): ") 158 | print(str(icon)+"\n") 159 | 160 | # _______________________________________________________________ 161 | 162 | # ---------------------------Functions--------------------------- 163 | 164 | # _______________________________________________________________ 165 | 166 | # get size of file 167 | def file_size(fname): 168 | info = os.stat(fname) 169 | return float(info.st_size) 170 | 171 | 172 | #create backup 173 | def backup(desktopfile,backup_folder): 174 | 175 | if not Path(backup_folder).exists(): 176 | os.makedirs(backup_folder) 177 | if not Path(backup_folder+"/"+desktopfile.name).exists(): 178 | shutil.copy(desktopfile,backup_folder) 179 | msg_backup(backup_folder) 180 | 181 | 182 | # Create links 183 | def create_link(click,havetolink): 184 | global symlink_l_nok 185 | symlink_l_nok=[] 186 | linksto=str(Path(click).resolve()) 187 | 188 | try: 189 | os.symlink(havetolink, click) 190 | msg_link_created(click,havetolink) 191 | 192 | except: 193 | if Path(click).is_symlink(): 194 | if not Path(click).exists(): 195 | os.remove(click) 196 | os.symlink(havetolink, click) 197 | msg__invalid_link(click,linksto,havetolink) 198 | elif havetolink==linksto: 199 | msg_link_ok(click,linksto) 200 | else: 201 | msg_link_nok(click,linksto,havetolink) 202 | symlink_l_nok.append(click) 203 | else: 204 | msg_file_nok(click) 205 | symlink_l_nok.append(click) 206 | 207 | #uncomment line below to show more info 208 | #msg_debug(click,linksto,havetolink) 209 | 210 | 211 | 212 | # Verify if desktop file is ok 213 | def desktopfileok(desktopfile): 214 | global f 215 | with open(desktopfile,"r") as f: 216 | if "Exec=toolbox run" in f.read(): 217 | f.close 218 | return True 219 | 220 | 221 | 222 | # getting icon path 223 | def icon_path(usrshare,desktopfile,line): 224 | 225 | icons_folder=str(desktopfile.parent).replace("applications","icons") 226 | icons={} 227 | icon_name=line[len("Icon="):] 228 | 229 | #if no icon is specified, jump this step 230 | if icon_name=="": 231 | return line 232 | 233 | # Check if it's there a svg file (prefer) 234 | for icon in Path(icons_folder).glob('**/'+icon_name+'.*'): 235 | if str(icon).rsplit(".",1)[1]=="svg": 236 | return "Icon="+str(icon) 237 | elif str(icon).rsplit(".",1)[1]=="png": 238 | icons[icon]=file_size(icon) 239 | 240 | # if found, get the larger icon from the list 241 | if len(icons)>0: 242 | icon=max(icons, key=icons.get) 243 | msg_user_icon(icon,icons,"svg icons") 244 | return "Icon="+str(icon) 245 | 246 | else: 247 | print("\nIcon not found. Try to edit the desktop file manually later") 248 | return line 249 | # _______________________________________________________________ 250 | 251 | # ---------------------------Main code--------------------------- 252 | 253 | # _______________________________________________________________ 254 | 255 | all_files=[] 256 | files_nok=[] 257 | symlink_list=[] 258 | symlink_l_nok=[] 259 | 260 | 261 | msg_title() 262 | 263 | 264 | 265 | 266 | #get ids of folders that contains desktop files 267 | for o_id in os.listdir(c_overlay): 268 | for desktopfile in \ 269 | Path(c_overlay+"/"+o_id+"/") \ 270 | .glob(c_usrshare+"/applications/"+"*.desktop"): 271 | 272 | msg_title_symlink() 273 | all_files.append(desktopfile.name) 274 | 275 | #create links to folders 276 | create_link(usrshare+"/applications/toolbox_"+o_id[:4], \ 277 | str(desktopfile).rsplit("/",1)[0]) 278 | 279 | symlink_list.append(usrshare+"/applications/toolbox_"+o_id[:4]) 280 | 281 | create_link(usrshare+"/icons/toolbox_"+o_id[:4], \ 282 | str(desktopfile).rsplit("/",1)[0] \ 283 | .replace("applications","icons")) 284 | 285 | symlink_list.append(usrshare+"/icons/toolbox_"+o_id[:4]) 286 | 287 | #create bakup folder 288 | backup(desktopfile, 289 | backups_folder+"/toolbox_"+o_id[:4]+"\n") 290 | 291 | msg_verifying_files() 292 | folder_name=str(desktopfile.parents[1]) 293 | print("folder:\n"+folder_name) 294 | 295 | 296 | if desktopfileok(desktopfile)==True: 297 | print("\nfile ok:\n"+desktopfile.name) 298 | else: 299 | f=open(desktopfile,"r") 300 | files_nok.append(desktopfile.name) 301 | 302 | # _______________________________________________________________ 303 | 304 | # Configure all lines desktop files in the list 305 | 306 | icons={} 307 | 308 | print("\nchanging file content:\n"+desktopfile.name+"\n") 309 | 310 | 311 | 312 | replaced_content = "" 313 | 314 | #looping through the file 315 | for line in f: 316 | 317 | line = line.strip() 318 | new_line=line 319 | 320 | # _______________________________________________________________ 321 | 322 | # checking and changing line 323 | 324 | if line.startswith("Exec="): 325 | new_line = line.replace("Exec=","Exec=toolbox run ") 326 | msg_changes(line,new_line) 327 | 328 | elif line.startswith("Name="): 329 | new_line = line+" (container)" 330 | msg_changes(line,new_line) 331 | 332 | elif line.startswith("DBusActivatable=true"): 333 | new_line = line.replace("DBusActivatable=true", "DBusActivatable=false") 334 | msg_changes(line,new_line) 335 | 336 | elif line.startswith("Icon="): 337 | new_line=icon_path(usrshare,desktopfile,line) 338 | msg_changes(line,new_line) 339 | 340 | replaced_content = replaced_content + new_line + "\n" 341 | 342 | f.close() 343 | 344 | # _______________________________________________________________ 345 | 346 | #save file 347 | with open(desktopfile,"w") as f: 348 | f.write(replaced_content) 349 | f.close() 350 | 351 | print("\n") 352 | 353 | 354 | # _______________________________________________________________ 355 | 356 | # making themes avaliable to toolbox, since it has access to home folder 357 | 358 | sts = subprocess.Popen("cp -r /usr/share/themes/* $HOME/.themes/", shell=True).wait() 359 | 360 | 361 | # show messages to user 362 | msg_title_summary() 363 | msg_symlink_list(symlink_list) 364 | msg_symlink_l_nok(symlink_l_nok) 365 | msg_all_desktop(all_files) 366 | msg_desktop(files_nok) 367 | 368 | #try to update apps in App Grid 369 | sts = subprocess.Popen("update-desktop-database ~/.local/share/applications", shell=True).wait() 370 | 371 | -------------------------------------------------------------------------------- /old/install-uninstall.sh: -------------------------------------------------------------------------------- 1 | # -----Install----- 2 | 3 | # Create folder and copy scripts 4 | mkdir ~/.podman-desktop-file-copy-to-user 5 | cp file1 ~/.podman-desktop-file-copy-to-user 6 | cp file2 ~/.podman-desktop-file-copy-to-user 7 | 8 | # Make aliases to run scripts 9 | alias script-install-app "sudo dnf install" 10 | alias script-remove-app 11 | alias script-remove-script 12 | 13 | # -----Uninstall----- 14 | 15 | # Remove folder created folder 16 | 17 | # Remove created aliases 18 | 19 | 20 | 21 | #!/bin/bash 22 | 23 | # manual input of folder 24 | overlay_id="d0ed434fec06789afb233cd607dee2572efe8f30bf816c7edddc9372b4bd668f" 25 | 26 | # get toolbox id 27 | toolbox_id=$(toolbox list | grep running | awk '{print $1}') 28 | 29 | echo "$toolbox_id" 30 | echo "$overlay_id" 31 | test="${HOME}/.local/share/applications/toolbox-${toolbox_id}" 32 | 33 | # create backup 34 | mv "${HOME}/.local/share/containers/storage/overlay/${overlay_id}/diff/usr/share/applications" \ 35 | "${HOME}/.local/share/containers/storage/overlay/${overlay_id}/diff/usr/share/applications-backup" 36 | 37 | # create folder inside applications (host) to current toolbox 38 | mkdir "${HOME}/.local/share/applications/toolbox-${toolbox_id}" 39 | 40 | # create symbolic link 41 | ln -s "${HOME}/.local/share/applications/toolbox-${toolbox_id}" \ 42 | "${HOME}/.local/share/containers/storage/overlay/${overlay_id}/diff/usr/share/applications" 43 | 44 | # copy contents of the backup 45 | cp "${HOME}/.local/share/containers/storage/overlay/${overlay_id}/diff/usr/share/applications-backup/." \ 46 | "${HOME}/.local/share/applications/toolbox-${toolbox_id}" 47 | 48 | alias install 49 | -------------------------------------------------------------------------------- /old/podman-desktop-file-copy-to-user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Método proposto: 4 | # OBS: Isto é um esboço, não seguindo a linguagem 5 | 6 | # variáveis iniciais 7 | container_id="d0ed434fec06789afb233cd607dee2572efe8f30bf816c7edddc9372b4bd668f" 8 | container_path="${HOME}/.local/share/containers/storage/overlay/${container_id}/" 9 | desktop_source_path="${container_path}/diff/usr/share/applications/" 10 | desktop_destination_path="${HOME}/.local/share/applications/" 11 | icon_path="container_path/diff/usr/share/icons/hicolor/scalable/apps/" 12 | 13 | 14 | # ------Detectar novo programa instalado------ 15 | # Verificar quando houver um novo arquivo em dektop_source_path 16 | # TRUE: Verificar arquivos com data de modificação nos últimos 5 minutos e guardar nome com extensão em desktop_source_name_ext_list 17 | # OBS: 5 minutos pode ser alterado, escolhido valor alto, para caso sejam criados ou colados mais de um arquivo ao mesmo tempo e caso o script demore até 5min a ser acionado 18 | 19 | # Para cada desktop_source_name_ext em desktop_source_name_ext_list 20 | 21 | 22 | # verificar se termina com .desktop 23 | # TRUE: verificar se já existe sua cópia em desktop_destination 24 | # TRUE: Verificar próximo 25 | # FALSE: Executar função copy_desktop_file 26 | # FALSE: verificar próximo 27 | 28 | # ------Alternativa: escolher arquivo manualmente------ 29 | 30 | # Abrir pasta origem 31 | ls -o -tr ${desktop_source_path} | grep ".*\.desktop$" | awk '{print $5.$6,$7,$8}' | tail -15 32 | echo "Últimos 15 alterados, copie e cole aqui o nome com extensão:" 33 | #read desktop_filename 34 | desktop_filename="firefox.desktop" 35 | #xdg-open "${desktop_source_path}${desktop_filename}" 36 | 37 | 38 | # ------Função copy_desktop_file------ 39 | 40 | # copiar para aplicações do usuário 41 | desktop_destination_file="${desktop_destination_path}toolbox-${desktop_filename}" 42 | cp "${desktop_source_path}${desktop_filename}" "${desktop_destination_file}" 43 | 44 | echo "${desktop_source_path}" 45 | 46 | # Comando de execução 47 | 48 | before="Exec=" 49 | after="Exec=toolbox run " 50 | 51 | sed -i "s|${before}|${after}|g" ${desktop_destination_file} 52 | 53 | # Caminho para o ícone 54 | 55 | before="Icon=" 56 | after="Icon=${icon_path}" 57 | 58 | sed -i "s|${before}|${after}|g" ${desktop_destination_file} 59 | 60 | 61 | # ------Fim da função------ 62 | -------------------------------------------------------------------------------- /translations/Leia-me (pt-br): -------------------------------------------------------------------------------- 1 | #podman-desktop-file-copy-to-user 2 | 3 | ### !! EM CONSTRUÇÃO !! 4 | 5 | ## Prefácio 6 | 7 | Atualmente, para instalar algo no Fedora Silverblue, as principais opções são (com suas respectivas principais desvantagens): 8 | - rpm-ostree 9 | Para utilizar o programa recém instalado, é necessário reiniciar para utilizar a nova imagem do sistema com os pacotes recém adicionados inclusos 10 | - flatpak 11 | Muitos aplicativos ainda não foram portados para este formato 12 | - dentro de un contêiner do podman usando a toolbox 13 | Eles foram feitos para instalar programas em CLI (terminal) e não aplicativos gráficos (GUI). Portanto, quando instalado um aplicativo em GUI, ele não fica totalmente integrado só sistema. Como por exemplo os atalhos (arquivo desktop), não ficam visíveis ao sistema hospedeiro, portanto o aplicativo não aparece na grade de aplicativos 14 | 15 | Esta página 16 | So this page shows the manual steps taken to minimally integrate the desktop file with Silverblue. 17 | And aims to create some way of doing it automatically. 18 | The manual steps were tested with a few different apps, and in all of them, there was only one toolbox created. 19 | 20 | All the drawbacks listed are my opinion, based on my current use of Silverblue. 21 | 22 | ## Objetivo 23 | Criar um script que automatize a criação de um atalho (arquivo desktop) na máquina real sempre que for instalado um programa novo no Fedora Silverblue através do toolbox (podman). 24 | Será utilizado o processo manual abaixo como base. 25 | 26 | 27 | ## Processo Manual 28 | Pesquisando, descobri que os conteiners da toolbox (podman) ficam em: 29 | ~/.local/share/containers 30 | 31 | Então instalei o blender na toolbox para fazer um teste. Verifiquei que os locais de destino são os seguintes: 32 | 33 | - Pasta do arquivo desktop: 34 | ~/.local/share/containers/storage/overlay/d0ed434fec06789afb233cd607dee2572efe8f30bf816c7edddc9372b4bd668f/diff/usr/share/applications/blender.desktop 35 | 36 | - Pasta do ícone: 37 | ~/.local/share/containers/storage/overlay/d0ed434fec06789afb233cd607dee2572efe8f30bf816c7edddc9372b4bd668f/diff/usr/share/icons/hicolor/scalable/apps/blender.svg 38 | 39 | - Então copiei o arquivo desktop renomeando para: 40 | ~/.local/share/applications/toolbox-blender.desktop 41 | 42 | No conteúdo do arquivo, modifiquei: 43 | 44 | - A linha do nome do aplicativo 45 | De: Name=Blender 46 | Para: Name=Blender (container) 47 | 48 | - A linha do comando de execução 49 | De: Exec=blender %f 50 | Para: Exec=toolbox run blender %f 51 | 52 | - A linha de definição de ícone: 53 | De: Icon=blender 54 | Para: Icon=/home/realgrm/Documents/Links/Fedora Container/usr/share/icons/hicolor/scalable/apps/blender.svg 55 | (Tem que ser especificado o caminho completo. A notação ~/ para a pasta do usuário não funciona aqui) 56 | 57 | 58 | OBS: As strings abaixo são específicas da minha instalação pode ser diferente para você: 59 | - "realgrm": nome do usuário 60 | - "d0ed434fec06789afb233cd607dee2572efe8f30bf816c7edddc9372b4bd668f": pasta criada pelo podman pra guardar os arquivos de um contêiner específico criado na minha in 61 | 62 | ## Imagens 63 | 64 | #### Arquivo Origem: 65 | ![desktop_source](https://user-images.githubusercontent.com/23300290/98545368-252a1e00-2274-11eb-8380-f3c894af5df0.png) 66 | 67 | #### Arquivo Destino: 68 | ![desktop_destination](https://user-images.githubusercontent.com/23300290/98545365-24918780-2274-11eb-8053-0851b496abdc.png) 69 | 70 | #### Menu Libre: 71 | ![image](https://user-images.githubusercontent.com/23300290/98615903-6f45ea80-22da-11eb-84a4-cd5f2c7e72cd.png) 72 | 73 | #### Overview: 74 | Aplicação rodando e aparecendo na Dash 75 | ![image](https://user-images.githubusercontent.com/23300290/98615310-0ca01f00-22d9-11eb-853a-f9b45b307b42.png) 76 | 77 | #### Show Applications: 78 | Aplicação na Dash indica que está rodando, porém nas Grade de aplicativos não aparece indicador abaixo do ícone 79 | ![image](https://user-images.githubusercontent.com/23300290/98615618-d616d400-22d9-11eb-8fce-3e3d3c09ffaa.png) 80 | 81 | --------------------------------------------------------------------------------