GithubHelp home page GithubHelp logo

zebradil / powerline-taskwarrior Goto Github PK

View Code? Open in Web Editor NEW
64.0 6.0 5.0 282 KB

䷡→䷆ A Powerline segment for displaying information from Taskwarrior task manager

License: MIT License

Python 89.45% Shell 6.77% Dockerfile 3.79%
powerline taskwarrior powerline-taskwarrior powerline-segment taskwarrior-segment

powerline-taskwarrior's Introduction

Powerline Taskwarrior

CI PyPI PyPI

A set of Powerline segments for showing information retrieved from Taskwarrior task manager.

It shows a current context and the most urgent active task.

screenshot

Requirements

Taskwarrior segments require:

  • task v2.4.2 or later,
  • Python ^3.7 (support for Python 2.7 was dropped)

Installation

AUR

yay -S python-powerline-taskwarrior

PIP

pip install --user -U powerline-taskwarrior

It can also be installed system-wide, but this is usually a bad idea.

Debian

On Debian (testing or unstable), installation can be performed with apt:

apt install python-powerline-taskwarrior

Usage

Activate segments

To activate Taskwarrior segments add them to your segment configuration. See more about powerline configuration in the official documentation. For example, I store powerline configuration in ~/.config/powerline/themes/shell/default.json.

These are available powerline-taskwarrior segments:

  • display current context name

    {
        "function": "powerline_taskwarrior.context",
        "priority": 70
    }
  • display the count of pending tasks

    {
        "function": "powerline_taskwarrior.pending_tasks_count",
        "priority": 70
    }
  • display the most urgent active task

    {
        "function": "powerline_taskwarrior.active_task",
        "priority": 70
    }
  • display the most urgent next task

    {
        "function": "powerline_taskwarrior.next_task",
        "priority": 70
    }
  • obsolete segment displays both of listed above

    {
        "function": "powerline_taskwarrior.taskwarrior",
        "priority": 70
    }

Color scheme

Taskwarrior-powerline requires custom colorscheme to be configured. Add the following to your colorschemes (.config/powerline/colorschemes/default.json):

{
  "groups": {
    "taskwarrior:context": "information:regular",
    "taskwarrior:pending_tasks_count": "information:priority",
    "taskwarrior:active_id": { "bg": "mediumgreen", "fg": "black", "attrs": [] },
    "taskwarrior:active_desc": { "bg": "green", "fg": "black", "attrs": [] },
    "taskwarrior:next_id": { "bg": "brightyellow", "fg": "black", "attrs": [] },
    "taskwarrior:next_desc": { "bg": "yellow", "fg": "black", "attrs": [] }
  }
}

And here you can configure the colors.

See powerline colorschemes docs for more details.

Further customization

If you have a custom name for task command, it should be specified via task_alias argument in the segment configuration.

powerline_taskwarrior.active_task and powerline_taskwarrior.next_task segments accept description_length parameter. It is an integer which represents a maximum length of the description field. If a description is longer than description_length, it is truncated by words.

powerline_taskwarrior.next_task segment accepts ignore_active parameter. If it set to true, the segment will be shown always, regardless of existence of an active task.

{
    "function": "powerline_taskwarrior.next_task",
    "priority": 70,
    "args": {
        "task_alias": "taskwarrior",
        "description_length": 40
    }
}

License

Licensed under the MIT License.

By German Lashevich.

powerline-taskwarrior's People

Contributors

dependabot[bot] avatar frankgruellich avatar irl avatar renovate[bot] avatar zebradil 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

powerline-taskwarrior's Issues

Customized colors

Hi,

right now powerline-taskwarrior hardcodes the rather standard highlight groups information:regular, critical:failure, and critical:success and thus does not really allow individual customization for colors. I think powerline-taskwarrior should use it's own highlight groups. Users can set them to the now hardcoded defaults, if they want.

Kind regards,
Frank.

Please make a release

Hi,

Thanks for your work on this.

I'd like to package this in Debian. (Debian bug is #836949).

Please tag a release that you consider to be "stable" for me to base the package on.

Thanks,

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): update dependency black to v23.12.1
  • chore(deps): update dependency isort to v5.13.2
  • chore(deps): update dependency semgrep to v1.70.0

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-python v5
  • actions/cache v4
  • actions/checkout v4
  • actions/setup-python v5
  • actions/cache v4
  • abatilo/actions-poetry v3.0.0
  • marvinpinto/action-automatic-releases v1.2.1
pep621
pyproject.toml
  • poetry-core >=1.0.0
poetry
pyproject.toml
  • python ^3.7
  • powerline-status ^2.7
  • black ^23.0.0
  • isort ^5.10.1
  • semgrep ^1.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: packagingRules

Count the number of tasks

Hi,

I'm usually Taskwarrior to store some small things I have to do, like, looking for some information, sending an email, while development related tasks are usually stored on a tool like Jira or Redmine.
I was wondering if a segment counting the number of pending tasks could be implemented ?

Thanks in advance !

no context shown after installation

Hei,
I installed powerline-taskwarrior with pip. Bevor I installed powerline-status and copied the config files to my privat folder like ~/.config/powerline as said in the instruction.
But after adding the function call to ~/.config/powerline/themes/shell/default.json none of the functions work.
powerline-lint does not give any error when parsing.
Attachted ther is a screenshot of setting, context in taskwarrior, and the pip list output.

So I don't quite understand if I did something wrong while installing, or maybe the script is broken.
Screenshot from 2021-07-30 17-51-36

Shell segment hangs if no task db is found

Hi,

I successfully used your newly powerline_taskwarrior.pending_tasks_count function on a project but was surprised to see my zsh prompt not appearing while launching a new terminal.

When trying to get the prompt back with Ctrl-C, I got

^CTraceback (most recent call last):                                                                                                                                                                                                         
  File "/home/linuxbrew/.linuxbrew/bin/powerline-render", line 31, in <module>
    write_output(args, powerline, segment_info, get_unicode_writer())
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/commands/main.py", line 184, in write_output
    rendered = powerline.render(
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/__init__.py", line 877, in render
    return self.renderer.render(*args, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/renderers/shell/__init__.py", line 92, in render
    return super(ShellRenderer, self).render(
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/renderer.py", line 291, in render
    return self.do_render(
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/renderers/shell/__init__.py", line 106, in do_render
    return super(ShellRenderer, self).do_render(segment_info=segment_info, **kwargs)
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/renderers/shell/__init__.py", line 62, in do_render
    res = super(PromptRenderer, self).do_render(
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/renderer.py", line 330, in do_render
    segments = list(theme.get_segments(side, line, segment_info, mode))
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/theme.py", line 140, in get_segments
    process_segment(
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/segment.py", line 173, in process_segment
    contents = segment['contents_func'](pl, segment_info)
  File "/home/linuxbrew/.linuxbrew/lib/python3.9/site-packages/powerline/segment.py", line 412, in <lambda>
    contents_func = lambda pl, segment_info: _contents_func(pl=pl, segment_info=segment_info, **args)
  File "/home/leonard/.local/lib/python3.9/site-packages/powerline_taskwarrior/segments.py", line 39, in __call__
    return self.build_segments()
  File "/home/leonard/.local/lib/python3.9/site-packages/powerline_taskwarrior/segments.py", line 187, in build_segments
    pending_tasks_count, err = self.execute(
  File "/home/leonard/.local/lib/python3.9/site-packages/powerline_taskwarrior/segments.py", line 18, in execute
    out, err = [item.decode("utf-8") for item in proc.communicate()]
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.9/subprocess.py", line 1134, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.9/subprocess.py", line 1979, in _communicate
    ready = selector.select(timeout)
  File "/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.9/selectors.py", line 416, in select
    fd_event_list = self._selector.poll(timeout)
KeyboardInterrupt

Now, the default cwd for my newly opened terminal is my $HOME.
I don't have any task db in my home : I use a project related task db and would like to keep it that way.

Is there something that can be checked in the segment configuration, like the existence of a taskrc file for example, to avoid such a problem ?

I guess I could also write a custom wrapper script to handle such a case !

What do you think ?

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.