giangvo / alfred-workflow-nodejs Goto Github PK
View Code? Open in Web Editor NEWA small library providing helpers to create Alfred Workflow
License: MIT License
A small library providing helpers to create Alfred Workflow
License: MIT License
Navigate to workflow folder and run pm install, where is the workflow folder?
Hey,
I'm currently trying to get my first alfred worflow with your nice framework up and running. I noticed that the npm package is slightly different than the github version. Especially this method of the Actionhandler
is totally missing:
onMenuItemSelected: function(action, handler) {
if (!action || !handler) {
return;
}
eventEmitter.on("menuItemSelected-" + action, handler);
},
I have multiple top-level alternatives such as
(Action) Set password + password
(Action) Set user + username
(Action) Get courses
(MenuItemSelected) Get courses + SelectedCourse
Now I would want an additional menu like
(MenuItemSelected) Get courses + SelectedCourse + Register
Is this possible?
Is there more to feedback that the notification alert?
How can I declare a menu of two options (Say ActionA and ActionB) and handle the event when either is selected?
I am lost between the various properties of each items and what they're for (title,subtitle,arg, hasSubItems, valid, data) unless they're just used for the menu subsystems & feedbacks
Sorry, I am not understanding the documentation. Can you help?
Right now I have this:
(function main() {
actionHandler.onAction("menu", function(query) {
var Item = AlfredNode.Item;
// generate feeback A
var item1 = new Item({
title: "TV Off",
subtitle: "Press tab to get menu items",
arg: "Feedback A",
hasSubItems: true, // set this to true to tell that this feedback has sub Items
valid: true,
data: {
alias: "X"
} // we can set data to item to use later to build sub items
});
workflow.addItem(item1);
// generate feeback B
var item2 = new Item({
title: "Feedback B",
subtitle: "Press tab to get menu items",
arg: "FeedbackB",
hasSubItems: false, // set this to true to tell that this feedback has sub Items
valid: true,
data: {
alias: "Y"
} // we can set data to item to use later to build sub items
});
workflow.addItem(item2);
// generate feedbacks
workflow.feedback();
});
actionHandler.onAction("Feedback B", function(query) {
// your code to handle action 1 here
workflow.info("Hub IP", "Test");
});
AlfredNode.run();
})();
I have a menu which first gets a list of objects from online. These objects contains strings with ä in them. These are encoded as %E4. The problem seems to arise when I select an element from a menu. The menu element has an ä which has the hex value %E4. When I autocomplete the title gets sent to an onMenuItemSelected listener.
The title is now still an ä but has a hexencoding of a%u0308 which makes the following code fail:
function getItemData(itemTitle) { var wfData = Storage.get("wfData"); return wfData ? wfData[itemTitle] : undefined; }
The wfData has a key containing the %E4 based ä and the ä in itemTitle is based on a%u0308.
Any idea on how to solve this?
Hello,
I am a member of the GitHub Security Lab (https://securitylab.github.com).
I've attempted to reach a maintainer for this project to report a potential security issue but have been unable to verify the report was received. Please could a project maintainer could contact us at [email protected], using reference GHSL-2020-115?
Thank you,
Kevin Backhouse
GitHub Security Lab
How do I listen to event when "Feedback A" or "Feedback B" is selected by return key?
First, thank you for your great library.
Will it be better to have a global error handling like https://github.com/sindresorhus/alfy#errorerr do?
Hello,
I see in the documentation that there is a mods
option for the AlfredNode.Item
object. Is this to support separate attributes when using modifier keys? I can't seem to find any examples within the repo.
Thanks!
Kobi
I have an exception. Node version is v14.17.5.
storage.initSync();
^
TypeError: storage.initSync is not a function
at Alfred/Alfred.alfredpreferences/workflows/user.workflow.F8F6BE96-BE8B-4524-8F7F-873C8C80E4EB/node_modules/alfred-workflow-nodejs/alfredNode.js:171:13
at Object.<anonymous> (Alfred/Alfred.alfredpreferences/workflows/user.workflow.F8F6BE96-BE8B-4524-8F7F-873C8C80E4EB/node_modules/alfred-workflow-nodejs/alfredNode.js:214:3)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (Alfred/Alfred.alfredpreferences/workflows/user.workflow.F8F6BE96-BE8B-4524-8F7F-873C8C80E4EB/main.js:1:18)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
It'd be helpful to have a sample .workflow
file for use with this lib
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.