aboutsummaryrefslogtreecommitdiff
path: root/main.c
Commit message (Collapse)AuthorAgeFilesLines
* fix: send implicit_mod to process_bindings (#176)N-R-K2021-12-011-5/+5
| | | | | | | | | | | | * fix: send implicit_mod to process_bindings this solves the edge case where someone might have `ShiftMask + A` in their keybindings compared to a plain `A`. Closes: https://github.com/nsxiv/nsxiv/pull/166#issuecomment-978853136 * code-style: smuggle small style fix in win_draw_bar now mimics autoreload_nop.c functions
* switch back to whitelisting modifers (#150)N-R-K2021-11-241-1/+1
| | | | | | | | | | | | | * Revert "Allow any set of modifiers to be used in keybindings" this keeps things equal with sxiv while giving users possibility to customize USED_MODMASK if they wish. This reverts commit 3234b0e521cca006a94cb135a88d146122d7f66d. Closes: https://github.com/nsxiv/nsxiv/issues/149 Closes: https://github.com/nsxiv/nsxiv/issues/123 Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* rename: keyhandler_abort -> KEYHANDLER_ABORT (#172)N-R-K2021-11-241-2/+2
| | | | | | | | with the exception of arrays, all other var names in config.h are in ALL CAPS. since keyhandler_abort is an unreleased feature, it should be okay to rename it for consistency. though.. in the future we should be more careful about naming when adding new vars to config.h (or the codebase in general.)
* mark functions and vars as static (#146)N-R-K2021-11-201-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | the goal here to mark functions and variables not used outside the translation unit as static. main reason for this is cleanliness. however as a side-effect this can help compilers optimize better as it now has guarantee that a certain function won't be called outside of that translation unit. one other side-effect of this is that accessing these vars/function from config.h is now different. if one wants to access a static var/func from different translation unit in config.h, he would have to create a wrapper function under the right ifdef. for static functions one would also need to forward declare it. here's a dummy example of accessing the function `run_key_handler` from config.h under _MAPPINGS_CONFIG ``` static void run_key_handler(const char *, unsigned); bool send_with_ctrl(arg_t key) { run_key_handler(XKeysymToString(key), ControlMask); return false; } ```
* set env var NSXIV_USING_NULL for key-handler and update docsNRK2021-11-191-0/+1
| | | | Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* apply -0 to stdin/-i as wellNRK2021-11-191-5/+9
| | | | | | | | | | | | while i was initially against this since it can be done via `xargs -0`. the problem with this approach is that there's a limit to how many args a command can recieve, leading to problem like this [0] when opening large (1k~) amount of images. there's no limit on how big stdin can be, so being able to read a null-separated list from stdin doesn't have this problem. [0]: https://github.com/ranger/ranger/pull/2307#issuecomment-818683515
* use dedicated function to process key/button bindings (#166)N-R-K2021-11-191-22/+22
| | | Co-authored-by: Arthur Williams <taaparthur@gmail.com>
* make width of navigation area configurable (#155)LuXu2021-11-041-4/+15
| | | | | | | | | this allows users to configure navigation width from config.h. it also allows disabling the navigation function entirely by using a 0 width. one extra functionality this adds is being able to define an absolute width (in pixels) instead of just percentage via `NAV_IS_REL`. Co-authored-by: NRK <nrk@disroot.org>
* -0 sends NULL separated file-list to key-handlerNRK2021-10-291-1/+1
| | | | | | | | with this change `-0` is turned into a more generic switch which can be used to send NULL-separated file-list to the key-handler as well. this also means `-0` no longer implicitly enables `-o` Closes: https://github.com/nsxiv/nsxiv/issues/140
* code-style: general cleanups (#137)N-R-K2021-10-291-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tns_clean_cache: remove unused function arg * remove malloc casting * improve consistency use sizeof(T) at the end * avoid comparing integers of different signedness * use Window type for embed and parent * remove unnecessary comparisons * remove cpp style comments * improve consistency: remove comma from the end of enumerator list * Removed useless _IMAGE_CONFIG defines * consistency: use the same order as snprintf * Resolve c89 warnings Co-authored-by: uidops <uidops@protonmail.com> Co-authored-by: Arthur Williams <taaparthur@gmail.com>
* update copyright notice (#139)eylles2021-10-281-1/+2
|
* code-style: remove extra casts (#130)javad2021-10-241-1/+1
| | | | Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com>
* Add ability to bind arbitrary functions.Arthur Williams2021-10-131-7/+8
| | | | | | | | | | | | | | | | | | | | | | | Before all the predated commands where kept in an array and their indexes were used in bindings. This meant that users couldn't add their own functions from the config file. Now key/mouse bindings have been changed to to store the function ptr (wrapped in a cmd_t struct to also store the mode) directly instead. General cleanup done in this commit: Defined `MODE_ALL` instead of using magic number. For example, suppose one had bindings like: { 0, XK_q, g_quit, None }, { ShitMask, XK_q, {quit_err}, None } { ControlMask, XK_q, {quit_err, .mode=MODE_IMAGE}, None } The existing binding `q` has been left unchanged and is defined the same way. However, the new hypothetical binding `Shift-q` can be used to call the custom function quit_err in any mode (default). `Ctrl-q` on the other hand will be called only on image mode. Closes #50
* Make imgcursor a config variable.Arthur Williams2021-10-131-12/+0
| | | | | | | | Previously, the value of imgcursor was determined by where a pointer binding was set to a ci_cursor_navigate. If it was then the pointer would change to left/right arrows depending on the position relative to the window. Now the user has full control of over it which also allows them to preserve the behavior in case they wrap the function.
* code-style: fix consistency issues all over the codebase (#94)Berke Kocaoğlu2021-10-111-8/+10
| | | | | | | | | | | | | | | * remove duplicate comment * remove empty tabs and blank lines * move macros and globals ontop * comment to seprate function implementation * fix alignment * switch to *argv[] similar to other suckless code * kill all empty last lines * append comment to endif * reuse existing ARRLEN macro * comment fall through * use while (true) everywhere Co-authored-by: NRK <nrk@disroot.org>
* add statusbar message upon key-hander activation (#98)N-R-K2021-10-071-1/+17
| | | | | | | | | Currently when running the key-handler the statusbar shows a "Running key-handler..." message, but there's no indication of the prefix key being pressed. There's a slight functional benefit of this patch in the sense that users can visually tell if the key-handler is listening on input or if the key-handler has been aborted or not.
* make ten_ms local to run (#101)N-R-K2021-09-291-2/+1
| | | | | ten_ms needed to be a global but after the following commit 3724d3fc17dc6135a05608cab5bdf00c6978282d this no longer holds true. it can simply be local to run, as it's not used anywhere else.
* make keyhandler abort key configurable via config.hNRK2021-09-241-1/+1
|
* fix: unable to bind anything to XK_EscapeNRK2021-09-241-1/+1
|
* Allow any set of modifiers to be used in keybindingsArthur Williams2021-09-201-1/+1
| | | | | | | | | | | | | Previous the code only allowed ShiftMask,ControlMask or Mod1Mask to be used in keybindings and the presence of any others modifiers would be ignored. Most problems generally allow certain modifiers to be be ignored but not most and certainly don't allow Super-A to be treated like A. Now users can use any modifiers they want in keybindings and can also ignore any modifiers they want. By default only ModMask2 (commonly numlock is ignored) Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com>
* Rename, Update Docs and Prepare for Release (#9)Berke Kocaoğlu2021-09-161-8/+9
| | | | | | | Co-authored-by: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com> Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Arthur Williams <taaparthur@gmail.com> Co-authored-by: eylles <ed.ylles1997@gmail.com>
* Exit when window is destroyedArthur Williams2021-09-161-0/+3
| | | | | | | If the user closed our window, the program won't automatically be die. It may look dead as there would be no graphical indication that it was running, but it still would be using/wasting the same resources. Now the program will abruptly exit when its window is killed.
* set title based on prefix and suffix (#23)qsmodo2021-09-161-0/+2
| | | | | | Co-authored-by: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* Fix indentationBert Münnich2020-01-161-4/+4
|
* Do not keep track of fullscreen stateBert Münnich2019-07-161-1/+1
| | | | | There is no more need for this after the removal of the special color handling for fullscreen mode in commit 2886876.
* Fix file list indexes when deleting last imageBert Münnich2018-12-291-3/+3
| | | | Fixes issue #331
* Set window title only once at startupBert Münnich2018-10-151-9/+0
| | | | | | | Putting image info in the title predates the info bar; it no longer seems necessary. Fixes issue #318.
* Don't skip dot files when cleaning cacheKacper Gutowski2018-07-301-1/+1
|
* Set global markidx whenever a single img is (un)markedBert Münnich2018-06-091-0/+1
| | | | This also sets *markidx* when using the right mouse button in thumbnail mode.
* (Un)mark thumbnails while holding Button3 downBert Münnich2018-06-091-4/+13
|
* (Un)mark single image through generic functionBert Münnich2018-06-091-0/+12
|
* Rename variable toggledidx to markidxBert Münnich2018-06-091-3/+3
|
* Fix cg_mark_range after removing images from file listBert Münnich2018-06-091-0/+2
|
* Remove unnecessary special cases in cg_mark_rangeBert Münnich2018-06-091-1/+1
|
* Add mark range functionDaniel Lublin2018-06-091-0/+1
| | | | | Sets the marked state of all images ranging from the latest marked/unmarked image to the current image, to the state of that latest toggled image.
* Revise waiting for child processesBert Münnich2018-02-181-6/+20
|
* Close image-info explicitlyBert Münnich2018-02-181-18/+18
|
* Skip imlib cache when reloading due to inotify eventBert Münnich2018-02-181-0/+1
|
* RefactoringBert Münnich2018-01-091-9/+7
|
* Fix a potential uninitialized variableHyleus2018-01-091-2/+5
|
* Separate bar fields only by spacesBert Münnich2017-12-071-5/+7
|
* Remove obsolete files[].baseBert Münnich2017-12-071-5/+0
|
* Left bar shows file name as given by userBert Münnich2017-12-071-19/+5
|
* Try to match a fallback font if neededSquibby2017-12-061-2/+2
| | | | | | | | | | | | | | Fixes #276 Instead of rendering the entire filename at once, Xft will let us do it character by character. This will allow sxiv to query fontconfig for a font that can provide any missing codepoints, if needed. A known issue of this patch is that the "..." dots rendering will not work properly for very long multibyte filenames. That is because we cannot easily predict the final width of the rendered filename before drawing it. I couldn't figure out a clean way to deal with this, so I ended up just truncating the offending filenames.
* Fix navigating from last to previous image over invalid filesBert Münnich2017-10-261-3/+4
|
* Set LC_COLLATE for -r file list sortingBert Münnich2017-10-241-0/+3
| | | | Fixes issue #293.
* One header file for type definitions and function declarationsBert Münnich2017-10-161-15/+4
|
* Improve mouse supportBert Münnich2017-10-061-3/+27
| | | | | | | | | | | | None of the mouse mappings uses a keyboard modifier, making it possible to access the most basic features by only using the mouse. Next/previous image with left button depending on cursor position, middle button for dragging, right button for switching to thumnail mode and wheel for zooming. Users can keep the old behaviour by simply not adapting the changes to the buttons array in config.def.h to their config.h file.
* Simplify cursor reset in image modeBert Münnich2017-10-051-2/+2
| | | | | No need to give cursor name. reset_cursor() is now the only place to decide what cursor to fall back to.
* Mouse drag translates pointer position to image areaBert Münnich2017-10-041-0/+1
| | | | This makes mouse panning more direct and faster.