wayvr/wayvr/src/assets/gui/keyboard.xml

246 lines
10 KiB
XML

<layout>
<macro name="keycap_rect"
margin="2" width="100%" overflow="hidden" box_sizing="border_box"
border_color="outline" border="2" round="6" color="background_variant" color2="background" gradient="vertical"
align_items="center" justify_content="center" />
<macro name="tray_rect"
margin="2" width="100%" overflow="hidden" box_sizing="border_box"
border_color="outline" border="2" round="6" color="background" color2="background_variant" gradient="vertical"
align_items="center" justify_content="center" />
<macro name="keycap_div"
width="${width}" height="${height}" min_width="${width}" min_height="${height}" max_width="${width}" max_height="${height}"
/>
<theme>
<var key="text_size" value="20" />
</theme>
<template name="VerticalSeparator">
<rectangle width="2" height="100%" color="primary" />
</template>
<!-- The keyboard is build from the xkb keymap. This file is for customizing the keycaps. -->
<!-- Key cap with a single label. -->
<!-- Used for special keys. -->
<template name="KeySpecial">
<div macro="keycap_div">
<rectangle id="${id}" macro="keycap_rect">
<sprite color="on_background" width="24" height="24" src="keyboard/${text}.svg" />
</rectangle>
</div>
</template>
<!-- Key cap with a single label. -->
<!-- Used for letter keys on layouts without AltGr. -->
<template name="KeyLetter">
<div macro="keycap_div">
<rectangle id="${id}" macro="keycap_rect">
<label text="${text}" size="~text_size" />
</rectangle>
</div>
</template>
<!-- Key cap with a primary label on top and an AltGr label on bottom. -->
<!-- Used for letter keys on layouts with AltGr. -->
<template name="KeyLetterAltGr">
<div macro="keycap_div">
<rectangle id="${id}" macro="keycap_rect" gap="3">
<label text="${text}" size="~text_size" />
<label color="on_background_variant" text="${text_altgr}" size="~text_size" />
</rectangle>
</div>
</template>
<!-- Key cap with a primary label on bottom and a Shift label on top. -->
<!-- Used for number & symbol keys on layouts without AltGr. -->
<template name="KeySymbol">
<div macro="keycap_div">
<rectangle id="${id}" macro="keycap_rect" gap="3">
<label color="on_background_variant" text="${text_shift}" size="~text_size" />
<label text="${text}" size="~text_size" />
</rectangle>
</div>
</template>
<!-- Key cap with a primary label on bottom-left, an AltGr label on bottom-right, Shift label on top-left. -->
<!-- Used for number & symbol keys on layouts with AltGr. -->
<template name="KeySymbolAltGr">
<div macro="keycap_div">
<rectangle id="${id}" macro="keycap_rect" flex_direction="row" flex_wrap="wrap" padding="4">
<div width="50%" height="50%" align_items="center" justify_content="center">
<label color="on_background_variant" text="${text_shift}" size="~text_size" />
</div>
<div width="50%" height="50%" align_items="center" justify_content="center" />
<div width="50%" height="50%" align_items="center" justify_content="center">
<label text="${text}" size="~text_size" />
</div>
<div width="50%" height="50%" align_items="center" justify_content="center">
<label color="on_background_variant" text="${text_altgr}" size="~text_size" />
</div>
</rectangle>
</div>
</template>
<!-- Key cap with a single text line in the middle -->
<!-- Used for keys, such as Home, PageUp, etc. -->
<template name="KeyOther">
<div macro="keycap_div">
<rectangle id="${id}" macro="keycap_rect">
<label text="${text}" size="16" />
</rectangle>
</div>
</template>
<macro name="button_style" border="2" round="6"
align_items="center" justify_content="center" padding="6" width="60" height="60" overflow="visible" />
<macro name="bg_rect" width="100%" color="background_contrast" round="10" border="2" border_color="primary" />
<blueprint name="menu_app">
<context_menu >
<!-- title text="${name}" /-->
<cell translation="BAR.TOGGLE_VISIBILITY" _press="::OverlayToggle ${name}" />
<cell translation="BAR.RESET_POSITION" _press="::OverlayReset ${name}" />
<cell translation="BAR.CLOSE_APP" _press="::WvrOverlayTermProcess ${name}" />
<cell translation="BAR.FORCE_CLOSE_APP" _press="::WvrOverlayKillProcess ${name}" />
</context_menu>
</blueprint>
<!-- An app with a single icon. -->
<template name="App">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_app" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" src_ext="${icon}" parent_color="ignore" />
</Button>
</template>
<blueprint name="menu_screen">
<context_menu >
<!-- title text="${name}" /-->
<cell translation="BAR.TOGGLE_VISIBILITY" _press="::OverlayToggle ${name}" />
<cell translation="BAR.RESET_POSITION" _press="::OverlayReset ${name}" />
</context_menu>
</blueprint>
<!-- A screen with a shortened connector name, e.g. "H1" for HDMI-A-1 or "D2" for DP-2 -->
<template name="Screen">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_screen" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" src_builtin="edit/screen.svg" />
<div position="absolute" margin_top="-7" margin_left="-1">
<label text="${display}" size="~text_size" weight="bold" parent_color="background" />
</div>
</Button>
</template>
<blueprint name="menu_panel">
<context_menu >
<!-- title text="${name}" /-->
<cell translation="BAR.TOGGLE_VISIBILITY" _press="::OverlayToggle ${name}" />
<cell translation="BAR.RESET_POSITION" _press="::OverlayReset ${name}" />
<cell translation="BAR.RELOAD_FROM_DISK" _press="::CustomOverlayReload ${name}" />
</context_menu>
</blueprint>
<template name="Panel">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_panel" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" src="${icon}" />
</Button>
</template>
<blueprint name="menu_mirror">
<context_menu >
<!-- title text="${name}" /-->
<cell translation="BAR.TOGGLE_VISIBILITY" _press="::OverlayToggle ${name}" />
<cell translation="BAR.RESET_POSITION" _press="::OverlayReset ${name}" />
<cell translation="BAR.CLOSE_OVERLAY" _press="::OverlayDrop ${name}" />
</context_menu>
</blueprint>
<template name="Mirror">
<Button macro="button_style" id="overlay_${idx}" tooltip_str="${name}" _context_name="${name}" _press_left="::ContextMenuOpen menu_mirror" _press_right="::OverlayToggle ${name}">
<sprite width="38" height="38" src_builtin="edit/mirror.svg" />
<div position="absolute" margin_top="5" margin_left="13">
<label text="${display}" size="20" weight="bold" parent_color="background" />
</div>
</Button>
</template>
<blueprint name="menu_handsfree">
<context_menu >
<cell translation="BAR.HANDSFREE.NONE" _press="::HandsfreeMode None" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.HMD" _press="::HandsfreeMode Hmd" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.HMD_ONLY" _press="::HandsfreeMode HmdOnly" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.EYE_TRACKING" _press="::HandsfreeMode EyeTracking" _press2="::ContextMenuClose" skip="${openvr}" />
<cell translation="BAR.HANDSFREE.EYE_ONLY" _press="::HandsfreeMode EyeTrackingOnly" _press2="::ContextMenuClose" skip="${openvr}" />
</context_menu>
</blueprint>
<blueprint name="menu_burger">
<context_menu >
<cell translation="BAR.EDIT_MODE_TOGGLE" _press="::EditToggle" _press2="::ContextMenuClose" />
<cell translation="BAR.HANDSFREE.TITLE" _press="::ContextMenuOpen menu_handsfree" />
<cell translation="BAR.ADD_MIRROR" _press="::NewMirror" skip="${not_wayland}" />
<cell translation="BAR.ADD_PASSTHRU" _press="::NewPassthru" skip="${openvr}" />
<cell translation="BAR.ADD_NEW_SET" _press="::AddSet" />
<cell translation="BAR.DELETE_CURRENT_SET" _press="::DeleteSet" />
</context_menu>
</blueprint>
<template name="Set">
<Button macro="button_style" id="set_${idx}" _press="::SetSwitch ${idx}" tooltip="WATCH.SWITCH_TO_SET" tooltip_side="bottom">
<sprite width="38" height="38" src_builtin="watch/set2.svg" />
<div position="absolute" margin_top="10" margin_left="-7">
<label text="${display}" size="20" weight="bold" parent_color="background" />
</div>
</Button>
</template>
<template name="Clock">
<div flex_direction="column" gap="3" align_items="center">
<label text="23:59" _source="clock" _display="time" size="21" weight="bold" color="primary" />
<label text="Tuesday" _source="clock" _display="dow" size="15" color="on_background_variant" />
<label text="22/2/2022" _source="clock" _display="date" size="15" color="on_background_variant" />
</div>
</template>
<elements>
<div flex_direction="column" interactable="0">
<rectangle macro="bg_rect" padding="10" align_items="center" justify_content="space_between">
<div gap="10">
<Button macro="button_style" id="btn_dashboard" _press="::DashToggle">
<sprite width="38" height="38" src="watch/wayvr_dashboard_mono.svg" />
</Button>
<VerticalSeparator />
<div id="panels_root" gap="6">
</div>
<VerticalSeparator />
<div id="apps_root" gap="6" skip="${openvr}">
</div>
</div>
<div id="tray_root" flex_direction="row" gap="10">
<Button macro="button_style" _press="::ContextMenuOpen menu_burger">
<sprite width="38" height="38" src_builtin="keyboard/burger.svg" />
</Button>
<VerticalSeparator />
<div id="sets_root" flex_direction="row" gap="6">
</div>
<VerticalSeparator />
<div id="clock_root">
<Clock />
</div>
</div>
</rectangle>
<div width="100%" height="13" interactable="0" />
<rectangle id="keyboard_root" macro="bg_rect" flex_direction="column" padding="10">
</rectangle>
</div>
</elements>
</layout>