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

Deprecation of rofi-script mode #240

Open
cdown opened this issue Nov 25, 2024 · 4 comments
Open

Deprecation of rofi-script mode #240

cdown opened this issue Nov 25, 2024 · 4 comments

Comments

@cdown
Copy link
Owner

cdown commented Nov 25, 2024

Normal rofi usage is unaffected, this is only for CM_LAUNCHER=rofi-script users.

This is a call for anyone who uses rofi-script mode to discuss the use case. Currently there is no support in clipmenu 7 as it significantly complicates locking strategy. There are ways to make it work, but they are complex, and I'm not immediately seeing the benefits of rofi-script mode over normal rofi use. It was mentioned it allows rofi to tab, but that seems like something rofi could in theory support even outside of script mode.

So, if there is some reason it should be kept, please make it known in the coming days :-)

Cc @RX14 who originally implemented it

@cdown cdown mentioned this issue Nov 25, 2024
@RX14
Copy link
Contributor

RX14 commented Nov 29, 2024

I don't use this any more.

@vejkse
Copy link

vejkse commented Dec 3, 2024

I don’t use it, but I just tested it to see what it was and I think it is already supported with the current version of clipmenu 7.

You just need to wrap clipmenu in a small script clipmenu-rofi-script:

#!/bin/bash

if [[ $# -eq 0 ]]; then
  # Step 1: Get list of items from clipmenu
  env CM_LAUNCHER='clipmenu-rofi-script-aux1' clipmenu
  cat < "$XDG_RUNTIME_DIR/clipmenu-rofi-script.list"
else
  # Step 2: Tell clipmenu which item was selected
  {
    export CLIPMENU_ROFI_SCRIPT_CHOSEN_LINE="$1"
    export CM_LAUNCHER='clipmenu-rofi-script-aux2'
    clipmenu >/dev/null 2>&1
  } &
fi

where clipmenu-rofi-script-aux1 is a clipmenu ‘launcher’ that reads the list from stdin into a file and fails (so no clipping is selected):

#!/bin/bash

cat > "$XDG_RUNTIME_DIR/clipmenu-rofi-script.list"
exit 1

and clipmenu-rofi-script-aux2 is a clipmenu ‘launcher’ that ignores stdin and outputs the line selected with rofi that was stored in an environment variable:

#!/bin/bash

echo "$CLIPMENU_ROFI_SCRIPT_CHOSEN_LINE"

Then you can use rofi-script in the following way:

rofi -show clipmenu -modes 'clipmenu:clipmenu-rofi-script'

I may have entirely missed the point…

@cdown
Copy link
Owner Author

cdown commented Dec 3, 2024

The problem with that is that the chosen line index races with addition of any new entry. That's the bit I mention about complicating the locking strategy :)

@cdown
Copy link
Owner Author

cdown commented Dec 3, 2024

But it's true that anyone who has this problem can use this script if they want support, even if it is racy. So while it can't have first party support, it's a good stopgap. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants