Git Product home page Git Product logo

Comments (7)

smzht avatar smzht commented on September 14, 2024 1

拡張機能を一つ作成し、対応しました。config_personal.py の最後の部分に拡張機能を有効にする if 文がありますので、if 1: にしてご利用ください。

from fakeymacs.

smzht avatar smzht commented on September 14, 2024 1

一点コメントとして、記録に残しておきます。

今回作成したコードでは、メニューが表示されているかの判定を Window.find という関数を使って行っています。ただし、この関数はフォーカスがあるウィンドウ以外も含め、ウィンドウ全体の検索を行うもののようです。

メニューがフォーカスのあるウィンドウ以外で開いている状態は無いと想定し、今回のコードとしているのですが、もしその状態があるのであれば、is_menu 関数を以下のようにした方が良いかもしれません。(一応、これでも動くことは確認しています。)

def is_menu():
    window =  Window.find("#32768", None)
    if window and window.getOwner() == keymap.getWindow():
        return True
    else:
        return False

今回は性能を優先し、Window.find 関数の結果のみによる簡易な判定としていますが、もし不都合が発生する場合があれば、このコメントを思い出していただければと思います。

以上、よろしくお願いします。

from fakeymacs.

smzht avatar smzht commented on September 14, 2024

プルダウンメニューやダイアログボックスのクラスが emacs キーバインドを無効にしたい箇所と異なるウィンドウのクラスをもっているのであれば、fc.emacs_target_class 変数を指定することで、fc.not_emacs_target 変数の設定より優先させることができます。デフォルトでは Edit クラスが指定されています。クラスは、Keyhac のメニューから「内部ログをON」を指定すると、Keyhac コンソールで確認できます。

from fakeymacs.

k9i avatar k9i commented on September 14, 2024

ご回答ありがとうございます。
Keyhac コンソールで調べてみたところ、プルダウンメニューとアプリ本体(emacs キーバインドを無効にしたい箇所)は同じクラスでした。
(例えば、TeraTerm4 のプルダウンメニューと本体コンソール部分のクラス名は同じ「VTWin32」)

何か違いはないか ahk で調べてみたところ、ahk の場合、下記でプルダウンメニューと本体を区別できることが分かりました。

; ahk でのプルダウンメニューの識別
  try { ; WinGetClass がエラーとなる場合があるため try で囲む
    If (WinGetClass("ahk_class #32768") == "#32768") {  ; メニューの場合
      Return True  ; emacs キーバインド対象(True)
    }
  }

fc.emacs_target_class = ["Edit", "#32768" ]
と設定してみたのですが、プルダウンメニューで emacs は有効になりませんでした(TeraTerm4)

ググったところ、#32768 は「メニューのクラス」のようでした。
https://learn.microsoft.com/ja-jp/windows/win32/winmsg/about-window-classes

Keyhac で #32768 を区別する方法が分からず試せずにいます。。

from fakeymacs.

smzht avatar smzht commented on September 14, 2024

次で判定することができるようです。

Window.find("#32768", None)

ただし、キーの入力毎に判定する必要があるので、処理の作り込みは少し面倒になると思います。

from fakeymacs.

k9i avatar k9i commented on September 14, 2024

ありがとうございます!
TeraTerm のメニューが emacs キーバインドになっていました。素晴らしいです。
問題ないようですのでクローズさせていただきます。ありがとうございました。

from fakeymacs.

k9i avatar k9i commented on September 14, 2024

ご丁寧にありがとうございます。留意しておきます。

from fakeymacs.

Related Issues (20)

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.