Move uncritical files into etc/ (#350)

This is mainly just to reduce the amount of files in the project root.
The criteria of what gets into `etc/` are the following:

* The file should not be necessary for building nsxiv. This excludes the
  `icon/*` stuff since that's needed by `window.c`.
* The file shouldn't have any valid reason to stay in the project root.
  This excludes things like `README.md`, `.gitignore` etc.

Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/350
Reviewed-by: explosion-mental <explosion-mental@noreply.codeberg.org>
This commit is contained in:
NRK
2022-08-09 16:21:52 +02:00
parent 8dc126194f
commit fb9686c650
16 changed files with 13 additions and 13 deletions

397
etc/CHANGELOG.md Normal file
View File

@ -0,0 +1,397 @@
nsxiv - Changelog
-----------------
**[git](https://codeberg.org/nsxiv/nsxiv.git)**
Changes will only be documented on stable releases. If you're on git/master then
there may be more changes. Please use `git log` to view them.
- - -
***SPECIAL NOTE***: Due to [this incident](https://codeberg.org/nsxiv/nsxiv-tmp/issues/1)
we have moved development over to [CodeBerg](https://codeberg.org/nsxiv/nsxiv).
A lot of the references *below* may now be 404 on GitHub. Any threads which
survived the wipe have been migrated over to [nsxiv-record]. All of the
references *above* can be found on the new main nsxiv repository on CodeBerg.
[nsxiv-record]: https://codeberg.org/nsxiv/nsxiv-record/
- - -
**[v30](https://codeberg.org/nsxiv/nsxiv/archive/v30.tar.gz)**
*(June 15, 2022)*
* Changes:
* Development and main repository moved over to Codeberg.
See the special note above for more info.
* `autoreload_{inotify,nop}.c` merged into a single file, `autoreload.c`. [#263]
* Moved all configuration related macros to `config.mk`. [#264]
* `win-title` is now called only when there's change rather than being called
on each redraw. [#266]
* Added:
* Added more mimetypes to the `.desktop` entry. [#260]
* Added `thumb-info` for customizing the statusbar in thumbnail-mode. [#265]
* Added comments for building on OpenBSD. [#264]
* Fixes:
* "Too many open file" error due to not closing the win-title script. [#245]
* `-f` now directly starts in fullscreen mode rather than opening a normal
window and then going fullscreen. [#251]
* Broken slideshow on slow systems or fast animations. [#282]
* Memory leak when removing an image in thumbnail mode. [#247]
* Correctly setting `_NET_WM_PID`. [#251]
* Don't override statusbar if info script doesn't exist. [#271]
* Potential misbehavior regarding font. [#250]
[#245]: https://codeberg.org/nsxiv/nsxiv-record/pulls/245
[#247]: https://codeberg.org/nsxiv/nsxiv-record/pulls/247
[#250]: https://codeberg.org/nsxiv/nsxiv-record/pulls/250
[#251]: https://codeberg.org/nsxiv/nsxiv-record/pulls/251
[#263]: https://codeberg.org/nsxiv/nsxiv-record/pulls/263
[#264]: https://codeberg.org/nsxiv/nsxiv-record/pulls/264
[#260]: https://codeberg.org/nsxiv/nsxiv-record/pulls/260
[#264]: https://codeberg.org/nsxiv/nsxiv-record/pulls/264
[#265]: https://codeberg.org/nsxiv/nsxiv-record/pulls/265
[#266]: https://codeberg.org/nsxiv/nsxiv-record/pulls/266
[#271]: https://codeberg.org/nsxiv/nsxiv-record/pulls/271
[#282]: https://codeberg.org/nsxiv/nsxiv-record/pulls/282
- - -
**[v29](https://github.com/nsxiv/nsxiv/archive/v29.tar.gz)**
*(March 03, 2022)*
* Changes:
* Window title is now customizeable via `win-title`, cli flag `-T` and related
config.h options are removed. See `WINDOW TITLE` section of the manpage for
more info. [#213]
* Imlib2 cache size is now set based on total memory percentage, by default
set to 3%. [#184]
* Removed some non-POSIX extensions in the Makefile. [#225]
* Added:
* Ability to customize thumbnail mode mouse-bindings via `config.h`. [#167]
* Option to set statusbar position to top via `config.h`. [#231]
* New keybinding <kbd>z</kbd> to scroll to center. [#203]
* Fixes:
* Manpage cleanup: avoid confusing wording and document thumbnail mode
mouse-bindings. [#186]
* Wrong jpeg exif orientation with Imlib2 v1.7.5 (and above). [#188]
* Animation slowdown when zoomed in. [#200]
* Reset statusbar after failed keyhandler. [#191]
* Window title not working on certain WMs. [#234]
* Various compiler warnings. [#197]
[#167]: https://codeberg.org/nsxiv/nsxiv-record/pulls/167
[#184]: https://codeberg.org/nsxiv/nsxiv-record/pulls/184
[#186]: https://codeberg.org/nsxiv/nsxiv-record/pulls/186
[#188]: https://codeberg.org/nsxiv/nsxiv-record/pulls/188
[#191]: https://codeberg.org/nsxiv/nsxiv-record/pulls/191
[#197]: https://codeberg.org/nsxiv/nsxiv-record/pulls/197
[#200]: https://codeberg.org/nsxiv/nsxiv-record/pulls/200
[#203]: https://codeberg.org/nsxiv/nsxiv-record/pulls/203
[#213]: https://codeberg.org/nsxiv/nsxiv-record/pulls/213
[#225]: https://codeberg.org/nsxiv/nsxiv-record/pulls/225
[#231]: https://codeberg.org/nsxiv/nsxiv-record/pulls/231
[#234]: https://codeberg.org/nsxiv/nsxiv-record/pulls/234
- - -
**[v28](https://github.com/nsxiv/nsxiv/archive/v28.tar.gz)**
*(December 12, 2021)*
* Changes:
* Statusbar made optional via `HAVE_LIBFONTS`. [#95]
* Remove library auto-detection, use `OPT_DEP_DEFAULT` instead. [#71]
* Example scripts will now be installed into `EGPREFIX`
(`$(PREFIX)/share/doc/nsxiv/examples` by default). See README for more
info. [#86]
* Added:
* Animated webp support (optional via `HAVE_LIBWEBP`). [#20]
* New mouse-binding <kbd>Ctrl-Button1</kbd> for relative drag. [#117]
* Ability to configure colors and fonts in `config.h`. [#115]
* Ability to configure navigation width area in `config.h`. [#155]
* Ability to customize the set of modifiers used when processing keybindings
in `config.h` via `USED_MODMASK`. [#150]
* Ability to configure Imlib2's cache size for better image (re)loading
performance in `config.h`. [#171]
* Cli flag `-0` for sending null-seperated file-list to standard out (`-o`),
and key-handler and receiving null-seperated file-list via stdin (`-i`).
[#68] [#141] [#164]
* Export environment variable `NSXIV_USING_NULL` to key-handler. [#164]
* Embed new nsxiv icon. [#163]
* `make install-icon` to install icons. [#80] [#96]
* `make install-desktop` to install .desktop entry. [#80] [#96]
* `make install-all` to install everything. [#80] [#96]
* Configurable `KEYHANDLER_ABORT` in `config.h`. [#91] [#172]
* Statusbar message upon key-handler activation. [#98]
* Ability to write custom C functions in `config.h` and use them via
keybindings. [#76]
* Fixes:
* Not able to use `KEYHANDLER_ABORT` key (<kbd>Escape</kbd> by default) in
regular keybindings. [#91]
* Memory leak related to Xresources. [#134]
* Memory leak in gif loader. [#165]
* Better handle gif colormap and prevent out-of-bound access. [#165]
* Prevent crash when zooming out in very small images. [#178]
* Removed non-POSIX commands and extensions from `Makefile`. [#71]
* Regression where nsxiv wouldn't run on non-TrueColor X server. [#114]
* Wrong comments in `config.h` and description in `manpage`.
[#105] [#106] [#152]
[#20]: https://codeberg.org/nsxiv/nsxiv-record/pulls/20
[#68]: https://codeberg.org/nsxiv/nsxiv-record/pulls/68
[#71]: https://codeberg.org/nsxiv/nsxiv-record/pulls/71
[#76]: https://codeberg.org/nsxiv/nsxiv-record/pulls/76
[#80]: https://codeberg.org/nsxiv/nsxiv-record/pulls/80
[#86]: https://codeberg.org/nsxiv/nsxiv-record/pulls/86
[#91]: https://codeberg.org/nsxiv/nsxiv-record/pulls/91
[#95]: https://codeberg.org/nsxiv/nsxiv-record/pulls/95
[#96]: https://codeberg.org/nsxiv/nsxiv-record/pulls/96
[#98]: https://codeberg.org/nsxiv/nsxiv-record/pulls/98
[#105]: https://codeberg.org/nsxiv/nsxiv-record/pulls/105
[#106]: https://codeberg.org/nsxiv/nsxiv-record/pulls/106
[#114]: https://codeberg.org/nsxiv/nsxiv-record/pulls/114
[#115]: https://codeberg.org/nsxiv/nsxiv-record/pulls/115
[#117]: https://codeberg.org/nsxiv/nsxiv-record/pulls/117
[#134]: https://codeberg.org/nsxiv/nsxiv-record/pulls/134
[#141]: https://codeberg.org/nsxiv/nsxiv-record/pulls/141
[#150]: https://codeberg.org/nsxiv/nsxiv-record/pulls/150
[#152]: https://codeberg.org/nsxiv/nsxiv-record/pulls/152
[#155]: https://codeberg.org/nsxiv/nsxiv-record/pulls/155
[#163]: https://codeberg.org/nsxiv/nsxiv-record/pulls/163
[#164]: https://codeberg.org/nsxiv/nsxiv-record/pulls/164
[#165]: https://codeberg.org/nsxiv/nsxiv-record/pulls/165
[#171]: https://codeberg.org/nsxiv/nsxiv-record/pulls/171
[#172]: https://codeberg.org/nsxiv/nsxiv-record/pulls/172
[#178]: https://codeberg.org/nsxiv/nsxiv-record/pulls/178
- - -
**[v27.1](https://github.com/nsxiv/nsxiv/archive/v27.1.tar.gz)**
*(September 16, 2021)*
* Fixes:
* Source tarball failing build [#66]
[#66]: https://codeberg.org/nsxiv/nsxiv-record/pulls/66
- - -
**[v27](https://github.com/nsxiv/nsxiv/archive/v27.tar.gz)**
*(September 16, 2021)*
* Changes:
* Re-release under the name nsxiv.
* Xresources `Sxiv.foreground` and `Sxiv.background` changed
to `Nsxiv.window.foreground` and `Nsxiv.window.background`.
* Xresources `Sxiv.font` changed to `Nsxiv.bar.font`.
* Rework the build system. Now by default we'll build with only optional
dependencies that are already installed. [#19]
* Added:
* Fill scale mode. [#2]
* Configurable X window title (via `config.h` and the `-T` flag). [#23]
* Support custom bar colors via Xresources. [#19]
* Support custom mark color via Xresources. [#51]
* Toggle animation playback with <kbd>Ctrl-a</kbd>. [#33]
* Set `_NET_WM_PID` and `WM_CLIENT_MACHINE` X properties. [#13]
* Set `ICCCM WM manager` hints. [#12]
* Fixes:
* Cli flag `-G` not initially setting gamma. [#31]
* Wrong keybinding description in the manpage. [#14]
* .desktop entry not advertising webp support. [#15]
* Prevent crash when embedded into transparent window. [#3]
* Small memory leak. [#57]
* Rare crash when showing some GIFs. [#41]
* Rare event where nsxiv wouldn't close after window being destroyed. [#53]
[#2]: https://codeberg.org/nsxiv/nsxiv-record/pulls/2
[#3]: https://codeberg.org/nsxiv/nsxiv-record/pulls/3
[#12]: https://codeberg.org/nsxiv/nsxiv-record/pulls/12
[#13]: https://codeberg.org/nsxiv/nsxiv-record/pulls/13
[#14]: https://codeberg.org/nsxiv/nsxiv-record/pulls/14
[#15]: https://codeberg.org/nsxiv/nsxiv-record/pulls/15
[#19]: https://codeberg.org/nsxiv/nsxiv-record/pulls/19
[#23]: https://codeberg.org/nsxiv/nsxiv-record/pulls/23
[#31]: https://codeberg.org/nsxiv/nsxiv-record/pulls/31
[#33]: https://codeberg.org/nsxiv/nsxiv-record/pulls/33
[#41]: https://codeberg.org/nsxiv/nsxiv-record/pulls/41
[#51]: https://codeberg.org/nsxiv/nsxiv-record/pulls/51
[#53]: https://codeberg.org/nsxiv/nsxiv-record/pulls/53
[#57]: https://codeberg.org/nsxiv/nsxiv-record/pulls/57
sxiv
----
**Stable releases**
**[v26](https://github.com/nsxiv/nsxiv/archive/v26.tar.gz)**
*(January 16, 2020)*
* Maintenance release
**[v25](https://github.com/nsxiv/nsxiv/archive/v25.tar.gz)**
*(January 26, 2019)*
* Support font fallback for missing glyphs
* Fix busy loop when built without inotify
* Use background/foreground colors from X resource database
**[v24](https://github.com/nsxiv/nsxiv/archive/v24.tar.gz)**
*(October 27, 2017)*
* Automatically reload the current image whenever it changes
* Support embedding into other X windows with -e (e.g. tabbed)
* New option -p prevents sxiv from creating cache and temporary files
* Simpler mouse mappings, the most basic features are accessible with the
mouse only (navigate, zoom, pan)
**[v1.3.2](https://github.com/nsxiv/nsxiv/archive/v1.3.2.tar.gz)**
*(December 20, 2015)*
* external key handler gets file paths on stdin, not as arguments
* Cache out-of-view thumbnails in the background
* Apply gamma correction to thumbnails
**[v1.3.1](https://github.com/nsxiv/nsxiv/archive/v1.3.1.tar.gz)**
*(November 16, 2014)*
* Fixed build error, caused by delayed config.h creation
* Fixed segfault when run with -c
**[v1.3](https://github.com/nsxiv/nsxiv/archive/v1.3.tar.gz)**
*(October 24, 2014)*
* Extract thumbnails from EXIF tags (requires libexif)
* Zoomable thumbnails, supported sizes defined in config.h
* Fixed build error with giflib version >= 5.1.0
**[v1.2](https://github.com/nsxiv/nsxiv/archive/v1.2.tar.gz)**
*(April 24, 2014)*
* Added external key handler, called on keys prefixed with `Ctrl-x`
* New keybinding `{`/`}` to change gamma (by András Mohari)
* Support for slideshows, enabled with `-S` option & toggled with `s`
* Added application icon (created by 0ion9)
* Checkerboard background for alpha layer
* Option `-o` only prints files marked with `m` key
* Fixed rotation/flipping of multi-frame images (gifs)
**[v1.1.1](https://github.com/nsxiv/nsxiv/archive/v1.1.1.tar.gz)**
*(June 2, 2013)*
* Various bug fixes
**[v1.1](https://github.com/nsxiv/nsxiv/archive/v1.1.tar.gz)**
*(March 30, 2013)*
* Added status bar on bottom of window with customizable content
* New keyboard shortcuts `\`/`|`: flip image vertically/horizontally
* New keyboard shortcut `Ctrl-6`: go to last/alternate image
* Added own EXIF orientation handling, removed dependency on libexif
* Fixed various bugs
**[v1.0](https://github.com/nsxiv/nsxiv/archive/v1.0.tar.gz)**
*(October 31, 2011)*
* Support for multi-frame images & GIF animations
* POSIX compliant (IEEE Std 1003.1-2001)
**[v0.9](https://github.com/nsxiv/nsxiv/archive/v0.9.tar.gz)**
*(August 17, 2011)*
* Made key and mouse mappings fully configurable in config.h
* Complete code refactoring
**[v0.8.2](https://github.com/nsxiv/nsxiv/archive/v0.8.2.tar.gz)**
*(June 29, 2011)*
* POSIX-compliant Makefile; compiles under NetBSD
**[v0.8.1](https://github.com/nsxiv/nsxiv/archive/v0.8.1.tar.gz)**
*(May 8, 2011)*
* Fixed fullscreen under window managers, which are not fully EWMH-compliant
**[v0.8](https://github.com/nsxiv/nsxiv/archive/v0.8.tar.gz)**
*(April 18, 2011)*
* Support for thumbnail caching
* Ability to run external commands (e.g. jpegtran, convert) on current image
**[v0.7](https://github.com/nsxiv/nsxiv/archive/v0.7.tar.gz)**
*(February 26, 2011)*
* Sort directory entries when using `-r` command line option
* Hide cursor in image mode
* Full functional thumbnail mode, use Return key to switch between image and
thumbnail mode
**[v0.6](https://github.com/nsxiv/nsxiv/archive/v0.6.tar.gz)**
*(February 16, 2011)*
* Bug fix: Correctly display filenames with umlauts in window title
* Basic support of thumbnails
**[v0.5](https://github.com/nsxiv/nsxiv/archive/v0.5.tar.gz)**
*(February 6, 2011)*
* New command line option: `-r`: open all images in given directories
* New key shortcuts: `w`: resize image to fit into window; `W`: resize window
to fit to image
**[v0.4](https://github.com/nsxiv/nsxiv/archive/v0.4.tar.gz)**
*(February 1, 2011)*
* New command line option: `-F`, `-g`: use fixed window dimensions and apply
a given window geometry
* New key shortcut: `r`: reload current image
**[v0.3.1](https://github.com/nsxiv/nsxiv/archive/v0.3.1.tar.gz)**
*(January 30, 2011)*
* Bug fix: Do not set setuid bit on executable when using `make install`
* Pan image with mouse while pressing middle mouse button
**[v0.3](https://github.com/nsxiv/nsxiv/archive/v0.3.tar.gz)**
*(January 29, 2011)*
* New command line options: `-d`, `-f`, `-p`, `-s`, `-v`, `-w`, `-Z`, `-z`
* More mouse mappings: Go to next/previous image with left/right click,
scroll image with mouse wheel (horizontally if Shift key is pressed),
zoom image with mouse wheel if Ctrl key is pressed
**[v0.2](https://github.com/nsxiv/nsxiv/archive/v0.2.tar.gz)**
*(January 23, 2011)*
* Bug fix: Handle window resizes correctly
* New keyboard shortcuts: `g`/`G`: go to first/last image; `[`/`]`: go 10
images back/forward
* Support for mouse wheel zooming (by Dave Reisner)
* Added fullscreen mode
**[v0.1](https://github.com/nsxiv/nsxiv/archive/v0.1.tar.gz)**
*(January 21, 2011)*
* Initial release

97
etc/CONTRIBUTING.md Normal file
View File

@ -0,0 +1,97 @@
Project Scope
-------------
* Bug fixes and maintenance
* Prioritize extensibility and simplicity
* Do not make the codebase more complex, keep it simple to hack on
* Do not add extra dependency (if we do, add compile time switch to disable it)
* New features may be added if it cannot be achieved (easily) via a shell script,
doesn't break backwards compatibility and doesn't violate any of the above rules.
Note: Since we aim to be a drop-in replacement for sxiv, we intend to keep all
sxiv's behaviors/features even in cases where removing them would make the
code-base simpler.
Also note that (n)sxiv uses `imlib2` for loading images. Thus any request or
patches for adding support for new image formats should go into
[imlib2's repo](https://git.enlightenment.org/old/legacy-imlib2) instead.
Contribution Guideline
----------------------
When contributing, make sure:
* Your contribution falls under nsxiv's scope and aim
* You follow the existing code style (see [.editorconfig](../.editorconfig))
* You open the pull request from a new branch, not from master
* To avoid using force pushes, especially for bigger patches. Only use them
when there's merge conflicts.
If your contribution is not suitable for general use, it will not be included in nsxiv.
For changes that are very much up to preference, such as changing values in config.h,
please do not open a pull request unless you have an objective explanation.
See the [open issues](https://codeberg.org/nsxiv/nsxiv/issues) to find something
to work on. You can also filter the issues via label:
* [Good first issue](https://codeberg.org/nsxiv/nsxiv/issues?labels=49698):
(Easy) Issues which do not require much if any experience.
* [Up for grabs](https://codeberg.org/nsxiv/nsxiv/issues?labels=49705):
(Intermediate) Issues which are free for anyone who wants to pick it up.
Might require some experience.
* [Help wanted](https://codeberg.org/nsxiv/nsxiv/issues?labels=49699):
(Intermediate/Experienced) Issues where we require some help.
Development workflow for maintainers
------------------------------------
If we notice you contributing and/or showing interest in issues/pull requests,
we may invite you to join the nsxiv org as a member. Being a member simply means
you will be able to approve, disapprove and merge pull requests.
Our workflow regarding pull requests is the following:
* Code related changes require two approvals, but documentation related
changes (e.g. typo) can be merged with just one.
* If a pull request has a single approval, no objections and has been open
for more than 7 days, then it may be force-merged.
* Always prefer squashing when merging. In the case a PR makes more than one
significant change, use the "don't squash" tag and rebase instead.
* When merging, make sure the commit message is cleaned up properly so that
it reflects the current intention of the PR.
For releases, the process is the following:
* Tag the release with a "vN" tag, where N is the version number. Also set
the commit message and tag description for the release commit to "Release
version N". Make sure to use an annotated tag.
* Update `VERSION` macro in `config.mk`.
* Update the changelog (`etc/CHANGELOG.md`):
* Include link to the release tarball and add the release date.
* Document only the changes or fixes between releases. Don't document
changes which never made it into a release.
* Use the "Changes" section to document behavior changes since the last
release, the "Added" section for new features, and the "Fixes" section
for fixed bugs or regressions.
* Include pull request IDs with reference style links.
Mirroring to GitHub:
Assuming `origin` is the name of the codeberg remote and `github` is the name
of the github remote; run the following commands to mirror the codeberg repo to
github:
```console
$ git fetch --prune origin
$ git push --prune github '+refs/remotes/origin/*:refs/heads/*' '+refs/tags/*:refs/tags/*'
```
The first command updates the local repo and the second command pushes
everything on `origin` without pushing any of the local branches.
- - -
For mundane development related talks which don't warrant their own issue, use
the [general discussion](https://codeberg.org/nsxiv/nsxiv/issues/294) thread.

21
etc/examples/image-info Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# Example for $XDG_CONFIG_HOME/nsxiv/exec/image-info
# Called by nsxiv(1) whenever an image gets loaded.
# The output is displayed in nsxiv's status bar.
# Arguments:
# $1: path to image file (as provided by the user)
# $2: image width
# $3: image height
# $4: fully resolved path to the image file
s=" " # field separator
exec 2>/dev/null
filename=$(basename -- "$1")
filesize=$(du -Hh -- "$1" | cut -f 1)
geometry="${2}x${3}"
echo "${filesize}${s}${geometry}${s}${filename}"

41
etc/examples/key-handler Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# Example for $XDG_CONFIG_HOME/nsxiv/exec/key-handler
# Called by nsxiv(1) after the external prefix key (C-x by default) is pressed.
# The next key combo is passed as its first argument. Passed via stdin are the
# images to act upon: all marked images, if in thumbnail mode and at least one
# image has been marked, otherwise the current image. nsxiv(1) will block until
# the handler terminates. It then checks which images have been modified and
# reloads them.
# By default nsxiv(1) will send one image per-line to stdin, however when using
# -0 the image list will be NULL separated and the environment variable
# "$NSXIV_USING_NULL" will be set to 1.
# The key combo argument has the following form: "[C-][M-][S-]KEY",
# where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X
# keysym as listed in /usr/include/X11/keysymdef.h without the "XK_" prefix.
# If KEY has an uppercase equivalent, S-KEY is resolved into it. For instance,
# K replaces S-k and Scedilla replaces S-scedilla, but S-Delete is sent as-is.
rotate() {
degree="$1"
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
case "$(file -b -i "$file")" in
image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
*) mogrify -rotate "$degree" "$file" ;;
esac
done
}
case "$1" in
"C-x") xclip -in -filter | tr '\n' ' ' | xclip -in -selection clipboard ;;
"C-c") while read file; do xclip -selection clipboard -target image/png "$file"; done ;;
"C-e") while read file; do urxvt -bg "#444" -fg "#eee" -sl 0 -title "$file" -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
"C-g") tr '\n' '\0' | xargs -0 gimp & ;;
"C-r") while read file; do rawtherapee "$file" & done ;;
"C-comma") rotate 270 ;;
"C-period") rotate 90 ;;
"C-slash") rotate 180 ;;
esac

20
etc/examples/thumb-info Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Example for $XDG_CONFIG_HOME/nsxiv/exec/thumb-info
# Called by nsxiv(1) whenever the selected thumbnail changes.
# The output is displayed in nsxiv's status bar.
# Arguments:
# $1: path to image file (as provided by the user)
# $2: empty
# $3: empty
# $4: fully resolved path to the image file
s=" " # field separator
exec 2>/dev/null
filename=$(basename -- "$4")
filesize=$(du -Hh -- "$4" | cut -f 1)
echo "${filesize}${s}${filename}"

27
etc/examples/win-title Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# Example for $XDG_CONFIG_HOME/nsxiv/exec/win-title
# Called by nsxiv(1) whenever any of the relevant information changes.
# The output is set as nsxiv's window title.
#
# Arguments, "Optional" arguments might be empty:
# $1: resolved absolute path of the current file
# $2: current file number
# $3: total file number
# $4: image width (Optional: Disabled on thumbnails mode)
# $5: image height (Optional: Disabled on thumbnails mode)
# $6: current zoom (Optional: Disabled on thumbnails mode)
#
# The term file is used rather than image as nsxiv does not
# precheck that the input files are valid images. Total file
# count may be different from the actual count of valid images.
exec 2>/dev/null
filename="${1##*/}"
if [ -n "$4" ]; then # image mode
printf "%s" "nsxiv - ${filename} | ${4}x${5} ${6}% [${2}/${3}]"
else
printf "%s" "nsxiv - ${filename} [${2}/${3}]"
fi

565
etc/nsxiv.1 Normal file
View File

@ -0,0 +1,565 @@
.TH NSXIV 1 nsxiv\-VERSION
.SH NAME
nsxiv \- Neo Simple X Image Viewer
.SH SYNOPSIS
.B nsxiv
.RB [ \-abcfhiopqrtvZ0 ]
.RB [ \-A
.IR FRAMERATE ]
.RB [ \-e
.IR WID ]
.RB [ \-G
.IR GAMMA ]
.RB [ \-g
.IR GEOMETRY ]
.RB [ \-N
.IR NAME ]
.RB [ \-n
.IR NUM ]
.RB [ \-S
.IR DELAY ]
.RB [ \-s
.IR MODE ]
.RB [ \-z
.IR ZOOM ]
.IR FILE ...
.SH DESCRIPTION
nsxiv is a simple image viewer for X.
.P
It has two modes of operation: image and thumbnail mode. The default is image
mode, in which only the current image is shown. In thumbnail mode a grid of
small previews is displayed, making it easy to choose an image to open.
.P
Please note, that the fullscreen mode requires an EWMH/NetWM-compliant window
manager.
.SH OPTIONS
.TP
.BI "\-A " FRAMERATE
Play animations with a constant frame rate set to
.IR FRAMERATE .
.TP
.B \-a
Play animations of multi-frame images.
.TP
.B \-b
Do not show statusbar at the bottom of the window.
.TP
.B \-c
Remove all orphaned cache files from the thumbnail cache directory and exit.
.TP
.BI "\-e " WID
Embed nsxiv's window into window whose ID is
.IR WID .
.TP
.B \-f
Start in fullscreen mode.
.TP
.BI "\-G " GAMMA
Set image gamma to GAMMA (\-32..32).
.TP
.BI "\-g " GEOMETRY
Set window position and size. See section GEOMETRY SPECIFICATIONS of X(7) for
more information on GEOMETRY argument.
.TP
.BI "\-N " NAME
Set the resource name of nsxiv's X window to NAME.
.TP
.BI "\-n " NUM
Start at picture number NUM.
.TP
.B \-h
Print brief usage information to standard output and exit.
.TP
.B \-i
Read names of files to open from standard input. Also done if FILE is `-'.
.TP
.B \-o
Write list of all marked files to standard output when quitting. In combination
with
.B \-i
nsxiv can be used as a visual filter/pipe.
.TP
.B \-p
Enable private mode, in which nsxiv does not write any cache or temporary files.
.TP
.B \-q
Be quiet, and disable warnings to standard error stream.
.TP
.B \-r
Search the given directories recursively for images to view.
.TP
.BI "\-S " DELAY
Start in slideshow mode. Set the delay between images to
.I DELAY
seconds.
.I DELAY
may be a floating-point number.
.TP
.BI "\-s " MODE
Set scale mode according to MODE character. Supported modes are: [d]own,
[f]it, [F]ill, [w]idth, [h]eight.
.TP
.B \-t
Start in thumbnail mode.
.TP
.B \-v
Print version information to standard output and exit.
.TP
.B \-Z
The same as `\-z 100'.
.TP
.BI "\-z " ZOOM
Set zoom level to ZOOM percent.
.TP
.B \-0
Use NULL-separator. With this option, output of \-o and file-list sent to the
key-handler and the input of \-i will be separated by a NULL character.
.SH KEYBOARD COMMANDS
.SS General
The following keyboard commands are available in both image and thumbnail modes:
.TP
.BR 0 \- 9
Prefix the next command with a number (denoted via
.IR count ).
.TP
.B q
Quit nsxiv.
.TP
.B Return
Switch to thumbnail mode / open selected image in image mode.
.TP
.B f
Toggle fullscreen mode.
.TP
.B b
Toggle visibility of statusbar at the bottom of the window.
.TP
.B Ctrl-x
Send the next key to the external key-handler. See section EXTERNAL KEY HANDLER
for more information.
.TP
.B g
Go to the first image.
.TP
.B G
Go to the last image, or image number
.IR count .
.TP
.B r
Reload image.
.TP
.B D
Remove current image from file list and go to next image.
.TP
.BR Ctrl-h ", " Ctrl-Left
Scroll left one screen width.
.TP
.BR Ctrl-j ", " Ctrl-Down
Scroll down one screen height.
.TP
.BR Ctrl-k ", " Ctrl-Up
Scroll up one screen height.
.TP
.BR Ctrl-l ", " Ctrl-Right
Scroll right one screen width.
.TP
.BR +
Zoom in.
.TP
.B \-
Zoom out.
.TP
.B m
Mark/unmark the current image.
.TP
.B M
Mark/unmark all images starting from the last marked/unmarked image up to the
current one.
.TP
.B Ctrl-m
Reverse all image marks.
.TP
.B Ctrl-u
Remove all image marks.
.TP
.B N
Go
.I count
marked images forward.
.TP
.B P
Go
.I count
marked images backward.
.TP
.B {
Decrease gamma correction by
.I count
steps.
.TP
.B }
Increase gamma correction by
.I count
steps.
.TP
.B Ctrl-g
Reset gamma correction.
.SS Thumbnail mode
The following keyboard commands are only available in thumbnail mode:
.TP
.BR h ", " Left
Move selection left
.I count
times.
.TP
.BR j ", " Down
Move selection down
.I count
times.
.TP
.BR k ", " Up
Move selection up
.I count
times.
.TP
.BR l ", " Right
Move selection right
.I count
times.
.TP
.B R
Reload all thumbnails.
.SS Image mode
The following keyboard commands are only available in image mode:
.TP
Navigate image list:
.TP
.BR n ", " Space
Go
.I count
images forward.
.TP
.BR p ", " Backspace
Go
.I count
images backward.
.TP
.B [
Go
.I count
* 10 images backward.
.TP
.B ]
Go
.I count
* 10 images forward.
.TP
.B Ctrl-6
Go to the previously viewed image.
.TP
Handle multi-frame images:
.TP
.B Ctrl-n
Go
.I count
frames of a multi-frame image forward.
.TP
.B Ctrl-p
Go
.I count
frames of a multi-frame image backward.
.TP
.BR Ctrl-a ", " Ctrl-Space
Play/stop animations of multi-frame images.
.TP
Panning:
.TP
.BR h ", " Left
Scroll image 1/5 of window width or
.I count
pixels left.
.TP
.BR j ", " Down
Scroll image 1/5 of window height or
.I count
pixels down.
.TP
.BR k ", " Up
Scroll image 1/5 of window height or
.I count
pixels up.
.TP
.BR l ", " Right
Scroll image 1/5 of window width or
.I count
pixels right.
.TP
.B H
Scroll to left image edge.
.TP
.B J
Scroll to bottom image edge.
.TP
.B K
Scroll to top image edge.
.TP
.B L
Scroll to right image edge.
.TP
.B z
Scroll to image center.
.TP
Zooming:
.TP
.B =
Set zoom level to 100%, or
.IR count %.
.TP
.B w
Set zoom level to 100%, but fit large images into window.
.TP
.B W
Fit image to window.
.TP
.B F
Fill image to window.
.TP
.B e
Fit image to window width.
.TP
.B E
Fit image to window height.
.TP
Rotation:
.TP
.B <
Rotate image counter-clockwise by 90 degrees.
.TP
.B >
Rotate image clockwise by 90 degrees.
.TP
.B ?
Rotate image by 180 degrees.
.TP
Flipping:
.TP
.B |
Flip image horizontally.
.TP
.B _
Flip image vertically.
.TP
Miscellaneous:
.TP
.B a
Toggle anti-aliasing.
.TP
.B A
Toggle visibility of alpha-channel, i.e. image transparency.
.TP
.B s
Toggle slideshow mode and/or set the delay between images to
.I count
seconds.
.SH MOUSE COMMANDS
.SS Thumbnail mode
The following mouse mappings are available in thumbnail mode:
.TP
.B Button1
Select the image. Goes into image mode if double\-clicked.
.TP
.B Button3
Mark/unmark the image. Dragging while holding down Button3 will mark/unmark
multiple images.
.TP
.B Button4
Scroll up by one row.
.TP
.B Button5
Scroll down by one row.
.TP
.B Ctrl-Button4
Scroll up by one page.
.TP
.B Ctrl-Button5
Scroll down by one page.
.SS Image mode
The following mouse mappings are available in image mode:
.TP
.B Button1
Go to the next image if the mouse cursor is in the right part of the window or
to the previous image if it is in the left part.
.TP
.B Ctrl-Button1
Pan the image relative to the mouse cursor.
.TP
.B Button2
Pan the image according to the mouse cursor position in the window while
keeping this button pressed down.
.TP
.B Button3
Switch to thumbnail mode.
.TP
.B Button4
Zoom in.
.TP
.B Button5
Zoom out.
.SH CONFIGURATION
The following X resources are supported:
.TP
.B window.background
Color of the window background
.TP
.B window.foreground
Color of the window foreground
.TP
.B bar.font
Name of Xft bar font
.TP
.B bar.background
Color of the bar background. Defaults to window.background
.TP
.B bar.foreground
Color of the bar foreground. Defaults to window.foreground
.TP
.B mark.foreground
Color of the mark foreground. Defaults to window.foreground
.TP
Please see xrdb(1) on how to change them.
.SH WINDOW TITLE
The window title can be replaced with the output of a user-provided script,
which is called by nsxiv whenever any of the relevant information changes.
The path of this script is
.I $XDG_CONFIG_HOME/nsxiv/exec/win-title
and the arguments given to it (where "Optional" arguments might be empty) are:
.IP $1 4
resolved absolute path of the current file
.IP $2 4
current file number
.IP $3 4
total file count
.IP $4 4
image width (Optional: Disabled on thumbnails mode)
.IP $5 4
image height (Optional: Disabled on thumbnails mode)
.IP $6 4
current zoom (Optional: Disabled on thumbnails mode)
.P
The term file is used rather than image as nsxiv does not precheck that the
input files are valid images. Total file count may be different from the actual
count of valid images.
.P
There is also an example script installed together with nsxiv as
.IR EGPREFIX/win-title .
.SH STATUS BAR
The information displayed on the left side of the status bar can be replaced
with the output of user-provided script.
.P
The script that is called by nsxiv whenever an image gets loaded is located at
.I $XDG_CONFIG_HOME/nsxiv/exec/image-info
and the arguments given to it are:
.IP $1 4
path to image file (as provided by the user)
.IP $2 4
image width
.IP $3 4
image height
.IP $4 4
fully resolved path to the image file
.P
In thumbnail mode, the script that is called is located at
.I $XDG_CONFIG_HOME/nsxiv/exec/thumb-info
and the arguments given to it are:
.IP $1 4
path to image file (as provided by the user)
.IP $2 4
empty
.IP $3 4
empty
.IP $4 4
fully resolved path to the image file
.P
There are also example scripts installed together with nsxiv as
.IR EGPREFIX/image-info
and
.IR EGPREFIX/thumb-info .
.SH EXTERNAL KEY HANDLER
Additional external keyboard commands can be defined using a handler program
located in
.IR $XDG_CONFIG_HOME/nsxiv/exec/key-handler .
The handler is invoked by pressing
.BR Ctrl-x .
The next key combo is passed as its first argument. Passed via stdin are the
images to act upon: all marked images, if in thumbnail mode and at least one
image has been marked, otherwise the current image. nsxiv(1) will block until
the handler terminates. It then checks which images have been modified and
reloads them.
By default nsxiv(1) will send one image per-line to stdin, however when using
\-0 the image list will be NULL separated and the environment variable
"$NSXIV_USING_NULL" will be set to 1.
The key combo argument has the following form: "[C-][M-][S-]KEY",
where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X
keysym as listed in /usr/include/X11/keysymdef.h without the "XK_" prefix.
If KEY has an uppercase equivalent, S-KEY is resolved into it. For instance,
K replaces S-k and Scedilla replaces S-scedilla, but S-Delete is sent as-is.
There is also an example script installed together with nsxiv as
.IR EGPREFIX/key-handler .
.SH THUMBNAIL CACHING
nsxiv stores all thumbnails under
.IR $XDG_CACHE_HOME/nsxiv/ .
.P
Use the command line option
.I \-c
to remove all orphaned cache files. Additionally, run the following command
afterwards inside the cache directory to remove empty subdirectories:
.P
.RS
find . \-depth \-type d \-empty ! \-name '.' \-exec rmdir {} \\;
.RE
.SH ORIGINAL AUTHOR
.EX
Bert Muennich <ber.t at posteo.de>
.EE
.SH CURRENT MAINTAINERS
.EX
N-R-K <nrk at disroot.org>
Berke Kocaoğlu <berke.kocaoglu at metu.edu.tr>
TAAPArthur <taaparthur at gmail.com>
eylles <ed.ylles1997 at gmail.com>
mamg22 <marcomonizg at gmail.com>
LuXu
explosion-mental <explosion0mental at gmail.com>
Guilherme Freire
Stein Gunnar Bakkeby <bakkeby at gmail.com>
Anupam Ashish Minz
Sam Whitehead
Kian Kasad <kian at kasad.com>
qsmodo
.EE
.SH CONTRIBUTORS
.EX
Bastien Dejean <nihilhill at gmail.com>
Dave Reisner <d at falconindy.com>
Fung SzeTat <sthorde at gmail.com>
Max Voit <mvdev at with-eyes.net>
For additional contributors, run `git shortlog -s` in the nsxiv repository.
.EE
.SH HOMEPAGE
.TP
Website:
.EE
https://nsxiv.codeberg.page/
.EX
.TP
Source code:
.EE
https://codeberg.org/nsxiv/nsxiv
.EX
.SH SEE ALSO
.BR X (7),
.BR xrdb (1)

8
etc/nsxiv.desktop Normal file
View File

@ -0,0 +1,8 @@
[Desktop Entry]
Type=Application
Name=nsxiv
GenericName=Image Viewer
Exec=nsxiv %F
MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/png;image/tiff;image/x-bmp;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-tga;image/x-xpixmap;image/webp;image/heic;image/svg+xml;application/postscript;image/jp2;image/jxl;image/avif;image/heif;
NoDisplay=true
Icon=nsxiv

13
etc/woodpecker/CFLAGS Normal file
View File

@ -0,0 +1,13 @@
# vanilla flags
-std=c99 -Wall -pedantic
# optimizations: enables extra warnings and deeper analysis thus catches more errors/warnings
-O3 -flto
# treat warnings as errors
-Werror
# extra flags
-Wextra -Wshadow -Wvla -Wpointer-arith
-Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code
-Wbad-function-cast -Wdeclaration-after-statement
-Wmissing-prototypes -Wstrict-prototypes
# silence
-Wno-unused-parameter -Wno-missing-field-initializers

View File

@ -0,0 +1,28 @@
branches: master
pipeline:
analysis:
image: alpine
commands: |
apk add --no-cache build-base cppcheck clang-extra-tools \
imlib2-dev xorgproto \
libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null
make config.h version.h
std="c99"
run_cppcheck() {
cppcheck --std="$std" --enable=performance,portability \
--force --quiet --inline-suppr --error-exitcode=1 \
--max-ctu-depth=8 -j"$(nproc)" \
$(make OPT_DEP_DEFAULT="$1" dump_cppflags) \
--suppress=varFuncNullUB --suppress=uninitvar \
*.c
}
run_tidy() {
checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)"
clang-tidy --warnings-as-errors="*" --checks="$checks" --quiet *.c \
-- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags)
}
run_cppcheck "0"
run_cppcheck "1"
run_tidy "0"
run_tidy "1"

28
etc/woodpecker/build.yml Normal file
View File

@ -0,0 +1,28 @@
branches: master
# NOTE: "stable" tcc is too old and fails at linking. instead fetching a recent known working commit.
pipeline:
build:
image: alpine
environment:
- TCC_SHA=027b8fb9b88fe137447fb8bb1b61079be9702472
commands: |
apk add --no-cache \
imlib2 imlib2-dev xorgproto \
libxft libxft-dev libexif libexif-dev giflib giflib-dev libwebp libwebp-dev \
gcc clang llvm llvm-dev build-base wget ca-certificates >/dev/null
wget "https://github.com/TinyCC/tinycc/archive/$TCC_SHA.tar.gz" >/dev/null
tar xzf "$TCC_SHA.tar.gz" >/dev/null
( cd "tinycc-$TCC_SHA" && ./configure --config-musl && make -s -j"$(nproc)" && make install; ) >/dev/null
CFLAGS="$(sed '/^#/d' etc/woodpecker/CFLAGS | paste -d ' ' -s)"
build () {
for cc in "gcc" "clang" "tcc"; do
echo "### $cc - $2 build ###"
make clean && make -s -j"$(nproc)" CC="$cc" CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT="$1"
done
}
# full-build #
build "1" "full"
# ensure minimal-build works without opt deps installed
apk del libxft libxft-dev libexif libexif-dev giflib giflib-dev libwebp libwebp-dev >/dev/null
build "0" "minimal"

View File

@ -0,0 +1,17 @@
# checks
clang-analyzer-*,clang-diagnostic-*,bugprone-*,performance-*,modernize-*
misc-*,readability-*,android-cloexec-*,cert-*
llvm-include-order
# silence
-misc-unused-parameters
-bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-bugprone-incorrect-roundings
-bugprone-implicit-widening-of-multiplication-result,-bugprone-integer-division
-readability-braces-around-statements,-readability-magic-numbers,-readability-isolate-declaration
-readability-function-cognitive-complexity,-readability-else-after-return
-readability-uppercase-literal-suffix,-readability-avoid-const-params-in-decls
-android-cloexec-fopen,-android-cloexec-pipe
# false positive warnings
-clang-analyzer-valist.Uninitialized
-misc-no-recursion

9
etc/woodpecker/spell.yml Normal file
View File

@ -0,0 +1,9 @@
branches: master
# NOTE: codespell not available on stable alpine, use edge
pipeline:
spell-check:
image: alpine:edge
commands: |
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing py3-codespell git >/dev/null
git ls-files | sed '/\.png$/d' | xargs codespell