Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for left/right scroll #399

Closed
sprig opened this issue May 8, 2016 · 21 comments
Closed

Allow for left/right scroll #399

sprig opened this issue May 8, 2016 · 21 comments

Comments

@sprig
Copy link

sprig commented May 8, 2016

Hello,

It would be nice if, when run in 'dmenu' mode, one could scroll the results of long strings right and left, and if it was possible to select right/left justification of the list of results.

Would you care to comment on where in the source it would be proper to add this functionality?

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented May 8, 2016

right/left align is done based if the text is RTL or LTR
This will right align:

echo -e "\u200f aap" | rofi -dmenu

The scrolling is probably not that trivial. Scrolling text on hover/selected row might be useful.

@sprig
Copy link
Author

sprig commented May 8, 2016

Thanks for the tip!

Scrolling selected row would be useful, but I would rather dynamic R/L justification, if it were a choice.

Usecase:

I have written a small custom script to search files based on filename, in my homedir, for which the UI was via dmenu and was bound to hotkey (e.g. Caps+b then, type a keyword from a paper name). This works surprisingly well, and much faster than anything normal file managers give, for my usecase. The full paths can be quite long (e.g. take almost entire screen width in small font). In rofi, most of the path is obstructed by '...', and esp. the most important part, which is the actual filename.

I got around this by piping to rofi just the filename and making rofi output just line number, which is used to select the line of actual output with the full filename. It would be better, however, if I could examine the entire path because sometimes I have similarly named files residing in different places.

Scroll on select would help here, but I suspect that it will be painfully slow to sift through the files this way.

@DaveDavenport
Copy link
Collaborator

If I get it right, you want to select between ellipsizing method at runtime.. (select between end, beginning or middle)

@sprig
Copy link
Author

sprig commented May 8, 2016

This is not precisely what I want, but it would be a major step forward in functionality for my use case ideally I would still like to be able to see entire paths somehow, but I understand that since every path has a different length, it is not obvious what is the correct way to implement scrolling.

Perhaps dynamic ellipsizing together with showing the entire text after a (selectable at invocation) amount of of time for selected text would be 95%+ of what I want.

@DaveDavenport
Copy link
Collaborator

Having all the text 'scroll' all the time is not a good solution. This will be very annoying to watch (and hard to read), I have tried this in another program (gmpc's playlist) in the past: It does not work.

Not sure what the right solution is here.

@sprig
Copy link
Author

sprig commented May 8, 2016

I agree - I didn't want all the text autoscrolling all the time. I wanted functioning left/right keys :-)

@DaveDavenport
Copy link
Collaborator

aah I see. (Those are already mapped for navigating the text box entry.)

do you want to 'scroll' all entries at once?

@sprig
Copy link
Author

sprig commented May 9, 2016

That was indeed my initial wish. Together with dynamic RTL/LTR switching (e,g, via C-\ key), it would be perfect.

@DaveDavenport
Copy link
Collaborator

Can you try this patch: https://filebin.pw/index.php/Dbb/
It adds ctrl-/ as keybinding for changing ellipsizing from end, middle, start.

Tried the scrolling on key,, it is really awkward when doing it on multiple rows with variable length.

@sprig
Copy link
Author

sprig commented May 9, 2016

Thanks! I will take a look tomorrow, as I am already away from the linux PC for the day...

@sprig
Copy link
Author

sprig commented May 10, 2016

It works well, with a couple of caveats;

  1. While the ellipsis is on the left, I think it would be best if the text would be aligned to the right (right now this is not the case if you have short lines).
  2. It would be great to be able to specify initial ellipsizing direction.
  3. (pipe dream idea) while ellipsis is in the middle, it would maybe be cool if the left part is aligned left and right part is aligned right, and short lines broken into two appropriate pieces? Not really sure this is a good idea, but nevertheless.

Finally, I'd like to state that it was a bit hard for me to figure out what is the proper procedure to build with autoconf and friends, as ./configure was obviously not present in the code. If you don't mind, I'll send a pull request later with additional documentation for building from git source.

@DaveDavenport
Copy link
Collaborator

  1. Don't realy want to mess with this, mostly because I do not know what will happen with RTL text.
  2. Owh, yet another configuration option.

What is missing in this https://github.com/DaveDavenport/rofi/blob/master/INSTALL.md#install-a-checkout-from-git explanation?

@sprig
Copy link
Author

sprig commented May 10, 2016

Nothing is missing - I only saw the explanation above it, sorry.

@sprig
Copy link
Author

sprig commented May 10, 2016

regarding 1, what I wrote is the behavior I'd like to see for RTL languages as well, and if it were easy for you, I'd also test it for hebrew. My logic is that if I'm throwing the left, then importance of characters goes down from right to left, and likewise (but reversed) if I throw stuff out from the right.

But if you don't feel inclined, I'll just try to do this myself :-)

@DaveDavenport
Copy link
Collaborator

I never use it myself (sticking to ascii in daily routine), so I am hesitant making changes in regards to this as I have no idea what it breaks..

@petobens
Copy link

petobens commented Sep 24, 2018

Hi @DaveDavenport I'm trying to left align elements in -dmenu but I cannot quite get it to work:
using echo -e "\u200e foo" | rofi -dmenu -width 10 -lines 1 still gives some spacing between the left margin and foo. Can you please point out the proper way to do it? Thanks!

Edit: My general script is as follows:

THEME="\
    window {
    location: northwest;
    anchor: northwest;
    y-offset: 1em;
    width: 15ch;
    x-offset: 0;
}
mainbox {
    children: [ listview ];
}
listview {
    fixed-height: false;
    dynamic: true;
    padding: 0px 0px 0px ;
}"


menulist="\
\u200e Launcher
 Reboot
襤 Shutdown
 About"

category=$(echo -e "$menulist" | \
        rofi -dmenu \
        -i \
        -no-custom \
        -select "$category" \
        -font "Noto Sans Mono 11" \
        -theme-str "$THEME" \
    | awk '{print $2}')

if [ -z "$category" ] ; then
    exit
fi

if [ "$category" = "Launcher" ] ; then
    rofi -combi-modi drun,run -show combi
elif [ "$category" = "Restart" ] ; then
    xdotool key Super_L+Shift+r
elif [ "$category" = "Shutdown" ] ; then
    xdotool key Super_L+Shift+s
elif [ "$category" = "About" ] ; then
    WINIT_HIDPI_FACTOR=2.66 alacritty -t "About Arch" -e /usr/bin/bash -i -c "neofetch;bash"
fi

sleep 0.1 # pause to avoid instant menu closing with mouse
exit 0

My problem is that even when setting padding: 0px 0px 0px ; and using \u200e I cannot get left alignment.

@avonmoll
Copy link

Is it possible, currently, to even have the ellipses on the left? I've tried combinations such as

echo -e "\u200f Hello this is a really long line and it is super long\none" | rofi -dmenu -theme-str "#element{ horizontal-align: 0;}"

where I use RTL (\u200f) or LTR (\u200e) with horizontal-align 0 or 1 and always the ellipsis is on the right. I don't really care about being able to change at run-time, I just want to be able to right align and always ensure the end of each entry is visible.

If it matters, my use case is finding files (via ripgrep) and quickly opening/launching them. So I'm piping filenames in to rofi which can get quite long, and what's most important is seeing the end of the path.

@Konfekt
Copy link

Konfekt commented Apr 16, 2020

The commit 52c5592#diff-bbf76b681ca634423325e1d2d7c7e21b does not document any option for permanently toggling this option in the configuration file.

piping filenames in to rofi which can get quite long, and what's most important is seeing the end of the path.

This usecase is quite common and rofi would be much more useful showing the file name instead of the preceding directories.

@DaveDavenport
Copy link
Collaborator

The commit 52c5592#diff-bbf76b681ca634423325e1d2d7c7e21b does not document any option for permanently toggling this option in the configuration file.

Because it does not add this. Please follow issue guidelines, if you have a feature request for this, open a new issue.

@DaveDavenport
Copy link
Collaborator

we have ellipsizing and a -keep-right for dmenu.
Lets close this old one.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants