$ -weight: 500;">brew -weight: 500;">install asdf
-weight: 500;">brew -weight: 500;">install asdf
-weight: 500;">brew -weight: 500;">install asdf
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install -weight: 500;">curl -weight: 500;">git
-weight: 500;">git clone https://github.com/asdf-vm/asdf.-weight: 500;">git ~/.asdf --branch v0.14.0
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
source ~/.zshrc
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install -weight: 500;">curl -weight: 500;">git
-weight: 500;">git clone https://github.com/asdf-vm/asdf.-weight: 500;">git ~/.asdf --branch v0.14.0
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
source ~/.zshrc
-weight: 600;">sudo -weight: 500;">apt -weight: 500;">install -weight: 500;">curl -weight: 500;">git
-weight: 500;">git clone https://github.com/asdf-vm/asdf.-weight: 500;">git ~/.asdf --branch v0.14.0
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
source ~/.zshrc
asdf plugin add nodejs
asdf -weight: 500;">install nodejs 24.13.0
asdf global nodejs 24.13.0
asdf plugin add nodejs
asdf -weight: 500;">install nodejs 24.13.0
asdf global nodejs 24.13.0
asdf plugin add nodejs
asdf -weight: 500;">install nodejs 24.13.0
asdf global nodejs 24.13.0
node --version # v24.13.0
node --version # v24.13.0
node --version # v24.13.0
-weight: 500;">npm -weight: 500;">install -g @smartthings/cli
-weight: 500;">npm -weight: 500;">install -g @smartthings/cli
-weight: 500;">npm -weight: 500;">install -g @smartthings/cli
smartthings --version
smartthings --version
smartthings --version
smartthings devices
smartthings devices
smartthings devices
┌────┬─────────────────┬──────────────────────────────────────┐
│ # │ Label │ Device ID │
├────┼─────────────────┼──────────────────────────────────────┤
│ 1 │ Samsung M8 │ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx │
└────┴─────────────────┴──────────────────────────────────────┘
┌────┬─────────────────┬──────────────────────────────────────┐
│ # │ Label │ Device ID │
├────┼─────────────────┼──────────────────────────────────────┤
│ 1 │ Samsung M8 │ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx │
└────┴─────────────────┴──────────────────────────────────────┘
┌────┬─────────────────┬──────────────────────────────────────┐
│ # │ Label │ Device ID │
├────┼─────────────────┼──────────────────────────────────────┤
│ 1 │ Samsung M8 │ xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx │
└────┴─────────────────┴──────────────────────────────────────┘
export SMARTTHINGS_MONITOR_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
export SMARTTHINGS_MONITOR_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
export SMARTTHINGS_MONITOR_ID='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
#!/usr/bin/env bash
# Control Samsung M8 monitor input via SmartThings CLI
# Requires: smartthings CLI + SMARTTHINGS_MONITOR_ID env var set in ~/.zshrc.local _smartthings_cmd() { local st_bin="$HOME/.asdf/installs/nodejs/24.13.0/bin/smartthings" if [[ -x "$st_bin" ]]; then "$st_bin" "$@" else command smartthings "$@" fi
} _monitor_check() { if ! _smartthings_cmd --version &>/dev/null; then echo "smartthings CLI not found." >&2 echo "Run: -weight: 500;">npm -weight: 500;">install -g @smartthings/cli" >&2 return 1 fi if [[ -z "$SMARTTHINGS_MONITOR_ID" ]]; then echo "SMARTTHINGS_MONITOR_ID is not set." >&2 echo "Run: smartthings devices → find your M8 device ID" >&2 echo "Then add to ~/.zshrc.local: export SMARTTHINGS_MONITOR_ID='<id>'" >&2 return 1 fi
} monitor_hdmi1() { _monitor_check || return 1 echo "Switching to HDMI 1..." _smartthings_cmd devices:commands "$SMARTTHINGS_MONITOR_ID" \ 'main:mediaInputSource:setInputSource("HDMI1")'
} monitor_hdmi2() { _monitor_check || return 1 echo "Switching to HDMI 2..." _smartthings_cmd devices:commands "$SMARTTHINGS_MONITOR_ID" \ 'main:mediaInputSource:setInputSource("HDMI2")'
} monitor_toggle() { _monitor_check || return 1 local current current=$(_smartthings_cmd devices:-weight: 500;">status "$SMARTTHINGS_MONITOR_ID" 2>/dev/null \ | jq -r '.components.main."samsungvd.mediaInputSource".inputSource.value // empty') if [[ -z "$current" ]]; then echo "Could not read current input source." >&2 return 1 fi echo "Current input: $current" if [[ "$current" == "HDMI1" ]]; then monitor_hdmi2 else monitor_hdmi1 fi
} # Allow running directly: ./monitor_input.sh [hdmi1|hdmi2|toggle]
case "${1:-}" in hdmi1) monitor_hdmi1 ;; hdmi2) monitor_hdmi2 ;; toggle) monitor_toggle ;; *) echo "Usage: $0 [hdmi1|hdmi2|toggle]" echo " or source this file and call monitor_hdmi1 / monitor_hdmi2 / monitor_toggle" ;;
esac
#!/usr/bin/env bash
# Control Samsung M8 monitor input via SmartThings CLI
# Requires: smartthings CLI + SMARTTHINGS_MONITOR_ID env var set in ~/.zshrc.local _smartthings_cmd() { local st_bin="$HOME/.asdf/installs/nodejs/24.13.0/bin/smartthings" if [[ -x "$st_bin" ]]; then "$st_bin" "$@" else command smartthings "$@" fi
} _monitor_check() { if ! _smartthings_cmd --version &>/dev/null; then echo "smartthings CLI not found." >&2 echo "Run: -weight: 500;">npm -weight: 500;">install -g @smartthings/cli" >&2 return 1 fi if [[ -z "$SMARTTHINGS_MONITOR_ID" ]]; then echo "SMARTTHINGS_MONITOR_ID is not set." >&2 echo "Run: smartthings devices → find your M8 device ID" >&2 echo "Then add to ~/.zshrc.local: export SMARTTHINGS_MONITOR_ID='<id>'" >&2 return 1 fi
} monitor_hdmi1() { _monitor_check || return 1 echo "Switching to HDMI 1..." _smartthings_cmd devices:commands "$SMARTTHINGS_MONITOR_ID" \ 'main:mediaInputSource:setInputSource("HDMI1")'
} monitor_hdmi2() { _monitor_check || return 1 echo "Switching to HDMI 2..." _smartthings_cmd devices:commands "$SMARTTHINGS_MONITOR_ID" \ 'main:mediaInputSource:setInputSource("HDMI2")'
} monitor_toggle() { _monitor_check || return 1 local current current=$(_smartthings_cmd devices:-weight: 500;">status "$SMARTTHINGS_MONITOR_ID" 2>/dev/null \ | jq -r '.components.main."samsungvd.mediaInputSource".inputSource.value // empty') if [[ -z "$current" ]]; then echo "Could not read current input source." >&2 return 1 fi echo "Current input: $current" if [[ "$current" == "HDMI1" ]]; then monitor_hdmi2 else monitor_hdmi1 fi
} # Allow running directly: ./monitor_input.sh [hdmi1|hdmi2|toggle]
case "${1:-}" in hdmi1) monitor_hdmi1 ;; hdmi2) monitor_hdmi2 ;; toggle) monitor_toggle ;; *) echo "Usage: $0 [hdmi1|hdmi2|toggle]" echo " or source this file and call monitor_hdmi1 / monitor_hdmi2 / monitor_toggle" ;;
esac
#!/usr/bin/env bash
# Control Samsung M8 monitor input via SmartThings CLI
# Requires: smartthings CLI + SMARTTHINGS_MONITOR_ID env var set in ~/.zshrc.local _smartthings_cmd() { local st_bin="$HOME/.asdf/installs/nodejs/24.13.0/bin/smartthings" if [[ -x "$st_bin" ]]; then "$st_bin" "$@" else command smartthings "$@" fi
} _monitor_check() { if ! _smartthings_cmd --version &>/dev/null; then echo "smartthings CLI not found." >&2 echo "Run: -weight: 500;">npm -weight: 500;">install -g @smartthings/cli" >&2 return 1 fi if [[ -z "$SMARTTHINGS_MONITOR_ID" ]]; then echo "SMARTTHINGS_MONITOR_ID is not set." >&2 echo "Run: smartthings devices → find your M8 device ID" >&2 echo "Then add to ~/.zshrc.local: export SMARTTHINGS_MONITOR_ID='<id>'" >&2 return 1 fi
} monitor_hdmi1() { _monitor_check || return 1 echo "Switching to HDMI 1..." _smartthings_cmd devices:commands "$SMARTTHINGS_MONITOR_ID" \ 'main:mediaInputSource:setInputSource("HDMI1")'
} monitor_hdmi2() { _monitor_check || return 1 echo "Switching to HDMI 2..." _smartthings_cmd devices:commands "$SMARTTHINGS_MONITOR_ID" \ 'main:mediaInputSource:setInputSource("HDMI2")'
} monitor_toggle() { _monitor_check || return 1 local current current=$(_smartthings_cmd devices:-weight: 500;">status "$SMARTTHINGS_MONITOR_ID" 2>/dev/null \ | jq -r '.components.main."samsungvd.mediaInputSource".inputSource.value // empty') if [[ -z "$current" ]]; then echo "Could not read current input source." >&2 return 1 fi echo "Current input: $current" if [[ "$current" == "HDMI1" ]]; then monitor_hdmi2 else monitor_hdmi1 fi
} # Allow running directly: ./monitor_input.sh [hdmi1|hdmi2|toggle]
case "${1:-}" in hdmi1) monitor_hdmi1 ;; hdmi2) monitor_hdmi2 ;; toggle) monitor_toggle ;; *) echo "Usage: $0 [hdmi1|hdmi2|toggle]" echo " or source this file and call monitor_hdmi1 / monitor_hdmi2 / monitor_toggle" ;;
esac
# ── Samsung M8 Monitor Input (SmartThings) ────────────────────────────────── if command -v smartthings &>/dev/null; then source "$HOME/dotfiles/scripts/monitor_input.sh" 2>/dev/null alias hdmi1='monitor_hdmi1' alias hdmi2='monitor_hdmi2' alias hdmi-toggle='monitor_toggle' alias t='monitor_toggle'
fi
# ── Samsung M8 Monitor Input (SmartThings) ────────────────────────────────── if command -v smartthings &>/dev/null; then source "$HOME/dotfiles/scripts/monitor_input.sh" 2>/dev/null alias hdmi1='monitor_hdmi1' alias hdmi2='monitor_hdmi2' alias hdmi-toggle='monitor_toggle' alias t='monitor_toggle'
fi
# ── Samsung M8 Monitor Input (SmartThings) ────────────────────────────────── if command -v smartthings &>/dev/null; then source "$HOME/dotfiles/scripts/monitor_input.sh" 2>/dev/null alias hdmi1='monitor_hdmi1' alias hdmi2='monitor_hdmi2' alias hdmi-toggle='monitor_toggle' alias t='monitor_toggle'
fi
source "$HOME/dotfiles/zsh/aliases/monitor.sh"
source "$HOME/dotfiles/zsh/aliases/monitor.sh"
source "$HOME/dotfiles/zsh/aliases/monitor.sh"
hdmi1 # switch to HDMI 1 (machine A)
hdmi2 # switch to HDMI 2 (machine B)
hdmi-toggle # toggle between whichever is active
t # same as hdmi-toggle, just shorter
hdmi1 # switch to HDMI 1 (machine A)
hdmi2 # switch to HDMI 2 (machine B)
hdmi-toggle # toggle between whichever is active
t # same as hdmi-toggle, just shorter
hdmi1 # switch to HDMI 1 (machine A)
hdmi2 # switch to HDMI 2 (machine B)
hdmi-toggle # toggle between whichever is active
t # same as hdmi-toggle, just shorter
~/dotfiles/scripts/monitor_input.sh toggle
~/dotfiles/scripts/monitor_input.sh hdmi1
~/dotfiles/scripts/monitor_input.sh toggle
~/dotfiles/scripts/monitor_input.sh hdmi1
~/dotfiles/scripts/monitor_input.sh toggle
~/dotfiles/scripts/monitor_input.sh hdmi1 - Samsung M8 monitor connected to your SmartThings account
- Node.js (we'll use asdf for version management)
- SmartThings CLI installed globally via -weight: 500;">npm
- Your M8's SmartThings device ID