chrysoberyl
The controllable image viewer
Features
- Key mapping
- Mouse mapping (+ with screen region)
- Multi control source (stdin, fifo file, and user specified command's stdout)
- Multi cell view
- Many operation commands
- Support HTTP(s)
- Support Archive (zip, lha, rar, tar.gz and more)
- Color config (window, statusbar, error text)
- Shuffle
- Directory expanding
- Cherenkov
- Shell script friendly output (stdout)
Multi cell view
Press 3v2V
for 3x2.
Cherenkov
Map to button with @map input button-2 @cherenkov --color blue --radius 0.02
.
And click with wheel.
Original -> Cherenkoved
Command line
chrysoberyl <OPTIONS>... (<FILE>|<DIRECTORY>)
chrysoberyl <OPTIONS>... <OPERATION_COMMAND>... ["@@" (<FILE>|<DIRECTORY>)...]
chrysoberyl (--print-path|-v)
chrysoberyl (--version|-v)
chrysoberyl (--help|-h)
Options
Name | Description |
---|---|
--silent |
Suppress stdout |
--shuffle|-z |
Shuffle entries |
--expand|e |
Expand directory (@expand ) |
--expand-recursive|-E |
Expand directory (@expand ) |
(--max-curl-threads|-t) <N_THREADS> |
Set maximum curl threads |
(--input|-i) <PATH> |
Create the file to input operation commands |
--encoding <ENCODING> |
Set filename encoding for archives (zip, rar, ...). |
--role <WINDOW_ROLE> |
Set window role |
--use-gtk-theme |
Use GTK theme |
Example
Open a PDF file.
$ chrysoberyl ~/my-books/rust-nomicon.pdf
Set some options (operation commands), then open a PDF file.
$ chrysoberyl @@views 2 @@set reverse @@ ~/my-books/rust-nomicon.pdf
Print the file or directory path used by chrysoberyl.
$ chrysoberyl --print-path
Operation commands
You can use below commands on STDIN of chrysoberyl.
@apng [(--length|-l) ]
Generate animated PNG.
@backword
Backword history
@cd
Change working directory.
@cherenkov [(--radius|-r) ] [(--random-hue|--hue|-h) ] [(--spokes|-s) ] [-x ] [-y ] [(-c|--color) <CSS_COLOR>] [--seed|-S ] [--detect-eyes|-d]
Cherenkoves current image.
<RADIUS>
→ Radius (0 to 1.0)<HUE>
→ 0 to 360<SPOKES>
→ Number of spokes (1 or more)<X>
<Y>
→ Position (0 to 1.0)<CSS_COLOR>
→ Color<SEED>
→ The seed of random color generator
if you use --detect-eyes
, set ENV AWS_XXX
for Amazon Rekognition.
Color examples
- red
- #00FF00
- random
@cherenkov-reset
Reset.
@clear
Clear image entries.
@clip [ [ [ []]]]
Clip by mouse selected rectangle.
@command-line <INITIAL_COMMAND>
Show command line with <INITIAL_COMMAND>
.
@controller-file
Open <PATH>
file to control chrysoberyl.
@controller-fifo
Open <PATH>
fifo file to control chrysoberyl.
@controller-socket [--binary|-b]
Open <PATH>
socket to control chrysoberyl.
@copy-to-clipboard [--meta <KEY_VALUE>] [--primary|-1|--secondary|-2|--clipboard]
Copy currently viewing image to clipboard.
@count
Set count
explicitly.
@cycle [...]
Cycle the value of OPTION
.
(@dec|@decrement|@decrease|@--)
Decrement the value of OPTION
.
@default
Load default configuration.
@define-switch <SWITCH_NAME> <OPERATIONS_1> @@ <OPERATIONS_2> @@ ...
Define user switch.
Each operations are speparated by @@
.
If you define as below...
@define-switch my-option ; @views 1 ; @disable reverse @@ ; @views 2 ; @enable reverse
then you can use @cycle my-option
to execute ; @views 1 ; @disable reverse
or ; @views 2 ; @enable reverse
.
@delete <FILTER_EXPRESSION>
Delete the selected entries by FILTER_EXPRESSION
.
@disable
Disable OPTION
.
@disable reverse
equals @set reverse false
.
@draw
Redraw image.
@editor [(--file|-f) ] [(--session|-s) ] [--comment-out|-c] [--freeze|-F] <COMMAND_LINE>...
SESSION
- all
- entries
- envs
- filter
- mappings
- markers
- options
- paths
- position
- queue
- reading (filter + options + entries + queue + markers + position)
- switches
@enable
Enable OPTION
.
@enable reverse
equals @set reverse true
.
@eval ...
Expand ENV variables in <OPERATION>...
.
e.g)
@query @eval @mark $CHRY_QUERY
@query @eval @jump --load $CHRY_QUERY
@expand [--recursive|-r|--rec] []
Add directory entries (image) on PATH
.
@file-move [--fail|-f] [--overwrite|-o] [--new|--new-file-name|-n] [(--size|-s) ] [--as-filepath|-F] []
Move the current image file to DIRECTORY
.
If destination file exists...
if --fail
is given, then file operation fails.
if --new
is given, then file operation succeeds with generated new file name.
if --overwrite
is given, then overwrites destination file.
@file-copy [--fail|-f] [--overwrite|-o] [--new|--new-file-name|-n] [(--size|-s) ] [--as-filepath|-F] []
Copy the current image file to DIRECTORY
.
See @file-move
to get more information.
@fill [(--shape|-s) ] [(--cell-index|-i) <CELL_INDEX>] [(--region|-r) ] [(--color|-c) <CSS_COLOR>] [(--operator|-o) ] [--mask|-m]
Fill the shape.
You can use @fill
with mapping.
@map region button-3 @fill --mask --filler circle --color red
REGION Format
<LEFT> 'x' <TOP> '-' <RIGHT> 'x' <BOTTOM>
examples
0.0x0.0-1.0x1.0
0.5x0.5-0.8x0.8
@filter [(--dynamic|-d)] [(--static|-s)] <FILTER_EXPRESSION>
Filter entries.
@fire <MAPPED_TYPE>
Fire mapped input/event.
@fire
does not support region
mapping.
(@first|@f) [--wrap|-w] [--archive|-a] [--ignore-views|-i] []
Show COUNT
th entry.
@flush-buffer
Pull all buffered entries.
See $CHRY_REMOTE_BUFFER
, if you want to get the number of buffered entries.
@fly-leaves
Insert NUMBER
flyleaves.
@forwrd
Forword history
@fragile
Make fragile operation file. You can write operation commands on this file to operate chrysoberyl.
@gif [(--length|-l) ] [--show|-s]
Generate cherenkoved animation gif to the PATH
.
@go []
Show the entry.
PATH
is entry path/URL.
INDEX
is page index of archive/PDF.
This operation does not add any entry.
(@inc|@increment|@increase|@++)
Increment the value of OPTION
.
@input [...]
Feed input event.
@kill-timer
Kill a timer named NAME
.
(@last|@l) [--wrap|-w] [--archive|-a] [--ignore-views|-i] []
Show COUNT
th (from last) entry.
@load [(--search-path|-p)]
Load operation script file.
If --search-path
is given, load from search-path
.
@load-ui [(--search-path|-p)]
Load *.glade
file.
See Glade - A User Interface Designer.
@map (input|event|region|operation) ...
@map input [(--region|-r) ]
Key/Mouse mapping.
See STDOUT of chrysoberyl for INPUT
.
@map event [--once|o] [(--repeat|-r) ] [(--group|-g) ] <EVENT_NAME>
When EVENT_NAME
is fired, execute OPERATION
@map region <MOUSE_BUTTON>
For @clip
and @fill
.
@message [--keep|-k] []
If <MESSAGE>
is not given, remove message.
If --keep
is given, keep current message.
@meow
Meow
@move-again [--wrap|-w] [--archive|-a] [--ignore-views|-i] []
Move again by previous method.
@multi [--async|-a] [--sync|-s] <OPERATIONS_1> [ <OPERATIONS_2>]...
Execute multiple operations at once.
@multi <> @first 42 <> @views 2 <> @shell xmessage "at 42"
";" <OPERATIONS_1> [";" <OPERATIONS_2>]...
Same as @multi
.
; @first 42 ; @views 2 ; @shell xmessage "at 42"
(@next|@n) [--wrap|-w] [--archive|-a] [--ignore-views|-i] [--forget|-f] []
Show COUNT
th next entry.
@page [<PAGE_NUMBER>]
Show COUNT
entry of the currently viewing archive/PDF.
@pdf-index [--async|-a] [--sync|-s] [--operation|-o] [--no-operation|-O] [--separator ] [(--format|-f) ] <COMMAND_ARG1>...
Execute shell COMMAND
.
Chrysoberyl passes PDF Index data to the STDIN of the COMMAND
process.
FORMAT
- "1" | "one-line" | "one" | "o"
- "2" | "two-lines" | "two" | "t"
- "indented" | "indent" | "i"
@link-action [...]
e.g)
@map input button-1 @link-action @next
(@prev|@p|@previous) [--wrap|-w] [--archive|-a] [--ignore-views|-i] [--forget|-f] []
Show COUNT
th previous entry.
@push [--meta <KEY_VALUE>]... [--force|-f] [--show|-s]
Add a entry.
PATH
is URL, file or directory.
@push-archive [--meta <KEY_VALUE>]... [--force|-f] [--show|-s]
Add a archive file.
@push-clipboard [--meta <KEY_VALUE>]... [--operation|-o] [--show|-s] [--primary|-1|--secondary|-2|--clipboard]
Add a clipboard image.
(@push-directory|@push-dir) [--meta <KEY_VALUE>]... [--force|-f] [--show|-s]
Add the images that the DIRECTORY
contains.
@push-image [--meta <KEY_VALUE>]... [--force|-f] [--show|-s] [--expand|-e] [--expand-recursive|-E]
Add a image.
If --expand
(or --expand-recursive
) is given, add the images that the directory of PATH
contains.
@push-next [--show|-s] [--clear|-c]
Add a next file.
@push-message [--meta <KEY_VALUE>]... [--show|-s]
Add a text message entry.
@push-pdf [--show|-s]
Add a PDF file.
(@push-previous|@push-prev) [--show|-s] [--clear|-c]
Add a previous file.
@push-url [--meta <KEY_VALUE>]... [--force|-f] [--show|-s] [(--type|-t|--as) ]
Add a URL to image/PDF/archive.
Type
- image
- archive
@queue [(--times|-t) ]...
Re-queue the operation to processsing queue.
@quit
See you.
(@random|@rand)
Show a entry randomly.
@record ...
Record to history
(@refresh|@r) [--image|-i]
Refresh something.
If --image
is given, clear the caches for currently viewing entries.
@remove-effects
Remove any effects (cherenkov etc).
@save [(--target|-t) ] [--freeze|-F]
Write the session data to PATH
.
You can @load
PATH
file to restore current session.
@scroll [(--size|-s) ] [--crush|-c] [--reset|-r] (up|down|left|right) [...]
Scroll image.
If no SIZE
is given, scroll size is 1.0
.
@search [--backward|-b] [(-c|--color) <CSS_COLOR>]
Search text with TEXT
, and highlights them.
@set
Set option value.
@set-env [--prefix|-p] [--system-prefix|-P]
Set ENV.
--prefix
adds CHRY_X_
to NAME
.
--system-prefix
adds CHRY_
to NAME
.
(@set-by-count|@set-count)
Set COUNT
as value to OPTION
.
@shell [--async|-a] [--sync|-s] [(--session|-S) ]... [--freeze|-F] [--operation|-o] [--path|-P] [--binary|-b] [--search-path|-p] <COMMAND_ARG1>...
Execute shell command.
If --operation
is given, chrysoberyl read the STDOUT of the command as operation commands.
@shell-filter [--search-path|-p] <COMMAND_ARG1>...
Execute COMMAND
and pass the STDOUT of chrysoberyl to the COMMAND
STDIN.
@show [--wrap|-w] [--archive|-a] [--ignore-views|-i] []
Show the entry.
@shuffle
Shuffle entries.
@sort [--accessed|-a] [--created|-c] [--modified|-m] [--reverse|-r] [--fix|-f] [ <COMMAND_ARG1>...]
Sort entries.
@timer [(--name|-n) ] [(--repeat|-r) ] [--infinity|-i] [--once|-1] [--async|-a] [--sync|-s] <INTERVAL_SEC> ...
Execute OPERATION
repeatedly.
@timer -i next-page 1.5 @next
You can use @kill-timer
to stop this task.
@toggle
Toggle between option values (true/false).
@unclip
Restore from @clip
.
@undo []
Undo some operations (fill/cherenkov).
@unless <FILTER_EXPRESSION> ...
If the result of FILTER_EXPRESSION
evaluation is false, execute the operation.
@unmap (input|region|event|operation)
Unmap the @map
ped.
@unmap event [(--group|-g) ] [<EVENT_NAME>]
Unmap a event
@unset
Set default value.
@update [--image] [--image-options|-o] [--status|-s] [--message|-m] [--pointer|-p]
For developper.
@user
DEPRECATED.
(@views|@v) [--ignore-views] []
Set the number of view cells.
The default of ROWS
is 1.
If you want to read a manga, maybe you should...
@views 2
@when <FILTER_EXPRESSION> ...
If the result of FILTER_EXPRESSION
evaluation is true, execute the operation.
@write [--index <CELL_INDEX>]
Write current entry image to PATH
.
@write
generate the image that is all effects applyed.
<KEY_VALUE> format
=
e.g.
key=value
Options
Name | Type | Default | Description |
---|---|---|---|
abbrev-length | unsigned integer | Max length for CRHY_ABBREV_PATH |
|
animation | boolean | Support animation GIF | |
auto-reload | boolean | Reload current viewingly images when they are updated. | |
auto-paging | no/always/smart | ||
canonicalize | boolean | true | Canonicalize file path |
curl-connect-timeout | unsigned integer | 10 | cURL option (seconds) |
curl-follow-location | boolean | true | cURL option |
curl-low-speed-limit | unsigned integer | cURL option | |
curl-low-speed-time | unsigned integer | cURL option | |
curl-timeout | type: unsigned integer | none | cURL option (seconds) |
empty-status-format | string-or-file | Status bar format for empty. Give a string or a mruby script file path (e.g. @~/.config/chrysoberyl/status.rb ) |
|
fit-to | width/height/original/original-or-cell/cell/crop/XXX%/WIDTHxHEIGHT | cell | |
freeze | boolean | false | |
idle-time | real number | 0.25 | Delay time for idle event |
ignore-failures | boolean | true | Remove the entries that failed to get from remote |
history-file | path | none | STDIN input history file |
horizontal-flip | boolean | Flip images horizontally | |
horizontal-views | unsigned integer | Number of horizontal cells (1 or more) | |
initial-position | top-left/top-right/bottom-left/bottom-right/center | Initial image position in cell | |
log-file | path | none | Path for log |
mask-operator | mark operators | ||
path | path | Script search path | |
pointer-hide-delay | unsinged integer | none | Time to hide pointer (mouse cursor) |
pre-render | boolean | true | |
pre-render-limit | unsigned integer | 100 | 1 or more |
pre-render-pages | unsigned integer | 5 | 1 or more |
pre-render-stages | unsigned integer | 3 | 1 or more |
reverse | boolean | false | |
rotation | 0/1/2/3 | ||
screen | main/command-line/log-view/ui | ||
status-bar | boolean | true | |
status-bar-align | left/center/right | center | |
status-bar-height | unsigned integer | none | 1 or more |
status-bar-overlay | boolean | false | |
status-format | string-or-file | Give a string or a mruby script file path (e.g. @~/.config/chrysoberyl/status.rb ) |
|
stdout | boolean | ||
style | string-or-file | Give a CSS string or a CSS file path (e.g. @~/.config/chrysoberyl/style.css ) |
|
title-format | string-or-file | Give a string or a mruby script file path (e.g. @~/.config/chrysoberyl/title.rb ) |
|
vertical-flip | boolean | Flip images vertically | |
vertical-views | unsigned integer | Number of vertical cells (1 or more) | |
update-cache-atime | boolean | false | |
watch-files | Fire file-changed event when currently viewing images are updated |
||
skip-resize-window | unsigned integer | TODO |
Mask operators
- clear
- source
- over
- in
- out
- atop
- dest
- dest-over
- dest-in
- dest-out
- dest-atop
- xor
- add
- saturate
- multiply
- screen
- overlay
- darken
- lighten
- color-dodge
- color-burn
- hard-light
- soft-light
- difference
- exclusion
- hsl-hue
- hsl-saturation
- hsl-color
- hsl-luminosity
Note
You can use @editor
to see current option values.
@editor --session all $EDITOR
Supportted operations
unsigned integer : @set, @unset, @increase, @decrease, @cycle
Events
Name | Description |
---|---|
at-first | After displaying first page |
at-last | After displaying last page |
download-all | After all download task is finished |
error | After error occurs |
file-changed | Current image files are changed |
idle | When the user doesn't operate for the time specified with idle-time |
initialize | After initializing chrysoberyl |
invalid-all | All displayed images are invalid |
mapped-input | After fire mapped input event. (You can see $CHRY_MAPPED , $CHRY_X and $CHRY_Y ) |
quit | Quit |
resize-window | After resize chrysoberyl window |
show-image-pre | Before image is shown |
show-image | After image is shown |
spawn | After spawning chrysoberyl window |
void | Void |
Filter Expression
Expr ← Block | Bool | Cond | Logic | 'not' Expr
Block ← '(' Expr ')' | '{' Expr '}'
Logic ← Bool LogicOp Expr
Bool ← Compare | BoolVariable | 'true' | 'false'
Cond ← 'if' Expr Expr Expr | 'when' Expr Expr | 'unless' Expr Expr
BoolOp ← 'and' | 'or'
Compare ← Value CmpOp Value
CmpOp ← '<' | '<=' | '>' | '>=' | '=' | '==' | '!=' | '=*' | '!*'
Value ← Glob | Integer | Variable
Variable ← 'type' | 'width' | 'height' | 'path' | 'ext' | 'extension' | 'dimensions' | 'name' | 'filesize' | 'page' | 'pages' | 'real-pages' | 'ratio'
Glob ← '<' string '>'
BoolVariable ← 'animation' | 'active' | 'valid'
User Defined UI
Chrysoberyl supports *.glade
file.
You can execute @load-ui
to load the UI you defined and execute @set screen ui
to show the UI.
When you click a named widget or type Return
on Entry), chrysoberyl fire the event.
(If you name a widget with foo
, ui-foo
will be fired)
Some events have the environment variable $CHRY_VALUE
.
Supported widget types
- Button
- ComboBoxText
- Entry
- RadioButton
- Scale
- Switch