使用 libnotify 显示通知时可以使用哪些图标?

发布于 2024-09-26 17:35:02 字数 416 浏览 4 评论 0原文

我正在使用 libnotify 库在 Ubuntu 中显示通知。理想情况下,我希望显示某种电池(因为我的应用程序是电池表)。

我可以使用的图标类型有:

  1. 指定图标文件名的 URI(例如 file://path/to/my-icon.png)

  2. “库存”图标名称。能够成功调用 gtk_icontheme_lookup() 的图标(例如“stock-delete”) 注意:这些不一定是正常的 GTK 库存图标 - 任何主题图标都可以。

  3. a pixbuf

我理想地希望使用选项#2,但是我找不到可用图标的名称。如何找到可用的图标?

I'm using the libnotify library to display a notification in Ubuntu. I would ideally like to display a battery of some sort (since my app is a battery meter).

The types of icons I can use are:

  1. a URI specifying the icon file name (e.g. file://path/to/my-icon.png)

  2. a 'stock' icon name. One that would succeed in a call to gtk_icontheme_lookup() (e.g. 'stock-delete') Note: these are not necessarily normal GTK stock icons - any theme icon will work.

  3. a pixbuf

I would ideally like to use option #2, however I can't find out the names of the available icons. How can I find which icons are available?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

孤独岁月 2024-10-03 17:35:02

您可以使用 pygtk 本身轻松找到:

>>> import gtk
>>> print "\n".join(name for name in dir(gtk) if name.startswith("STOCK_"))

在我的机器上,打印:

STOCK_ABOUT
STOCK_ADD
STOCK_APPLY
STOCK_BOLD
STOCK_CANCEL
STOCK_CAPS_LOCK_WARNING
STOCK_CDROM
STOCK_CLEAR
STOCK_CLOSE
STOCK_COLOR_PICKER
STOCK_CONNECT
STOCK_CONVERT
STOCK_COPY
STOCK_CUT
STOCK_DELETE
STOCK_DIALOG_AUTHENTICATION
STOCK_DIALOG_ERROR
STOCK_DIALOG_INFO
STOCK_DIALOG_QUESTION
STOCK_DIALOG_WARNING
STOCK_DIRECTORY
STOCK_DISCARD
STOCK_DISCONNECT
STOCK_DND
STOCK_DND_MULTIPLE
STOCK_EDIT
STOCK_EXECUTE
STOCK_FILE
STOCK_FIND
STOCK_FIND_AND_REPLACE
STOCK_FLOPPY
STOCK_FULLSCREEN
STOCK_GOTO_BOTTOM
STOCK_GOTO_FIRST
STOCK_GOTO_LAST
STOCK_GOTO_TOP
STOCK_GO_BACK
STOCK_GO_DOWN
STOCK_GO_FORWARD
STOCK_GO_UP
STOCK_HARDDISK
STOCK_HELP
STOCK_HOME
STOCK_INDENT
STOCK_INDEX
STOCK_INFO
STOCK_ITALIC
STOCK_JUMP_TO
STOCK_JUSTIFY_CENTER
STOCK_JUSTIFY_FILL
STOCK_JUSTIFY_LEFT
STOCK_JUSTIFY_RIGHT
STOCK_LEAVE_FULLSCREEN
STOCK_MEDIA_FORWARD
STOCK_MEDIA_NEXT
STOCK_MEDIA_PAUSE
STOCK_MEDIA_PLAY
STOCK_MEDIA_PREVIOUS
STOCK_MEDIA_RECORD
STOCK_MEDIA_REWIND
STOCK_MEDIA_STOP
STOCK_MISSING_IMAGE
STOCK_NETWORK
STOCK_NEW
STOCK_NO
STOCK_OK
STOCK_OPEN
STOCK_ORIENTATION_LANDSCAPE
STOCK_ORIENTATION_PORTRAIT
STOCK_ORIENTATION_REVERSE_LANDSCAPE
STOCK_ORIENTATION_REVERSE_PORTRAIT
STOCK_PAGE_SETUP
STOCK_PASTE
STOCK_PREFERENCES
STOCK_PRINT
STOCK_PRINT_ERROR
STOCK_PRINT_PAUSED
STOCK_PRINT_PREVIEW
STOCK_PRINT_REPORT
STOCK_PRINT_WARNING
STOCK_PROPERTIES
STOCK_QUIT
STOCK_REDO
STOCK_REFRESH
STOCK_REMOVE
STOCK_REVERT_TO_SAVED
STOCK_SAVE
STOCK_SAVE_AS
STOCK_SELECT_ALL
STOCK_SELECT_COLOR
STOCK_SELECT_FONT
STOCK_SORT_ASCENDING
STOCK_SORT_DESCENDING
STOCK_SPELL_CHECK
STOCK_STOP
STOCK_STRIKETHROUGH
STOCK_UNDELETE
STOCK_UNDERLINE
STOCK_UNDO
STOCK_UNINDENT
STOCK_YES
STOCK_ZOOM_100
STOCK_ZOOM_FIT
STOCK_ZOOM_IN
STOCK_ZOOM_OUT

You can easily find out using pygtk itself:

>>> import gtk
>>> print "\n".join(name for name in dir(gtk) if name.startswith("STOCK_"))

On my machine, this prints:

STOCK_ABOUT
STOCK_ADD
STOCK_APPLY
STOCK_BOLD
STOCK_CANCEL
STOCK_CAPS_LOCK_WARNING
STOCK_CDROM
STOCK_CLEAR
STOCK_CLOSE
STOCK_COLOR_PICKER
STOCK_CONNECT
STOCK_CONVERT
STOCK_COPY
STOCK_CUT
STOCK_DELETE
STOCK_DIALOG_AUTHENTICATION
STOCK_DIALOG_ERROR
STOCK_DIALOG_INFO
STOCK_DIALOG_QUESTION
STOCK_DIALOG_WARNING
STOCK_DIRECTORY
STOCK_DISCARD
STOCK_DISCONNECT
STOCK_DND
STOCK_DND_MULTIPLE
STOCK_EDIT
STOCK_EXECUTE
STOCK_FILE
STOCK_FIND
STOCK_FIND_AND_REPLACE
STOCK_FLOPPY
STOCK_FULLSCREEN
STOCK_GOTO_BOTTOM
STOCK_GOTO_FIRST
STOCK_GOTO_LAST
STOCK_GOTO_TOP
STOCK_GO_BACK
STOCK_GO_DOWN
STOCK_GO_FORWARD
STOCK_GO_UP
STOCK_HARDDISK
STOCK_HELP
STOCK_HOME
STOCK_INDENT
STOCK_INDEX
STOCK_INFO
STOCK_ITALIC
STOCK_JUMP_TO
STOCK_JUSTIFY_CENTER
STOCK_JUSTIFY_FILL
STOCK_JUSTIFY_LEFT
STOCK_JUSTIFY_RIGHT
STOCK_LEAVE_FULLSCREEN
STOCK_MEDIA_FORWARD
STOCK_MEDIA_NEXT
STOCK_MEDIA_PAUSE
STOCK_MEDIA_PLAY
STOCK_MEDIA_PREVIOUS
STOCK_MEDIA_RECORD
STOCK_MEDIA_REWIND
STOCK_MEDIA_STOP
STOCK_MISSING_IMAGE
STOCK_NETWORK
STOCK_NEW
STOCK_NO
STOCK_OK
STOCK_OPEN
STOCK_ORIENTATION_LANDSCAPE
STOCK_ORIENTATION_PORTRAIT
STOCK_ORIENTATION_REVERSE_LANDSCAPE
STOCK_ORIENTATION_REVERSE_PORTRAIT
STOCK_PAGE_SETUP
STOCK_PASTE
STOCK_PREFERENCES
STOCK_PRINT
STOCK_PRINT_ERROR
STOCK_PRINT_PAUSED
STOCK_PRINT_PREVIEW
STOCK_PRINT_REPORT
STOCK_PRINT_WARNING
STOCK_PROPERTIES
STOCK_QUIT
STOCK_REDO
STOCK_REFRESH
STOCK_REMOVE
STOCK_REVERT_TO_SAVED
STOCK_SAVE
STOCK_SAVE_AS
STOCK_SELECT_ALL
STOCK_SELECT_COLOR
STOCK_SELECT_FONT
STOCK_SORT_ASCENDING
STOCK_SORT_DESCENDING
STOCK_SPELL_CHECK
STOCK_STOP
STOCK_STRIKETHROUGH
STOCK_UNDELETE
STOCK_UNDERLINE
STOCK_UNDO
STOCK_UNINDENT
STOCK_YES
STOCK_ZOOM_100
STOCK_ZOOM_FIT
STOCK_ZOOM_IN
STOCK_ZOOM_OUT
我的奇迹 2024-10-03 17:35:02

You can look it up in the Free Desktop Icon Naming Specification. It looks like the icons you need are "battery", "battery-caution", and "battery-low".

人生戏 2024-10-03 17:35:02

图标在“freedesktop icon-theme-spec”中指定,您可以在此处阅读:

https://specations.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout

  • 因此,图标“可用”可以是任何此文件夹的数量:

HOME/.icons

/usr/share/icons

/usr/share/pixmaps

The icons are specify in "freedesktop icon-theme-spec", you can read here:

https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout

  • So, the icons "availables" are in any of this folders:

HOME/.icons

/usr/share/icons

/usr/share/pixmaps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文