Giter VIP home page Giter VIP logo

kitti3's Introduction

Kitti3 - Kitty drop-down manager for i3 & Sway

Kitti3 turns Kitty into a drop-down, Quake-style floating terminal for the i3 and Sway window managers.

Features

  • i3 & Sway native, flicker-free visibility toggling
  • Multi-monitor support with adaptive resizing and alignment to the active monitor
  • Flexible choice of terminal position; freely selectable dimensions
  • Great responsiveness by leveraging the i3/Sway IPC API
  • Support for multiple concurrent instances
  • Kitty argument forwarding (e.g. --session)

Image of Kitti3

Installation and setup

Kitti3 is a Python 3 package that lives on PYPI.

  1. To install Kitti3, either:

    • use pipx (recommended):
      $ pipx install kitti3
      
    • or use pip:
      $ pip install kitti3 --user
      
    • or copy main.py to somewhere on your $PATH, rename it to kitti3 and make it executable. (Note: in this case it's your responsibility to satisfy the Python dependencies)
  2. Ensure that Kitti3 is reachable (e.g. $ which kitti3); the WM won't necessarily complain later if it isn't!

  3. Add the following to your ~/.config/<WM>/config:

    exec_always --no-startup-id kitti3
    bindsym $mod+n nop kitti3
    

    where $mod+n refers to your keyboard shortcut of choice. Take a look at the configuration section below for a list of the CLI options that kitti3 accepts.

  4. Restart i3/Sway inplace (e.g. $mod+Shift+r)

  5. Trigger the shortcut to verify that the terminal appears (slight flicker / tiling noise is normal on the first toggle when Kitty is spawned and floated by Kitti3)

Configuration

Kitti3 does not make use of a dedicated configuration file, but its behaviour can be modified via commandline options:

$ kitti3 -h
usage: kitti3 [-h] [-n NAME] [-p {LT,LC,LB,CT,CC,CB,RT,RC,RB}]
              [-s SHAPE SHAPE] [-v]

Kitti3: i3/Sway drop-down manager for Kitty. Arguments following '--' are
forwarded to the Kitty instance

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  name/tag used to identify this Kitti3 instance. Must
                        match the keybinding used in the i3/Sway config (e.g.
                        `bindsym $mod+n nop NAME`)
  -p {LT,LC,LB,CT,CC,CB,RT,RC,RB}, --position {LT,LC,LB,CT,CC,CB,RT,RC,RB}
                        where to position the Kitty window within the active
                        workspace, e.g. 'TL' for Top Left, or 'BC' for Bottom
                        Center (character order does not matter)
  -s SHAPE SHAPE, --shape SHAPE SHAPE
                        dimensions (x, y) of the Kitty window, each as a
                        fraction of the workspace size, e.g. '1.0 0.5' for
                        full width, half height 
  -v, --version         show kitti3's version number and exit

Command line options

-n, --name (default: kitti3)

The name option provides the string identifier used to connect a user-defined i3/Sway keybinding to the Kitti3 instance. Specifically, Kitti3 will listen to IPC events and toggle the visibility of Kitty when it encounters the bindsym command nop NAME - hence the requirement to include a "no-op" bindsym declaration in your config.

The name option value is also used internally to associate Kitti3 with the Kitty instance it manages (the latter is forwarded the argument --name NAME). For this reason it is worth ensuring that an instance name is chosen which is unlikely to collide with that of another application's window; it would be wise to avoid the likes of slack or discord.

-p, --position (default: RT)

The position option accepts a 2-char ID, which sets the Kitty window's location within the workspace (and implicitly in which directions to grow the window's dimensions). The window can be placed in one of nine locations:

  Left Center Right
Top LT CT RT
Center LC CC RC
Bottom LB CB RB

The case and order of the characters are inconsequential (i.e. LB == bl).

Note that for backwards compatibility, the position option additionally accepts an older location format, with the following mapping. The default position if none is provided is actually right (refer to the note on shape below for why this matters). These choices will be removed in a future release.

Old New
top LT
bottom LB
left LT
right RT

-s, --shape (default: 1.0 0.3)

The shape option specifies the (x, y) dimensions of the Kitty window relative to its workspace. Allowed values are in the range [0, 1], where 1.0 corresponds to the full extent of the given workspace axis.

Note that for backwards compatibility, shape values will be interpreted in (y, x) order when position is set to left or right.

Examples

Centered terminal with custom name and argument forwarding

The following i3/Sway configuration snippet produces a Kitty terminal positioned at the center of the workspace, filling half its height and 30% of its width. It is assigned the custom name "caterwaul", and the argument --session ~/.kitty_session is forwarded to Kitty when it is spawned.

exec_always --no-startup-id kitti3 -n caterwaul -p CC -s 0.5 0.3 -- --session ~/.kitty_session
bindsym $mod+n nop caterwaul

Note that any arguments following -- are ignored by Kitti3 and forwarded to the terminal when it is spawned.

Multiple instances

Multiple Kitti3 instances (and hence Kitty windows) can be run concurrently; they just need to be distinguished by unique instance names to avoid crosstalk, e.g.:

exec_always --no-startup-id kitti3 -n almond -p CT -s 0.5 0.25
bindsym $mod+t nop almond 
exec_always --no-startup-id kitti3 -n bubblegum -p CB -s 1.0 0.4
bindsym $mod+b nop bubblegum

Updating the configuration

Kitti3 must be respawned to trigger any changes made to its command line arguments in the i3/Sway config file. This can most easily be achieved by restarting the WM inplace (e.g. $mod+Shift+r), which because of the use of exec_always will spawn a new instance of Kitti3. The old instance will automatically exit when it detects a restart event, so you should not see any stray instances hanging around.

Dependencies

  • Kitty (duh)
  • i3 > 4 or Sway >= 1.6 (you should also be fine on the latest git)
  • Python >= 3.6
  • i3ipc-python (pip(x) will pull in >=2.0)

Alternatives

The following rant discussion was written some years ago and might not accurately represent the current day lay of the land.

The natives

If you're not too fussed about which terminal you're using then there are several alternatives out there that do drop-down out of the box, like guake and tilda. However, if you find yourself wanting to experiment with fonts that support programming ligatures (like the excellent FiraCode), your options quickly dwindle as terminals based on the VTE library (like the two above) still don't play well with ligatures.

The other bolt-ons

But you're here because you want to use Kitty, so forget about the natives for a second and instead ask yourself why you shouldn't just be using one of the other "drop-downifiers". Two notable mentions in this space are tdrop and i3-quickterm. tdrop is a swiss army knife that could probably turn a potato into a drop-down if you worked hard enough, but while feature rich it can be prohibitively slow and cause substantial flicker artifacts in i3wm during visibility toggling.

Kitti3 was actually inspired by the approach taken by i3-quickterm, which issues show/hide commands to i3 via IPC. It also supports other terminals than just Kitty, however its single-shot, mark-based design leads to some speed penalties and unwanted behaviour when spawning terminals. If you're open to using other terminals than Kitty (and have somehow made it this far into the readme), you should try it out. It was i3-quickterm's inability to display terminals as slide-ins (as opposed to drop-down or pop-up) that prompted the creation of Kitti3.

Kitti3 runs as a daemon and listens to events through the i3/Sway IPC API, using information about the active workspace to dynamically direct the WM in how to best resize and position Kitty when visibility is toggled. This leads to excellent responsiveness and no flicker artifacts, as well as a seamless experience in multi-monitor, multi-resolution setups.

Bare-metal i3/Sway config

"But I don't have a hundred external monitors on my desk!" you cry out. Well, if you're running a single-monitor setup, or you're simply content with having the terminal displayed on your main monitor only, then you don't actually need Kitti3 or any of the other bolt-ons. The WM is happy to take care of container floating and positioning if you're happy to work with absolute pixel values. This is where you start (add to ~/.config/<WM>/config):

exec --no-startup-id kitty --name dropdown 
for_window [instance="dropdown"] floating enable, border none, move absolute \
position 0px 0px, resize set 1920px 384px, move scratchpad
bindsym $mod+n [instance="dropdown"] scratchpad show

and the i3 user's guide will lead you the rest of the way.

Development

Found a bug? Feel like a feature is missing? Create an issue on GitHub!

Want to get your hands dirty and contribute? Great! Clone the repository and dig in.

The project follows a setuptools based structure and can be installed in development mode using pip (from the project root directory):

$ pip install -e .

This exposes the kitti3 entry point console script, which starts the Kitty manager.

License

Kitti3 is released under a BSD 3-clause license; see LICENSE for the details.

kitti3's People

Contributors

landingellipse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kitti3's Issues

People should know that kitti3 is doing just fine, thank you very much

Just putting this here for the potential user who might be sceptical about the lack of activity in this repo over the last year. The reason is simply that kitti3's been working flawlessly for me ever since the window origin scare of '20. So if it ain't broke, don't fix it.

Friendly reminder to please submit an issue if anything's not right, or if you have any suggestions on improving the on-boarding experience for new users.

When I find the time to implement some of the nice-to-have features already on the list I'll take the opportunity to bump the project to 1.0.0, as I think it deserves it at this point :)

Cheers,
Landing

Readme should cover possible issues associated with i3 config reload

When I dynamically reload i3wm's config (e.g. via mod+shift+r) kitti3 is terminated, for whatever reason that I haven't had the chance to look into. As this might not be intuitive for users, to minimise confusion it would be good to include an "Issues" section in the readme that mentions this and how to recover (i.e. start kitti3 from the launcher).

kitti3 -p top doesn't work with two monitors

I have two monitors:

eDP-1 connected primary 1920x1080+0+1050 (normal left inverted right x axis y axis) 294mm x 165mm
DP-1 connected 1680x1050+120+0 (normal left inverted right x axis y axis) 433mm x 270mm

and I launch kitti3 -p top -- -c=~/.config/kitty/quake.conf.

While it works when when I have only one monitor connected, with the two monitor setup, the terminal appears centered (almost) on the upper left edge of the current monitor, which makes it unusable.

`on_spawn` event handler not active immediately after registration

It would be nice to be able to register the on_spawn handler on demand from within spawn (i.e. when we know a new window will be created soon-ish), and allow the former to simply de-register itself after its done. This would would stand in contrast to the current scheme where on_spawn is registered on Kitti3 instantiation and kept active indefinitely, which while admittedly not an issue performance wise, is less neat.

However, although the window::new event does not trigger until ~0.2s (on my system) after spawn has initiated the creation of the Kitty window, if on_spawn is registered from within spawn it appears to, for an unknown reason, miss the window::new event in question.

Not able to start

I have the same error as this. I am using i3-gaps 4.19.1. But when i follow the instructions and enter Super(my mod key)+n nothing happend. NOTE: i did restart i3 along with rebooting

Kitti3 could support other terminals, applications

There's nothing inherently stopping Kitti3 from managing pretty much any application/container which is able to set a telltale - WM_INSTANCE attribute (name or class), title, or app_id (sway).

Rough approach:

  • keep "database" of common/known programs and their way of setting a telltale (e.g. Kitty: --class for app_id and --name for window_instance)
  • add new arg: -p, --program (default to Kitty for backwards compatibility)
  • if PROGRAM is single word and is in DB, use DB entry when spawning
  • elif PROGRAM contains fmt placeholder, put NAME in placeholder when spawning
  • else either error out(?) or assume user supplies instance; disable spawning
  • potentially add new arg: -i, --identity (default window_instance/app_id based on WM); sets which criteria to use when searching for NAME

update Pypi package

I think the bug I encountered (multiple instances, not floating with sway) has likely been fixed with the most recent commits, but the Pypi package is trailing behind the repo a bit. The current pypi version is 0.4.1 but the version on main is 0.5.1.

you can actually publish directly from github with tagged commits and github actions.

awesome project btw

Desktop display issues with picom

  • kitti3 0.2.4
  • kitty 0.16.0
  • i3 version 4.18 (gaps)
  • picom v7.5
  • xorg-server 1.20.7-1
  • X display driver: intel

This is recent(ish) behavior; maybe within the past week. When I first noticed this was after a system update, and every package but kitti3 may have been updated; in that list, only kitti3 is manually installed, and I just updated it this morning to try to fix the issue.

kitti3 will open on the left external display reliably. It will not show on the right display, but I can tell by the other windows dimming that picom thinks it's got another window to show. I can get it to show on the right display if I perform the following magic: show on left; hotkey switch to right; hide & show kitti3 again -- but then it'll only show on either the left or the right; if I switch to the middle, it just opens on the right again. If I switch left and close/open kitti3, then I can get it to open on the middle. It only ever opens in that "there, but hidden" state on the right screen.

All behavior is normal when picom is killed, and then kitti3 opens on the correct display whichever that is.

Only kitti3 is getting this treatment. All other windows (including floating ones) correctly show up on whichever display has focus.

Output of xrandr -q, trimming the unused modes:

Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 290mm x 160mm
   1920x1080     60.03*+  48.03  
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP2-1 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 520mm x 290mm
   1920x1080     60.00*+  50.00    59.94  
DP2-2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 520mm x 290mm
   1920x1080     60.00*+  50.00    59.94  
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

Documentation revamp

It's time to toss out the old readme and come up with something new.

Work in progress.

readme.md

Outline

  • Tagline
  • Features overview
  • GIF taster demo
  • Installation / quick start (basic cli invocation only)
  • Usage
    • General overview of what Kitti3 can do / where it fits w.r.t. host config etc.
    • Basic terminal (Kitty/Alacritty; known clients)
    • Animate anything (title w/ Tabs Outliner window)
    • Dynamic association (con_mark w/ __focused__ set mark keybind companion)
  • Reference
    • cli args (breakdown)
    • i3 vs sway (feature comparison)
  • Contributing
  • License

Considerations

  • Use term "host" to refer to i3 and sway? (b/c i3 is a WM and sway is a compositor...)
  • Lower case s in sway, as that seems to be their preference?
  • Figure out what to call Kitti3 - "handler" instead of current "manager"? Want to avoid confusion with WM that might come from calling Kitti3 a "floating window manager"...
  • Was thinking about doing a screencast to showcase the various features, but might be better to just do gif demos for each usage example?

Misc

  • Create issue template (ask people to use --debug and ideally combine w/ sway -D > ~/sway_kitti3.log or somesuch)

Kitti3 should complain if Kitty is not installed

i3's exec command is happy enough regardless of what you ask it to execute, such that even if Kitty is not installed on a user's system the return status of the IPC exec request sent by spawn will indicate success.

The entrypoint cli function could perhaps do a quick check during startup (akin to $ which kitty) and complain if Kitty can't be resolved?

$mod-n conflicts with the conky from Manjaro i3 edition

Though I an not using Manjaro (partly due to the disappearance of the forums), but Arch, I am using a modified version of the conky from Manjaro i3 with keybinding help.

I do not understand the finer points of Conky, so cannot explain why: $mod-n causes the conky to act very strangely.

I have a dropdown working now that seems to have issues using kitty. KItty is a fine term! I am a little put off that I need to learn another keystroke (kitty's mod (Ctrl-Shift) PgUp / PgDown to examine the scrollback history. This is a nice uitility.

Oh! One more thing, the example using caterwaul also didn't work on my system. I don't know why.

AD

Keybinding "Appears" to Do nothing

Surely I'm doing something wrong so please forgive me.

I installed using pip. It appears in my path when I run which. At the bottom of my i3 config I added the lines.

###############################################################################
# User Configuaration
###############################################################################

# Launch Kitty Drop Down
exec --no-startup-id kitti3
bindsym $alt+` nop kitti3

I've also attached my entire config file for i3, which is just the default regolith config. I had to rename it with a .txt suffix to attach it.
config.txt

After system update, kitti3 no longer likes me. i3ipc socket does not exist?

So, admittedly, a big update came through on my system which changed the default python version from 3.9 to 3.10. Kitti3 would not run
when called with the i3 keybind, but would run in the terminal for some reason. This caused me to do some investigating, and inevitably
trying to reinstall kitti3. Unfortunately, once I tried to install it, I always received the same error message when I attempted to run
it. It appears i3ipc is not creating it's socket, but this is just a guess

Traceback (most recent call last):
  File "/usr/local/bin/kitti3", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/site-packages/kitti3/main.py", line 312, in cli
    kitti3 = Kitti3(
  File "/usr/local/lib/python3.10/site-packages/kitti3/main.py", line 78, in __init__
    self.i3 = i3ipc.Connection()
  File "/usr/local/lib/python3.10/site-packages/i3ipc/connection.py", line 74, in __init__
    self._cmd_socket.connect(self._socket_path)
FileNotFoundError: [Errno 2] No such file or directory

Any suggestions?

Kitti3 does not work when focusing primary (right) monitor

I recently upgraded to a multimonitor setup, and have been using kitti3 for quite some time now. When I move my mouse to my (new) primary monitor and try to access kitti3, all it does is unfocus whatever window was focused previously. When I move my mouse to my secondary monitor and try to access kitti3, it works just fine. I should note that my secondary monitor is setup to be on the left of my primary monitor. Is there any way to get kitti3 working on both monitors (as in whichever my mouse is in)? Or at least just my primary monitor?
Edit: just tried making my primary monitor (in software) to the left of my secondary monitor, and kitti3 worked on my primary monitor then but not on my secondary, so it seems that it doesn't work on whichever monitor is seen as the "left" monitor

kitti3 not opening kitty window

Until yesterday, this had been working so I suspect some upgrade broke kitti3. I strongly suspect it's related to a python upgrade, because I had to do that for something else in the morning.

Behavior

  • kitty itself works fine -- I can open windows as usual
  • Triggering kitti from the i3 hotkey doesn't do anything
  • There are no errors in .xsession-errors
  • If I replace nop and make it an exec I just end up with a bunch of kitti3 instances -- one for every time I press MOD1+n.
  • I've tried with compiz both enabled and disabled
  • I've confirmed that $mod+n is bound exactly once in the .i3/config, and that's to kitti3
  • I tried to fix it with pip install --force-reinstall --upgrade kitti3 --user
  • I changed the i3 exec to exec_always to make sure kitti3 is executed on i3 restart, and confirmed via ps that i3 is, indeed, executing the kitti3 command.
  • Killing the i3 kitti3 and running kitti3 from the command line, kitti3 executes and does nothing as expected (since it doesn't fork). ^z + bg to fork and background it, and then:
  • a second call to kitti3 from the command line also does nothing (triggers no exposure of a window). It, too, just hangs there with no errors.

I don't know if kitti3 is doing something clever with i3 sockets and so testing from the command line is not valid; if so, any other pointers on how to debug this would be appreciated.

Environment

  • i3-gaps 4.17.1
  • arch linux, up-to-date as of last night. The problem started prior to the system upgrade.
  • kitty 0.14.6 created by Kovid Goyal
  • kitti3 0.2.4
  • python 3.7.4
➜  ~ grep kitti3 .i3/config
bindsym $mod+n nop /home/ser/.local/bin/kitti3
exec --no-startup-id "/home/ser/.local/bin/kitti3 -p right -s 1.0 0.6"

Kitty font size should reflect relative monitor resolution

In multi-monitor, multi-resolution setups, Kitti3 might be able to capitalise on Kitty's remote control capabilities to adjust the latter's font size when displayed on monitors with resolutions different than the "native" (main screen) resolution.

ToDo:

  • research Kitty remote control functionality
  • map out relevant transitions / scenarios
  • implement font size transitions

Feature request: add centre positions

Hi. I just installed this and think it will be very nice to use. This is more of a feature request, but is it possible to add more positions?

Specifically my want would be top-center like yakauke does it.

I've also seen zones like:
123 top-left, top-center, top-right
456 center-left, center-center, center-right
789 bottom-left, bottom-center, bottom-right

Thanks again!

i3 assigns kitti3 to workspace with kitty

It seems there is no way to assign normal kitty instances ([class="kitty]) to their own workspace without assigning kitti3 as well.
Even though I have named my kitti3 instance, which adds to its class name, it retains the kitty class. While I could set the class with a flag when I open kitty instances and only assign those, this wouldn't help on terminals that aren't summoned by me explicitly.
Is there a way to remove the "kitty" class string from a kitti3 instance?

Sway support

Hey, long-time kitti3 user here,
I just moved over to the sway window manager and am missing kitti3, would it be possible for you to get kitti3 working with Sway?

Position and size arguments broken

In i3, I can run this with just kitti3 on its own. However, when I try to reposition or resize, no matter how I format the flags, kitti3 does not show up anywhere, except my system processes.

Readme should include pipx installation instructions

pipx is an awesome way for end users to install Python packages as applications (as opposed to developing installing packages as libraries for use in their own projects). Reflecting this in the installation section of the readme could help increase adoption of kitti3.

Kitti3 should reposition re-floated windows

If a Kitty window managed by Kitti3 is tiled and subsequently floated again its pre-tiled size will be conserved but its position will not (on my system it is placed seemingly centred) on the screen.

In a similar vein to how on_moved handles moves between workspaces, it would appear easy enough to catch the window::floating events and reposition as necessary.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.