특수 문자, 움라우트, 외국 문자를 삽입할 수 있는 응용 프로그램이나 명령이 있습니까?

특수 문자, 움라우트, 외국 문자를 삽입할 수 있는 응용 프로그램이나 명령이 있습니까?

저는 독일어, 스페인어, 프랑스어, 그리스어, 영어 등 여러 언어로 글을 쓰고 작업합니다. Mac에서는 2초 이상 키를 누르면 주인공에서 파생된 특수 문자 중에서 선택할 수 있습니다. Windows에는 동일한 기능을 수행하는 Holdkey라는 소프트웨어가 있습니다. Linux에도 비슷한 것이 있나요? 아직 찾지 못했습니다.

답변1

저는 두 가지 조언을 드립니다:

  1. 적합한 키보드 레이아웃, 즉 데드 키가 있는 레이아웃을 사용하십시오. 영어 키보드가 있는 경우 예를 들어 선택하세요.영어(미국, 국제, 데드 키 포함). 그러나 몇 가지 다른 변형이 있습니다.
  2. 정의하다작성 키. 이렇게 하면 사용 중인 키보드 레이아웃에 포함되지 않은 많은 문자를 입력할 수 있습니다. (Compose 키는 XKB 기능이므로 Kubuntu에서 사용할 수 있지만 거기서 정의하는 방법을 알아내야 합니다.)

답변2

설정하는 것이 두렵지 않다면(지침이 명확해야 함) 아래에서 자주 사용하는 특수 문자(-대체 문자)를 빠르게 삽입할 수 있는 대안을 제공할 수 있습니다.

편집 가능한 특수 문자 도구

아래 스크립트는 자주 사용하는 문자를 즉시 ​​사용할 수 있도록 하는 유연한 도구(클릭으로 문자를 삽입하는 창)입니다.

여기에 이미지 설명을 입력하세요

작동 원리

  • 바로가기로 창호를 호출하세요
  • 문자를 삽입하려면 해당 문자를 클릭하기만 하면 작업 중이던 창에 문자가 붙여넣어집니다.
  • 문자 세트를 추가하려면 다음을 누르십시오. + 텍스트 편집기 창이 열리고 첫 번째 줄에 "가족" 이름을 추가하고 다음 줄에 관련 특수 문자를 한 줄에 하나씩 추가합니다. 예:

    a
    å
    ä
    ã
    â
    á
    à
    ª
    

    (이미지에서). 파일을 닫으면 다음에 창을 호출할 때부터 특수 문자를 사용할 수 있습니다.

  • 사용 가능한 문자 세트를 삭제하려면 다음을 누르십시오.x

설정 방법

  1. 몇 가지 종속성을 충족해야 합니다.

    • python3-xlib

      sudo apt install python3-xlib
      
    • pyautogui:

      pip3 install pyautogui
      
    • 파이퍼클립:

      sudo apt install python3-pyperclip xsel xclip
      
    • Wnck를 설치해야 할 수도 있습니다.

      python3-gi gir1.2-wnck-3.0
      

    로그아웃했다가 다시 로그인하세요.

  2. 아래 스크립트를 빈 파일에 복사하고 다른 이름으로 저장하세요 specialchars.py.실행 가능하게 만들어라

    #!/usr/bin/env python3
    import os
    import gi
    gi.require_version("Gtk", "3.0")
    gi.require_version('Wnck', '3.0')
    from gi.repository import Gtk, Wnck, Gdk
    import subprocess
    import pyperclip
    import pyautogui
    
    
    css_data = """
    .label {
      font-weight: bold;
      color: blue;
    }
    .delete {
      color: red;
    }
    """
    
    fpath = os.environ["HOME"] + "/.specialchars"
    
    def create_dirs():
        try:
            os.mkdir(fpath)
        except FileExistsError:
            pass
    
    
    def listfiles():
        files = os.listdir(fpath)
        chardata = []
        for f in files:
            f = os.path.join(fpath, f)
            chars = [s.strip() for s in open(f).readlines()]
            try:
                category = chars[0]
                members = chars[1:]
            except IndexError:
                os.remove(f)
            else:
                chardata.append([category, members, f])
        chardata.sort(key=lambda x: x[0])
        return chardata
    
    
    def create_newfamily(button):
        print("yay")
        n = 1
        while True:
            name = "charfamily_" + str(n)
            file = os.path.join(fpath, name)
            if os.path.exists(file):
                n = n + 1
            else:
                break
        open(file, "wt").write("")
        subprocess.Popen(["xdg-open", file])
    
    
    class Window(Gtk.Window):
        def __init__(self):
            Gtk.Window.__init__(self)
            self.set_decorated(False)
            # self.set_active(True)
            self.set_keep_above(True);
            self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
            self.connect("key-press-event", self.get_key)
            self.set_default_size(0, 0)
            self.provider = Gtk.CssProvider.new()
            self.provider.load_from_data(css_data.encode())
            self.maingrid = Gtk.Grid()
            self.add(self.maingrid)
            chardata = listfiles()
            # get the currently active window
            self.screendata = Wnck.Screen.get_default()
            self.screendata.force_update()
            self.curr_subject = self.screendata.get_active_window().get_xid()
            row = 0
            for d in chardata:
                bbox = Gtk.HBox()
                fambutton = Gtk.Button(d[0])
                fambutton_cont = fambutton.get_style_context()
                fambutton_cont.add_class("label")
                fambutton.connect("pressed", self.open_file, d[2])
                Gtk.StyleContext.add_provider(
                    fambutton_cont,
                    self.provider,
                    Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
                )
                fambutton.set_tooltip_text(
                    "Edit special characters of '" + d[0] + "'"
                )
                bbox.pack_start(fambutton, False, False, 0)
                for c in d[1]:
                    button = Gtk.Button(c)
                    button.connect("pressed", self.replace, c)
                    button.set_size_request(1, 1)
                    bbox.pack_start(button, False, False, 0)
                self.maingrid.attach(bbox, 0, row, 1, 1)
                deletebutton = Gtk.Button("X")
    
                deletebutton_cont = deletebutton.get_style_context()
                deletebutton_cont.add_class("delete")
                Gtk.StyleContext.add_provider(
                    deletebutton_cont,
                    self.provider,
                    Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
                )
    
                deletebutton.connect("pressed", self.delete_file, d[2], bbox)
                deletebutton.set_tooltip_text("Delete family")
    
                self.maingrid.attach(deletebutton, 100, row, 1, 1)
                row = row + 1
            addbutton = Gtk.Button("+")
            addbutton.connect("pressed", create_newfamily)
            addbutton.set_tooltip_text("Add family")
            self.maingrid.attach(addbutton, 100, 100, 1, 1)
            self.maingrid.attach(Gtk.Label("- Press Esc to exit -"), 0, 100, 1, 1)
            self.show_all()
            Gtk.main()
    
        def get_key(self, button, val):
            # keybinding to close the previews
            if Gdk.keyval_name(val.keyval) == "Escape":
                Gtk.main_quit()
    
        def replace(self, button, char, *args):
            pyperclip.copy(char)
            subprocess.call(["wmctrl", "-ia", str(self.curr_subject)])
            pyautogui.hotkey('ctrl', 'v')
            Gtk.main_quit()
    
    
        def open_file(self, button, path):
            subprocess.Popen(["xdg-open", path])
    
        def delete_file(self, button, path, widget):
            os.remove(path)
            widget.destroy()
            button.destroy()
            self.resize(10, 10)
    
    create_dirs()
    Window()
    
  3. 실행할 단축키를 설정하세요.

    python3 /path/to/specialchars.py
    

처음 실행하면 +버튼만 표시됩니다. 캐릭터 "가족" 추가를 시작하고 창을 다시 시작(-호출)하여 클릭 한 번으로 모두 사용할 수 있습니다.

그게 다야 ...

답변3

Linux에서는 유니코드를 사용하여 특수 문자를 입력할 수 있습니다.

특수 문자를 입력하려면 먼저 CTRL+ SHIFT+를 누른 U다음 키에서 손을 떼세요.

그런 다음 삽입하려는 문자의 16진수 코드를 입력하고 다음을 누릅니다.ENTER

"ü"의 16진수 코드는 입니다 00fc.

유니코드 문자에 대한 Wikipedia 페이지를 보려면 여기를 클릭하십시오.

유니코드 수학 문자에 대한 Wikipedia 페이지를 보려면 여기를 클릭하세요.

관련 정보