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:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
issues: write
pull-requests: write
discussions: write
concurrency:
group: lock-threads
jobs:
lock:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2
- uses: dessant/lock-threads@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-lock-inactive-days: '31'
issue-exclude-created-before: ''
issue-exclude-labels: ''
issue-lock-labels: ''
issue-lock-reason: 'resolved'
issue-lock-comment: >
This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
pr-lock-inactive-days: '31'
pr-exclude-created-before: ''
pr-exclude-labels: ''
pr-lock-labels: ''
pr-lock-reason: 'resolved'
pr-lock-comment: >
process-only: 'issues'
github-token: ${{ github.token }}
issue-inactive-days: '31'
exclude-issue-created-before: ''
exclude-issue-created-after: ''
exclude-issue-created-between: ''
exclude-issue-closed-before: ''
exclude-issue-closed-after: ''
exclude-issue-closed-between: ''
include-any-issue-labels: ''
include-all-issue-labels: ''
exclude-any-issue-labels: ''
add-issue-labels: ''
remove-issue-labels: ''
issue-comment: >
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
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",
/** Monitor */
.monitor = "-5",
/** Multiply scrolling amount **/
.scroll_multiplier = 1,
/** Set filter */
.filter = NULL,
.dpi = -1,

View File

@ -143,7 +143,7 @@ The following options are supported:
- **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`
environment variable. This entry does not get searched for filtering.

View File

@ -95,6 +95,8 @@ typedef struct {
/** Toggle to enable sorting. */
unsigned int sort;
/** Sorting method. */
unsigned int scroll_multiplier;
/** Sorting method. */
SortingMethod sorting_method_enum;
/** 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);
/**
* @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
*
@ -143,12 +158,12 @@ void listview_nav_next(listview *lv);
* - Wrap around.
*/
void listview_nav_prev(listview *lv);
/**
* @param lv The listview handle
*
* Move the selection one row up.
* - Wrap around.
* Alternate, potentially multi-row alternative to listview_nav_down
* - No wrap around.
* - Do not move to top row when at start.
*/
void listview_nav_up(listview *lv);
/**

View File

@ -693,10 +693,10 @@ listview_trigger_action(widget *wid, MouseBindingListviewAction action,
listview_nav_right(lv);
break;
case SCROLL_DOWN:
listview_nav_down(lv);
listview_scroll_next(lv);
break;
case SCROLL_UP:
listview_nav_up(lv);
listview_scroll_prev(lv);
break;
}
return WIDGET_TRIGGER_ACTION_RESULT_HANDLED;
@ -863,6 +863,67 @@ void listview_nav_prev(listview *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) {
if (lv->selected >= lv->cur_columns) {
lv->selected -= lv->cur_columns;

View File

@ -333,6 +333,12 @@ static XrmOption xrmOptions[] = {
NULL,
"Threads to use for string matching",
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,
"scroll-method",
{.num = &config.scroll_method},