therockmandolinist
-
Posts
43 -
Joined
-
Last visited
-
Days Won
1
Content Type
Blogs
Gallery
Downloads
Events
Profiles
Forums
Articles
Media Demo
Posts posted by therockmandolinist
-
-
In any case, even a feature to toggle Alfred clipboard saving would be handy, though I'm not aware of one.
-
Well, pass is a command line utility, so I'm not sure that works in this case?
-
Hi,
I was wondering if there's a way to get Alfred to either a) ignore clipboard items from the pass password manager or b ) respect that they should be temporary.
Thanks!
-
I mostly made this for reference for a school semester, but I decided I'd publish it as my first proper packal workflow. It may or may not be useful to anyone as it's a bit specific/narrow scoped, but here it is just in case.
--------------------------------
Atmos
An Alfred workflow to find temperature, speed of sound, pressure, and density at queried altitude, acording to the International Standard Atmosphere model.Basically a python port of Matlab's atmosisa.
Usage- atmos <query> — Show values for altitude . Defaults to meters, but if query ends in f or ft, the proper conversion is made.
- ↩ or ⌘+<NUM> — Copy result to clipboard
- atmoshelp — Describe values.
Demo
Licensing, thanks
This workflow is released under the MIT licence.
This workflow uses the Alfred-Workflow library, which is also released under the MIT licence.Also shoutout to deanishe's cookiecutter template
Links
Packal, Direct github download - atmos <query> — Show values for altitude . Defaults to meters, but if query ends in f or ft, the proper conversion is made.
-
I'm having such a hard time with this, because I'm a person of habit and am really used to my own custom theme, but after trying your 'Material Blue Grey Dark', I really don't think I could go back. All of them, really, are very nice. I think I'm going to stick with this one for a while...
-
I just found this, and it's exactly what I needed, so thanks @deanishe !
I was wondering if you could explain a little more about how to convert src into a .alfredworkflow file with this configuration?
-
When defining a word with Alfred, it might be useful to have the word and definition show up as large text when pressing command-L.
-
-
I was wondering if there's a way to do a search for files by file extension, possibly by using the Json Config utility in Alfred 3, kind of like the search in specific folders workflow that comes with Alfred 3 (I'd input the file extension, and only files of that type would show in the search).
-
Sweet! I made a similar one for all greek letters. Personally, I prefer mathematica's style, where [Esc]p[Esc] is pi, for example. It shortens some of them, and gives it termination (if another has a similar beginnig, like phi, you add another letter, like [Esc]ph[Esc]). I simulated the Esc with a ";" both times.
Though, in mathematica you can actually type the full word as well (it's more of an autocompletion type system), and the latex way is probably much more clear/less ambiguous way of doing this when it comes to snippets, so I might switch to the full words.
-
A fallback search that changes based on the input (runs a workflow/script to display the fallback). Not sure if possible, could be cool though. I'm thinking something with simple, one line output, for the most part, since we do have workflows for more complex stuff. Not really sure if this would be that useful for anything, it's mostly just something I was curious about/thought would be neat.
-
Sorry, resolved (I think.)
Used:
IFS=$'\t' read -r -a filepath <<< "$filepath"
my_command "${filepath[@]}"
which I think worked, since multiple paths are tab separated.
-
Trying to pass multiple paths from file action as args to a command in a bash script. Is there a way to do this?
-
One of the handy features is being able to drag files from the file search. Is there a way to drag the files in your file buffer, or to drag more than one file at once?
-
Would be cool to be able to lock alfred in place based on keyword/workflow. (As in if i type a given keyword (for a workflow), alfred won't "go away" and erase anything I have typed when i click away from it). This might be useful for workflows with complex chains of interaction or when a lot of text needs to be typed in.
Don't know if this is possible or if it's against the spirit of Alfred in terms of what it's "supposed" to be used for, but I have a couple workflows where I could use this.
-
You can't use γ as a dictionary key in your script because you haven't specified an encoding, therefore Python treats it as ASCII.
Put
# encoding: utf-8
at the top of the script.
Other than that, I don't see any obvious issues other than the ones mentioned above.
Thanks for all the advice - it's always appreciated. Your suggestions did actually clear up a couple of my initial issues, but I then found that getting sympy's parse_expr function to recognize unicode characters in python 2 (esp. as custom var names) is not really optimal/easily possible, so for now I'm just handling it with a substitution on input to that function and then re-substitution after output (replacing 'γ' with 'gamma' and back again). Sorta gives me more peace of mind that way anyway, no funky stuff.
Thanks again for the help!
-
I know the topic backwards, forwards and sideways, but I'm not psychic and can't debug code I haven't seen.
http://www.deanishe.net/alfred-workflow/user-manual/text-encoding.html
It's very general, but that's the best you're going to get without posting your code that's causing the issue.
You might even be using Python 3 for all I know. Which would change all the answers compared to Python 2.
Thanks for the reply. I'm using python 2, very rough/working code is below. I'm working on a calculator/expression parser for alfred that uses sympy's parse_expr. I'm passing in arguments with a bash script as in 'python myscript.py "{query}"'. The dictionary 'var_dict' that holds the unicode characters in the script is for defining custom vars in sympy, so if I pass in 'γ' to alfred, (then going through "{query}" in the previous manner), it would recognize that as 1.4. This works when i pass in ascii chars, but not unicode ones.
I probably don't need docopt here, but I've found it fun to use.
'''calculate.py [args] Usage: calculate.py <query> Options: -h''' from sympy.parsing.sympy_parser import (parse_expr,standard_transformations, convert_xor,implicit_multiplication_application, split_symbols_custom,_token_splittable,TokenError) import sympy from sympy import N,SympifyError from workflow import Workflow import sys import re #reload(sys) #sys.setdefaultencoding('UTF8') # sympy.cosd = lambda x : sympy.cos( sympy.mpmath.radians(x) ) # sympy.sind = lambda x : sympy.sin( sympy.mpmath.radians(x) ) sympy.cosd = lambda x : sympy.cos( sympy.mpmath.radians(x) ) sympy.sind = lambda x : sympy.sin( sympy.mpmath.radians(x) ) sympy.tand = lambda x : sympy.tan( sympy.mpmath.radians(x) ) var_dict={u'R':287,u'gamma':1.4,u'gammae':1.3,u'γ':1.4,u'g':9.81} def can_split(symbol): if symbol not in (var_dict.keys()): return _token_splittable(symbol) return False transformation=split_symbols_custom(can_split) transformations = (standard_transformations +(transformation,convert_xor,implicit_multiplication_application)) def main(wf): from docopt import docopt args = docopt(__doc__,wf.args) query=args.get('<query>').decode('UTF-8') with open('history.txt') as historyFile: historyList=historyFile.read().splitlines() history=[tuple(x.split(',')) for x in historyList[::-1]] if 'v:' in query: quer=re.compile(query.split('v:')[1],re.IGNORECASE) ordered=sorted(var_dict.keys(), key=lambda s: s.lower()) for i in ordered: if quer.search(i) or quer.search(str(var_dict[i])): wf.add_item(i, unicode(var_dict[i]), autocomplete=query.split('v:')[0]+i) wf.send_feedback() return 0 elif 'h:' in query: quer=re.compile(query.split('h:')[1],re.IGNORECASE) for i in history: if quer.search(i[0]) or quer.search(i[1]): wf.add_item(i[0], i[1], icon='history.png', autocomplete=query.split('h:')[0]+i[0]) wf.send_feedback() return 0 try: parsed=parse_expr(query,local_dict=var_dict,transformations=transformations) result=unicode(N(parsed).round(10)) except TypeError: try: parsed=parse_expr(query,local_dict=var_dict,transformations=transformations) result=unicode(N(parsed)) except TypeError: result=u'...' except (TokenError,SyntaxError,SympifyError): result=u'...' #parsed=query result=result.replace('**','^') #parsed=(unicode(parsed).replace('**','^') if unicode(parsed)[0:2]!='0-' else unicode(parsed)[1:].replace('**','^')) query=(unicode(query) if unicode(query)!='0-' else unicode(query[1:])) wf.add_item(result, query, arg=result+','+query, icon='rightarrow.png', valid=True, largetext=result) for i in history: wf.add_item(i[0], i[1], autocomplete=i[1], icon='history.png') wf.send_feedback() if __name__==u"__main__": wf=Workflow() sys.exit(wf.run(main))
-
I'm trying to pass in a character like γ into a python script through alfred, (as well as use it as a dict key within that script).
I keep getting the error 'ascii' codec can't decode byte 0xce in position 0: ordinal not in range(128).
Does anyone know what this is about, or how I can achieve unicode character input into a python script?
-
Is there a way to make notifications use the keyword icon instead of the workflow icon?
-
Would be nice to have the option to toggle also showing items whose tags match the typed query. Currently, only a name search/match is possible, I think. Sometimes having to type a different keyword to search tags seems just a little more cumbersome.
-
Quick question: is there a way to search for full/specific phrases (multiple words in given order) with the file search keyword "in" ?
At the moment it seems to just give me anything with all given words regardless of their placement.
-
Alfred Preferences > Features > Terminal / Shell
What have you got set in there? That determines how Alfred runs commands in Terminal/iTerm/whatever, including via Terminal Command actions.
Ahh, yes. That's what you meant by custom script. I had apparently changed this to custom and forgotten about it. Resolved. Thanks for the help!
-
By default, Alfred should open a new Terminal window and run the command there. Are you using a custom script?
I'm using the alfred action "Terminal Command" with a file filter.
-
It just affects the location of the Alfred.preferences file (which is actually a directory that contains all the preferences and workflows). The cache and data directories are always in the normal locations. Those directories are not shared.Also, I tried to update the script to take that into effect, but somewhere else in the script it had problems with spaces and parenthesis in the path (My path has both). You might want to thoroughly check the script for that condition.
I tried to update it myself as well - Is that still happening? My path has spaces in it too, so I'm not really sure what the cause of the error would be.
Ignore clipboard items from pass?
in Discussion & Help
Posted
@Vero adding the terminal application (iTerm in this case) doesn't quite work, since pass uses pbcopy internally (though I'm afraid i don't have a great understanding beyond that, here's the source code).
Is there a more specific definition to "marked as transient"? I think it just waits 45 seconds and then deletes from the clipboard, which evidently doesn't delete it from the Alfred clipboard.
@deanishe i'm not sure I understand what you mean by this.