reibitto / command-center Goto Github PK
View Code? Open in Web Editor NEWA CLI-based launcher and general productivity tool.
License: Apache License 2.0
A CLI-based launcher and general productivity tool.
License: Apache License 2.0
Right now commandNames
is hardcoded inside the class itself:
It would be better if it were a field of the case class instead.
Then each Decoder
instance would need to change to look for commandNames
in application.conf
.
It would be fine to keep the default names if the field is left off completely. The point of this change is that it gives you the capability to rename anything.
1
instead of 1.0
and so on.,
instead of .
log2
, ln
, ceil
, floor
For converting things like kg/lbs, cm/feet, etc.
You can take a look at how TemperatureCommand is implemented. We could generalize that so it works with all kinds units, not just temperature.
If there are 3rd-party JVM solutions for this, that would also be an option. We would then just need to wrap it.
To be able to quickly pull the latest version of a dependency into your clipboard and so on. Might be nice to also have a view that shows the transitive dependencies.
Something similar to this:
https://github.com/bevesce/unicode-symbols-search
Pretty self-explanatory, but this is basically what I had in mind:
https://github.com/raarellano/alfred-lorem-ipsum-workflow
Reference: http://www.packal.org/workflow/random-mac
Just use
rmac
to generate and apply a new MAC address. This can be useful when traveling, using free wifi, or troubleshooting a router. If you need an interface other than en0, just edit the script, it's very simple.
We can make the interface part an arg. But en0 is a fine default.
Basically I want to be able to quickly switch to a specific window by name/title. Especially if I have many windows currently open.
I imagine typing something like w zio
and hitting enter and it should switch to the specific IntelliJ window that I have open that has the zio project loaded.
Similar to how you can scroll up and down in your history in the command line, you should be able to do the same in Command Center.
Things to keep in mind:
Right now when the user inputs text, all commands are run against that text and the results are collected in one go. This means if there's 1 slow command, it'll hold up the results from rendering until it's done.
What really should be done is to make each command result render independently. To make this efficient, debounce it so that we don't call render
a ridiculous amount of times. Most commands will complete within a couple of milliseconds anyway, so only a small waitTime on the debounce should be needed.
There are a few things not working in the native executable. For example, setting the clipboard content or opening the browser. I'm thinking it must be due to java.awt.Toolkit
not working properly with Graal native-image. If so, we'll need a workaround. Maybe with the utility tools:
https://github.com/reibitto/command-center/tree/master/tools
Not all commands would need this, but the option to add a hook for tab completion would be nice.
I was thinking it might be nice if more of the available commands showed up at the bottom of the results list (i.e. giving it a low score) rather than hiding them completely. Though maybe this should be a configurable option in case you want the results pane to be as small as possible.
I want to be able to install external plugins with a single command like install plugin-name
.
I think we should maintain a list of "verified" plugins. But you should also be able to install unverified plugins by URL and file path. Should probably pop up a security warning for the latter case though.
This is a difficult task and I don't recommend tackling it just yet. But it's something that I eventually want.
If a command is taking too long for whatever reason, we should probably cancel it (with a configurable timeout) to minimize delay and save resources.
There aren't many commands that have the potential to run too long yet, but this feature is something that will see more use in the future. Currently there's only 1 command that makes an HTTP request.
The blocker for this was this lanterna issue:
mabe02/lanterna#422
But it seems like it's been addressed (at least partially?). It's a matter of trying it on Windows and seeing what happens.
I'm imagining the usage being like "define WORD". Some operating systems have built-in dictionaries (like macOS). I'm not sure if those are usable or not. Or do we have to use an online API instead?
A command for searching emojis by name and then copying it into your clipboard.
Graal native-image for the cli-client was working until async-http-client-backend-zio
was added. It has to do with the netty dependency. I tried fixing it, but no luck so far. Making netty work with native-image appears to be super complicated.
If this can't be fixed, maybe we should try a different backend. But there doesn't appear to be a compatable ZIO backend at the moment. Maybe we can add one to sttp. Such as a OkHttpZIOBackend
?
https://sttp.softwaremill.com/en/latest/backends/summary.html
Here's a reference to one implementation:
http://www.wox.one/plugin/60
In addition to this, there is an opportunity to integrate the auto language detection (which I barely started here). It might also help to have a config option for the languages you use (or are learning) and use that to improve auto-detection. For example, if I have languages = ["en", "ja"]
set then it should automatically know to translate to English by default if I type Japanese text.
This is useful for translating key codes and putting them into your clipboard. Reference:
https://github.com/vitorgalvao/alfred-workflows/tree/master/KeyCodes
Currently, one command can only shows only one output, even though it may have a list:
.sortBy(_.score)(Ordering.Double.TotalOrdering.reverse)
.distinctBy(_.source)
One possible way to do it is:
groupBy(_.source)
.WDYT?
Currently, to get local IP address, we use:
localIP <- PCommand("ipconfig", "getifaddr", "en0").string.bimap(CommandError.UnexpectedException, _.trim)
It works for macOS, but for Linux the command can vary based on the distro, not to mention Windows. For example, I'm using Manjaro and the default command to list addresses is ip a
, which then needs some command line magic to extract the IP address.
We can use Java/Scala to get this information. This seems to work with my box (multiple interfaces, running together with docker and VMs)
val interfaces = NetworkInterface.getNetworkInterfaces.asScala.toList
interfaces.filter { interface =>
!interface.isLoopback && !interface.isVirtual && interface.isUp
}.flatMap { interface =>
interface.getInetAddresses.asScala.collect {
case address: Inet4Address => interface.getDisplayName -> address.getHostAddress
}
}
For things like killing processes easily. For some ideas:
https://github.com/vitorgalvao/alfred-workflows/tree/master/ProcessControl
I gave this a try too, but ran into these blockers:
oracle/graal#1870
oracle/graal#1327
The next release looks like it'll include the fix. But even if you get passed that one, there might be other blockers lurking. Can't know until we try.
Also, Windows support for native-image seems very experimental right now. Just configuring everything was a huge pain for me. We might want to hold off on this issue until the Windows support is more stable. But if anybody wants to try tackling it anyway, that's fine with me.
Right now I don't print errors because it interferes with the UI (at least for CLI mode). We need a logger that is aware of whether it's in CLI mode or not. If it's not, then print to the console. Otherwise print to a file I guess?
Another idea is to store errors in a ring buffer and have a Command for viewing these errors.
You should be able to specify which screen you want the pop-up terminal to show up on. This would go in the DisplayConfig
class.
Right now it's possible to type something really fast and hit enter and before the results have populated. This should be addressed in some way. A couple of things:
The thing is, this is a delicate issue that's hard to get right. This will get trickier once #4 is addressed. We want to try to avoid issues where you type something, get some results, and then just as you hit enter a new result (one that you didn't want/expect) popped up and took its place for the highest score causing you to run a command you didn't intend to. For anyone who has tried using Spotlight, I'm sure you know exactly what I'm talking about. ๐
Playback controls for Spotify.
I imagine this will also need a cache ZIO Reader so that you can store whatever auth token/session ID (to prevent re-authing for each command).
I haven't done this before with a JVM app yet, but the daemon project should be packaged into a single executable like .app
for macOS, .exe
for Windows, and so on. The daemon project is a GUI application.
The cli-client on the other hand is fine to be a simple binary executable file. Ideally we distribute with homebrew for Mac and so on for other operating systems. Or just a plain install script.
The multiple events in Command
are a bit awkward right now:
inputPreview
keywordPreview
prefixPreview
argsPreview
It also has the issue where if you implement multiple of these in a single command, things might be executed multiple times for a single input (assuming you don't early-exit).
I think maybe all of these could be combined into a single ADT and then have 1 def preview(...)
which would replace the other 4. Or if not an ADT, one SearchInput
class that you can parse into these different cases with helper methods.
Might want to separate this issue out for each password manager that we want to support, but basically I'd like to support the most common ones.
It would be nice to have a command for adding calendar events easily. I haven't thought about what the interface should look like, but something that is flexible might be best. I think I'd like to be able to write stuff like "John's welcome party @ 9pm" or something and it would add it to my configured calendar.
But if that's too difficult, a command line interface could work too. Something like:
cal --date tomorrow --time 19:00 Welcome Party
Or whatever else anybody else can think of.
Reference: https://github.com/vitorgalvao/alfred-workflows/tree/master/CalmNotifications
This will be OS-specific, but it's fine to start off with just whatever OS you use.
For a few reasons:
win
/windows
key instead of meta
. And to allow more variations like ctrl
vs. control
and so on. And maybe even support symbols like โ (for Mac).Once that's done, change the configs like KeyboardConfig(openShortcut: String)
to KeyboardConfig(openShortcut: KeyboardShortcut)
You should be able to set shortcuts for your commands (for example, cmd+G for Google, etc). If a single shortcut is bound to multiple commands, select the one with the highest score.
This is useful if you would rather not scroll through the results (or type more than you have to) for common operations.
This is self-explanatory. The only thing is which API do we use for this? Is there something that's free?
This probably depends on the OS, but it would be nice to be able to not show the app's icon in the dock/taskbar since the daemon is basically always running. Apps like Alfred tend to show up only in the menubar (system tray for Windows).
You should be able to type math expressions like 52 + (21*672)
and so on and it could show the result right there in the preview window. Support for n choose r
, factorial, and all kinds of miscellaneous functions would be nice too. I find myself needing those a lot.
The theme is currently hardcoded:
Instead, it should be put in application.conf and read from there. Only if there's no theme defined in the conf file should the default theme be used.
Creating Graal native images are tricky depending on what features you're using. Creating one for daemon
is probably not doable until some issues like Swing compatibility are resolved. For example: oracle/graal#664
A native-image for cli-client
is more realistic and I got that mostly working. There are limitations though. For example, loading external plugins requires reflection and that doesn't gel well with native-image because of reflection limitations. I'm not sure if there's a way to make a plugin system work with native-image. This needs some investigation.
Idea: 6pm ET = GMT
will show 7pm. We can start with --time {time} --from {timezone} --to {timezone}
.
from
is omitted, take current time zone, or a configured one. Same for to
.time
is omitted, take now()
.I'm not too familiar with Windows and how good the default Windows search works (and whether you can use their internal API in the first place). But if it's not great, perhaps using the Everything tool for indexing would be a good option. It seems like it's a common choice among Windows application launchers.
Opens Google Maps (or configurable alternatives). Should also support directions, something like from X to Y
, directions X to Y
, etc.
There are no tests right now and that makes it really easy to break things. "Add tests" is too broad of an issue, so for now the focus should probably be the Command.search
functionality. The function doesn't require a broad set of dependencies, so it should be pretty easy to set up tests for. Just create a Vector of arbitrary commands and aliases and then pass in a search string and make sure the results are correct.
There's a lot that could be done here. But I was thinking about having a clipboard history, and possibly storing it as a tree-like structure could be cool. Might want to leverage existing solutions for this?
Also, there should probably be a way to clear the history. And perhaps something to prevent storing sensitive data in the history.
Each one should be its own Command object, but we can also add them to the general encode
alias that maps to all of them.
Some that I had in mind:
And any other useful ones that you can think of.
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.