Giter Site home page Giter Site logo

build-refresh's Introduction

build-refresh

build-refresh is an Alfred workflow .

Installation

  1. Clone the repository

  2. Double-click on build-refresh.alfredworkflow and import it into Alfred

  3. By default, the workflow uses "Hyper" and "Vivaldi" as the termianl and browser, respectively. If you use different applications, you can change these keywords in the different cells. Each cell has a description that includes info on whether or not it should be changed.

Dependencies

Requires the Alfred Powerpack.

Project setup

You probably want to have a build.sh script. You also want to have a build-open.sh which functions as a fallback in case somebody doesn’t have build-refresh.

build-open.sh

For example, with asciidoctor-pdf, your build-open.sh could look like this:

./build.sh "$@" && \
open *.pdf;

or, for asciidoctor (with html output), you could use:

./build.sh "$@" && \
open *.html;

build-refresh.sh

Finally, you can add a build-refresh.sh that uses this workflow:

# This script requires the Alfred workflow `com.alfredapp.hacker-dom.build-refresh`.
# It can be downloaded from https://github.com/hacker-DOM/build-refresh
# Alfred is a productivity tool for MacOS.
# If you don't have Alfred or this workflow you can just use ./build-open.sh
./build.sh "$@" && \
/usr/bin/osascript -e "tell application \"Alfred 4\" to run trigger \"refresh\" in workflow \"com.alfredapp.hacker-dom.build-refresh\"";

Usage

There are multiple ways to use the workflow:

  1. Anywhere in your operating system, launch Alfred (default Cmd+Space), type build and execute the build trigger of this workflow. The only requirement here is that in your most-recently-used terminal window, the AsciiDoc project is the first tab (more specifically, activatable by Cmd+1).

    This trigger will run ./build-refresh.sh in the first tab of your most-recently-used terminal window.

  2. Alternatively, your can use run build-refresh.sh directly.

Either way, this will run the trigger refresh. This will use Vivaldi’s Api to search its tabs and find one matching one of the following two regexs

/^file:\/\/\/Users\/.*\.pdf$/

/^file:\/\/\/Users\/.*\.html$/

It will then: . activate that tab . activate that window . raise Vivaldi . activate Vivaldi . send Cmd+R to refresh the page 🚀

FAQ

What’s the best way to test, locally, if it is working?

Create an empty directory and add:

  1. a a.adoc file with optional contents,

  2. a build.sh file with asciidoctor-pdf "$@" a.adoc,

  3. a build-refresh.sh as above.

  1. Open a new terminal window and try running build-refresh.sh.

  2. Open a new tab and also a new browser window.

  3. Open a different application, run your Aflred shortcut (default: Cmd+Space), type build, and if a trigger comes up, press Enter. Hyper should be activated, your project built, Vivaldi activated with the right tab and window and the document refreshed - voilà!

For a different-application setup, change the corresponding parts in the workflow, and then in this setup 🙂

Can I use a Safari?

Safari has a different Api and is currently not supported

Something doesn’t work!

Submit an issue! I’d like this workflow to work on all Chromium-browsers, terminals, etc.

build-refresh's People

Contributors

hacker-dom avatar

Watchers

 avatar  avatar  avatar

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.