yurikhan / kitty_grab Goto Github PK
View Code? Open in Web Editor NEWKeyboard-driven screen grabber for Kitty
License: GNU General Public License v3.0
Keyboard-driven screen grabber for Kitty
License: GNU General Public License v3.0
Thanks for this kitten. It adds a great missing feature to kitty.
Exception is thrown directly after triggering the hotkey for the grab action.
Unhandled exception running kitten:
Traceback (most recent call last):
File "kitty/runner.py", line 142, in main
File "kitty/runner.py", line 68, in launch
TypeError: main() takes 0 positional arguments but 1 was given
Press Enter to quit...
kitty 0.12.3
Minimal user configuration in kitty.conf:
map ctrl+space kitten grab1.py
(from #3)
It should be possible to move and select by pages.
Immediately after triggering the hotkey the following exception occurs:
Exception in callback Loop._read_ready(<kitten.GrabH...t 0x10ae3eeb8>, 6)
Traceback (most recent call last):
File "Python/events.py", line 88, in _run
File "kitty/loop.py", line 188, in _read_ready
File "kitty/loop.py", line 265, in _on_apc
File "/Users/coby/.config/kitty/grab2.py", line 273, in on_key
action = self.shortcut_action(key_event)
File "kitty/handler.py", line 37, in shortcut_action
AttributeError: 'GrabHandler' object has no attribute '_key_shortcuts'
Press the Enter key to quit
The only version of kitty I've tested this on is 0.13.2, but I haven't been able to get it to work in 0.13.0.
When running I'm getting the error:
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/bin/../lib/kitty/__main__.py", line 136, in <module>
main()
File "/usr/bin/../lib/kitty/__main__.py", line 127, in main
namespaced(['+', first_arg[1:]] + sys.argv[2:])
File "/usr/bin/../lib/kitty/__main__.py", line 84, in namespaced
func(args[1:])
File "/usr/bin/../lib/kitty/__main__.py", line 71, in run_kitten
rk(kitten)
File "/usr/bin/../lib/kitty/kittens/runner.py", line 124, in run_kitten
m = runpy.run_path(path, init_globals={'sys': sys, 'os': os}, run_name='__run_kitten__')
File "/usr/lib/python3.9/runpy.py", line 268, in run_path
return _run_module_code(code, init_globals, run_name,
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/axel/.config/kitty/kitty_grab/grab.py", line 3, in <module>
import _grab_ui
ModuleNotFoundError: No module named '_grab_ui'
even though _grab_ui.py
is in that folder. Any idea why?
I would like some indication that I am currently in grab mode. I have the top window bar disabled, so changing the background for example would be a nice way to do that.
I only see
#: Colors {{{
# selection_foreground #FFFFFF
# selection_background #5294E2
#: Colors for selected text while grabbing.
#: }}}
the selection color in the example config.
Still not sure if it's directly related to the update, need to look into it some more, but thought i'd leave this here for your information, and just in case you have any advice re: dealing with it. LOVE this plugin btw, keep up the awesome work!
Key action failed
kitten kitty_grab/grab.py
cannot import name 'key_func' from 'kitty.conf.utils'
Press Enter to close.
My goal for me to make his copy mode work is always to try to use vim key-binding as my top priority. So I did bunch of tries:
However it works partially but not entirely, which will depends on what programs actually does the coloring in the first place. Some lines have been restored perfectly, some lines are either not or partially restored.
So my question is, can I borrow your implementation of "intact" of the original buffer and apply the same to my approach above? Not sure if you have tried using vim, you might have, if so, would you please just teach me the lesson so that I won't bump to the wall again.
Thanks
When I do stream selection (shift + arrows with default bindings) on a output line which is displayed on the terminal in multiple lines (due to being too long) I get a newline inserted at the point where the display breaks the line. This doesn't happen when I select using the mouse.
I just installed kitty_grab but is not working
-Press mapped key
-Kitty flashes
-Change title to "grab"
-Select text
-Press enter
-But when trying to paste, it paste what is already on de clipboard no the selection I just made.
$ kitty -v kitty 0.27.1 created by Kovid Goyal
Windows system X11
Firstly, this is great plugin for kitty, thanks for the work, it is what I am looking for.
There are quite a few things don't work quite right at moment.
I can only manage to fine tune and customise keys, like j/k/h/l for cursor movement, y to yank, the other mappings I have tried hard, but none worked or behaved in weird way. And it is better to mimic the key bindings by default in vim style
Here are a few things I think it requires more work:
a. page up/down, ctrl+f/b
b. v for visual selection mode, if it is possible
c. the column selection just does not work. In fact, I enable alt key in my mac, and none of the mapping using alt key works. Not sure why.
d. not sure how to do search, or if this is possible.
Thank you
In my kitty.conf, I have:
cursor none
cursor_text_color background
cursor_shape block
cursor_beam_thickness 3
cursor_blink_interval 0
Note that cursor_text_color background
should do nothing because the above is set to cursor none
. If I comment it out, there is no change to any of the following. It's just there for completeness, I guess.... but it's superfluous.
The result when I use kitty_grab is as you'd expect - the cursor 'inverts' the background and foreground colours. Here's a shot (look at the 'y' in the middle:
So that's nice, and working as expected. But I'd kinda like to be using the beam
cursor. When I use beam, it uses the text foreground colour as the foreground of the beam, but doesn't use the text background colour as the text foreground colour, so instead of 'blue on black' becoming 'black on blue' as per the above shot, I get 'blue on blue' which means the text is invisible. screenshot:
I chose the lowercase letter y on purpose, so that you can see that the 'underline' cursor has the same issue:
I'll just keep using block
for now, but it would be super cool if you know how to fix this up, so that I can switch to beam
:)
Thanks in advance for any help!
As far as I am aware scrolling vertically can only be done one line on each keypress ('up'/'down') or one screen height ('page up'/'page down'). Thus I find it tedious to navigate to a line at the middle of the screen. A big improvement would be to allow binding keys to multi-line cursor movements, either by a fixed number of lines or a fraction of the screen height.
The selection doesn't really match what's shown on screen wherever special characters are present. Using the default zsh configuration (no themes) works flawlessly.
Is there any shortcut to select the whole current line?
The current way I'm doing it is to use 'a' to go the the beginning and then shift+e to go to the end. Not sure if it is the most efficient way.
(from #3)
Add incremental search.
OSC52 branch is working as far as copy and paste goes, although it does something weird with the highlighted text.:
This is what it pasted after that:
Originally posted by @pallaswept in #27 (comment)
kitty-grab works great! Thank you! I found your documentation easy to follow. kitty-grab should be included in kitty itself. I detest using my mouse to copy text.
I'd like to use kitty-grab just as I use following standard text selection features on my Linux machine when I use Google Docs, Mousepad, SpaceFM, LibreWriter, etcetera...
Shift+Ctrl+Right
to select one word to the right.Shift+Ctrl+Left
to select one word to the left.Shift+End
to select from the current cursor position to the end of the line.Shift+Home
to select from the current cursor position to the beginning of the line.Shift+Ctrl+End
to select from the current cursor position to the end of the "document."Shift+Ctrl+Home
to select from the current cursor position to the beginning of the "document."Thanks,
Yekutiel
Ctrl
+←
/→
works by looking at code points, but should really use extended grapheme clusters as defined by UAX #29.
Two examples that work incorrectly that come to mind:
Since somewhere around Kitty 0.26.3, kitty_grab stopped working, because the API has changed.
For example, _grab_ui.py
depends on kitty.fast_data_types.set_clipboard_string
, but Kitty moved that function away from fast_data_types
in kovidgoyal/kitty@7e1380c.
Is it possible through configuration to make the movement vim style (for example like alacritty's ctrl+shift+space)
I've updated kitty
today to 0.17.0
on macOS and kitty_grab
stopped working. I've also updated some configs kitty.conf
meanwhile, so not sure is it the update itself or something else. How can I properly debug this extension?
I'm trying to map:
map Ctrl+d move page down
in grab.conf
, but it seems to not be working.
All other shortcuts, such as:
map Ctrl+f move page down
works fine. Just not ctrl+d.
Is there a way to select the output of the last command exclusively, with just one key combination. If not, I would find that very useful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.