linux上如何创建软件快捷方式图标显示

2023-07-09 09:24 综合百科 0阅读 投稿:小七

首先描述下我的环境, 喜欢折腾着玩,所以我的电脑上装了3个系统,分别是ubuntu22.04, opensuse 15.5, manjora 三个操作系统,平时基本上换着用。这3个系统分别使用独立的根分区/ 和 /root分区, 但挂载同一个数据分区 /u01(存放数据文件和软件等)

这3个操作系统上都装上了我平时经常使用的软件,像libreoffice,typora等。

之前, 需要分别在ubuntu上安装软件的deb版本, 在opensuse上安装软件的rpm版本, 在manjaro上安装软件的二进制版本。

后来发现很多linux软件有appimage版本,不需安装就能运行。 例如 navicat , 也有的软件只要解压就可以运行,例如 idea。

所以, 我就开始摒弃rpm/deb 版本 ,转而下载appimage和二进制压缩包了, 这样只要在 /usr/share/applications 中按照格式创建 .desktop文件,开始菜单中就有对应的图标了,打开就是执行,非常方便。

这样就不用分别为3个系统安装deb/rpm/binary包了。 只需要写好脚本,安装完操作系统,运行下脚本,分别为软件创建.desktop就行了。

大部分.desktop文件是大同小异,主要的就2项,一个是程序的路径, 一个是程序的图标。为了和rpm/deb安装效果一样, 我参考了rpm/deb安装生成的 .desktop文件内容, 并从appimage中提取了原版的图标。写下了下面的创建脚本, 供大家参考。

分三部分,分别是libreoffice, appimage软件, 二进制压缩包软件。

linux上如何创建软件快捷方式图标

linux上如何创建appimage软件快捷方式


linux上如何创建二进制包软件快捷方式图标

libreoffice

libreoffice软件包含了writer,calc,math,impress ,base,draw等等, 分别对应office中的word,excel,powerpoint ,access,viso 等软件。还有math(公式编辑器) 没有对应的office产品,libreoffice相当于入口。所以一共要创建7个快捷方式。

写法稍微复杂,单独列出来。ubuntu22.04/opensuse 15.5 /manjaro均测试通过

#libreofficecat > /usr/share/applications/libreoffice-startcenter.desktop <<EOF[Desktop Entry]Version=7.5.2.2Terminal=falseNoDisplay=falseIcon=libreoffice-startcenterType=ApplicatiOnCategories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other;Exec=/u01/3.software/3.crossplatfrom/office/LibreOffice-7.5.2.2.standard-x86_64.AppImage %UMimeType=application/vnd.openofficeorg.extension;x-scheme-handler/vnd.libreoffice.cmis;x-scheme-handler/vnd.sun.star.webdav;x-scheme-handler/vnd.sun.star.webdavs;x-scheme-handler/vnd.libreoffice.command;x-scheme-handler/ms-word;x-scheme-handler/ms-powerpoint;x-scheme-handler/ms-excel;x-scheme-handler/ms-visio;x-scheme-handler/ms-access;Name=LibreOfficeGenericName=OfficeComment=The office productivity suite compatible to the open and standardized ODF document format. Supported by The Document Foundation.StartupNotify=trueX-GIO-NoFuse=trueStartupWMClass=libreoffice-startcenterX-KDE-Protocols=file,*** Action Writer]Name=WriterExec=libreoffice --writer[Desktop Action Calc]Name=CalcExec=libreoffice --calc[Desktop Action Impress]Name=ImpressExec=libreoffice --impress[Desktop Action Draw]Name=DrawExec=libreoffice --draw[Desktop Action Base]Name=BaseExec=libreoffice --base[Desktop Action Math]Name=MathExec=libreoffice --mathEOFcat > /usr/share/applications/libreoffice-writer.desktop <<EOF[Desktop Entry]Version=7.5.2.2Terminal=falseIcon=libreoffice-writerType=ApplicatiOnCategories=Office;WordProcessor;Exec=/u01/3.software/3.crossplatfrom/office/LibreOffice-7.5.2.2.standard-x86_64.AppImage --writer %UMimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.oasis.opendocument.text-master-template;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/msword;application/vnd.ms-word;application/x-doc;application/x-hwp;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.lotus-wordpro;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroEnabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroEnabled.12;application/vnd.ms-works;application/vnd.stardivision.writer-global;application/x-extension-txt;application/x-t602;text/plain;application/vnd.oasis.opendocument.text-flat-xml;application/x-fictionbook+xml;application/macwriteii;application/x-aportisdoc;application/prs.plucker;application/vnd.palm;application/clarisworks;application/x-sony-bbeb;application/x-abiword;application/x-iwork-pages-sffpages;application/x-mswrite;application/x-starwriter;Name=LibreOffice WriterGenericName=Word ProcessorComment=Create and edit text and graphics in letters, reports, documents and Web pages by using Writer.StartupNotify=trueX-GIO-NoFuse=trueKeywords=Text;Letter;Fax;Document;OpenDocument Text;Microsoft Word;Microsoft Works;Lotus WordPro;OpenOffice Writer;CV;odt;doc;docx;rtf;InitialPreference=5StartupWMClass=libreoffice-writerX-KDE-Protocols=file,*** Action NewDocument]Name=New DocumentIcon=document-newExec=libreoffice --writerEOFcat > /usr/share/applications/libreoffice-calc.desktop <<EOF[Desktop Entry]Version=7.5.2.2Terminal=falseIcon=libreoffice-calcType=ApplicatiOnCategories=Office;Spreadsheet;Exec=/u01/3.software/3.crossplatfrom/office/LibreOffice-7.5.2.2.standard-x86_64.AppImage --calc %UMimeType=application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.spreadsheet-template;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/msexcel;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;text/csv;application/x-dbf;text/spreadsheet;application/csv;application/excel;application/tab-separated-values;application/vnd.lotus-1-2-3;application/vnd.oasis.opendocument.chart;application/vnd.oasis.opendocument.chart-template;application/x-dbase;application/x-dos_ms_excel;application/x-excel;application/x-msexcel;application/x-ms-excel;application/x-quattropro;application/x-123;text/comma-separated-values;text/tab-separated-values;text/x-comma-separated-values;text/x-csv;application/vnd.oasis.opendocument.spreadsheet-flat-xml;application/vnd.ms-works;application/clarisworks;application/x-iwork-numbers-sffnumbers;application/x-starcalc;Name=LibreOffice CalcGenericName=SpreadsheetComment=Perform calculations, analyze information and manage lists in spreadsheets by using Calc.StartupNotify=trueX-GIO-NoFuse=trueKeywords=Accounting;Stats;OpenDocument Spreadsheet;Chart;Microsoft Excel;Microsoft Works;OpenOffice Calc;ods;xls;xlsx;InitialPreference=5StartupWMClass=libreoffice-calcX-KDE-Protocols=file,*** Action NewDocument]Name=New SpreadsheetIcon=document-newExec=libreoffice --calcEOFcat > /usr/share/applications/libreoffice-impress.desktop <<EOF[Desktop Entry]Version=7.5.2.2Terminal=falseIcon=libreoffice-impressType=ApplicatiOnCategories=Office;Presentation;Exec=/u01/3.software/3.crossplatfrom/office/LibreOffice-7.5.2.2.standard-x86_64.AppImage --impress %UMimeType=application/vnd.oasis.opendocument.presentation;application/vnd.oasis.opendocument.presentation-template;application/vnd.sun.xml.impress;application/vnd.sun.xml.impress.template;application/mspowerpoint;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.openxmlformats-officedocument.presentationml.slide;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;application/vnd.oasis.opendocument.presentation-flat-xml;application/x-iwork-keynote-sffkey;Name=LibreOffice ImpressGenericName=PresentatiOnComment=Create and edit presentations for slideshows, meeting and Web pages by using Impress.StartupNotify=trueX-GIO-NoFuse=trueKeywords=Slideshow;Slides;OpenDocument Presentation;Microsoft PowerPoint;Microsoft Works;OpenOffice Impress;odp;ppt;pptx;InitialPreference=5StartupWMClass=libreoffice-impressX-KDE-Protocols=file,*** Action NewDocument]Name=New PresentatiOnIcon=document-newExec=libreoffice --impressEOFcat > /usr/share/applications/libreoffice-draw.desktop <<EOF[Desktop Entry]Version=7.5.2.2Terminal=falseIcon=libreoffice-drawType=ApplicatiOnCategories=Office;FlowChart;Graphics;2DGraphics;VectorGraphics;Exec=/u01/3.software/3.crossplatfrom/office/LibreOffice-7.5.2.2.standard-x86_64.AppImage --draw %UMimeType=application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opendocument.graphics-flat-xml;application/vnd.oasis.opendocument.graphics-template;application/vnd.sun.xml.draw;application/vnd.sun.xml.draw.template;application/vnd.visio;application/x-wpg;application/vnd.corel-draw;application/vnd.ms-publisher;image/x-freehand;application/clarisworks;application/x-pagemaker;application/pdf;application/x-stardraw;image/x-emf;image/x-wmf;Name=LibreOffice DrawGenericName=Drawing ProgramComment=Create and edit drawings, flow charts and logos by using Draw.StartupNotify=trueX-GIO-NoFuse=trueKeywords=Vector;Schema;Diagram;Layout;OpenDocument Graphics;Microsoft Publisher;Microsoft Visio;Corel Draw;cdr;odg;svg;pdf;vsd;InitialPreference=5StartupWMClass=libreoffice-drawX-KDE-Protocols=file,*** Action NewDocument]Name=New DrawingIcon=document-newExec=libreoffice --drawEOFcat > /usr/share/applications/libreoffice-base.desktop <<EOF[Desktop Entry]Version=7.5.2.2Terminal=falseIcon=libreoffice-baseType=ApplicatiOnCategories=Office;Database;Exec=/u01/3.software/3.crossplatfrom/office/LibreOffice-7.5.2.2.standard-x86_64.AppImage --base %UMimeType=application/vnd.oasis.opendocument.database;application/vnd.sun.xml.base;Name=LibreOffice BaseGenericName=Database DevelopmentComment=Manage databases, create queries and reports to track and manage your information by using Base.StartupNotify=trueX-GIO-NoFuse=trueKeywords=Data;SQL;InitialPreference=5StartupWMClass=libreoffice-baseX-KDE-Protocols=file,*** Action NewDocument]Name=New DatabaseIcon=document-newExec=libreoffice --baseEOFcat > /usr/share/applications/libreoffice-math.desktop <<EOF[Desktop Entry]Version=7.5.2.2Terminal=falseNoDisplay=falseIcon=libreoffice-mathType=ApplicatiOnCategories=Office;Math;Exec=/u01/3.software/3.crossplatfrom/office/LibreOffice-7.5.2.2.standard-x86_64.AppImage --math %UMimeType=application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math;application/vnd.oasis.opendocument.formula-template;text/mathml;application/mathml+xml;Name=LibreOffice MathGenericName=Formula EditorComment=Create and edit scientific formulas and equations by using Math.StartupNotify=trueX-GIO-NoFuse=trueKeywords=Equation;OpenDocument Formula;Formula;odf;MathML;InitialPreference=5StartupWMClass=libreoffice-mathX-KDE-Protocols=file,*** Action NewDocument]Name=New FormulaIcon=document-newExec=libreoffice --mathEOF
声明:若水百科所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系youzivr@vip.qq.com