{"id":16936548,"url":"https://github.com/jonhoo/mktrayicon","last_synced_at":"2025-04-11T19:07:40.060Z","repository":{"id":10454986,"uuid":"12625642","full_name":"jonhoo/mktrayicon","owner":"jonhoo","description":"Create system tray icons by writing to a pipe","archived":false,"fork":false,"pushed_at":"2020-02-06T21:17:37.000Z","size":64,"stargazers_count":24,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T01:48:30.135Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonhoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-05T18:38:56.000Z","updated_at":"2025-03-11T03:52:34.000Z","dependencies_parsed_at":"2022-09-05T00:50:15.588Z","dependency_job_id":null,"html_url":"https://github.com/jonhoo/mktrayicon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fmktrayicon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fmktrayicon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fmktrayicon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonhoo%2Fmktrayicon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonhoo","download_url":"https://codeload.github.com/jonhoo/mktrayicon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248465314,"owners_count":21108244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T20:57:15.846Z","updated_at":"2025-04-11T19:07:40.039Z","avatar_url":"https://github.com/jonhoo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mktrayicon\n\n`mktrayicon` is a simple proxy program that lets you create and modify\nsystem tray icons without having to deal with a graphical toolkit like\nGTK.\n\n`mktrayicon` can be used two ways: To create an icon that is controlled\nby a named pipe or, more simply, to create a non-interactive icon.\n\nIf a FIFO is not provided, mktrayicon will run until killed (e.g.,\n`pkill -f 'mktrayicon.*\u003cICON\u003e'`). If you are using a named pipe (FIFO)\nto control the icon, *the pipe should already be created before you call\n`mktrayicon`*.\n\nEvery line written to the pipe should contain a single letter specifying\nwhat operation to perform, optionally followed by a space and a\nparameter to the command. Each command should be terminated by a\nnewline. The following commands are supported:\n\n  - `q`: Terminate `mktrayicon` and remove the tray icon\n  - `i \u003cicon\u003e`: Set the graphic to use for the tray icon; it can be a\n    stock icon name (see `/usr/share/icons`) or path to a custom icon\n  - `t \u003ctext\u003e`: Set the text to display in the icon tooltip\n  - `t`: Remove the icon tooltip\n  - `c \u003ccmnd\u003e`: Set the command to be execute when the user clicks the\n    icon (`cmnd` is passed to `/bin/sh -c`)\n  - `c`: Remove the click handler\n  - `m \u003clabel1\u003e,\u003ccmd1\u003e|\u003clabel2\u003e,\u003ccmd2\u003e|...`: Set the labels and the\n    corresponding commands to be executed when the user opens the icon\n    menu (right-click usually) (`cmd#` is passed to `/bin/sh -c`)\n  - `m`: Remove the menu handler\n  - `h`: Hide the tray icon\n  - `s`: Show the tray icon\n\nBy default, the `none` tooltip icon is used. To change this, pass `-i\n\u003cstock_icon_name\u003e` or `-i \u003cpath_to_custom_icon\u003e` when running\n`mktrayicon`.\n\nNote that any script communicating with `mktrayicon` via the pipe\n**must**, for the time being, send `q` when they are done. Just removing\nthe FIFO file will **not** cause the tray icon to be removed.\n\nThe command argument can be quoted with either `'` or `\"` if you wish it\nto include newlines. Other string interpolation may be added later.\nQuoted strings are terminated by a matching quote at the end of a line\n(ignoring whitespace). To escape a quote character at the end of a line\nto continue a quoted string, prefix it with a `\\`.\n\nThe m(enu) command uses `,` as a delimiter between label and command and\n`|` as a delimiter between entries (label+command). If you want to use\nthese two characters in a label or command, you have to escape them with\n`\\`. You can make a blank label or a label without an action by leaving\nout the `label` or `cmd` respectively. For example:\n\n```console\n$ echo \"m Browser,firefox|Terminal,xterm|Label-only||,chromium\" \u003e /tmp/test\n$ # (where `mkfifo /tmp/test` has been executed before)\n```\n\nWould give you a menu with five entries:\n\n - \"Browser\", which launches `firefox` when clicked\n - \"Terminal\", which launches `xterm` when clicked\n - \"Label-only\", which does nothing if clicked\n - An unlabeled, inactive entry (useful as a separator)\n - An unlabeled entry which launches `chromium` when clicked\n\n## Why?\n\nBecause I wanted to be able to create tray icons from bash without all\nthe hassle of interacting with GTK. Now I can create scripts for\nmeasuring stuff and instantly make tray icons out of them (3G signal\nstrength for example).\n\n## Example run\n\nThis example is also in `examples/test.sh` so you can try running it.\n\n```bash\n#!/bin/bash\n\n# Set up tray icon\nmkfifo /tmp/$$.icon\n./mktrayicon /tmp/$$.icon \u0026\n\n# Manipulate tray icon\n\n# Click handling\necho \"c xterm -e /bin/sh -c 'iwconfig; read'\" \u003e /tmp/$$.icon\n\n# Change the icon and tooltip\nfor i in none weak ok good excellent; do\n  echo \"i network-wireless-signal-$i-symbolic\" \u003e /tmp/$$.icon\n  echo \"t Signal strength: $i\" \u003e /tmp/$$.icon\n  sleep 2\ndone\n\n# Remove tooltip and click handler\necho \"c\" \u003e /tmp/$$.icon\necho \"t\" \u003e /tmp/$$.icon\n\n# Toggle the visibility of the icon for a bit\nfor i in {1..3}; do\n  for j in h s; do\n    echo $j \u003e /tmp/$$.icon\n    sleep 1\n  done\ndone\n\n# Remove tray icon\necho \"q\" \u003e /tmp/$$.icon\nrm /tmp/$$.icon\n```\n\n## Known bugs\n\nThis is my first time using the GTK+ C library, and I've got to say it\nis less than pleasant to work with. My biggest issue has been trying to\ndo blocking IO without blocking the GUI thread, as GTK seems to not like\nthat.\n\n**Patches are very welcome!**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonhoo%2Fmktrayicon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonhoo%2Fmktrayicon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonhoo%2Fmktrayicon/lists"}