hicon - Criador de ícones desktop e aplicações do Gnome

Publicado por henrique (última atualização em 30/01/2023)

[ Hits: 2.434 ]

Homepage: https://mrh-ofici.github.io/

Download hicon.py




Ele cria um arquivo desktop e salva na área de trabalho e na pasta de aplicações para que ele seja exibido como app, mas isso é opcional. Como foco ele cria o arquivo que serviria como um link.

  



Esconder código-fonte

#!/bin/python

# by: mrh

from os import system; from colorama import Fore
print('-' * 65)
print(Fore.LIGHTBLUE_EX + """
         ____ ____ ____ ____ ____ 
        ||H |||i |||c |||o |||n ||
        ||__|||__|||__|||__|||__||
        |/__\|/__\|/__\|/__\|/__\|

The creator of Application and desktop entrances for gnome
""")
#make file
def file(filename, name):

    command = input('Command: ')
    terminal = input('Terminal[Y or N]: ')
    notification = input('Notification[Y or N]: ')
    icon = input('Icon: ')
    path = input('Path[Y orn N]: ')
    file = open(filename, "w")
    file.write("#!/usr/bin/env xdg-open" + "\n\n")
    file.write("[Desktop Entry]" + "\n\n")
    file.write("Version=1.0" + "\n")
    file.write("Type=Application" + "\n")
    file.write("Name=" + name + "\n")
    file.write("Exec=" + command + "\n")
    if 'y' in path or 'Y' in path:
        path1 = input('The office Directory: ')
        file.write("Path=" + path1 + "\n")
    if 'y' in notification or 'Y' in notification:
        file.write("StartupNotify=true" + "\n")
    if 'n' in notification or 'N' in notification:
        file.write("StartupNotify=false" + "\n")
    if 'N' or 'n' in terminal:
        file.write("Terminal=false" + "\n")
    if 'Y' or 'y' in terminal:
        file.write("Terminal=true" + "\n")
    file.write("Icon=" + icon + "\n")

    file.close()

#move it for the directory of exibition
def move(filename):
    system("sudo chmod +x " + filename)
    application = input('Application[Y or N]: ')
    desktop = input('Desktop[Y or N]: ')
    if 'Y' in desktop or 'y' in desktop:
        system("sudo cp " + filename + " ~/Desktop/")
    if 'Y' or 'y' in application:
        system("sudo cp " + filename + " /usr/share/applications")
    system('rm ' + filename)
#execute
def main():
    try:
        name = input('Name: ')

        filename = f"{name}.desktop"

        file(filename, name)
        move(filename)
    except Exception as e:
        print(e)


if __name__ == '__main__':
    main()
    print(Fore.RESET + '-' * 65)
                                

Scripts recomendados

Juntando tabelas em aquivo texto

Expressão regular com input STDIN

tar7z

Le um arquivo e exibe na tela

Manipulação de arquivos CSV - OO


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts