feat: turn off KDE's middle-click paste
Inside a Chromium application the flag settles this on its own - with autoscroll on, Blink stops pasting the primary selection. Everywhere else on the desktop middle click goes on pasting, which is the thing this whole program exists to get away from. KWin has a switch for it, on Wayland, where the paste is a protocol the compositor either offers or does not: EnablePrimarySelection in kwinrc. Written with kwriteconfig, the way System Settings would, because kwinrc has a cascade behind it. What the key said before goes in the ledger, so disable puts it back - and a key that already said false is left alone and not recorded, so a paste the user switched off themselves is never switched back on. X11 has no such switch and nothing is written there.
This commit is contained in:
1 parent
0c4e7645d0
commit
004094ef78
11 files changed
+259
-4
No files matched your search
+14
-2
@@ -278,9 +278,12 @@ mca_state_write() {
|
||||
# shadow <generated desktop entry> <source entry it was generated from>
|
||||
# inplace <edited file> <basename of its backup copy>
|
||||
# flags <flag file> created | appended | merged
|
||||
# kwin <kwinrc> what EnablePrimarySelection said before
|
||||
#
|
||||
# `inplace` and `flags` differ in how they are undone: a backup is restored
|
||||
# wholesale, a flag file only loses the one line that was added to it.
|
||||
# The kinds differ in how they are undone: a backup is restored wholesale, a
|
||||
# flag file only loses the one line that was added to it, and kwinrc gets one
|
||||
# key written back - it is a file KDE writes to itself, and putting a whole
|
||||
# copy of it back would take everything else settled since with it.
|
||||
|
||||
mca_ledger_add() {
|
||||
local kind="$1" path="$2" detail="${3:-}"
|
||||
@@ -303,6 +306,15 @@ mca_ledger_has() {
|
||||
awk -F'\t' -v p="$1" '$2 == p { found = 1 } END { exit !found }' "$MCA_LEDGER"
|
||||
}
|
||||
|
||||
# mca_ledger_detail <path>
|
||||
# The third column of that file's line, empty when the ledger has none. What it
|
||||
# means is the kind's business; for `kwin` it is the value to put back.
|
||||
mca_ledger_detail() {
|
||||
[[ -f $MCA_LEDGER ]] || return 1
|
||||
awk -F'\t' -v p="$1" '$2 == p { d = $3 } END { if (!length(d)) exit 1; print d }' \
|
||||
"$MCA_LEDGER"
|
||||
}
|
||||
|
||||
mca_ledger_forget() {
|
||||
local path="$1" tmp
|
||||
[[ -f $MCA_LEDGER ]] || return 0
|
||||
|
||||
Reference in new issue
Block a user