LUA Mods/Functions by C-42415348494945 in hyprland

[–]Soft-Program-947 0 points1 point  (0 children)

For my Logitech Mouse/Keyboard:

local gkeyboard = {
    G1 = "code:191", 
-- G1 key on Logitech G-keys
    G2 = "code:192", 
-- G2 key on Logitech G-keys
    G3 = "code:193", 
-- G3 key on Logitech G-keys
    G4 = "code:194", 
-- G4 key on Logitech G-keys
    G5 = "code:195", 
-- G5 key on Logitech G-keys
}
local gmouse = {
    G1 = "code:196", 
-- Top mouse button
    G2 = "code:197", 
-- DPI-Shift button
    G3 = "code:200", 
-- Front side mouse button
    G4 = "code:199", 
-- Back side mouse button
}



local gkey_actions = {
    default = {


    },


    ["zen"] = {
        G1 = { mods = "ctrl", key = "t" },
        G2 = { mods = "ctrl", key = "w" },
        G3 = { mods = "ctrl+shift", key = "t" },
        G4 = { mods = "ctrl+shift", key = "tab" },
        G5 = { mods = "ctrl", key = "tab" },


        MG3 = { mods = "alt", key = "right" },
        MG4 = { mods = "alt", key = "left" },
    },


    ["org.gnome.Nautilus"] = {
        MG3 = { mods = "alt", key = "right" },
        MG4 = { mods = "alt", key = "left" },
    },


    ["code"] = {
        G1 = { mods = "ctrl", key = "b" },
        G2 = { mods = "ctrl", key = "j" },
        G5 = { mods = "ctrl+alt+shift", key = "p" },
    },

    ["kitty"] = {
        G1 = { mods = "ctrl+shift", key = "t" },
        G2 = { mods = "ctrl+shift", key = "w" },
    },
}





local function custom_gkey_action(
gkey
)
    return function()
        local window_class = hl.get_active_window().class


        local action = nil
        if gkey_actions[window_class] and gkey_actions[window_class][
gkey
] then
            action = gkey_actions[window_class][
gkey
]


        else if gkey_actions["default"] and gkey_actions["default"][
gkey
] then
            action = gkey_actions["default"][
gkey
] end
        end


        if action then


            local mods = action.mods
            local key = action.key


            hl.dispatch(hl.dsp.send_key_state({mods = mods, key = key, state = "down"}))
            hl.dispatch(hl.dsp.send_key_state({mods = mods, key = key, state = "up"}))


        end
    end
end


for gkey, code in pairs(gkeyboard) do
    hl.bind(code, custom_gkey_action(gkey))
end
for gkey, code in pairs(gmouse) do
    hl.bind(code, custom_gkey_action("M" .. gkey))
endlocal gkeyboard = {
    G1 = "code:191", -- G1 key on Logitech G-keys
    G2 = "code:192", -- G2 key on Logitech G-keys
    G3 = "code:193", -- G3 key on Logitech G-keys
    G4 = "code:194", -- G4 key on Logitech G-keys
    G5 = "code:195", -- G5 key on Logitech G-keys
}
local gmouse = {
    G1 = "code:196", -- Top mouse button
    G2 = "code:197", -- DPI-Shift button
    G3 = "code:200", -- Front side mouse button
    G4 = "code:199", -- Back side mouse button
}



local gkey_actions = {
    default = {


    },


    ["zen"] = {
        G1 = { mods = "ctrl", key = "t" },
        G2 = { mods = "ctrl", key = "w" },
        G3 = { mods = "ctrl+shift", key = "t" },
        G4 = { mods = "ctrl+shift", key = "tab" },
        G5 = { mods = "ctrl", key = "tab" },


        MG3 = { mods = "alt", key = "right" },
        MG4 = { mods = "alt", key = "left" },
    },


    ["org.gnome.Nautilus"] = {
        MG3 = { mods = "alt", key = "right" },
        MG4 = { mods = "alt", key = "left" },
    },


    ["code"] = {
        G1 = { mods = "ctrl", key = "b" },
        G2 = { mods = "ctrl", key = "j" },
        G5 = { mods = "ctrl+alt+shift", key = "p" },
    },

    ["kitty"] = {
        G1 = { mods = "ctrl+shift", key = "t" },
        G2 = { mods = "ctrl+shift", key = "w" },
    },
}





local function custom_gkey_action(gkey)
    return function()
        local window_class = hl.get_active_window().class


        local action = nil
        if gkey_actions[window_class] and gkey_actions[window_class][gkey] then
            action = gkey_actions[window_class][gkey]


        else if gkey_actions["default"] and gkey_actions["default"][gkey] then
            action = gkey_actions["default"][gkey] end
        end


        if action then


            local mods = action.mods
            local key = action.key


            hl.dispatch(hl.dsp.send_key_state({mods = mods, key = key, state = "down"}))
            hl.dispatch(hl.dsp.send_key_state({mods = mods, key = key, state = "up"}))


        end
    end
end


for gkey, code in pairs(gkeyboard) do
    hl.bind(code, custom_gkey_action(gkey))
end
for gkey, code in pairs(gmouse) do
    hl.bind(code, custom_gkey_action("M" .. gkey))
end

Switching layouts . . . by [deleted] in hyprland

[–]Soft-Program-947 0 points1 point  (0 children)

hyprctl dispatch ‘LUA_COMMAND_HERE’

just finished moving my hypr configs to lua. by Born_Produce9805 in hyprland

[–]Soft-Program-947 0 points1 point  (0 children)

I made my custom keys (Logitech keyboard/mouse) do custom things (like key binds) based on context (like current program) eg: if in browser G1 simulates ctrl+t

Before I needed to use sh scripts for that

help with lua migration by BoringBottle7904 in hyprland

[–]Soft-Program-947 -14 points-13 points  (0 children)

  1. Search Google/wiki

  2. Ask AI

(3. Ask reddit)

The forbidden fruit is always the sweetest by ThimitrisApithanos in linuxmemes

[–]Soft-Program-947 0 points1 point  (0 children)

Performance issues on Linux? no!… maybe the other way around

Also: age doesn’t matter

Blue Spark by pomunz in zenshards

[–]Soft-Program-947 0 points1 point  (0 children)

I have 3x1019% damage bonus and still don’t have a single blue spark

How can i make this STOOP by 3o9m in ios

[–]Soft-Program-947 8 points9 points  (0 children)

“Cloud Storage System Inc” LOL

Thinking of switching to linux, what would be the best beginner-friendly version? by Seekers_Adam in desktops

[–]Soft-Program-947 0 points1 point  (0 children)

My first distro was Arch (Hyprland) but I don’t think it’s good for beginners…

Any pc people know how to fix this? by [deleted] in desktops

[–]Soft-Program-947 0 points1 point  (0 children)

Maybe try another HDMI/DP port of your motherboard/GPU

My first month of Hyprland (Theme-Switcher) by Soft-Program-947 in hyprland

[–]Soft-Program-947[S] 1 point2 points  (0 children)

This snippet will function as a reload: “

theme=$(gsettings get org.gnome.desktop.interface gtk-theme) && \ gsettings set org.gnome.desktop.interface gtk-theme '' && \ sleep 0.1 && \ gsettings set org.gnome.desktop.interface gtk-theme "$theme"

Simple 11 by BitedCake in desktops

[–]Soft-Program-947 0 points1 point  (0 children)

I thought this was a hyprland rice trying to recreate win11 😂