From f07e6c66678e7cbf05cf5e76376fb404a6a2de95 Mon Sep 17 00:00:00 2001 From: kpbaks Date: Sat, 10 Aug 2024 18:52:46 +0200 Subject: [PATCH] Add completions for `notify-send` --- po/de.po | 4 +++ po/en.po | 4 +++ po/fr.po | 4 +++ po/pl.po | 4 +++ po/pt_BR.po | 4 +++ po/sv.po | 4 +++ po/zh_CN.po | 4 +++ share/completions/notify-send.fish | 23 +++++++++++++++ .../__fish_complete_freedesktop_icons.fish | 28 +++++++++++++++++++ 9 files changed, 79 insertions(+) create mode 100644 share/completions/notify-send.fish create mode 100644 share/functions/__fish_complete_freedesktop_icons.fish diff --git a/po/de.po b/po/de.po index bfa5c0016..78ef3a521 100644 --- a/po/de.po +++ b/po/de.po @@ -102178,6 +102178,10 @@ msgstr "" msgid "Footnotes by Docutils" msgstr "" +#: share/functions/__fish_complete_freedesktop_icons.fish:1 +msgid "List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`" +msgstr "" + #: share/functions/__fish_complete_ftp.fish:1 msgid "Complete ftp, pftp" msgstr "" diff --git a/po/en.po b/po/en.po index a09cc7dcf..ed78af5de 100644 --- a/po/en.po +++ b/po/en.po @@ -102141,6 +102141,10 @@ msgstr "" msgid "Footnotes by Docutils" msgstr "" +#: share/functions/__fish_complete_freedesktop_icons.fish:1 +msgid "List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`" +msgstr "" + #: share/functions/__fish_complete_ftp.fish:1 msgid "Complete ftp, pftp" msgstr "" diff --git a/po/fr.po b/po/fr.po index 63df4f6c0..34338191f 100644 --- a/po/fr.po +++ b/po/fr.po @@ -103813,6 +103813,10 @@ msgstr "" msgid "Footnotes by Docutils" msgstr "" +#: share/functions/__fish_complete_freedesktop_icons.fish:1 +msgid "List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`" +msgstr "" + #: share/functions/__fish_complete_ftp.fish:1 msgid "Complete ftp, pftp" msgstr "Compléter ftp, pftp" diff --git a/po/pl.po b/po/pl.po index f63ae4ea9..910d67314 100644 --- a/po/pl.po +++ b/po/pl.po @@ -102075,6 +102075,10 @@ msgstr "" msgid "Footnotes by Docutils" msgstr "" +#: share/functions/__fish_complete_freedesktop_icons.fish:1 +msgid "List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`" +msgstr "" + #: share/functions/__fish_complete_ftp.fish:1 msgid "Complete ftp, pftp" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index 03194ac0a..d8eb614b0 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -102132,6 +102132,10 @@ msgstr "" msgid "Footnotes by Docutils" msgstr "" +#: share/functions/__fish_complete_freedesktop_icons.fish:1 +msgid "List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`" +msgstr "" + #: share/functions/__fish_complete_ftp.fish:1 msgid "Complete ftp, pftp" msgstr "" diff --git a/po/sv.po b/po/sv.po index c3bb694e4..929a874a0 100644 --- a/po/sv.po +++ b/po/sv.po @@ -102113,6 +102113,10 @@ msgstr "" msgid "Footnotes by Docutils" msgstr "" +#: share/functions/__fish_complete_freedesktop_icons.fish:1 +msgid "List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`" +msgstr "" + #: share/functions/__fish_complete_ftp.fish:1 msgid "Complete ftp, pftp" msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 20ae582ae..e7ed3dbfb 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -102064,6 +102064,10 @@ msgstr "" msgid "Footnotes by Docutils" msgstr "" +#: share/functions/__fish_complete_freedesktop_icons.fish:1 +msgid "List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`" +msgstr "" + #: share/functions/__fish_complete_ftp.fish:1 msgid "Complete ftp, pftp" msgstr "" diff --git a/share/completions/notify-send.fish b/share/completions/notify-send.fish new file mode 100644 index 000000000..a8af39934 --- /dev/null +++ b/share/completions/notify-send.fish @@ -0,0 +1,23 @@ +set -l c complete -c notify-send + +$c -f # Disable file completion + +# notify-send [OPTION…] [BODY] - create a notification + +set -l urgency_levels + +$c -s u -l urgency -d "urgency level" -x -a 'low normal critical' +$c -s t -l expire-time -x -d "timeout in milliseconds at which to expire the notification" +$c -s a -l app-name -x -d "app name for the icon" +$c -s i -l icon -x -d "icon filename or stock icon to display" +$c -s i -l icon -x -a "(__fish_complete_freedesktop_icons)" +$c -s c -l category -x -d "notification category" +$c -s e -l transient -d "create a transient notification" +$c -s h -l hint -x -d "extra data to pass, format: `TYPE:NAME:VALUE`, valid types: boolean, int, double, string, byte and variant" +$c -s p -l print-id -d "print the notification ID" +$c -s r -l replace-id -x -d "ID of the notification to replace" +$c -s w -l wait -d "wait for the notification to be closed before exciting" +$c -s A -l action -x -d "clickable actions to display to the user. implies --wait, can be set multiple times, example: --action=save='Save Screenshot?'" + +$c -s '?' -l help -d "print help information" +$c -s v -l version -d "print program version" diff --git a/share/functions/__fish_complete_freedesktop_icons.fish b/share/functions/__fish_complete_freedesktop_icons.fish new file mode 100644 index 000000000..61c87c614 --- /dev/null +++ b/share/functions/__fish_complete_freedesktop_icons.fish @@ -0,0 +1,28 @@ +function __fish_complete_freedesktop_icons -d 'List installed icon names according to `https://specifications.freedesktop.org/icon-theme-spec/0.13/`' + # The latest `icon-theme-spec` as of 2024-08-10 is 0.13 + # https://specifications.freedesktop.org/icon-theme-spec/latest/ + # https://specifications.freedesktop.org/icon-theme-spec/0.13/ + + # https://specifications.freedesktop.org/icon-theme-spec/0.13/#directory_layout + # 1. $HOME/.icons + # 2. $XDG_DATA_DIRS/icons + # 3. /usr/share/pixmaps + set -l dirs + test -d $HOME/.icons; and set -a dirs $HOME/.icons + if set -q XDG_DATA_DIRS + # Can be a list of directories so we append each + for d in $XDG_DATA_DIRS + test -d $d/icons; and set -a dirs $d/icons + end + end + test -d /usr/share/pixmaps; and set -a dirs /usr/share/pixmaps + + for d in $dirs + # https://specifications.freedesktop.org/icon-theme-spec/0.13/#definitions + # .png, .svg and .xpm are valid icon file formats + printf '%s\n' $d/**/*.{png,svg,xpm} + end \ + | path basename \ + | path change-extension '' \ + | command sort --unique +end