u/I_M_NooB1

Not able to use iGPU for rendering Hyprland.

I am not able to use iGPU as the primary renderer for Hyprland, the setup used to work fine before, but doesn't work now (for some reason I wasn't able to debug. I checked the wiki, but that only mentions AQ_DRM_DEVICES which is properly set as I understand. I am Arch.

❯ lspci -d ::03xx
01:00.0 3D controller: NVIDIA Corporation GA107 [GeForce RTX 2050] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (rev c6)
❯ l /dev/dri/by-path/
Permissions Size User Date Modified Name
lrwxrwxrwx     - root 21 May 15:11   pci-0000:01:00.0-card -> ../card0
lrwxrwxrwx     - root 21 May 15:11   pci-0000:01:00.0-render -> ../renderD129
lrwxrwxrwx     - root 21 May 15:11   pci-0000:05:00.0-card -> ../card1
lrwxrwxrwx     - root 21 May 15:11   pci-0000:05:00.0-render -> ../renderD128
❯ cat ~/.config/hypr/nvidia.lua
local env = hl.env

local igpu = true

if not igpu then
  -- nvidia mode
  env('__GLX_VENDOR_LIBRARY_NAME', 'nvidia')
  env('__GL_VRR_ALLOWED', '1')
else
  -- igpu mode
  env('LIBVA_DRIVER_NAME', 'radeonsi')
  env('__GLX_VENDOR_LIBRARY_NAME', 'mesa')
  env('AQ_DRM_DEVICES', '/dev/dri/card1:/dev/dri/card0')
end

hl.config {
  cursor = {
    no_hardware_cursors = true,
  },
}
❯ sudo lsof /dev/nvidia*
[sudo] password for sauceguy:
lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
COMMAND   PID     USER FD   TYPE  DEVICE SIZE/OFF NODE NAME
Hyprland 1359 sauceguy 46u   CHR 195,255      0t0  879 /dev/nvidiactl
Hyprland 1359 sauceguy 47u   CHR   195,0      0t0  881 /dev/nvidia0
Hyprland 1359 sauceguy 48u   CHR   195,0      0t0  881 /dev/nvidia0
Hyprland 1359 sauceguy 49u   CHR   195,0      0t0  881 /dev/nvidia0
Hyprland 1359 sauceguy 50u   CHR 195,255      0t0  879 /dev/nvidiactl

A problem with the previous setup was that if I started any game on the dGPU, then Hyprland too switched to the dGPU, even after closing the game, which inhibited sleep, ate battery, and needed a reboot to fix.

How do I fix this?

reddit.com
u/I_M_NooB1 — 1 day ago

I'm trying to migrate my config to lua. I have been able to port most of the stuff to lua, except a few which either don't work or seem to be bugs.

keyword

I have these keybinds for zooming in my old config:

binde = Super, Minus, exec, ~/.config/hypr/hyprland/scripts/zoom.sh decrease 0.3
binde = Super, Equal, exec, ~/.config/hypr/hyprland/scripts/zoom.sh increase 0.3

the script is:

#!/usr/bin/env bash

# Controls Hyprland's cursor zoom_factor, clamped between 1.0 and 3.0

# Get current zoom level
get_zoom() {
    hyprctl getoption -j cursor:zoom_factor | jq '.float'
}

# Clamp a value between 1.0 and 3.0
clamp() {
    local val="$1"
    awk "BEGIN {
        v = $val;
        if (v < 1.0) v = 1.0;
        if (v > 3.0) v = 3.0;
        print v;
    }"
}

# Set zoom level
set_zoom() {
    local value="$1"
    clamped=$(clamp "$value")
    hyprctl keyword cursor:zoom_factor "$clamped"
}

case "$1" in
    reset)
        set_zoom 1.0
        ;;
    increase)
        if [[ -z "$2" ]]; then
            echo "Usage: $0 increase STEP"
            exit 1
        fi
        current=$(get_zoom)
        new=$(awk "BEGIN { print $current + $2 }")
        set_zoom "$new"
        ;;
    decrease)
        if [[ -z "$2" ]]; then
            echo "Usage: $0 decrease STEP"
            exit 1
        fi
        current=$(get_zoom)
        new=$(awk "BEGIN { print $current - $2 }")
        set_zoom "$new"
        ;;
    *)
        echo "Usage: $0 {reset|increase STEP|decrease STEP}"
        exit 1
        ;;
esac

The usage for keyword has been replaced by eval, so I replaced it with

hyprctl eval "hl.config { cursor = { zoom_factor = $clamped } }"

which seems to work in theory. The getoption result says the zoom has increased, but I don't see any visual changes.

code:*

In old config, I have plenty of keybinds which accept code:* keys. Take zoom for example:

binde = Super, code:82, exec, ~/.config/hypr/hyprland/scripts/zoom.sh decrease 0.3
binde = Super, code:86, exec, ~/.config/hypr/hyprland/scripts/zoom.sh increase 0.3

I tried to port these like this:

bind(mm .. '+code:82', exec(Hypr.hypr_scripts .. '/zoom.sh decrease 0.3'), { repeating = true })
bind(mm .. '+code:86', exec(Hypr.hypr_scripts .. '/zoom.sh increase 0.3'), { repeating = true })

But these don't seem to work. Hyprland throws Unknown keysym error.

A few minor ones

I have this keybind for moving around floating windows.

bindm = Super, mouse:272, movewindow

I ported it like this:

bind(mm .. '+mouse:272', dsp.window.move, { desc = 'Move window', mouse = true })

But I get runtime error that move accepts a table with arguments, like direction. As per the docs, direction only accepts left, right, up, down, so I am not sure how to do free motion.

I use end4's config. They have setup submaps for proper quickshell integration. One of the issues I found porting is this keybind.

binditn = Super, catchall, global, quickshell:searchToggleReleaseInterrupt

I'm not sure what this does. Further, I checked both the old and the new wikis for catchall, both don't seem to suggest much regarding how I can port this. I checked reddit and their github repo, that too didn't help much. If you know how I can port this, please do help.

reddit.com
u/I_M_NooB1 — 18 days ago

PS: Same behaviour as before. So separate entries work.

I'm trying to prepare for the upcoming lua update. In hyprlang, we could do things like this:

bind = super, t, exec, kitty
bind = super, t, exec, wezterm

As I understand, both of the binds run simultaneously, at least that's what I have observed.

My query in particular is this:

bindid = Super, Super_L, Toggle search, global, quickshell:searchToggleRelease # Toggle search
bind = Super, Super_L, exec, qs -c $qsConfig ipc call TEST_ALIVE || pkill fuzzel || fuzzel # [hidden] Launcher (fallback)

I use end4's dots, with a few additions for my usage. How do I do this lua?

hl.bind(mm .. ' + SUPER_L', hl.dsp.global 'quickshell:searchToggleRelease', { ignore_mods = true, desc = 'Toggle search' })

mm is just 'SUPER'. Does the sequential binding layout work for lua too, or do I need to put both of the bindings into a wrapper function, like this:

hl.bind(mm .. ' + SUPER_L', function()
  hl.dsp.global 'quickshell:searchToggleRelease'
  hl.exec_cmd(string.format('qs -c %s ipc call TEST_ALIVE || pkill fuzzel || fuzzel', Hypr.qsConfig))
end, { ignore_mods = true, desc = 'Toggle search' })
reddit.com
u/I_M_NooB1 — 23 days ago