Skip to content

Commit

Permalink
feat: Add ibus restart if it's running
Browse files Browse the repository at this point in the history
This commit adds the functionality to restart ibus if it's already running. It checks if the ibus-daemon process is running using the `pgrep` command, and if it is, it restarts ibus using the `ibus restart` command. This improves the user experience by ensuring that ibus is always in a consistent state.
  • Loading branch information
ulises-jeremias committed Aug 28, 2024
1 parent de5add6 commit 66ec043
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ sudo pacman -S --noconfirm --needed \
ibus

yay -S --noconfirm --needed \
ibus-autostart \
shin-git
ibus-autostart

git clone https://github.com/apockill/shin.git --single-branch --depth 1 --branch feature/arbitrary-commands /tmp/shin
cd /tmp/shin
make
sudo make install

# Run ibus restart if it's running
pgrep ibus-daemon && ibus restart

{{ end -}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ yay -S --noconfirm --needed \

sudo systemctl enable --now ollama

ollama pull llama3.1
# ollama pull llama3.1
ollama pull mistral:7b-instruct

pipx install shell-gpt[litellm]
{{ end -}}
Expand Down
7 changes: 4 additions & 3 deletions home/dot_config/shell_gpt/private_dot_sgptrc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ CACHE_PATH=/tmp/cache
CHAT_CACHE_LENGTH=100
CACHE_LENGTH=100
REQUEST_TIMEOUT=60
DEFAULT_MODEL=ollama/llama3.1
# DEFAULT_MODEL=ollama/llama3.1
DEFAULT_MODEL=ollama/mistral:7b-instruct
DEFAULT_COLOR=magenta
ROLE_STORAGE_PATH={{- .chezmoi.homeDir -}}/.config/shell_gpt/roles
DEFAULT_EXECUTE_SHELL_CMD=false
Expand All @@ -12,8 +13,8 @@ CODE_THEME=dracula
OPENAI_FUNCTIONS_PATH={{- .chezmoi.homeDir -}}/.config/shell_gpt/functions
OPENAI_USE_FUNCTIONS=false
SHOW_FUNCTIONS_OUTPUT=false
# API_BASE_URL=default
API_BASE_URL=http://localhost:4891
API_BASE_URL=default
# API_BASE_URL=http://localhost:4891
PRETTIFY_MARKDOWN=true
USE_LITELLM=true
OPENAI_API_KEY=dummy-key
14 changes: 7 additions & 7 deletions home/dot_zsh/config.d/sgpt.zsh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Shell-GPT integration for ZSH
_sgpt_zsh() {
if [[ -n "$BUFFER" ]]; then
_sgpt_prev_cmd=$BUFFER
BUFFER+=""
zle -I && zle redisplay
BUFFER=$(sgpt --shell <<< "$_sgpt_prev_cmd" --no-interaction)
zle end-of-line
fi
if [[ -n "$BUFFER" ]]; then
_sgpt_prev_cmd=$BUFFER
BUFFER+=""
zle -I && zle redisplay
BUFFER=$(sgpt --shell <<< "$_sgpt_prev_cmd" --no-interaction)
zle end-of-line
fi
}
zle -N _sgpt_zsh
bindkey "^p" _sgpt_zsh
1 change: 1 addition & 0 deletions home/executable_dot_profile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export PASSWORD_STORE_DIR="${XDG_DATA_HOME}/pass-store"
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
# export SHIN_DEFAULT_COMMAND="sgpt"

# add /usr/local/bin to PATH if it exists and is not already in path
[[ -d "/usr/local/bin" && ! "$PATH" =~ "/usr/local/bin" ]] && export PATH="/usr/local/bin:$PATH"
Expand Down

0 comments on commit 66ec043

Please sign in to comment.