Repository navigation
Replies: 5 comments 1 reply
|
In my opinion you should consider this as a bug. I faced the same issue. If you use the pen anyway because of signing some document or something else, you want to proceed your productive work with the pen. |
|
I definitely feel like this is needed. As someone who likes to be able to work entirely in tablet mode (like for note taking and things like that) having the walker menu work well with touch input is a must. |
|
Is there any new about this? |
|
You could use hyprgrass (https://github.com/horriblename/hyprgrass). This will give some functionality. There are some suggestions on the github in relation to other touschscreen tools. |
Native Multi-Touch Gestures Daemon for Omarchy / Hyprland 0.55+ (Tablet & 2-in-1 Devices)Context & MotivationOn touchscreen tablets (such as the Minisforum V3, Surface Pro, ThinkPad X12, and ROG Flow Z13), Wayland treats touchscreen inputs as direct touch/click events rather than touchpad gestures. Consequently, native compositor gestures like multi-finger workspace switching and window management do not work directly on the screen. This guide provides a lightweight, resilient Python daemon that translates hardware touchscreen events into Hyprland 0.55+ Lua dispatchers, complete with systemd user-level autostart and permission persistence. Technical Architecture & Lessons Learned
1. Installation & Script SetupCreate the touch gesture script: cat << 'EOF' > ~/.config/hypr/touch_gestures.py#!/usr/bin/env python3import osimport sysimport timeimport subprocessfrom evdev import InputDevice, list_devices, ecodesTHRESHOLD = 40def find_real_touch_device(): """Scan and match the physical touchscreen panel.""" for path in list_devices(): try: dev = InputDevice(path) caps = dev.capabilities(verbose=False) if ecodes.EV_ABS in caps: abs_codes = [code for code, _ in caps[ecodes.EV_ABS]] if ecodes.ABS_MT_POSITION_X in abs_codes: if "touchpad" not in dev.name.lower(): return path, dev.name except Exception: continue # Fallback to any multi-touch device for path in list_devices(): try: dev = InputDevice(path) caps = dev.capabilities(verbose=False) if ecodes.EV_ABS in caps: abs_codes = [code for code, _ in caps[ecodes.EV_ABS]] if ecodes.ABS_MT_POSITION_X in abs_codes: return path, dev.name except Exception: continue return None, Nonedef send_hypr_cmd(cmd): """Inject Hyprland signature and dispatch Lua commands.""" env = os.environ.copy() uid = "1000" for u in ["1000", "1001", str(os.getuid())]: if os.path.exists(f"/run/user/{u}/hypr"): uid = u break env['XDG_RUNTIME_DIR'] = f"/run/user/{uid}" hypr_dir = f"/run/user/{uid}/hypr/" if os.path.exists(hypr_dir): sigs = os.listdir(hypr_dir) if sigs: env['HYPRLAND_INSTANCE_SIGNATURE'] = sigs[0] if 'WAYLAND_DISPLAY' not in env: env['WAYLAND_DISPLAY'] = 'wayland-1' subprocess.run(['hyprctl', 'dispatch', cmd], env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)def main(): # Cold-boot defense: retry until kernel initializes the touchscreen device_path, device_name = None, None for _ in range(15): device_path, device_name = find_real_touch_device() if device_path: break time.sleep(1) if not device_path: sys.exit(1) try: dev = InputDevice(device_path) except Exception: sys.exit(1) slots = {} current_slot = 0 max_fingers = 0 start_x, start_y = 0, 0 last_x, last_y = 0, 0 touch_active = False for event in dev.read_loop(): if event.type == ecodes.EV_ABS: if event.code == ecodes.ABS_MT_SLOT: current_slot = event.value elif event.code == ecodes.ABS_MT_TRACKING_ID: if event.value == -1: slots.pop(current_slot, None) else: slots[current_slot] = {'x': 0, 'y': 0} elif event.code == ecodes.ABS_MT_POSITION_X: if current_slot in slots: slots[current_slot]['x'] = event.value elif event.code == ecodes.ABS_MT_POSITION_Y: if current_slot in slots: slots[current_slot]['y'] = event.value elif event.type == ecodes.EV_SYN: if event.code == ecodes.SYN_REPORT: active_count = len(slots) if active_count > 0: xs = [s['x'] for s in slots.values()] ys = [s['y'] for s in slots.values()] cx = sum(xs) / active_count cy = sum(ys) / active_count if not touch_active: touch_active = True max_fingers = active_count start_x, start_y = cx, cy last_x, last_y = cx, cy else: max_fingers = max(max_fingers, active_count) last_x, last_y = cx, cy else: if touch_active: dx = last_x - start_x dy = last_y - start_y dist = (dx2 + dy2)*0.5 if dist > THRESHOLD: abs_dx = abs(dx) abs_dy = abs(dy) # 🖐️ 5 Fingers -> Close active window if max_fingers == 5: send_hypr_cmd('hl.dsp.window.close()') # ✋ 3 Fingers -> Window Focus & Layout Switch elif max_fingers == 3: if abs_dx > abs_dy: if dx > 0: send_hypr_cmd('hl.dsp.focus({ direction = "l" })') else: send_hypr_cmd('hl.dsp.focus({ direction = "r" })') else: if dy > 0: send_hypr_cmd('hl.dsp.focus({ direction = "d" })') send_hypr_cmd('hl.dsp.layout("togglesplit")') else: send_hypr_cmd('hl.dsp.focus({ direction = "u" })') send_hypr_cmd('hl.dsp.layout("swapsplit")') # 🖐️ 4 Fingers -> Workspace Switch & Window State elif max_fingers == 4: if abs_dx > abs_dy: if dx > 0: send_hypr_cmd('hl.dsp.focus({ workspace = "r-1" })') else: send_hypr_cmd('hl.dsp.focus({ workspace = "r+1" })') else: if dy > 0: send_hypr_cmd('hl.dsp.window.fullscreen({ mode = 1 })') else: send_hypr_cmd('hl.dsp.window.float({ action = "toggle" })') touch_active = False max_fingers = 0if name == 'main': main()EOFchmod +x ~/.config/hypr/touch_gestures.py2. Persistent Udev Permissions & Systemd User ServiceEnsure device read access across reboots and enable the user service: # 1. Permanent udev access rule 3. Gesture Cheat Sheet
|

Uh oh!
There was an error while loading. Please reload this page.
Should probably move this upstream but basically in the few times I ever use my laptop in "tablet mode" (folded 360 degrees) it's pretty much unusable since the dmenu doesn't register touch input (I can open it by tapping the Omarchy icon on the top left but that's pretty much it). The normal walker app launcher works great with touch though.
Obviously Omarchy is extremely keyboard focused and I love that, but it would be nice to have some usability in tablet mode.
Hyprland in general doesn't focus much on touchscreen gestures. the new trackpad gestures are great so if they ever do the same with touchscreen gestures it would actually be a really good "tablet" OS too.
What do you guys think? is it even needed?
For now I'm probably just going to add an app launcher button to waybar when I'm in tablet mode.
All reactions