Skip to content

Instantly share code, notes, and snippets.

@Dregu
Dregu / joy.lua
Last active August 27, 2026 18:03
Bind joysticks in Hyprland
--[[
Bind joystick buttons in Hyprland :D and reset idle timer too
Get your button codes from evtest or whatever
Requires lua-posix, maybe from pacman
Also requires https://github.com/hyprwm/Hyprland/pull/16005
Example:
joy = require"joy"
joy.dev("/dev/input/by-id/usb-WiseGroup._Ltd_MP-8866_Dual_USB_Joypad-event-joystick")
joy.bind(290, hl.dsp.window.fullscreen())
@Dregu
Dregu / hyprland.service
Last active August 1, 2026 22:44
Hyprland autostart to hyprlock securely (don't quote me on that)
# /etc/systemd/system/hyprland.service
# This service will make hyprlock your login screen basically. Requires Hyprland 0.56.
# It's for a single user machine that needs password protection with eyecandy and unified login and lock screen.
# This way of launching directly to hyprlock is probably secure enough against your friends, but not your enemies.
# Don't use this if you don't understand it or don't know how to undo it if it breaks.
# This is just an example, replace the relevant bits with your own info.
# You also have to actually install and configure hyprlock to use hyprlock.
# Probably test hyprlock and the --locked-cmd before outright nuking getty?
# If you have a display manager you should obviously disable that too.
@Dregu
Dregu / repl.lua
Last active June 9, 2026 17:16
Lua REPL console for Hyprland
-- Lua UDP REPL console for Hyprland
-- Just stick repl.lua in .config/hypr and `require "repl"`
-- Connect with `socat readline,prompt="> " udp-datagram:localhost:42069`
-- Get luasocket somehow, `pacman -S lua-socket` installs here:
package.path = "/usr/share/lua/" .. _VERSION:sub(5) .. "/?.lua;/usr/share/lua/" .. _VERSION:sub(5) .. "/?/init.lua;" .. package.path
-- lua-inspect is on e.g. aur
-- Pretty useful, not really required, so lets not error on that, although hl custom error handler might do it anyway
_, inspect = pcall(require, "inspect")
@Dregu
Dregu / hypr-socket2-template.sh
Created November 20, 2025 22:35
hyprland socket2 bash example template thing
#!/bin/sh
function handle {
EVENT=${1%%\>\>*}
DATA=${1#*\>\>}
case $EVENT in
activewindow)
IFS=, read -r CLASS TITLE <<< "$DATA"
echo "Window focused | Class: $CLASS | Title: $TITLE"
;;
focusedmonv2)
@Dregu
Dregu / hyprvol
Last active April 27, 2026 23:59
Control active window volume in Hyprland
#!/bin/bash
# control active window pipewire volume with hyprland binds
# tries really hard to figure out complex situations like:
# - individual firefox tabs/windows
# - gamescope games
# - proton games
# - child process playing audio in terminal window
# - multiple streams per process
@Dregu
Dregu / hypr-tagwindows
Last active August 30, 2025 09:07
Tag Hyprland windows with their process name
#!/bin/bash
# Allows you to use process names in windowrules when the class and title are useless, e.g. spotify miniplayer
# exec-once = ~/.config/scripts/hypr-tagwindows
# windowrule = forcergbx, tag:spotify, floating:1
function handle {
if [[ "$1" =~ "openwindow>>" ]]; then
read -d, ADDR WS CLASS TITLE <<< $(echo "$1" | cut -f3 -d">")
@Dregu
Dregu / yallushot
Last active February 22, 2026 15:29
yallushot
#!/bin/sh
# Yet Another Luxurious but Laughably Unnecessary screenShot tool for Hyprland by Dregu
# Capture specific window, layer, region or output with a single command and pipe to satty.
# Usage: ./yallushot [region|window|output]
# TOLD YA!
# remember to add `layerrule = no_anim on, match:namespace selection` or you will see slurp in your screenshots!
# PARAMS
# (none): shoots selected region OR clicked window/layer without decorations OR output when clicked outside a window/cancelled
@Dregu
Dregu / edid_stuff.sh
Created August 20, 2025 20:00
Linux EDID stuff to force DP output to stay enabled when monitor is off or maybe make a generic virtual display
# make nice place for edid files
sudo mkdir -p /usr/lib/firmware/edid
# find edid file for your monitor or maybe get one from the interweb
sudo find /sys | grep /edid$
# copy it to firmware
sudo cp one_of_the_results /usr/lib/firmware/edid/xyz1337.bin
# check to make sure it's not garbage I guess
@Dregu
Dregu / README.md
Last active September 29, 2026 13:05
Sunshine headless virtual display on various Wayland compositors with automatic resolution matching.

Headless Sunshine Wayland stuff

  • These configs create a headless virtual display on demand when connecting to the "Headless" app
  • The commands might also work globally with any app when added to "General - Command Preparations", but this is untested
  • The headless display mode is automatically set to match whatever is set in Moonlight settings
  • The real display is automatically disabled while streaming
  • Remember to enable these Moonlight settings to send resolution info and toggle the displays when streaming:
    • Optimize game settings for streaming
  • Quit app on host PC after ending stream
@Dregu
Dregu / paper.sh
Last active August 16, 2025 15:15
Set random wallpaper and matching active border gradient using hyprpaper/swaybg and imagemagick
#!/bin/bash
# Set random wallpaper and matching active border gradient using hyprpaper/swaybg and imagemagick
DIR=~/pics/wallpapers
FORCE="$1"
# Collect old swaybg pids to kill after fading new one in
OLD=$(pgrep -d" " swaybg)