Skip to content

Instantly share code, notes, and snippets.

View ItsProfessional's full-sized avatar

ItsProfesssional ItsProfessional

View GitHub Profile
@ItsProfessional
ItsProfessional / disable-mouse-paste.md
Last active April 21, 2024 11:46
Disable middle click pasting in Linux

Disable middle click pasting in Linux without breaking middle click functionality (X11/Wayland)

Context

  • Both X11 and Wayland have clipboard and primary clipboards. The clipboard clipboard stores the text you copy. The primary clipboard stores the text you select (not copy!) using the mouse.
  • When you paste using your keyboard, it pastes the text stored in the clipboard clipboard, but when you paste using middle click, it pastes from the primary clipboard.
  • The idea is to clear the primary clipboard, when you middle click so that nothing gets pasted, and we only clear the primary clipboard so the text you copied previously will remain as-is.

Clearing the "primary" clipboard on middle click

  • Install a key binding daemon that is capable of listening to mouse button clicks (middle click in our case) and executing shell commands. I personally recommend evsieve.
  • If you are using X11, make sure xsel is installed. If you are using Waylan
@ItsProfessional
ItsProfessional / keepenv.patch
Last active May 18, 2023 07:19
Pkexec patch to pass-through ALL environment variables as-is (warning: this is insecure and introduces vulnerabilities via environment variables like LD_PRELOAD and LD_LIBRARY_PATH)
From ebfa88955c5cee76bbf6d726209c155f08e27c46 Mon Sep 17 00:00:00 2001
From: ItsProfessional <[email protected]>
Date: Tue, 16 May 2023 18:27:04 +0530
Subject: [PATCH] keep all environment variables in pkexec
---
src/programs/pkexec.c | 55 +++++--------------------------------------
1 file changed, 6 insertions(+), 49 deletions(-)
diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c
@ItsProfessional
ItsProfessional / patch-discord.sh
Last active June 2, 2023 07:06
Pacman hooks for auto repatching discord without manual intervention (system electron, vencord, openasar)
#!/bin/sh
# Extract asar and rename original file
asar e /opt/discord/resources/app.asar /opt/discord/resources/app
mv /opt/discord/resources/app.asar /opt/discord/resources/app.asar.default -f
# Patch extracted asar
sed -i "s|process.resourcesPath|'/usr/share/discord/resources'|" /opt/discord/resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'/usr/share/pixmaps',|" /opt/discord/resources/app/app_bootstrap/autoStart/linux.js