GithubHelp home page GithubHelp logo

hotkeys's Introduction

It's that time of year again!

๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„
๐ŸŽ„ https://adventofcode.com/ ๐ŸŽ„
๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„๐ŸŽ„

https://github.com/donaldducky/advent-of-code

hotkeys's People

Contributors

donaldducky avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jrisebor

hotkeys's Issues

Better error handling

Came back to this after unlocking my screen:

Traceback (most recent call last):
  File "/Users/donaldchea/Projects/d/hotkeys/hotkeys.py", line 111, in <module>
    main_loop()
  File "/Users/donaldchea/Projects/d/hotkeys/hotkeys.py", line 100, in main_loop
    context = get_context(active_app)
  File "/Users/donaldchea/Projects/d/hotkeys/hotkeys.py", line 55, in get_context
    out = subprocess.run(cmd, capture_output=True, universal_newlines=True, check=True).stdout
  File "/Users/donaldchea/.asdf/installs/python/3.9.1/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ps', '-t', 'ttys007', '-opid=,stat=,command=']' returned non-zero exit status 1.

Sometimes commands fail, who knew?

In any case, this doesn't give us any information other than the exit code.

  • Is there anything in stderr we can capture in this case?
  • We can't really display errors to on the screen unless we crash/pause
    • we can't right now because screen is constantly cleared
    • if we can find a nice tui to use, we could potentially display the last error
  • Maybe we can just log to a file?

Add GitHub Action

What python tooling is available?

Minimum would be:

  • flake8 to enforce style

Find a better way of determining the context of an iTerm2 window

When iTerm2 is the current app, we use ps to figure out the foreground process.

Is there a good way to figure this out?
If it's a list of pipeline processes, it's possible we won't know which process to use.

SIngle process

It returns a process with status S+ when the app is "sleeping" or R+ if it's running (not sure the difference atm).

S+ or R+?

In some cases it can have S+ and R+. We are preferring S+ as the "foreground" process here.

Multiple processes (S+, R+?)

In other cases, there may be multiple S+ processes as is the case here.

Find method to handle cleanup on exit

When the script is started, the cursor is hidden.
Is there a good way to ensure the terminal is restored to the proper state when the script exits?

We handle ctrl+c.

But the script can raise or receive SIGTERM, etc.

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.