From 4776aa0f721216af317e2515b6fa9d29946da8fe Mon Sep 17 00:00:00 2001 From: Michael Champanis Date: Sat, 31 Jan 2026 15:27:26 +0100 Subject: [PATCH 1/5] new scripts; clean up old script; update README --- LICENSE | 2 +- README.md | 8 ++++++-- drag_window_from_anywhere.sh | 13 +++++++++++++ fix_bluetooth_mouse_lag.sh | 2 +- fix_press_and_hold.sh | 16 ++++++++++------ remove_dock_delay.sh | 17 +++++++++++++++++ 6 files changed, 48 insertions(+), 10 deletions(-) create mode 100755 drag_window_from_anywhere.sh mode change 100644 => 100755 fix_press_and_hold.sh create mode 100755 remove_dock_delay.sh diff --git a/LICENSE b/LICENSE index ca62623..7b0a45a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 David Jacka +Copyright (c) 2026 David Jacka, mchampanis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 63a8f6c..1eaf410 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # useful_scripts -Some random useful scripts. -1. Using repeat keys for some applications on macos +Some random useful scripts (mostly for macOS). + +1. Enable repeat keys only for certain applications +2. Allow windows to be dragged from any point inside window (with Ctrl-Cmd + ) +3. Speed up appearance and disappearance of Dock (if auto-hide is enabled) +4. Fix Bluetooth mouse polling/lag diff --git a/drag_window_from_anywhere.sh b/drag_window_from_anywhere.sh new file mode 100755 index 0000000..4d3e2a8 --- /dev/null +++ b/drag_window_from_anywhere.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +if [ "$1" == "undo" ]; then + echo "Undoing drag windows from any part of window..." + defaults write -g NSWindowShouldDragOnGesture -bool false +else + echo "Allowing windows to be dragged from any part of the window (Ctrl-Cmd + )..." + defaults write -g NSWindowShouldDragOnGesture -bool true +fi + +echo "Done." diff --git a/fix_bluetooth_mouse_lag.sh b/fix_bluetooth_mouse_lag.sh index 9d95743..2dfd2bb 100755 --- a/fix_bluetooth_mouse_lag.sh +++ b/fix_bluetooth_mouse_lag.sh @@ -10,4 +10,4 @@ else sudo defaults write /Library/Preferences/com.apple.airport.bt.plist bluetoothCoexMgmt Hybrid fi -echo "Done." \ No newline at end of file +echo "Done." diff --git a/fix_press_and_hold.sh b/fix_press_and_hold.sh old mode 100644 new mode 100755 index 9083b7f..96795d9 --- a/fix_press_and_hold.sh +++ b/fix_press_and_hold.sh @@ -1,9 +1,13 @@ -KEY='ApplePressAndHoldEnabled' \ -&& defaults delete -g "$KEY" \ -; echo \ -&& APP_ID_PREFIX='com\.jetbrains\.|com\.microsoft\.VSCode|com\.todesktop\.230313mzl4w4u92' \ -&& defaults read | egrep -o "${APP_ID_PREFIX}[^\"]+" | sort --unique \ +#!/bin/bash + +set -e + +defaults delete -g ApplePressAndHoldEnabled + +APP_ID_PREFIX='com\.jetbrains\.|com\.microsoft\.VSCode|com\.todesktop\.230313mzl4w4u92' + +defaults read | egrep -o "${APP_ID_PREFIX}[^\"]+" | sort --unique \ | while read APP_ID; do echo "Setting \"repeat-character-while-key-held\" for application: '$APP_ID'..." - defaults write "$APP_ID" "$KEY" -bool 'false' + defaults write "$APP_ID" ApplePressAndHoldEnabled -bool 'false' done diff --git a/remove_dock_delay.sh b/remove_dock_delay.sh new file mode 100755 index 0000000..e8d9321 --- /dev/null +++ b/remove_dock_delay.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +if [ "$1" == "undo" ]; then + echo "Undoing speedy Dock..." + # defaults delete com.apple.dock autohide-time-modifier + defaults delete com.apple.dock autohide-delay + killall Dock +else + echo "Making the Dock faster..." + # defaults write com.apple.dock autohide-time-modifier -int 0.25 # this is very aggressive + defaults write com.apple.dock autohide-delay -float 0 + killall Dock +fi + +echo "Done." From ecb4116c0dc427977a0245f07dec35172f154ca2 Mon Sep 17 00:00:00 2001 From: Michael Champanis Date: Sat, 31 Jan 2026 15:29:14 +0100 Subject: [PATCH 2/5] fix README typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1eaf410..e53213a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,6 @@ Some random useful scripts (mostly for macOS). 1. Enable repeat keys only for certain applications -2. Allow windows to be dragged from any point inside window (with Ctrl-Cmd + ) +2. Allow windows to be dragged from any point inside window (with Ctrl-Cmd + \) 3. Speed up appearance and disappearance of Dock (if auto-hide is enabled) 4. Fix Bluetooth mouse polling/lag From 999ece77aa01133e103f6a286622f3476f0beefc Mon Sep 17 00:00:00 2001 From: Michael Champanis Date: Tue, 3 Feb 2026 15:19:15 +0100 Subject: [PATCH 3/5] .DS_Store disabler script --- disable_dsstore_usb_network.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 disable_dsstore_usb_network.sh diff --git a/disable_dsstore_usb_network.sh b/disable_dsstore_usb_network.sh new file mode 100755 index 0000000..3564732 --- /dev/null +++ b/disable_dsstore_usb_network.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +if [ "$1" == "undo" ]; then + echo "Enabling .DS_Store file creation on network shares and removable drives..." + defaults write com.apple.desktopservices DSDontWriteNetworkStores false + defaults write com.apple.desktopservices DSDontWriteUSBStores -bool false +else + echo "Disabling .DS_Store file creation on network shares and removable drives..." + defaults write com.apple.desktopservices DSDontWriteNetworkStores true + defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true +fi + +echo "Done." From 2abc462717a4cf4c37276cf303c4c3347929e722 Mon Sep 17 00:00:00 2001 From: Michael Champanis Date: Wed, 4 Feb 2026 12:05:00 +0100 Subject: [PATCH 4/5] add noTunes config script --- notunes_set_player.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 notunes_set_player.sh diff --git a/notunes_set_player.sh b/notunes_set_player.sh new file mode 100755 index 0000000..4d90b0e --- /dev/null +++ b/notunes_set_player.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# https://github.com/tombonez/noTunes +# `brew install --cask notunes` +# noTunes is a macOS application that will prevent iTunes or Apple Music from launching. +# You can configure it to open a different program when the Play media key is pressed. + +set -e + +if [ "$1" == "undo" ]; then + echo "Disabling noTunes replacement app..." + defaults delete digital.twisted.noTunes replacement +elif [ "$1" == "Tidal" ]; then + echo "Setting noTunes default app to Tidal..." + defaults write digital.twisted.noTunes replacement /Applications/Tidal.app +else + echo "Setting noTunes default app to Spotify..." + defaults write digital.twisted.noTunes replacement /Applications/Spotify.app +fi + +echo "Done." From f38d4ba71e6c185429f9145c39d65405a81bfcd3 Mon Sep 17 00:00:00 2001 From: Michael Champanis Date: Thu, 19 Feb 2026 13:36:07 +0100 Subject: [PATCH 5/5] Update README.md Updated the script list with filenames and descriptions. --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e53213a..6038cb5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,13 @@ Some random useful scripts (mostly for macOS). -1. Enable repeat keys only for certain applications -2. Allow windows to be dragged from any point inside window (with Ctrl-Cmd + \) -3. Speed up appearance and disappearance of Dock (if auto-hide is enabled) -4. Fix Bluetooth mouse polling/lag +1. `fix_press_and_hold.sh` enable repeat keys only for certain applications +2. `drag_window_from_anywhere.sh` drag a window from anywhere inside it using Ctrl+Cmd and dragging with mouse +3. `remove_dock_delay.sh` speed up appearance and disappearance of Dock (if auto-hide is enabled) +4. `fix_bluetooth_mouse_lag.sh` fix Bluetooth mouse polling/lag +5. `disable_dsstore_usb_network.sh` disable creation of .DS_Store files on USB and network drives +6. `notunes_set_player.sh` stop Music/iTunes from opening when you push the Play media key; optionally open Tidal or Spotify instead + +## requirements + +https://github.com/tombonez/noTunes