Jump to content

User:Earboxer/Hyprland

From postmarketOS Wiki

Configuring Hyprland for Mobile

When you launch hyprland for the first time, it copies its default configuration into your home directory.

Example Configuration: https://git.sr.ht/~earboxer/dotfiles/tree/enchilada/item/.config/hypr/hyprland.conf

Turning the screen off

With the power button

   # toggle screen on/off
   bindli = , XF86PowerOff, exec, hyprctl dispatch dpms $(hyprctl -j monitors | jq -r 'first|.dpmsStatus|if . then "off" else "on" end')
   # toggle touch input on/off
   bindli = , XF86PowerOff, exec, hyprctl keyword input:touchdevice:enabled $(hyprctl -j getoption input:touchdevice:enabled | jq '.int==0')

Keyboard

You probably want a virtual keyboard if your device doesn't have a physical one.

WVKBD toggled with volume down

similar to SXMO, but with less latency

   $keyboard = wvkbd-mobintl
   $keyboard_args = -l simple,specialpad -H 160
   # There used to be a bug where the keyboard would eat CPU when you restarted the compositor, this workaround probably isn't needed.
   exec-once = killall $keyboard
   # send the toggle command to wvkbd
   bindi = , XF86AudioLowerVolume, exec, pkill -SIGRTMIN -f $keyboard
   # If someone killed the keyboard, restart it
   bindi =, XF86AudioLowerVolume, execr, pgrep $keyboard || $keyboard $keyboard_args

Phosh OSK Stub

Could also be used as a keyboard, which can automatically hide/show itself.


App Launcher

NWGGrid with Volume Up

It's not the prettiest, but a decent way to launch your .desktop files.

   $menu = nwggrid -s 70
   bindi = , XF86AudioRaiseVolume, exec, $menu

bemenu-run

you could use bemenu-run as your menu, with volume navigation and power to launch similar to how SXMO does their menus, like so

   $menu = bemenu-run -s -n -w -c -l8 -M 40 -H 20
   bindi = , XF86AudioRaiseVolume, exec, hyprctl dispatch submap menu; $menu; hyprctl dispatch submap reset
   submap=menu
   bindie=,XF86AudioRaiseVolume,exec,wtype -k up
   bindie=, XF86AudioLowerVolume,exec,wtype -k down
   bindi=,XF86PowerOff, exec, wtype -k return
   # also close the submap when you push the button
   bindi=,XF86PowerOff,submap,reset
   # use shift+escs to go back to the global submap
   bind=SHIFT,escape,submap,reset
   # will reset the submap, meaning end the current one and return to the global one
   submap=reset

Change workspaces with gesture

Adding outer gaps and enabling the gesture enables the edges to be used to change workspaces

 general {
   gaps_out = 20
 }
 gestures {
   workspace_swipe = on
   workspace_swipe_cancel_ratio = 0.5
   workspace_swipe_min_speed_to_force = 5
   workspace_swipe_touch = on
 }

Misc

SwayNC for volume and brightness

Sway Notification Center's panel provides widgets for a number of useful features, including volume and brightness.

I launch the panel by tapping on waybar

https://git.sr.ht/~earboxer/dotfiles/tree/enchilada/item/.config/waybar/config See "on-click".

I use a custom build of swaync to make brightness setting work https://github.com/ErikReider/SwayNotificationCenter/pull/476

https://git.sr.ht/~earboxer/dotfiles/tree/enchilada/item/.config/swaync/config.json

For backlight control, you need to specify the device. You can figure out the name of the device using `brightnessctl -l`

   "widgets": ["title","dnd", "menubar","notifications","inhibitors","mpris","volume","backlight"],
       "widget-config": {
               "backlight": {
                       "label": "☀️",
                       "min": 1,
                       "device": "ae94000.dsi.0"
               },
               "volume": {
                       "label": "🔈",
                       "show-per-app": true
               },


Lock Screen

Currently, I haven't found a suitable lock screen. swaylock and similar don't have a way to enter the password for devices without physical keyboards, and peanutbutter had problems when I tried.

Change your monitor scale

  monitor=DSI-1,preferred,auto,2.66666

bugfixes

Work around some graphical bugs

  render {
       explicit_sync = 0
       explicit_sync_kms = 0
       direct_scanout = false
  }
  # gnome 47 vulkan segfaults
  env = GSK_RENDERER,ngl


See also