{"id":14962662,"url":"https://github.com/raguay/scriptbarapp","last_synced_at":"2025-07-14T00:35:59.371Z","repository":{"id":45741864,"uuid":"412684953","full_name":"raguay/ScriptBarApp","owner":"raguay","description":"An application to show results from TextBar and xBar scripts and Node-Red workflows in the menubar.","archived":false,"fork":false,"pushed_at":"2024-06-29T02:21:41.000Z","size":10079,"stargazers_count":12,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-23T14:33:28.572Z","etag":null,"topics":["css","golang","html","javascript","node-red","svelte3","wails-app"],"latest_commit_sha":null,"homepage":"","language":"Svelte","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/raguay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["raguay"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2021-10-02T04:01:48.000Z","updated_at":"2024-06-29T02:21:44.000Z","dependencies_parsed_at":"2024-06-29T03:28:00.173Z","dependency_job_id":"42855d3e-be1a-4208-8d14-f35c143e9952","html_url":"https://github.com/raguay/ScriptBarApp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raguay%2FScriptBarApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raguay%2FScriptBarApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raguay%2FScriptBarApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raguay%2FScriptBarApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raguay","download_url":"https://codeload.github.com/raguay/ScriptBarApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867822,"owners_count":16554366,"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":["css","golang","html","javascript","node-red","svelte3","wails-app"],"created_at":"2024-09-24T13:30:19.683Z","updated_at":"2024-09-24T13:47:39.307Z","avatar_url":"https://github.com/raguay.png","language":"Svelte","funding_links":["https://github.com/sponsors/raguay"],"categories":[],"sub_categories":[],"readme":"![ScriptBarApp](https://socialify.git.ci/raguay/scriptbarapp/image?description=1\u0026font=Raleway\u0026forks=1\u0026issues=1\u0026language=1\u0026owner=1\u0026pattern=Circuit%20Board\u0026pulls=1\u0026stargazers=1\u0026theme=Dark)\n\n[![Richard's GitHub stats](https://github-readme-stats.vercel.app/api?username=raguay)](https://github.com/anuraghazra/github-readme-stats)\n\n# Script Bar\n\n![Script Bar](https://github.com/raguay/ScriptBarApp/blob/main/img/ScriptBar.jpg?raw=truehttps)\n\nAn application to show results from scripts and Node-Red in the menubar. It is currently in the Alpha stage, but very usable. You can display results from the Node-Red server in [EmailIt Server](https://github.com/raguay/EmailItServer), command line scripts for either [TextBar](http://richsomerfield.com/apps/textbar/) (mostly working), [xBar](https://github.com/matryer/xbar) (not working - still in development), or some of the builtin components include web sites and IP addresses both local and external. You have to have the [EmailIt Server](https://github.com/raguay/EmailItServer) running to use this program. Currently, EmailItServer is now apart of [EmailIt](https://GitHub.com/raguay/EmailIt).\n\nThe program is built with a [Svelte](https://svelte.dev/) JavaScript frontend and [Wails](https://wails.app/) backend and packager. The goal is to make this project usable on Windows, macOS, and Linux. I'm currently developing it on macOS and will be working of the other versions after the macOS is stable and Wails version 2 is ready for that platform. \n\n## Note:\n\nThis program isn't a replacement for xBar. xBar puts script outputs into individual menubar items. ScriptBar places all script output into a single interface for easy viewing when activated. I have a very cluttered menubar with many application that I use. So, I wanted some scripts to show in it's own menubar using xBar, and some grouped together in a single interface for convience. Pick the program that best suites your needs or use both like I do! This program also get output from a Node-Red server in the EmailIt Server program.\n\n## Building\n\nTo build the application, first go to the `frontend` directory and build it using:\n\n```sh\nnpm install\nnpm run build\n```\nThe first line installs the libraries used to build the application. The second line compiles the Svelte front end. Next, you need to build the Wails app. First, install Wails by installing the prerequisites mentioned on their webiste and then run:\n\n```sh\ngo get -u github.com/wailsapp/wails/cmd/wails\n```\n\nThen build the application or your platform with:\n\n```sh \nwails build\n```\n\nor, to build a macOS universal program, use this command line:\n\n```sh\nwails build --platform \"darwin/universal\"\n```\n\nTo run the program, simply run the executable in the `build/bin` directory:\n\n```sh \nopen ./build/bin/ScriptBar.app\n```\n\nYou must have the [EmailIt Server](https://github.com/raguay/EmailItServer) running first. Currently, EmailItServer is embedded inside of [EmailIt](https://GitHub.com/raguay/EmailIt).\n\n## Documentation\n\nThe ScriptBar application is launched along with EmailIt. It relies upon the EmailIt Server for all of it's information. Just like EmailIt, it is a Wails application using Svelte for the frontend framework.\n\n![ScriptBar Application](/img/ScriptBar.png)\n\nThis shows my ScriptBar. The `+` in the upper left corner allows you to add new items to each tab. The tab with a `+` in it allows you to add a new tab. By double clicking the tab names, you can change text shown for each tab. You can have as many tabs as you want and as many items in each tab as you want. But, if you get too many, it will go past your screen edges! You can click and drag the top area to move the application around.\n\n![Double Click Entry](/img/doubleclickentry.png)\n\nIf you double click on the name of an entry, you can click `Up` to move it up the list or `Down` to move it down the list. By double clicking the entry name, you can edit it's parameters.\n\nThere are seven types of entries that you can use. They are described below:\n\n#### Birthday Counter\n\n![Birthday Counter](/img/birthdaycounter.png)\n\nThe birthday counter takes the output of a birthday counter flow in Node-Red. It will show the time to the person's next birthday and their current age. The script for the birthday node in Node-Red is:\n\n```javascript\n//\n// Get the current date and the count down\n// date.\n//\nvar now = new Date();\n\n\nvar dmon = msg.payload.month - 1;\nvar dday = msg.payload.day;\nvar dyear = msg.payload.year;\nvar bd = new Date();\nbd.setFullYear(now.getFullYear());\nbd.setMonth(dmon);\nbd.setDate(dday);\n\n//\n// Calculate the number of milliseconds until\n// the date.\n//\nvar diff = 0;\nif(now.getMonth() \u003c= dmon) {\n    diff = bd.getTime() - now.getTime();\n    if((now.getMonth() === dmon)\u0026\u0026(now.getDate() \u003e dday)) {\n        diff = 0;\n    }\n}\n\nif(diff === 0) {\n    var yearEnd = new Date();\n    yearEnd.setMonth(11);\n    yearEnd.setDate(31);\n    diff = yearEnd.getTime() - now.getTime();\n    bd.setFullYear(now.getFullYear()+1);\n    diff += bd.getTime() - yearEnd.getTime();\n}\n\n//\n// Convert the difference to months, weeks, days.\n//\nddays = Math.floor(diff / (1000*60*60*24));\ndweeks = Math.floor(ddays / 7);\nddays -= dweeks * 7;\n\n//\n// Create the answer and send it on.\n//\nvar result = dweeks.toString() + ' weeks, ' + ddays.toString() + ' days';\nvar ans = {\n    payload: result,\n    topic: 'days'\n}\nreturn ans;\n```\n\nYou put this code into a function node. Then create another function node with this code to calculate the current age:\n\n```javascript\n//\n// Get the current date and the count down\n// date.\n//\nvar now = new Date();\n\nvar dmon = msg.payload.month - 1;\nvar dday = msg.payload.day;\nvar dyear = msg.payload.year;\n\n//\n// Create the answer and send it on.\n//\nvar result = now.getFullYear() - dyear;\nvar ans = {\n    payload: result,\n    topic: 'age'\n}\nreturn ans;\n```\n\nYou feed these two function nodes with an inject node with a payload like this:\n\n```json\n{\"year\":1969,\"month\":8,\"day\":1}\n```\n\nYou need to change the `year`, `month`, and `day` fields to match the person's birthday. Then add a join node with these properties:\n\n![Join Node for Birthday Counter](/img/joinnode.png)\n\nThe last node is a `SPVariables` node set to the name of the Node-Red variable you want to use. The full flow looks like this:\n\n![Birthday Counter Flow](/img/birthdayflow.png)\n\n#### Flow Variable\n\n![Flow Variable](/img/flowvariable.png)\n\nThe flowvariable entry takes the text in a Node-Red flow variable and simply displays it.\n\n#### Internal IP Address\n\n![Internal IP Address](/img/intipaddress.png)\n\nThe Internal IP Address entry will display the internal IP address of your computer. That is the IP of your local network, not the IP used on the Internet. If you give a port number and check the link checkbox, you can click the IP address shown in ScriptBar and it will open a webpage to that address and port number. This entry type uses an API from the EmailItServer.\n\n#### External IP Address\n\n![External IP Address](/img/ipaddress.png)\n\nThe External IP Address is the same as the Internal IP address except that it takes a Node-Red flow variable name. You have to create a flow that fills in the external IP address of your system. There are several nodes that can supply that information, so I leave up to you. The one I use is an HTTP request node with the url set to `https://api.ipify.org?format=json`.\n\n#### Script\n\n![Script](/img/script.png)\n\nThe Script entry allows you to call an External Script from EmailIt and display it's output. The output types can be: Generic, TextBar, BitBar (which is now xBar), and HTML. The Generic setting just displays the output as plain text. The TextBar setting processes the output as a TextBar script. The BitBar setting processes the output as a BitBar script (not currently working), and the HTML setting displays the output as HTML. The `What is the command line?` isn't currently used. I plan to have it just run the command line and display the results. \n\n![Output of a Script](/img/scriptoutput.png)\n\nThe picture above shows an TextBar script output called TaskPaperTodo.rb. This is a ruby script that displays the tasks I have in the TaskPaper program.\n\n#### Separator\n\n![Separator](/img/separator.png)\n\nThis is a simple line separator to separate entry types.\n\n#### Web Link\n\n![Web Link](/img/weblink.png)\n\nThe Web Link entry type allows you to give a website address. By clicking on the glob on the ScriptBar program, it will open that web link in the default browser. I use this type a whole lot to keep up with websites that I go to often.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraguay%2Fscriptbarapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraguay%2Fscriptbarapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraguay%2Fscriptbarapp/lists"}