Merge branch 'master' into 'master'
Rust additions to make terminal keyboard shows a localized layout See merge request Librem5/squeekboard!437
This commit is contained in:
		
							
								
								
									
										220
									
								
								data/keyboards/terminal/fr.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										220
									
								
								data/keyboards/terminal/fr.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,220 @@
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    action:    { width: 59,    height: 46 }
 | 
			
		||||
    small:     { width: 50,    height: 22 }
 | 
			
		||||
    default:   { width: 35.33, height: 46 }
 | 
			
		||||
    altline:   { width: 48,    height: 46 }
 | 
			
		||||
    wide:      { width: 50,    height: 46 }
 | 
			
		||||
    spaceline: { width: 110,   height: 46 }
 | 
			
		||||
    special:   { width: 44,    height: 46 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "Ctrl Alt Tabsmall ↑ ↓ ← →"
 | 
			
		||||
        - "a z e r t y u i o p"
 | 
			
		||||
        - "q s d f g h j k l m"
 | 
			
		||||
        - "Shift_L   w x c v b n period   BackSpace"
 | 
			
		||||
        - "show_numbers preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    upper:
 | 
			
		||||
        - "Ctrl Alt Tabsmall PgUp PgDn Home End"
 | 
			
		||||
        - "A Z E R T Y U I O P"
 | 
			
		||||
        - "Q S D F G H J K L M"
 | 
			
		||||
        - "Shift_L   W X C V B N ,  BackSpace"
 | 
			
		||||
        - "show_numbers preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "Ctrl Alt Tabsmall ↑ ↓ ← →"
 | 
			
		||||
        - "1 2 3 4 5 6 7 8 9 0"
 | 
			
		||||
        - "@ # € % & - _ + ( )"
 | 
			
		||||
        - "show_symbols   , \" ' colon ; ! ?  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "Ctrl Alt Tabsmall ↑ ↓ ← →"
 | 
			
		||||
        - "~ ` | · √ π τ ÷ × ¶"
 | 
			
		||||
        - "© ® £ $ ¥ ^ ° * { }"
 | 
			
		||||
        - "show_numbers_from_symbols   \\ / < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    eschars:
 | 
			
		||||
        - "Ctrl Alt Tabsmall ↑ ↓ ← →"
 | 
			
		||||
        - "à â ç é è ê î ô ù û"
 | 
			
		||||
        - "À Â Ç É È Ê Î Ô Ù Û"
 | 
			
		||||
        - "show_numbers_from_symbols  æ œ ä ë ï ö ü  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    actions:
 | 
			
		||||
        - "Ctrl Alt PgUp PgDn Home End"
 | 
			
		||||
        - "F1  F2  F3  F4  F5  F6"
 | 
			
		||||
        - "F7  F8  F9  F10 F11 F12"
 | 
			
		||||
        - "Esc Tab Pause Insert Up Del"
 | 
			
		||||
        - "show_letters Menu Break Left Down Right"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
buttons:
 | 
			
		||||
    F1:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F1"
 | 
			
		||||
    F2:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F2"
 | 
			
		||||
    F3:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F3"
 | 
			
		||||
    F4:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F4"
 | 
			
		||||
    F5:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F5"
 | 
			
		||||
    F6:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F6"
 | 
			
		||||
    F7:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F7"
 | 
			
		||||
    F8:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F8"
 | 
			
		||||
    F9:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F9"
 | 
			
		||||
    F10:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F10"
 | 
			
		||||
    F11:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F11"
 | 
			
		||||
    F12:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F12"
 | 
			
		||||
    Esc:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Escape"
 | 
			
		||||
    Tab:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
    Tabsmall:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
        label: "Tab"
 | 
			
		||||
    Del:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Delete"
 | 
			
		||||
    Insert:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Insert"
 | 
			
		||||
    Menu:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Menu"
 | 
			
		||||
    Pause:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Pause"
 | 
			
		||||
    Break:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Break"
 | 
			
		||||
    Home:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Home"
 | 
			
		||||
    End:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "End"
 | 
			
		||||
    PgUp:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Up"
 | 
			
		||||
    PgDn:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Down"
 | 
			
		||||
    "↑":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    "↓":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    "←":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    "→":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Up:
 | 
			
		||||
        label: "↑"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    Left:
 | 
			
		||||
        label: "←"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    Down:
 | 
			
		||||
        label: "↓"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    Right:
 | 
			
		||||
        label: "→"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Ctrl:
 | 
			
		||||
        modifier: "Control"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Ctrl"
 | 
			
		||||
    Alt:
 | 
			
		||||
        modifier: "Alt"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Alt"
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        text: "."
 | 
			
		||||
    show_actions:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "actions"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        label: ">_"
 | 
			
		||||
    Shift_L:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "upper"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-shift"
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        action: erase
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
    show_numbers:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_numbers_from_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_letters:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "abc"
 | 
			
		||||
    show_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "symbols"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "*/="
 | 
			
		||||
    show_eschars:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "eschars"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "âÂ"
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        text: ":"
 | 
			
		||||
    "\"":
 | 
			
		||||
        keysym: "quotedbl"
 | 
			
		||||
							
								
								
									
										223
									
								
								data/keyboards/terminal/fr_wide.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										223
									
								
								data/keyboards/terminal/fr_wide.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,223 @@
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    action:    { width: 90,   height: 37 }
 | 
			
		||||
    small:     { width: 67.4, height: 22 }
 | 
			
		||||
    default:   { width: 54,  height: 37 }
 | 
			
		||||
    altline:   { width: 81,  height: 37 }
 | 
			
		||||
    wide:      { width: 100, height: 37 }
 | 
			
		||||
    spaceline: { width: 110, height: 37 }
 | 
			
		||||
    special:   { width: 54,  height: 37 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "a z e r t y u i o p"
 | 
			
		||||
        - "q s d f g h j k l m"
 | 
			
		||||
        - "Shift_L   w x c v b n period   BackSpace"
 | 
			
		||||
        - "show_numbers preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    upper:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt PgUp PgDn Home End"
 | 
			
		||||
        - "A Z E R T Y U I O P"
 | 
			
		||||
        - "Q S D F G H J K L M"
 | 
			
		||||
        - "Shift_L   W X C V B N ,  BackSpace"
 | 
			
		||||
        - "show_numbers preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "1 2 3 4 5 6 7 8 9 0"
 | 
			
		||||
        - "@ # € % & - _ + ( )"
 | 
			
		||||
        - "show_symbols   , \" ' colon ; ! ?  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "~ ` | · √ π τ ÷ × ¶"
 | 
			
		||||
        - "© ® £ $ ¥ ^ ° * { }"
 | 
			
		||||
        - "show_numbers_from_symbols   \\ / < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    eschars:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "à â ç é è ê î ô ù û"
 | 
			
		||||
        - "À Â Ç É È Ê Î Ô Ù Û"
 | 
			
		||||
        - "show_numbers_from_symbols  æ œ ä ë ï ö ü  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        show_eschars show_actions Return"
 | 
			
		||||
    actions:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt PgUp PgDn Home End"
 | 
			
		||||
        - "F1  F2  F3  F4  F5  F6"
 | 
			
		||||
        - "F7  F8  F9  F10 F11 F12"
 | 
			
		||||
        - "Esc Tab Pause Insert Up Del"
 | 
			
		||||
        - "show_letters Menu Break Left Down Right"
 | 
			
		||||
 
 | 
			
		||||
buttons:
 | 
			
		||||
    F1:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F1"
 | 
			
		||||
    F2:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F2"
 | 
			
		||||
    F3:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F3"
 | 
			
		||||
    F4:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F4"
 | 
			
		||||
    F5:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F5"
 | 
			
		||||
    F6:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F6"
 | 
			
		||||
    F7:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F7"
 | 
			
		||||
    F8:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F8"
 | 
			
		||||
    F9:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F9"
 | 
			
		||||
    F10:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F10"
 | 
			
		||||
    F11:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F11"
 | 
			
		||||
    F12:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F12"
 | 
			
		||||
    Esc:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Escape"
 | 
			
		||||
    EscSmall:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Escape"
 | 
			
		||||
        label: "Esc"
 | 
			
		||||
    Tab:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
    TabSmall:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
        label: "Tab"
 | 
			
		||||
    Del:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Delete"
 | 
			
		||||
    Insert:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Insert"
 | 
			
		||||
    Menu:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Menu"
 | 
			
		||||
    Pause:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Pause"
 | 
			
		||||
    Break:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Break"
 | 
			
		||||
    Home:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Home"
 | 
			
		||||
    End:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "End"
 | 
			
		||||
    PgUp:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Up"
 | 
			
		||||
    PgDn:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Down"
 | 
			
		||||
    "↑":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    "↓":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    "←":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    "→":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Up:
 | 
			
		||||
        label: "↑"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    Left:
 | 
			
		||||
        label: "←"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    Down:
 | 
			
		||||
        label: "↓"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    Right:
 | 
			
		||||
        label: "→"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Ctrl:
 | 
			
		||||
        modifier: "Control"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Ctrl"
 | 
			
		||||
    Alt:
 | 
			
		||||
        modifier: "Alt"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Alt"
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        text: "."
 | 
			
		||||
    show_actions:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "actions"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        label: ">_"
 | 
			
		||||
    Shift_L:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "upper"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-shift"
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        action: erase
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
    show_numbers:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_numbers_from_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_letters:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "abc"
 | 
			
		||||
    show_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "symbols"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "*/="
 | 
			
		||||
    show_eschars:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "eschars"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "âÂ"
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        text: ":"
 | 
			
		||||
    "\"":
 | 
			
		||||
        keysym: "quotedbl"
 | 
			
		||||
@ -147,9 +147,6 @@ buttons:
 | 
			
		||||
    Pause:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Pause"
 | 
			
		||||
    Menu:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Menu"
 | 
			
		||||
    Break:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Break"
 | 
			
		||||
@ -155,9 +155,6 @@ buttons:
 | 
			
		||||
    Pause:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Pause"
 | 
			
		||||
    Menu:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Menu"
 | 
			
		||||
    Break:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Break"
 | 
			
		||||
							
								
								
									
										200
									
								
								data/keyboards/terminal/us.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										200
									
								
								data/keyboards/terminal/us.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,200 @@
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    default: { width: 35.33, height: 46 }
 | 
			
		||||
    action:  { width: 59,    height: 46 }
 | 
			
		||||
    altline: { width: 52.67, height: 46 }
 | 
			
		||||
    wide: { width: 59, height: 46 }
 | 
			
		||||
    spaceline: { width: 140, height: 46 }
 | 
			
		||||
    special: { width: 44, height: 46 }
 | 
			
		||||
    small: { width: 59, height: 22 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "q w e r t y u i o p"
 | 
			
		||||
        - "a s d f g h j k l"
 | 
			
		||||
        - "Shift_L   z x c v b n m  BackSpace"
 | 
			
		||||
        - "show_numbers preferences      space        show_actions Return"
 | 
			
		||||
    upper:
 | 
			
		||||
        - "Ctrl Alt PgUp PgDn Home End"
 | 
			
		||||
        - "Q W E R T Y U I O P"
 | 
			
		||||
        - "A S D F G H J K L"
 | 
			
		||||
        - "Shift_L   Z X C V B N M  BackSpace"
 | 
			
		||||
        - "show_numbers preferences      space        show_actions Return"
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "1 2 3 4 5 6 7 8 9 0"
 | 
			
		||||
        - "* # $ / & - _ + ( )"
 | 
			
		||||
        - "show_symbols   , \" ' colon ; ! ?  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        period Return"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "~ ` | · √ π τ ÷ × ¶"
 | 
			
		||||
        - "© ® £ € ¥ ^ ° @ { }"
 | 
			
		||||
        - "show_numbers_from_symbols   \\ % < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        period Return"
 | 
			
		||||
    actions:
 | 
			
		||||
        - "Ctrl Alt PgUp PgDn Home End"
 | 
			
		||||
        - "F1  F2  F3  F4  F5  F6"
 | 
			
		||||
        - "F7  F8  F9  F10 F11 F12"
 | 
			
		||||
        - "Esc Tab Pause Insert Up Del"
 | 
			
		||||
        - "show_letters Menu Break Left Down Right"
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    Shift_L:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "upper"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-shift"
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        action: erase
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
    show_numbers:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_numbers_from_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_letters:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "ABC"
 | 
			
		||||
    show_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "symbols"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "τ=\\"
 | 
			
		||||
    show_actions:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "actions"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: ">_"
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        text: "."
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        text: ":"
 | 
			
		||||
    F1:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F1"
 | 
			
		||||
    F2:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F2"
 | 
			
		||||
    F3:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F3"
 | 
			
		||||
    F4:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F4"
 | 
			
		||||
    F5:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F5"
 | 
			
		||||
    F6:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F6"
 | 
			
		||||
    F7:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F7"
 | 
			
		||||
    F8:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F8"
 | 
			
		||||
    F9:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F9"
 | 
			
		||||
    F10:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F10"
 | 
			
		||||
    F11:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F11"
 | 
			
		||||
    F12:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F12"
 | 
			
		||||
    Esc:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Escape"
 | 
			
		||||
    Tab:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
    Del:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Delete"
 | 
			
		||||
    Insert:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Insert"
 | 
			
		||||
    Menu:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Menu"
 | 
			
		||||
    Pause:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Pause"
 | 
			
		||||
    Break:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Break"
 | 
			
		||||
    Home:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Home"
 | 
			
		||||
    End:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "End"
 | 
			
		||||
    PgUp:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Up"
 | 
			
		||||
    PgDn:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Down"
 | 
			
		||||
    "↑":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    "↓":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    "←":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    "→":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Up:
 | 
			
		||||
        label: "↑"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    Left:
 | 
			
		||||
        label: "←"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    Down:
 | 
			
		||||
        label: "↓"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    Right:
 | 
			
		||||
        label: "→"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Ctrl:
 | 
			
		||||
        modifier: "Control"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Ctrl"
 | 
			
		||||
    Alt:
 | 
			
		||||
        modifier: "Alt"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Alt"
 | 
			
		||||
							
								
								
									
										208
									
								
								data/keyboards/terminal/us_wide.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								data/keyboards/terminal/us_wide.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,208 @@
 | 
			
		||||
---
 | 
			
		||||
outlines:
 | 
			
		||||
    default:   { width: 54,   height: 37 }
 | 
			
		||||
    action:    { width: 90,   height: 37 }
 | 
			
		||||
    altline:   { width: 81,   height: 37 }
 | 
			
		||||
    wide:      { width: 90,   height: 37 }
 | 
			
		||||
    spaceline: { width: 225,  height: 37 }
 | 
			
		||||
    special:   { width: 54,   height: 37 }
 | 
			
		||||
    small:     { width: 67.4, height: 22 }
 | 
			
		||||
 | 
			
		||||
views:
 | 
			
		||||
    base:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "q w e r t y u i o p"
 | 
			
		||||
        - "a s d f g h j k l"
 | 
			
		||||
        - "Shift_L   z x c v b n m  BackSpace"
 | 
			
		||||
        - "show_numbers preferences      space        show_actions Return"
 | 
			
		||||
    upper:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt PgUp PgDn Home End"
 | 
			
		||||
        - "Q W E R T Y U I O P"
 | 
			
		||||
        - "A S D F G H J K L"
 | 
			
		||||
        - "Shift_L   Z X C V B N M  BackSpace"
 | 
			
		||||
        - "show_numbers preferences      space        show_actions Return"
 | 
			
		||||
    numbers:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "1 2 3 4 5 6 7 8 9 0"
 | 
			
		||||
        - "* # $ / & - _ + ( )"
 | 
			
		||||
        - "show_symbols   , \" ' colon ; ! ?  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        period Return"
 | 
			
		||||
    symbols:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt ↑ ↓ ← →"
 | 
			
		||||
        - "~ ` | · √ π τ ÷ × ¶"
 | 
			
		||||
        - "© ® £ € ¥ ^ ° @ { }"
 | 
			
		||||
        - "show_numbers_from_symbols   \\ % < > = [ ]  BackSpace"
 | 
			
		||||
        - "show_letters preferences         space        period Return"
 | 
			
		||||
    actions:
 | 
			
		||||
        - "EscSmall TabSmall Ctrl Alt PgUp PgDn Home End"
 | 
			
		||||
        - "F1  F2  F3  F4  F5  F6"
 | 
			
		||||
        - "F7  F8  F9  F10 F11 F12"
 | 
			
		||||
        - "Esc Tab Pause Insert Up Del"
 | 
			
		||||
        - "show_letters Menu Break Left Down Right"
 | 
			
		||||
 | 
			
		||||
buttons:
 | 
			
		||||
    Shift_L:
 | 
			
		||||
        action:
 | 
			
		||||
            locking:
 | 
			
		||||
                lock_view: "upper"
 | 
			
		||||
                unlock_view: "base"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "key-shift"
 | 
			
		||||
    BackSpace:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        icon: "edit-clear-symbolic"
 | 
			
		||||
        action: erase
 | 
			
		||||
    preferences:
 | 
			
		||||
        action: "show_prefs"
 | 
			
		||||
        outline: "special"
 | 
			
		||||
        icon: "keyboard-mode-symbolic"
 | 
			
		||||
    show_numbers:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_numbers_from_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "numbers"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "123"
 | 
			
		||||
    show_letters:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "base"
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        label: "ABC"
 | 
			
		||||
    show_symbols:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "symbols"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: "τ=\\"
 | 
			
		||||
    show_actions:
 | 
			
		||||
        action:
 | 
			
		||||
            set_view: "actions"
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        label: ">_"
 | 
			
		||||
    period:
 | 
			
		||||
        outline: "altline"
 | 
			
		||||
        text: "."
 | 
			
		||||
    space:
 | 
			
		||||
        outline: "spaceline"
 | 
			
		||||
        text: " "
 | 
			
		||||
    Return:
 | 
			
		||||
        outline: "wide"
 | 
			
		||||
        icon: "key-enter"
 | 
			
		||||
        keysym: "Return"
 | 
			
		||||
    colon:
 | 
			
		||||
        text: ":"
 | 
			
		||||
    F1:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F1"
 | 
			
		||||
    F2:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F2"
 | 
			
		||||
    F3:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F3"
 | 
			
		||||
    F4:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F4"
 | 
			
		||||
    F5:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F5"
 | 
			
		||||
    F6:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F6"
 | 
			
		||||
    F7:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F7"
 | 
			
		||||
    F8:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F8"
 | 
			
		||||
    F9:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F9"
 | 
			
		||||
    F10:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F10"
 | 
			
		||||
    F11:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F11"
 | 
			
		||||
    F12:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "F12"
 | 
			
		||||
    Esc:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Escape"
 | 
			
		||||
    EscSmall:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Escape"
 | 
			
		||||
        label: "Esc"
 | 
			
		||||
    Tab:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
    TabSmall:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Tab"
 | 
			
		||||
        label: "Tab"
 | 
			
		||||
    Del:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Delete"
 | 
			
		||||
    Insert:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Insert"
 | 
			
		||||
    Menu:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Menu"
 | 
			
		||||
    Pause:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Pause"
 | 
			
		||||
    Break:
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Break"
 | 
			
		||||
    Home:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Home"
 | 
			
		||||
    End:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "End"
 | 
			
		||||
    PgUp:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Up"
 | 
			
		||||
    PgDn:
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Page_Down"
 | 
			
		||||
    "↑":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    "↓":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    "←":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    "→":
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Up:
 | 
			
		||||
        label: "↑"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Up"
 | 
			
		||||
    Left:
 | 
			
		||||
        label: "←"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Left"
 | 
			
		||||
    Down:
 | 
			
		||||
        label: "↓"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Down"
 | 
			
		||||
    Right:
 | 
			
		||||
        label: "→"
 | 
			
		||||
        outline: "action"
 | 
			
		||||
        keysym: "Right"
 | 
			
		||||
    Ctrl:
 | 
			
		||||
        modifier: "Control"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Ctrl"
 | 
			
		||||
    Alt:
 | 
			
		||||
        modifier: "Alt"
 | 
			
		||||
        outline: "small"
 | 
			
		||||
        label: "Alt"
 | 
			
		||||
@ -128,30 +128,22 @@ settings_get_layout(GSettings *settings, char **type, char **layout)
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
eekboard_context_service_use_layout(EekboardContextService *context, struct squeek_layout_state *state, uint32_t timestamp) {
 | 
			
		||||
    gchar *layout_name = state->overlay_name;
 | 
			
		||||
    gchar *layout_name = state->layout_name;
 | 
			
		||||
    gchar *overlay_name = state->overlay_name;
 | 
			
		||||
 | 
			
		||||
    // try to get the best keyboard layout
 | 
			
		||||
    if (layout_name == NULL) {
 | 
			
		||||
        layout_name = state->layout_name;
 | 
			
		||||
 | 
			
		||||
        switch (state->purpose) {
 | 
			
		||||
        case ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER:
 | 
			
		||||
        case ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE:
 | 
			
		||||
            layout_name = "number";
 | 
			
		||||
            break;
 | 
			
		||||
        case ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TERMINAL:
 | 
			
		||||
            layout_name = "terminal";
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            ;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (layout_name == NULL) {
 | 
			
		||||
            layout_name = "us";
 | 
			
		||||
        }
 | 
			
		||||
        layout_name = "us";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // overlay is "Normal" for most layouts, we will only look for "terminal" in rust code.
 | 
			
		||||
    // for now just avoid passing a null pointer
 | 
			
		||||
    if (overlay_name == NULL) {
 | 
			
		||||
        overlay_name = "Normal";    // fallback to Normal
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    // generic part follows
 | 
			
		||||
    struct squeek_layout *layout = squeek_load_layout(layout_name, state->arrangement);
 | 
			
		||||
    struct squeek_layout *layout = squeek_load_layout(layout_name, state->arrangement, state->purpose, overlay_name);
 | 
			
		||||
    LevelKeyboard *keyboard = level_keyboard_new(layout);
 | 
			
		||||
    // set as current
 | 
			
		||||
    LevelKeyboard *previous_keyboard = context->keyboard;
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										73
									
								
								src/data.rs
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								src/data.rs
									
									
									
									
									
								
							@ -12,6 +12,7 @@ use std::io;
 | 
			
		||||
use std::path::PathBuf;
 | 
			
		||||
use std::rc::Rc;
 | 
			
		||||
use std::vec::Vec;
 | 
			
		||||
use std::convert::TryFrom;
 | 
			
		||||
 | 
			
		||||
use xkbcommon::xkb;
 | 
			
		||||
 | 
			
		||||
@ -27,6 +28,7 @@ use ::resources;
 | 
			
		||||
use ::util::c::as_str;
 | 
			
		||||
use ::util::hash_map_map;
 | 
			
		||||
use ::xdg;
 | 
			
		||||
use ::imservice::ContentPurpose;
 | 
			
		||||
 | 
			
		||||
// traits, derives
 | 
			
		||||
use serde::Deserialize;
 | 
			
		||||
@ -42,25 +44,40 @@ pub mod c {
 | 
			
		||||
    #[no_mangle]
 | 
			
		||||
    pub extern "C"
 | 
			
		||||
    fn squeek_load_layout(
 | 
			
		||||
        name: *const c_char,
 | 
			
		||||
        type_: u32,
 | 
			
		||||
        name: *const c_char,    // name of the keyboard
 | 
			
		||||
        type_: u32,             // type like Wide
 | 
			
		||||
        variant: u32,          // purpose variant like numeric, terminal...
 | 
			
		||||
        overlay: *const c_char, // the overlay (looking for "terminal")
 | 
			
		||||
    ) -> *mut ::layout::Layout {
 | 
			
		||||
        let type_ = match type_ {
 | 
			
		||||
            0 => ArrangementKind::Base,
 | 
			
		||||
            1 => ArrangementKind::Wide,
 | 
			
		||||
            _ => panic!("Bad enum value"),
 | 
			
		||||
        };
 | 
			
		||||
        
 | 
			
		||||
        let name = as_str(&name)
 | 
			
		||||
            .expect("Bad layout name")
 | 
			
		||||
            .expect("Empty layout name");
 | 
			
		||||
 | 
			
		||||
        let (kind, layout) = load_layout_data_with_fallback(&name, type_);
 | 
			
		||||
        let variant = ContentPurpose::try_from(variant)
 | 
			
		||||
                    .or_print(
 | 
			
		||||
                        logging::Problem::Warning,
 | 
			
		||||
                        "Received invalid purpose value",
 | 
			
		||||
                    )
 | 
			
		||||
                    .unwrap_or(ContentPurpose::Normal);
 | 
			
		||||
 | 
			
		||||
        let overlay_str = as_str(&overlay)
 | 
			
		||||
                .expect("Bad overlay name")
 | 
			
		||||
                .expect("Empty overlay name");
 | 
			
		||||
 | 
			
		||||
        let (kind, layout) = load_layout_data_with_fallback(&name, type_, variant, &overlay_str);
 | 
			
		||||
        let layout = ::layout::Layout::new(layout, kind);
 | 
			
		||||
        Box::into_raw(Box::new(layout))
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const FALLBACK_LAYOUT_NAME: &str = "us";
 | 
			
		||||
const FALLBACK_GENERIC_LAYOUT_NAME: &str = "terminal";
 | 
			
		||||
 | 
			
		||||
#[derive(Debug)]
 | 
			
		||||
pub enum LoadError {
 | 
			
		||||
@ -105,6 +122,7 @@ type LayoutSource = (ArrangementKind, DataSource);
 | 
			
		||||
fn list_layout_sources(
 | 
			
		||||
    name: &str,
 | 
			
		||||
    kind: ArrangementKind,
 | 
			
		||||
    overlay: &str,
 | 
			
		||||
    keyboards_path: Option<PathBuf>,
 | 
			
		||||
) -> Vec<LayoutSource> {
 | 
			
		||||
    // Just a simplification of often called code.
 | 
			
		||||
@ -175,7 +193,14 @@ fn list_layout_sources(
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // No other choices left, so give anything.
 | 
			
		||||
    add_by_kind(ret, FALLBACK_LAYOUT_NAME.into(), &kind)
 | 
			
		||||
    let mut fallback=FALLBACK_LAYOUT_NAME;
 | 
			
		||||
    match overlay {
 | 
			
		||||
        "terminal" => fallback = FALLBACK_GENERIC_LAYOUT_NAME,
 | 
			
		||||
        _          => fallback = FALLBACK_LAYOUT_NAME,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    add_by_kind(ret, fallback.into(), &kind)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn load_layout_data(source: DataSource)
 | 
			
		||||
@ -202,12 +227,28 @@ fn load_layout_data(source: DataSource)
 | 
			
		||||
fn load_layout_data_with_fallback(
 | 
			
		||||
    name: &str,
 | 
			
		||||
    kind: ArrangementKind,
 | 
			
		||||
    purpose: ContentPurpose,
 | 
			
		||||
    overlay: &str,
 | 
			
		||||
) -> (ArrangementKind, ::layout::LayoutData) {
 | 
			
		||||
 | 
			
		||||
    // Build the path to the right keyboard layout subdirectory
 | 
			
		||||
    let path = env::var_os("SQUEEKBOARD_KEYBOARDSDIR")
 | 
			
		||||
        .map(PathBuf::from)
 | 
			
		||||
        .or_else(|| xdg::data_path("squeekboard/keyboards"));
 | 
			
		||||
    
 | 
			
		||||
    for (kind, source) in list_layout_sources(name, kind, path) {
 | 
			
		||||
    // prefix the layout name if we are showing a terminal specific layout
 | 
			
		||||
    let layout_name = match overlay {
 | 
			
		||||
        "Normal" => format!("{}", name),           // normal keyboard layouts
 | 
			
		||||
        other    => format!("{}-{}", other, name), // terminal and catch-all
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    log_print!(
 | 
			
		||||
        logging::Level::Debug, 
 | 
			
		||||
        "load_layout_data_with_fallback() -> name:{}, purpose:{:?}, overlay:{}, layout_name:{}", 
 | 
			
		||||
        name, purpose, overlay, &layout_name
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    for (kind, source) in list_layout_sources(&layout_name, kind, overlay, path) {
 | 
			
		||||
        let layout = load_layout_data(source.clone());
 | 
			
		||||
        match layout {
 | 
			
		||||
            Err(e) => match (e, source) {
 | 
			
		||||
@ -940,7 +981,7 @@ mod tests {
 | 
			
		||||
    /// First fallback should be to builtin, not to FALLBACK_LAYOUT_NAME
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn fallbacks_order() {
 | 
			
		||||
        let sources = list_layout_sources("nb", ArrangementKind::Base, None);
 | 
			
		||||
        let sources = list_layout_sources("nb", ArrangementKind::Base, "Normal", None);
 | 
			
		||||
        
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            sources,
 | 
			
		||||
@ -957,7 +998,7 @@ mod tests {
 | 
			
		||||
    /// If layout contains a "+", it should reach for what's in front of it too.
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn fallbacks_order_base() {
 | 
			
		||||
        let sources = list_layout_sources("nb+aliens", ArrangementKind::Base, None);
 | 
			
		||||
        let sources = list_layout_sources("nb+aliens", ArrangementKind::Base, "Normal", None);
 | 
			
		||||
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            sources,
 | 
			
		||||
@ -971,8 +1012,24 @@ mod tests {
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn fallbacks_terminal_order_base() {
 | 
			
		||||
        let sources = list_layout_sources("terminal-nb+aliens", ArrangementKind::Base, "terminal", None);
 | 
			
		||||
 | 
			
		||||
        assert_eq!(
 | 
			
		||||
            sources,
 | 
			
		||||
            vec!(
 | 
			
		||||
                (ArrangementKind::Base, DataSource::Resource("terminal-nb+aliens".into())),
 | 
			
		||||
                (ArrangementKind::Base, DataSource::Resource("terminal-nb".into())),
 | 
			
		||||
                (
 | 
			
		||||
                    ArrangementKind::Base,
 | 
			
		||||
                    DataSource::Resource(FALLBACK_GENERIC_LAYOUT_NAME.into())
 | 
			
		||||
                ),
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn unicode_keysym() {
 | 
			
		||||
        let keysym = xkb::keysym_from_name(
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ struct transformation squeek_layout_calculate_transformation(
 | 
			
		||||
        const struct squeek_layout *layout,
 | 
			
		||||
        double allocation_width, double allocation_size);
 | 
			
		||||
 | 
			
		||||
struct squeek_layout *squeek_load_layout(const char *name, uint32_t type);
 | 
			
		||||
struct squeek_layout *squeek_load_layout(const char *name, uint32_t type, uint32_t variant_type, const char *overlay_name);
 | 
			
		||||
enum squeek_arrangement_kind squeek_layout_get_kind(const struct squeek_layout *);
 | 
			
		||||
void squeek_layout_free(struct squeek_layout*);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -82,11 +82,17 @@ const KEYBOARDS: &[(*const str, *const str)] = &[
 | 
			
		||||
    // Others
 | 
			
		||||
    ("number", include_str!("../data/keyboards/number.yaml")),
 | 
			
		||||
 | 
			
		||||
    // layout+overlay
 | 
			
		||||
    ("terminal", include_str!("../data/keyboards/terminal.yaml")),
 | 
			
		||||
    ("terminal_wide", include_str!("../data/keyboards/terminal_wide.yaml")),
 | 
			
		||||
    // Terminal
 | 
			
		||||
    ("terminal-generic", include_str!("../data/keyboards/terminal/generic.yaml")),
 | 
			
		||||
    ("terminal-generic_wide",   include_str!("../data/keyboards/terminal/generic_wide.yaml")),
 | 
			
		||||
 | 
			
		||||
    ("terminal-fr", include_str!("../data/keyboards/terminal/fr.yaml")),
 | 
			
		||||
 | 
			
		||||
    ("terminal-us", include_str!("../data/keyboards/terminal/us.yaml")),
 | 
			
		||||
 | 
			
		||||
    // Overlays
 | 
			
		||||
    ("emoji", include_str!("../data/keyboards/emoji.yaml")),
 | 
			
		||||
    ("terminal", include_str!("../data/keyboards/terminal/generic.yaml")),
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
pub fn get_keyboard(needle: &str) -> Option<&'static str> {
 | 
			
		||||
 | 
			
		||||
@ -85,10 +85,14 @@ foreach layout : [
 | 
			
		||||
    'us+colemak', 'us+colemak_wide',
 | 
			
		||||
    'us+dvorak', 'us+dvorak_wide',
 | 
			
		||||
 | 
			
		||||
    # Terminal keyboards
 | 
			
		||||
    'terminal-generic', 'terminal-generic_wide',
 | 
			
		||||
    'terminal-fr', 
 | 
			
		||||
    'terminal-us',
 | 
			
		||||
    
 | 
			
		||||
    # Block: Not languages.
 | 
			
		||||
    'emoji',
 | 
			
		||||
    'number',
 | 
			
		||||
    'terminal', 'terminal_wide',
 | 
			
		||||
]
 | 
			
		||||
    extra = []
 | 
			
		||||
    if layout == 'emoji'
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user