Coder Social home page Coder Social logo

i3-quickterm's Introduction

i3-quickterm

Packaging status

A small drop-down terminal for i3wm and sway

Features

  • use your favourite terminal emulator
  • can select a shell with dmenu / rofi
  • adapt to screen width
  • multi-monitor aware

Installation

Via pip:

pip install i3-quickterm

Or check the the repology badge above to see if it is packaged by your distribution.

Usage

When launched, it will minimize the quickterm on the current screen if there is one. Otherwise, it will either prompt the user for the shell to open or use the one supplied in argument.

If the requested shell is already opened on another screen, it will be moved on the current screen.

It is recommended to map it to an i3 binding:

# with prompt
bindsym $mod+p exec i3-quickterm
# always bring up standard shell, without the menu
bindsym $mod+b exec i3-quickterm shell

Configuration

The configuration is read from ~/.config/i3-quickterm/config.json or ~/.config/i3/i3-quickterm.json.

  • menu: the dmenu-compatible application used to select the shell
  • term: the terminal emulator of choice
  • history: a file to save the last-used shells order, last-used ordering is disabled if set to null
  • ratio: the percentage of the screen height to use
  • pos: where to pop the terminal (top or bottom)
  • shells: registered shells ({ name: command })

term can be either:

  • the name of a terminal from the supported list.
  • auto to select the first existing terminal of the list above (only to provide friendler defaults, not recommended otherwise)
  • a format string, like this one: urxvt -t {title} -e {expanded} with the correct arguments format of your terminal. Some terminals, like xfce4-terminal need the command argument to be passed as a string. In this case, replace {expanded} by {string}

menu, term, history and shell can contain placeholders for environment variables: {$var}.

Unspecified keys are inherited from the defaults:

{
    "menu": "rofi -dmenu -p 'quickterm: ' -no-custom -auto-select",
    "term": "auto",
    "history": "{$HOME}/.cache/i3-quickterm/shells.order",
    "ratio": 0.25,
    "pos": "top",
    "shells": {
        "js": "node",
        "python": "ipython3 --no-banner",
        "shell": "{$SHELL}"
    }
}

Supported terminals

  • alacritty
  • foot
  • gnome-terminal
  • kitty
  • roxterm
  • st
  • terminator
  • termite
  • urxvt
  • urxvtc
  • xfce4-terminal
  • xterm

If you'd like to add another terminal (or correct an error), please open a pull request.

Requirements

  • python >= 3.8
  • i3 >= v3.11 or sway >= 1.2
  • i3ipc-python >= v2.0.1
  • dmenu or rofi (optional)

i3-quickterm's People

Contributors

bytebutcher avatar cit avatar joweiss avatar lbonn avatar markstos avatar przymusp avatar wleoncio 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  avatar  avatar  avatar  avatar

i3-quickterm's Issues

Some Programs Get Absorbed

Certain programs such as Discord and Lutris seem to get absorbed, becoming the dropdown instead of the terminal...

add support for multiple terminals using tabs

Guake, Yakukake (or even Konsole) allow you to have multiple terminals simultaneously and have them under different tabs.

I wonder if it would be possible to extend your code to somehow support this in a neat way?

[FR] remember shell resizes between toggles

qt offers ratio configuration for setting height, but in addition to that I'd prefer it to also remember our ad-hoc resizes between toggles.

Current state:
a) shell is opened, height X
b) shell height is resized to Y
c) shell is toggled, hiding it
d) shell is toggled again, height X

To-be state:
a) shell is opened, height X
b) shell height is resized to Y
c) shell is toggled, hiding it
d) shell is toggled again, height remains at Y

Just fyi I'm working on it already, will be sending in a PR soon for consideration.

Launching with a kitty session

Kitty has this nice feature that lets you launch it with a predefined session info using the switcher --session.
I tried every possible option I could think of in order to get this to work, including manually setting the title of my session to quickterm_***.
Maybe I'm missing something, but is it even possible?

Thanks.

TypeError: 'WorkspaceReply' object is not subscriptable

Thanks for making this. I'm getting the following error when I run ./i3-quickterm.

Traceback (most recent call last):
  File "./i3-quickterm", line 252, in <module>
    toggle_quickterm_select(conf)
  File "./i3-quickterm", line 155, in toggle_quickterm_select
    ws, ws_tree = get_current_workspace(conn)
  File "./i3-quickterm", line 141, in get_current_workspace
    ws = [w for w in conn.get_workspaces() if w['focused']][0]
  File "./i3-quickterm", line 141, in <listcomp>
    ws = [w for w in conn.get_workspaces() if w['focused']][0]
TypeError: 'WorkspaceReply' object is not subscriptable

python: Python 3.6.8
i3: i3 version 4.16.1 (2019-01-27) © 2009 Michael Stapelberg and contributors

One quickterm per workspace?

I'm fairly new to this application so forgive me if I'm missing something obvious. Is there a way to spawn a new terminal session for each quickterm invoked on different workspaces? For example right now if I open a quickterm on workspace 3 and start a 'ping' operation, then go to workspace 4 and open a quickterm again, I see the same ping operation from workspace 3. I'd like to have a "fresh" terminal on workspace 4.

Can't use, getting errors

Traceback (most recent call last):
  File "i3-quickterm", line 250, in <module>
    toggle_quickterm_select(conf)
  File "i3-quickterm", line 194, in toggle_quickterm_select
    toggle_quickterm(conf, shell)
  File "i3-quickterm", line 219, in toggle_quickterm
    os.execvp(term_cmd[0], term_cmd)
  File "/usr/lib/python3.5/os.py", line 615, in execvp
    _execvpe(file, args)
  File "/usr/lib/python3.5/os.py", line 660, in _execvpe
    raise last_exc.with_traceback(tb)
  File "/usr/lib/python3.5/os.py", line 650, in _execvpe
    exec_func(fullname, *argrest)
FileNotFoundError: [Errno 2] No such file or directory

What seems to be the problem here? Am I doing something wrong? I'm using i3 4.15 on ubuntu 16.04.

Move config file from .config/i3

Having the config file in .config/i3/ doesn't make much sense considering this isnt i3 specific. It would be good to have the config file in its own directory.

quickterm does not take full width

OS: Manjaro 20.2
i3: 4.19
Laptop: Dell XPS 7590
Screen resolution: 3840x2160

When I start quickterm it does not take full length of the screen, it takes about 70%. My config goes as follows:

{
    "term": "alacritty",
    "history": "{$HOME}/.cache/i3/i3-quickterm.order",
    "ratio": 0.25,
    "pos": "top",
    "shells": {
        "shell": "{$SHELL}"
    }
}

Any hints?

could create a default config on first run

Just found your project, looks pretty cool!
Though, when trying to run it for the first time it complains about lack of json config.

invalid config file: [Errno 2] No such file or directory: '/home/rskolasinski/.config/i3/i3-quickterm.json'
Traceback (most recent call last):
  File "./i3-quickterm", line 243, in <module>
    toggle_quickterm_select(conf)
  File "./i3-quickterm", line 188, in toggle_quickterm_select
    toggle_quickterm(conf, shell)
  File "./i3-quickterm", line 212, in toggle_quickterm
    os.execvp(term_cmd[0], term_cmd)
  File "/usr/lib/python3.7/os.py", line 572, in execvp
    _execvpe(file, args)
  File "/usr/lib/python3.7/os.py", line 614, in _execvpe
    raise last_exc
  File "/usr/lib/python3.7/os.py", line 605, in _execvpe
    exec_func(fullname, *argrest)
FileNotFoundError: [Errno 2] No such file or directory

maybe it would be a good idea to create that with default value?

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.