vonshednob / pter

Manage your todo.txt in a commandline user interface (TUI)
https://vonshednob.cc/pter/
MIT License
102 stars 6 forks source link

Copy task line to clipboard feature request (terminal version pter) #32

Closed jason-mehmel closed 8 months ago

jason-mehmel commented 9 months ago

I was using pter through my terminal and really enjoying it. The one issue I came up to was being able to copy the text of the task line easily.

I'm often using that text as the source of a google or email search, so quick selection is very useful! I found trying to select the text in the terminal non-intuitive, but also probably a result of the terminal environment itself! So a feature of a full clipboard-copy of that text would be nearly as useful, and maybe easier than changing the text-entry and manipulation details?

vonshednob commented 9 months ago

So, you mean like a shortcut to copy a full task text (including date and tags) into clipboard?

vonshednob commented 9 months ago

Alright, in qpter it's Ctrl+C. In the commandline it's Y and requires xsel, xclip (for X11) or wl-copy (for Wayland). If you're really wild and run tmux, pter will also make sure that your tmux buffer contains the copied task!

All shiny new in version 3.11.0 :)

Does this solve the issue?

jason-mehmel commented 9 months ago

I do have xclip and xsel on my install!

Upgraded to 3.11.0.

Works as expected with qpter, thank you!

Running pter, I couldn't get it to work.

Is that Y with any additions? When I hit y on it's own I get 'no such keybinding.'

shift-Y doesn't create a response, but it also doesn't copy it to the clipboard.

I've got a task selected, but is there something else I should be doing for this?

Or any way to activate that xclip or xsel can receive it?

vonshednob commented 9 months ago

Unfortunately I could not actually test it on my machine with xsel or xclip because… well, wayland. I’ll add the compatibility layer for X11 and try to fix it later today or tomorrow!

Thanks for testing :)

Edit: forgot to answer, it should be Shift+y. But I guess I should add some feedback, too.

vonshednob commented 9 months ago

Alright, please update pter to 3.11.1; it will likely not fix your problem, but it will give (a) feedback after copying to the clipboard and (b) when you run pter with -l debug you can find some useful information about the copy in ~/.cache/pter/pter.log

Let me know how that went!

jason-mehmel commented 9 months ago

Okay! It did give feedback 'copied to clipboard' but... didn't actually copy it from what I could tell.

I do have both xsel and xclip on my X11 system!

Here's what I got from the log!

[DEBUG] Loading key configuration [DEBUG] Current key sequence: ('Y',) [DEBUG] Calling to-clipboard [INFO] Copied to clipboard using /usr/bin/xsel [DEBUG] /usr/bin/xsel ended with 0 [INFO] Copied to clipboard using /usr/bin/xclip [DEBUG] /usr/bin/xclip ended with 0 [DEBUG] Refreshing status bar [DEBUG] Current key sequence: ('q',) [DEBUG] Calling quit

vonshednob commented 9 months ago

Interesting. The return code by both xsel and xclip seem to indicate that the copy succeeded.

After the copy to clipboard, could you try in (first) the same terminal (quit pter first) to paste by typing xsel -o and by typing xclip -o and (second) the same, but in a different terminal?

I have the feeling some defaults wrt the default clipboard selection might be wrong; or maybe pter is running in a container of sorts :thinking:

vonshednob commented 9 months ago

Come to think of it: what desktop environment are you running in?

vonshednob commented 9 months ago

Alrighty, try version 3.11.2. I think I fixed it (and was able to verify that it works on KDE in X11).

jason-mehmel commented 9 months ago

I can confirm it works!

Also, apologies for the delay but my DE is Openbox, with BunsenLabs as my distro!

Thank you for being so responsive and adaptable adding to this software! It's great to have a terminal-based todo.txt solution!

Before we close this, is there any way I can help with or check documentation so other users know about the copy command and ability?

vonshednob commented 9 months ago

No worries about the delay! I'm happy you asked for the feature: integration into other programs is a bit of a weak point in pter atm.

Before we close this, is there any way I can help with or check documentation so other users know about the copy command and ability?

I wouldn't mind a review of the documentation! I added a section to the man page, but maybe it's not clear enough.

Thanks a lot for the offer!

jason-mehmel commented 9 months ago

I think it's pretty clear! A specific and easy-to-implement note:

More general notes:

Move all of the config stuff below the note about Bugs at the end. (Or if 'Bugs' always have to be at the end, then below the Conforming To section.) I suppose this would the File section but it's mostly about the config files.

I think it's safe to assume anyone using this probably wants to know how it works and is test-driving it before they decide to reconfigure anything under the hood! (I'm sure there's a use case where that's not true, but either way, someone willing to jump in is going to find the config stuff easily.)

Lastly, (and this would be lots more work) but a few top-level notes about what distinguishes this from todo.txt on it's own might be nice. Recurring tasks, task sequences, time tracking, those are all bits that seem pretty unique so if someone like me is coming into it with their own established todo.txt file, we might not know how to play with those new toys!

(In fact, now that this clipboard thing is solved I'm going to start looking at task sequences and may have some feature ideas!)

vonshednob commented 9 months ago

Thank you so much for the input! And I fully agree with everything you’ve written!

pter's documentation has grown since its first releases - and it shows that the structure is not how it should be. I would even go as far as moving the configuration file section into its own man-page (i.e. separate document). Because otherwise everyone's just overwhelmed with too much information.

Thanks a lot again, I’ll start refactoring the documentation :grinning:

jason-mehmel commented 8 months ago

You're welcome, and thank you once again for the program, and your responsiveness to ideas and updates for it!

vonshednob commented 8 months ago

Alrighty, I split the documentation into three manpages: pter(1), pter.config(5), and qpter(1). Thanks for pointing out this long overdue structural change in the documentation!

jason-mehmel commented 8 months ago

Brilliant! I'm honored to have contributed to the benefit of the project!

vonshednob commented 8 months ago

Now that the man-page is also installing to the right location and all, I'm closing this issue -- thanks a lot for the really useful feature request/idea!