0

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

conf0="/home/myuser/.config/i3/config" case "${1}" in (alt) key=Mod1 ;; (win) key=Mod4 ;; (*) printf "Invalid key: %s\n" "${1}" ; exit 1 ;; esac 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

3
  • 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
    CommentedApr 25, 2022 at 12:49
  • Sorry thought to over the head, but this is a great solution! This fixed my probem! ThxCommentedApr 25, 2022 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
    CommentedApr 25, 2022 at 20:43

1 Answer 1

1

Per this page, these commands seem to be available:

i3-msg reload i3-msg restart 

    You must log in to answer this question.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.