Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# useful_scripts
Some random useful scripts.

1. Using repeat keys for some applications on macos
Some random useful scripts (mostly for macOS).

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
15 changes: 15 additions & 0 deletions disable_dsstore_usb_network.sh
Original file line number Diff line number Diff line change
@@ -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."
13 changes: 13 additions & 0 deletions drag_window_from_anywhere.sh
Original file line number Diff line number Diff line change
@@ -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 + <drag>)..."
defaults write -g NSWindowShouldDragOnGesture -bool true
fi

echo "Done."
2 changes: 1 addition & 1 deletion fix_bluetooth_mouse_lag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ else
sudo defaults write /Library/Preferences/com.apple.airport.bt.plist bluetoothCoexMgmt Hybrid
fi

echo "Done."
echo "Done."
16 changes: 10 additions & 6 deletions fix_press_and_hold.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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
21 changes: 21 additions & 0 deletions notunes_set_player.sh
Original file line number Diff line number Diff line change
@@ -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."
17 changes: 17 additions & 0 deletions remove_dock_delay.sh
Original file line number Diff line number Diff line change
@@ -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."