Giter Club home page Giter Club logo

rrun's Introduction

https://travis-ci.org/buster/rrun.svg?branch=master

rrun

Note: Apart from the occasional fix, this project is not actively developed anymore. rrun works fine and should run/compile for the time being on rust stable. Alternatives to rrun are gmrun and rofi. Feel free to fork, request ownership or commit pull requests.

rrun is a minimalistic command launcher in rust similar to gmrun. It started as a playground to learn Rust, but since i use it all day for months now, it's probably useful for others as well. It replaced gmrun and gnome-do on my laptop. rrun has few features, it can do bash completion and run commands and that's it. It will also append the commands being run to your bash history.

rrun.gif

Dependencies

GTK3.10+

Installation

You have several options:

  1. download a Debian package from https://github.com/buster/rrun/releases
  2. install from crates.io with "cargo install rrun"
  3. compile yourself with "cargo build"

Usage

  • enter a command and press Return to execute it
  • press TAB for tab completion of available commands
  • Press Ctrl + Return to display the command output in the text field

Set up rrun as command helper on Capslock

I have mapped the unused, needless CapsLock key to some other key and set up Gnome or whatever (i3wm in my case) to launch rrun on keypress.

My ~/.Xmodmap:

remove Lock = Caps_Lock
keysym Caps_Lock = XF86HomePage

Don't forget to run "xmodmap ~/.Xmodmap" after login.

The relevant parts of ~/.i3/config:

bindsym XF86HomePage exec rrun
for_window [title="rrun"] floating enable
exec --no-startup-id xmodmap ~/.Xmodmap

How to build the package

Creation of a cowbuilder image

The build process needs pbuilder/cowbuilder installed in debian (apt-get install cowbuilder pbuilder). A Debian testing buid image can be created with:

sudo cowbuilder --create --distribution testing

Eatmydata Installation

Install eatmydata (on build machine and in the image) to speeding up dpkg (from https://wiki.debian.org/cowbuilder ):

On the build machine:

apt-get install eatmydata

In the build image:

sudo cowbuilder --login --save
apt-get install eatmydata

For eatmydata (>=82-2), add this /etc/pbuilderrc (on the build machine):

if [ -z "$LD_PRELOAD" ]; then
  LD_PRELOAD=libeatmydata.so
else
  LD_PRELOAD="$LD_PRELOAD":libeatmydata.so
fi

export LD_PRELOAD

Package Build Process

The debian package can be built with the following commands:

  • make deb just creates the .deb file without touching the changelog
  • make snapshot creates a snapshot .deb without incrementing the version number (but updating the changelog)
  • make release creates a new release and bumps the minor version number

Contributors

@nightscape @tshepang

rrun's People

Contributors

buster avatar nightscape avatar tshepang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rrun's Issues

Directly choosing a result from the list

It would save a little time, if one could directly select an entry from the list view with a shortcut like Ctrl+7.
The corresponding code would probably need to go here where we already handle other keys.

cargo install rrun fails

The installation via cargo install rrun seems to be broken.

$ rustc --version
rustc 1.11.0-nightly (6b4511755 2016-06-14)


$ cargo --version
cargo 0.12.0-nightly (5a26b65 2016-06-14)
$ cargo install rrun
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling bitflags v0.4.0
   Compiling gdk v0.5.0
   Compiling winapi-build v0.1.1
   Compiling gio v0.1.0
   Compiling bitflags v0.5.0
   Compiling strsim v0.4.1
   Compiling vec_map v0.4.0
   Compiling winapi v0.2.7
   Compiling gdk-pixbuf v0.1.0
   Compiling pkg-config v0.3.8
   Compiling utf8-ranges v0.1.3
   Compiling bitflags v0.3.3
   Compiling cairo-rs v0.1.0
   Compiling ansi_term v0.7.2
   Compiling c_vec v1.0.12
   Compiling rustc-serialize v0.3.19
   Compiling kernel32-sys v0.2.2
   Compiling libc v0.2.12
   Compiling log v0.3.6
   Compiling gtk v0.1.0
   Compiling regex-syntax v0.3.3
   Compiling clap v1.5.5
   Compiling itertools v0.4.16
   Compiling memchr v0.1.11
   Compiling thread-id v2.0.0
   Compiling thread_local v0.2.6
   Compiling aho-corasick v0.5.2
   Compiling gio-sys v0.3.1
   Compiling gdk-pixbuf-sys v0.3.1
   Compiling glib-sys v0.3.1
   Compiling cairo-sys-rs v0.3.1
   Compiling gdk-sys v0.3.1
   Compiling atk-sys v0.3.1
   Compiling gtk-sys v0.3.1
   Compiling pango-sys v0.3.1
   Compiling gobject-sys v0.3.1
   Compiling regex v0.1.71
   Compiling glib v0.1.0
   Compiling pango v0.1.0
   Compiling toml v0.1.30
   Compiling env_logger v0.3.3
   Compiling rrun v0.2.0
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:24:5: 24:17 error: unresolved import `gtk::widgets`. There is no `widgets` in `gtk`. Did you mean to use `widget`? [E0432]
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:24 use gtk::widgets;
                                                                              ^~~~~~~~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:24:5: 24:17 help: run `rustc --explain E0432` to see a detailed explanation
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:154:30: 154:52 error: failed to resolve. Could not find `widgets` in `gtk` [E0433]
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:154         let completion_list: gtk::widgets::TreeView = builder.get_object("completion_view").unwrap();
                                                                                                        ^~~~~~~~~~~~~~~~~~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:154:30: 154:52 help: run `rustc --explain E0433` to see a detailed explanation
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:155:20: 155:45 error: failed to resolve. Could not find `widgets` in `gtk` [E0433]
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:155         let entry: gtk::widgets::SearchEntry = builder.get_object("search_entry").unwrap();
                                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:155:20: 155:45 help: run `rustc --explain E0433` to see a detailed explanation
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:25:5: 25:25 error: module `signal` is private
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:25 use gtk::signal::Inhibit;
                                                                              ^~~~~~~~~~~~~~~~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:51:45: 51:51 error: no method named `unwrap` found for type `gtk::TreeViewColumn` in the current scope
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:51     let column = gtk::TreeViewColumn::new().unwrap();
                                                                                                                      ^~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:52:45: 52:51 error: no method named `unwrap` found for type `gtk::CellRendererText` in the current scope
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:52     let cell = gtk::CellRendererText::new().unwrap();
                                                                                                                      ^~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:149:72: 149:82 error: multiple applicable items in scope [E0034]
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:149                 widgets::StyleContext::add_provider_for_screen(&window.get_screen(), &cp, 1);
                                                                                                                                                  ^~~~~~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:149:72: 149:82 help: run `rustc --explain E0034` to see a detailed explanation
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:149:72: 149:82 note: candidate #1 is defined in an impl of the trait `gtk::WidgetExt` for the type `_`
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:149:72: 149:82 note: candidate #2 is defined in an impl of the trait `gtk::WindowExt` for the type `_`
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:166:63: 166:69 error: no method named `unwrap` found for type `gtk::ListStore` in the current scope
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:166     let completion_store = gtk::ListStore::new(&column_types).unwrap();
                                                                                                                                         ^~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:209:25: 209:30 error: the trait bound `str: std::marker::Sized` is not satisfied [E0277]
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:209                     let query = entry.get_text().unwrap_or_else(|| panic!("Unable to get string from Entry widget!"));
                                                                                                   ^~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:209:25: 209:30 help: run `rustc --explain E0277` to see a detailed explanation
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:209:25: 209:30 note: `str` does not have a constant size known at compile-time
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:209:25: 209:30 note: all local variables must have a statically known size
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:229:46: 229:54 error: mismatched types [E0308]
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:229                 if last_pressed_key.get() == key::Tab {
                                                                                                                        ^~~~~~~~
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:229:46: 229:54 help: run `rustc --explain E0308` to see a detailed explanation
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:229:46: 229:54 note: expected type `i32`
.cargo/registry/src/github.com-1ecc6299db9ec823/rrun-0.2.0/src/main.rs:229:46: 229:54 note:    found type `u32`
error: aborting due to 6 previous errors
error: failed to compile `rrun v0.2.0`, intermediate artifacts can be found at `/tmp/cargo-install.qlPuQqy8lkzh`

Caused by:
  Could not compile `rrun`.

To learn more, run the command again with --verbose.

Document configuration file

The documentation is rather scarce.
Now, with a new undocumented configuration file, that needs to be documented

get rid of unwrap()

The source code is making use of far too many unwrap() calls.
We should handle all return values explicitely and fail with a good and explanatory message if some call doesn't return Ok() (unwrap() just panics with some message that doesn't help at all).

implement helper shortcuts

I'd be nice to have some shortcuts to act on the content of the text (or interpret the text).

Ideas:
Alt+g -> open browser with content (aka url)
Alt+k -> fetch password from keepass (how?)
Alt+z -> search/open zim

Alternative (text field tags):
"g:" -> open browser with content (aka url)
"kp:" -> fetch password from keepass
"ku:" -> fetch user from keepass
"z:<text" -> search/open zim for text/key

Create a nicer UI

The current UI is usable, but not really eye-candy ;)
Moreover, having only one line for the user-specified query and the results makes selection of completions slower than necessary.
I would propose to create a UI similar to Albert and Alfred.
I'm not an expert in UI toolkits, but would see the following features as desirable:

  • portability and easy cross-compilation (Linux, Mac, Windows?)
  • stylability (e.g. CSS or similar)
  • easy key listening in text box
  • key listening for global shortcuts
  • low resource consumption
  • high startup speed

Besides the current GTK UI, QT or Conrod might be good options. Possibly also other candidates from the awesome rust listing.

@buster Do you see any other desirables or options?

Invoking runner spawns a process but not the requested app

  1. Open rrun dialogue
  2. Type in some command
  3. Press Enter

I can see the spawned process in the list of processes:

$ ps -o state=,command | grep bash
R bash -i -c (history -s rrun; history -a) && rrun

but the application itself does not run.

make packaging easier

Since rustis still not packaged for Debian and the whole debian build process is nightmarish and complex, there should be better instructions on how to actually build the debian package..
"make snapshot" and "make local-deb" happens to work for me, but it was non-trivial to set up

Implement more tests

Although we use travis, only one test function is implemented.
That should be more, now that we have several components that can be unit-tested..

Simple and modular caching

There are completions that take too long to be run live every time. A simple form of caching would be nice here.
I have an idea that would fit nicely with the current Unix-like "small combinable tools" philosophy:
We add a command line option to rrun that doesn't show the GUI but instead runs a completion and prints the returned result string directly to STDOUT.
One could then add something like this to the config:

[[completion]]
type="cache-request"
trigger="cache (.*)"
command="rrun list-completions {}"

[[runner]]
type="cache-request"
command="rrun complete {} > ~/.config/rrun/command_{}.cache"

and use the cache by just adding

[[completion]]
type="command"
command="cat ~/.config/rrun/command_*.cache | grep {}"

With some duplication in the config, you could do the same thing for URLs or whatever.

Note 1: You can already do this manually by running the code from the completion yourself and storing it into a file. The above proposal would just make it a lot more convenient.
Note 2: If we additionally write which command was called how often somewhere, one could also easily implement a script that sorts the contents of the .cache files by their usage and get the most frequently used completions first.

gdk compile errors

error: failed to compile `rrun v0.2.1 (https://github.com/buster/rrun#fe6dccdf)`, intermediate artifacts can be found at `/tmp/cargo-install.HGmFlrkrPQNs`

Caused by:
  Multiple packages link to native library `gdk`. A native library can be linked only once.

Package `gdk-sys v0.3.4`
    ... which is depended on by `gdk v0.5.3`
    ... which is depended on by `gtk v0.1.3`
    ... which is depended on by `rrun v0.2.1 (https://github.com/buster/rrun#fe6dccdf)`
links to native library `gdk`.

Package `gdk-sys v0.5.0`
    ... which is depended on by `gdk v0.7.0`
    ... which is depended on by `rrun v0.2.1 (https://github.com/buster/rrun#fe6dccdf)`
also links to native library `gdk`.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.