Compare commits

...

6 Commits

Author SHA1 Message Date
djvs 9f457f70d9
Merge a382dd03c1 into 6c38a49d54 2024-03-25 22:13:05 -04:00
Dave Davenport 6c38a49d54 [Doc] Fix typo, thx to @Nickwiz 2024-03-16 11:53:12 +01:00
Dave Davenport 94f8c88336 [github] update lock config. 2024-03-15 10:29:04 +01:00
Qball Cow 81e06d7157 [github] bump lock-threads flow version 2024-03-13 07:18:08 +01:00
djvs a382dd03c1 fix 2023-03-29 17:10:06 -04:00
djvs 0b3f7f7bb8 scroll-multiplier option 2023-03-29 10:20:06 -04:00
7 changed files with 121 additions and 26 deletions

View File

@ -1,32 +1,41 @@
name: 'Lock threads' name: 'Lock Threads'
on: on:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
workflow_dispatch:
permissions:
issues: write
pull-requests: write
discussions: write
concurrency:
group: lock-threads
jobs: jobs:
lock: action:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: dessant/lock-threads@v2 - uses: dessant/lock-threads@v5
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} process-only: 'issues'
issue-lock-inactive-days: '31' github-token: ${{ github.token }}
issue-exclude-created-before: '' issue-inactive-days: '31'
issue-exclude-labels: '' exclude-issue-created-before: ''
issue-lock-labels: '' exclude-issue-created-after: ''
issue-lock-reason: 'resolved' exclude-issue-created-between: ''
issue-lock-comment: > exclude-issue-closed-before: ''
This issue has been automatically locked since there exclude-issue-closed-after: ''
has not been any recent activity after it was closed. exclude-issue-closed-between: ''
Please open a new issue for related bugs. include-any-issue-labels: ''
pr-lock-inactive-days: '31' include-all-issue-labels: ''
pr-exclude-created-before: '' exclude-any-issue-labels: ''
pr-exclude-labels: '' add-issue-labels: ''
pr-lock-labels: '' remove-issue-labels: ''
pr-lock-reason: 'resolved' issue-comment: >
pr-lock-comment: >
This pull request has been automatically locked since there This pull request has been automatically locked since there
has not been any recent activity after it was closed. has not been any recent activity after it was closed.
Please open a new issue for related bugs. Please open a new issue for related bugs.
process-only: '' issue-lock-reason: 'resolved'
log-output: false

View File

@ -123,6 +123,8 @@ Settings config = {
.window_match_fields = "all", .window_match_fields = "all",
/** Monitor */ /** Monitor */
.monitor = "-5", .monitor = "-5",
/** Multiply scrolling amount **/
.scroll_multiplier = 1,
/** Set filter */ /** Set filter */
.filter = NULL, .filter = NULL,
.dpi = -1, .dpi = -1,

View File

@ -143,7 +143,7 @@ The following options are supported:
- **nonselectable**: If true the row cannot activated. - **nonselectable**: If true the row cannot activated.
- **permantent**: If true the row always shows, independent of filter. - **permanent**: If true the row always shows, independent of filter.
- **info**: Info that, on selection, gets placed in the `ROFI_INFO` - **info**: Info that, on selection, gets placed in the `ROFI_INFO`
environment variable. This entry does not get searched for filtering. environment variable. This entry does not get searched for filtering.

View File

@ -95,6 +95,8 @@ typedef struct {
/** Toggle to enable sorting. */ /** Toggle to enable sorting. */
unsigned int sort; unsigned int sort;
/** Sorting method. */ /** Sorting method. */
unsigned int scroll_multiplier;
/** Sorting method. */
SortingMethod sorting_method_enum; SortingMethod sorting_method_enum;
/** Sorting method. */ /** Sorting method. */
char *sorting_method; char *sorting_method;

View File

@ -129,6 +129,21 @@ void listview_set_selected(listview *lv, unsigned int selected);
*/ */
unsigned int listview_get_selected(listview *lv); unsigned int listview_get_selected(listview *lv);
/**
* @param lv The listview handle
*
* Move the selection one row up.
* - Wrap around.
*/
void listview_scroll_prev(listview *lv);
/**
* @param lv listview handle.
*
* Alternate, potentially multi-row alternative to listview_nav_up
* - Wrap around.
*/
void listview_scroll_next(listview *lv);
/** /**
* @param lv The listview handle * @param lv The listview handle
* *
@ -143,12 +158,12 @@ void listview_nav_next(listview *lv);
* - Wrap around. * - Wrap around.
*/ */
void listview_nav_prev(listview *lv); void listview_nav_prev(listview *lv);
/** /**
* @param lv The listview handle * @param lv The listview handle
* *
* Move the selection one row up. * Alternate, potentially multi-row alternative to listview_nav_down
* - Wrap around. * - No wrap around.
* - Do not move to top row when at start.
*/ */
void listview_nav_up(listview *lv); void listview_nav_up(listview *lv);
/** /**

View File

@ -693,10 +693,10 @@ listview_trigger_action(widget *wid, MouseBindingListviewAction action,
listview_nav_right(lv); listview_nav_right(lv);
break; break;
case SCROLL_DOWN: case SCROLL_DOWN:
listview_nav_down(lv); listview_scroll_next(lv);
break; break;
case SCROLL_UP: case SCROLL_UP:
listview_nav_up(lv); listview_scroll_prev(lv);
break; break;
} }
return WIDGET_TRIGGER_ACTION_RESULT_HANDLED; return WIDGET_TRIGGER_ACTION_RESULT_HANDLED;
@ -863,6 +863,67 @@ void listview_nav_prev(listview *lv) {
listview_nav_up_int(lv); listview_nav_up_int(lv);
} }
static void listview_scroll_up_int(listview *lv) {
if (lv == NULL) {
return;
}
unsigned int mult = 1;
if (config.scroll_multiplier){
mult = config.scroll_multiplier;
}
for (unsigned int i=0; i < mult; i++) {
if (lv->req_elements == 0 || (lv->selected == 0 && !lv->cycle)) {
return;
}
if (lv->selected == 0) {
lv->selected = lv->req_elements;
}
lv->selected--;
}
lv->barview.direction = RIGHT_TO_LEFT;
if (lv->sc_callback) {
lv->sc_callback(lv, lv->selected, lv->sc_udata);
}
widget_queue_redraw(WIDGET(lv));
}
static void listview_scroll_down_int(listview *lv) {
if (lv == NULL) {
return;
}
unsigned int mult = 1;
if (config.scroll_multiplier){
mult = config.scroll_multiplier;
}
for (unsigned int i=0; i < mult; i++) {
if (lv->req_elements == 0 ||
(lv->selected == (lv->req_elements - 1) && !lv->cycle)) {
return;
}
lv->selected = lv->selected < lv->req_elements - 1
? MIN(lv->req_elements - 1, lv->selected + 1)
: 0;
}
lv->barview.direction = LEFT_TO_RIGHT;
if (lv->sc_callback) {
lv->sc_callback(lv, lv->selected, lv->sc_udata);
}
widget_queue_redraw(WIDGET(lv));
}
void listview_scroll_next(listview *lv) {
if (lv == NULL) {
return;
}
listview_scroll_down_int(lv);
}
void listview_scroll_prev(listview *lv) {
if (lv == NULL) {
return;
}
listview_scroll_up_int(lv);
}
static void listview_nav_column_left_int(listview *lv) { static void listview_nav_column_left_int(listview *lv) {
if (lv->selected >= lv->cur_columns) { if (lv->selected >= lv->cur_columns) {
lv->selected -= lv->cur_columns; lv->selected -= lv->cur_columns;

View File

@ -333,6 +333,12 @@ static XrmOption xrmOptions[] = {
NULL, NULL,
"Threads to use for string matching", "Threads to use for string matching",
CONFIG_DEFAULT}, CONFIG_DEFAULT},
{xrm_Number,
"scroll-multiplier",
{.num = &config.scroll_multiplier},
NULL,
"Scrolling multiplier (how many times as many lines to scroll)",
CONFIG_DEFAULT},
{xrm_Number, {xrm_Number,
"scroll-method", "scroll-method",
{.num = &config.scroll_method}, {.num = &config.scroll_method},