Git Product home page Git Product logo

fontpreview-sway-imv's Introduction


✨ Very customizable and minimal font previewer written in bash ✨

fontpreview is a commandline tool that lets you quickly search for fonts that are installed on your machine and preview them. The fuzzy search feature is provided by fzf and the preview is generated with imagemagick and then displayed using imv. This tool is highly customizable, almost all of the variables in this tool can be changed using the commandline flags or you can configure them using environment variables.

This repository is a fork of fontpreview by sdushantha, adapting their work to avoid having to install the X11 tools xdotool and nsxiv in sway.

Dependencies

  • sway (should include swaymsg)
  • fzf
  • imagemagick
  • imv

Installation

Install using make

# Clone the repo
$ git clone https://github.com/srp-mx/fontpreview-sway-imv

# Change your current directory to fontpreview-sway-imv
$ cd fontpreview-sway-imv

# Install it
$ sudo make install

Install it locally

# Download the fontpreview source code, save as fontpreview
# and make it executeable
$ curl -L https://raw.githubusercontent.com/srp-mx/fontpreview-sway-imv/master/fontpreview > fontpreview && chmod +x fontpreview

# Then move fontpreview to somewhere in your $PATH
# Here is an example
$ mv fontpreview ~/scripts/

Usage

$ fontpreview --help
usage: fontpreview [-h] [--size "px"] [--position "+x+y"] [--search-prompt SEARCH_PROMPT]
                   [--font-size "FONT_SIZE"] [--bg-color "BG_COLOR"] [--fg-color "FG_COLOR"]
                   [--preview-text "PREVIEW_TEXT"] [-i font.otf] [-o preview.png] [--version]

┌─┐┌─┐┌┐┌┌┬┐┌─┐┬─┐┌─┐┬  ┬┬┌─┐┬ ┬
├┤ │ ││││ │ ├─┘├┬┘├┤ └┐┌┘│├┤ │││
└  └─┘┘└┘ ┴ ┴  ┴└─└─┘ └┘ ┴└─┘└┴┘
Very customizable and minimal font previewer written in bash

optional arguments:
   -h, --help            show this help message and exit
   -i, --input           filename of the input font (.otf, .ttf, .woff are supported)
   -o, --output          filename of the output preview image (input.png if not set)
   --size                size of the font preview window
   --position            the position where the font preview window should be displayed
   --search-prompt       input prompt of fuzzy searcher
   --font-size           font size
   --bg-color            background color of the font preview window
   --fg-color            foreground color of the font preview window
   --preview-text        preview text that should be displayed in the font preview window
   --version             show the version of fontpreview you are using

If you want to generate a preview image for a single font file (.otf, .ttf, and .woff are supported), use the -i and -o option to indicate the filename of the input font and the output preview image.

$ fontpreview -i font.otf -o preview.png

Configure

You can configure fontpreview through environment variables.

This can be in your .bashrc, .zshrc, etc

# Input prompt of fuzzy searcher
export FONTPREVIEW_SEARCH_PROMPT=""

# Size of the font preview window
export FONTPREVIEW_SIZE=532x365

# The position where the font preview window should be displayed
export FONTPREVIEW_POSITION="+0+0"

# Font size
export FONTPREVIEW_FONT_SIZE=38

# Background color of the font preview window
export FONTPREVIEW_BG_COLOR="#ffffff"

# Foreground color of the font preview window
export FONTPREVIEW_FG_COLOR="#000000"

# Preview text that should be displayed in the font preview window
export FONTPREVIEW_PREVIEW_TEXT="ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\nabcdefghijklm\nnopqrstuvwxyz\n1234567890\n!@$\%(){}[]"

fontpreview-sway-imv's People

Contributors

sdushantha avatar 0mp avatar birma avatar krasjet avatar imgbotapp avatar sebastianmeisel avatar maxdevjs avatar misterhackerman avatar erenhatirnaz avatar srp-mx avatar elsorino avatar tastytea 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.