AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 672974
Accepted
Fabby
Fabby
Asked: 2015-09-12 07:10:09 +0800 CST2015-09-12 07:10:09 +0800 CST 2015-09-12 07:10:09 +0800 CST

当我更改 .desktop 文件时,为什么启动器中的图标没有变化?

  • 772

我有点像个修补匠,我把最常用的应用程序图标改成了我自己的蒸汽朋克主题。

我无法更改其图标的唯一应用程序是qBitTorrent。

这些.desktop文件的存在只是/usr/share/applications为了让所有用户都可以使用它们,并且~/.local/share/applications/已经过验证不包含任何桌面文件。

任何人都可以阐明为什么会这样吗? (并指导如何更改该图标?)

蒸汽朋克发射器

对于那些不了解 SteamPunk 的人:我想更改丑陋的蓝色图标... ;-)

更多信息:

$ lsattr /usr/share/applications/qBittorrent.desktop
-------------e-- /usr/share/applications/qBittorrent.desktop

$ lsattr /usr/share/pixmaps/Steampunk-Vlc-Audio-Player-Icon-Mkii.png 
-------------e-- /usr/share/pixmaps/Steampunk-Vlc-Audio-Player-Icon-Mkii.png

现在我已经让 qTox 自己运行(在@JacobVlijm 的一点帮助下)并且没有人给我任何关于 qBittorrent 的想法,我正在增加赏金......

笔记:

我不打算使用~/.local/share/applications/覆盖更改图标,而是针对所有用户/usr/share/applications/或任何其他系统范围的设置!

14.04
  • 1 1 个回答
  • 1223 Views

1 个回答

  • Voted
  1. Best Answer
    kos
    2015-09-16T11:41:47+08:002015-09-16T11:41:47+08:00

    问题是 qBittorrent 的.desktop文件根据本地化设置图标:

    sed -n '/^Icon\(\[[^]]*\]\)\?=.*$/p' /usr/share/applications/qBittorrent.desktop
    Icon=qbittorrent
    Icon[be]=qbittorrent
    Icon[cs]=qbittorrent
    Icon[el]=qbittorrent
    Icon[en_GB]=qbittorrent
    Icon[es]=qbittorrent
    Icon[eu]=qbittorrent
    Icon[fi]=qbittorrent
    Icon[gl]=qbittorrent
    Icon[it]=qbittorrent
    Icon[ja]=qbittorrent
    Icon[lt]=qbittorrent
    Icon[nb]=qbittorrent
    Icon[pl]=qbittorrent
    Icon[pt]=qbittorrent
    Icon[pt_BR]=qbittorrent
    Icon[ro]=qbittorrent
    Icon[ru]=qbittorrent
    Icon[sv]=qbittorrent
    Icon[uk]=qbittorrent
    Icon[vi]=qbittorrent
    Icon[zh_TW]=qbittorrent
    Icon[en_AU]=qbittorrent
    

    因此,更改第一个通用Icon=条目设置的图标无济于事:

    截图1

    您必须设置与Icon=当前语言环境匹配的条目;然而,由于通过为每个区域设置完全相同的图标来本地化图标首先是一件非常愚蠢的事情,您最好Icon=通过运行此命令来更改所有条目(它将在 中创建一个qBittorrent.desktop.bak备份文件/usr/share/applications):

    sudo sed -i.bak 's|^Icon\(\[[^]]*\]\)\?=.*$|Icon\1=/path/to/icon|' /usr/share/applications/qBittorrent.desktop
    
    Insert the path to the icon here-------------------^-----------^
    
    user@user-X550CL ~ % sudo sed -i.bak 's|^Icon\(\[[^]]*\]\)\?=.*$|Icon\1=/home/user/icon.png|' /usr/share/applications/qBittorrent.desktop 
    user@user-X550CL ~ % sed -n '/^Icon\(\[[^]]*\]\)\?=.*$/p' /usr/share/applications/qBittorrent.desktop
    Icon=/home/user/icon.png
    Icon[be]=/home/user/icon.png
    Icon[cs]=/home/user/icon.png
    Icon[el]=/home/user/icon.png
    Icon[en_GB]=/home/user/icon.png
    Icon[es]=/home/user/icon.png
    Icon[eu]=/home/user/icon.png
    Icon[fi]=/home/user/icon.png
    Icon[gl]=/home/user/icon.png
    Icon[it]=/home/user/icon.png
    Icon[ja]=/home/user/icon.png
    Icon[lt]=/home/user/icon.png
    Icon[nb]=/home/user/icon.png
    Icon[pl]=/home/user/icon.png
    Icon[pt]=/home/user/icon.png
    Icon[pt_BR]=/home/user/icon.png
    Icon[ro]=/home/user/icon.png
    Icon[ru]=/home/user/icon.png
    Icon[sv]=/home/user/icon.png
    Icon[uk]=/home/user/icon.png
    Icon[vi]=/home/user/icon.png
    Icon[zh_TW]=/home/user/icon.png
    Icon[en_AU]=/home/user/icon.png
    

    或者通过运行此命令删除本地化Icon=条目并更改通用Icon=条目(它将在 中创建一个qBittorrent.desktop.bak备份文件/usr/share/applications):

    sudo sed -i.bak '/^Icon\(\[[^]]*\]\)\=.*$/d; s|^Icon=.*$|Icon=/path/to/icon|'
    
    Insert the path to the icon here------------------------------^-----------^
    
    user@user-X550CL ~ % sudo sed -i.bak '/^Icon\(\[[^]]*\]\)\=.*$/d; s|^Icon=.*$|Icon=/path/to/icon|' /usr/share/applications/qBittorrent.desktop
    user@user-X550CL ~ % sed -n '/^Icon\(\[[^]]*\]\)\?=.*$/p' /usr/share/applications/qBittorrent.desktop
    Icon=/path/to/icon
    

    或者只是Icon=通过任何方式更改与您当前语言环境匹配的条目,例如:

    sudo nano /usr/share/applications/qBittorrent.desktop
    

    截图2

    • 6

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve