This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ -n "$1" ]]; then | |
TKB_TIMEOUT=$1 | |
else | |
TKB_TIMEOUT=600 # 10 minutes | |
fi | |
# Prevent sudo from timing out | |
# https://serverfault.com/a/266463 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
acpi_listen | while IFS= read -r line; do | |
if [ "$line" = "jack/headphone HEADPHONE plug" ] | |
then | |
pactl -- set-sink-volume 0 20% | |
amixer -D pulse set Master mute | |
elif [ "$line" = "jack/headphone HEADPHONE unplug" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Courtesy of https://superuser.com/a/638487 | |
IDLE_TIME_MIN=15 | |
IDLE_TIME_SEC=$((IDLE_TIME_MIN*60)) | |
IDLE_TIME_MS=$((IDLE_TIME_SEC*1000)) | |
sleep_time_ms=$IDLE_TIME_MS | |
triggered=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Add to crontab via: | |
# (crontab -u $USER -l; echo "*/1 * * * * $HOME/.local/bin/unstuck-keyboard" ) | crontab -u $USER - | |
# Set up env vars so that gnome-screensaver-command works with cron. If these | |
# are not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
KEYBOARD_INFO=$(xinput list | sed -e 's/ */ /g' | grep "AT Translated Set 2 keyboard") | |
EXTRAKEY_INFO=$(xinput list | sed -e 's/ */ /g' | grep "ThinkPad Extra Buttons") | |
KEYBOARD_ID=$(echo $KEYBOARD_INFO | grep -o -P 'id=\K\d*') | |
EXTRAKEY_ID=$(echo $EXTRAKEY_INFO | grep -o -P 'id=\K\d*') | |
MASTER_ID=$(xinput list | sed -e 's/ */ /g' | grep -o -P 'slave keyboard \(\K\d*' | head -n 1) | |
IS_ATTACHED=$([ -z "$(echo $KEYBOARD_INFO | grep -o -P 'floating slave')" ]) | |
if [ -z "$(echo $KEYBOARD_INFO | grep -o -P 'floating slave')" ]; then | |
xinput float $KEYBOARD_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Add to crontab via: | |
# (crontab -u $USER -l; echo "*/1 * * * 1-5 $HOME/.local/bin/check-sound-playing" ) | crontab -u $USER - | |
# Set up env vars so that gnome-screensaver-command works with cron. If these | |
# are not set, the scree |