i am writing a script to quick change the mod key of i3


case "${1}" in
  (alt) key=Mod1 ;;
  (win) key=Mod4 ;;
  (*)   printf "Invalid key: %s\n" "${1}" ; exit 1 ;;

sed -i 's/^\(set $mod\) .*/\1 '"${key}/" "${conf0}" || exit

printf "Changed successfully to %s/%s\n" "${1}" "${key}"

but i wont the i3 config to automatically reload at the end of my script. I found xdotool might work but if have to check the current $mod key to be able to reload i3.

How can this? Is awk a goo choice for that?

Please point me in the right direction

  • I assume you're talking about sending keystrokes to the app, this doesn't seem like an ideal approach. A quick google found this which may suggest a better solution is available: faq.i3wm.org/question/6505/reload-config-from-bash.1.html
    – bxm
    Apr 25 at 12:49
  • Sorry thought to over the head, but this is a great solution! This fixed my probem! Thx
    – fabolous05
    Apr 25 at 19:56
  • Great, glad it worked. I’ve added it as an answer so the commands are here for any future on lookers.
    – bxm
    Apr 25 at 20:43

1 Answer 1


Per this page, these commands seem to be available:

i3-msg reload
i3-msg restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.