Use st as terminal
Switch from gnome-terminal to st (see fork on github). Open new terminal by default in the same working-dir as current window. Modify scratchpad-terminal to work with every terminal.
This commit is contained in:
@@ -33,7 +33,9 @@ floating_modifier $mod
|
|||||||
# set $TERMINAL kitty
|
# set $TERMINAL kitty
|
||||||
# bindsym $mod+Return exec i3-sensible-terminal
|
# bindsym $mod+Return exec i3-sensible-terminal
|
||||||
# bindsym $mod+Return exec kitty
|
# bindsym $mod+Return exec kitty
|
||||||
bindsym $mod+Return exec gnome-terminal --hide-menubar
|
# bindsym $mod+Return exec gnome-terminal --hide-menubar
|
||||||
|
bindsym $mod+Return exec st -d "$(xcwd)"
|
||||||
|
bindsym $mod+Shift+Return exec st
|
||||||
|
|
||||||
# kill focused window
|
# kill focused window
|
||||||
bindsym $mod+Shift+q kill
|
bindsym $mod+Shift+q kill
|
||||||
@@ -206,19 +208,22 @@ bindsym XF86RFKill exec --no-startup-id ~/.config/i3/airplane-mode-notify.sh
|
|||||||
exec --no-startup-id compton -b
|
exec --no-startup-id compton -b
|
||||||
|
|
||||||
# scratchpad-terminal
|
# scratchpad-terminal
|
||||||
for_window [class="Gnome-terminal" title="^scratchpad-terminal$"] \
|
for_window [class="st-256color" title="^scratchpad-terminal$"] \
|
||||||
move scratchpad, \
|
move scratchpad, \
|
||||||
sticky enable, \
|
sticky enable, \
|
||||||
scratchpad show, \
|
scratchpad show, \
|
||||||
resize set 1600 900, \
|
resize set 1600 900, \
|
||||||
border none, \
|
border none, \
|
||||||
move position center
|
move position center
|
||||||
|
# hide scratchpad-terminal again when restarting i3
|
||||||
|
exec_always i3-msg '[class="St" title="^scratchpad-terminal$"] scratchpad show'
|
||||||
# show scratchpad-terminal or create one if none exists
|
# show scratchpad-terminal or create one if none exists
|
||||||
bindsym $mod+comma exec ~/.config/i3/scratchpad-terminal.sh -s
|
bindsym $mod+comma exec ~/.config/i3/scratchpad-terminal.sh -s -c st-256color -n scratchpad-terminal -e st
|
||||||
# hide scratchpad-terminal indepedent of where the focus sits
|
# hide scratchpad-terminal indepedent of where the focus sits
|
||||||
bindsym $mod+Shift+comma exec ~/.config/i3/scratchpad-terminal.sh -h
|
bindsym $mod+Shift+comma exec ~/.config/i3/scratchpad-terminal.sh -h -c st-256color -n scratchpad-terminal
|
||||||
|
|
||||||
bindsym $mod+Shift+m move scratchpad
|
bindsym $mod+Shift+m move scratchpad
|
||||||
|
bindsym $mod+Shift+o scratchpad show
|
||||||
bindsym $mod+Shift+s [class="^Spotify$"] scratchpad show
|
bindsym $mod+Shift+s [class="^Spotify$"] scratchpad show
|
||||||
bindsym $mod+Shift+t [class="^TelegramDesktop$"] scratchpad show
|
bindsym $mod+Shift+t [class="^TelegramDesktop$"] scratchpad show
|
||||||
|
|
||||||
|
|||||||
@@ -2,50 +2,55 @@
|
|||||||
|
|
||||||
exec >/dev/null
|
exec >/dev/null
|
||||||
|
|
||||||
CLASS="Gnome-terminal"
|
while getopts "c:e:hn:s" FLAGS; do
|
||||||
NAME="scratchpad-terminal"
|
|
||||||
|
|
||||||
while getopts "hn:s" FLAGS; do
|
|
||||||
case "$FLAGS" in
|
case "$FLAGS" in
|
||||||
|
c) W_CLASS="$OPTARG";;
|
||||||
|
e) COMMAND="$OPTARG";;
|
||||||
h) HIDE=1;;
|
h) HIDE=1;;
|
||||||
n) NAME="$OPTARG";;
|
n) W_NAME="$OPTARG";;
|
||||||
s) SHOW=1;;
|
s) SHOW=1;;
|
||||||
*) exit 1;;
|
*) exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1 ))
|
shift $(($OPTIND - 1 ))
|
||||||
|
|
||||||
|
[ -n "$W_CLASS" ] || return 1
|
||||||
|
[ -n "$W_NAME" ] || return 1
|
||||||
|
[ -z "$SHOW" ] || [ -n "$COMMAND" ] || return 1
|
||||||
|
|
||||||
TREE="$(i3-msg -t get_tree)"
|
TREE="$(i3-msg -t get_tree)"
|
||||||
if ! (echo "$TREE" | grep -Po "\"name\":\"${NAME}\".*?floating\":\"[^\"]*\"" \
|
if ! (echo "$TREE" | grep -Po "\"name\":\"${W_NAME}\".*?class\":\"$W_CLASS\".*?floating\":\"[^\"]*\"" \
|
||||||
| grep -q '"floating":"user_on"')
|
| grep -q '"floating":"user_on"')
|
||||||
then
|
then
|
||||||
EXIST_NOT=1
|
EXIST_NOT=1
|
||||||
elif (echo "$TREE" | grep -Po '"focused":true.*?name":"[^"]*"' \
|
elif (echo "$TREE" | grep -Po '"focused":true.*?name":"[^"]*"' \
|
||||||
| grep -q "\"name\":\"${NAME}\"")
|
| grep -q "\"name\":\"${W_NAME}\"")
|
||||||
then
|
then
|
||||||
FOCUS_ON_PAD=1
|
FOCUS_ON_PAD=1
|
||||||
elif [ ! $EXIST_NOT ] && (echo "$TREE" | grep -Po '"output":"__i3".*?"name":"[^"]*"' \
|
elif [ ! $EXIST_NOT ] && (echo "$TREE" | grep -Po '"output":"__i3".*?"name":"[^"]*"' \
|
||||||
| grep -q "\"name\":\"${NAME}\"")
|
| grep -q "\"name\":\"${W_NAME}\"")
|
||||||
then
|
then
|
||||||
HIDDEN=1
|
HIDDEN=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $HIDE ] && [ ! $EXIST_NOT ] && [ ! $HIDDEN ]; then
|
if [ $HIDE ] && [ ! $EXIST_NOT ] && [ ! $HIDDEN ]; then
|
||||||
# There is a visible scratchpad-terminal that shall be hidden
|
# There is a visible scratchpad-terminal that shall be hidden
|
||||||
i3-msg "[class=\"$CLASS\" title=\"^${NAME}$\"] scratchpad show"
|
i3-msg "[class=\"$W_CLASS\" title=\"^${W_NAME}$\"] scratchpad show"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $SHOW ]; then
|
if [ $SHOW ]; then
|
||||||
if [ $EXIST_NOT ]; then
|
if [ $EXIST_NOT ]; then
|
||||||
# terminal does not exist yet
|
# terminal does not exist yet
|
||||||
gnome-terminal --window-with-profile="$NAME" --hide-menubar
|
# WORKSPACE="$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true).name' | tr -d '"')"
|
||||||
|
# i3-msg "workspace $W_NAME, exec env SCRATCHPAD_TERMINAL=1 $COMMAND, workspace $WORKSPACE"
|
||||||
|
env SCRATCHPAD_TERMINAL=1 $COMMAND
|
||||||
elif [ $HIDDEN ]; then
|
elif [ $HIDDEN ]; then
|
||||||
# terminal is "hidden" in scratchpad
|
# terminal is "hidden" in scratchpad
|
||||||
i3-msg "[class=\"$CLASS\" title=\"^${NAME}$\"] scratchpad show"
|
i3-msg "[class=\"$W_CLASS\" title=\"^${W_NAME}$\"] scratchpad show"
|
||||||
elif [ ! $FOCUS_ON_PAD ]; then
|
elif [ ! $FOCUS_ON_PAD ]; then
|
||||||
# terminal is visible but focus lays somewhere else
|
# terminal is visible but focus lays somewhere else
|
||||||
i3-msg "[class=\"$CLASS\" title=\"^${NAME}$\"] scratchpad show, scratchpad show"
|
i3-msg "[class=\"$W_CLASS\" title=\"^${W_NAME}$\"] scratchpad show, scratchpad show"
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
## Author: druckdev
|
## Author: druckdev
|
||||||
## Created 2018-11-23
|
## Created 2018-11-23
|
||||||
|
|
||||||
# echo ${(pl.$LINES..\n.)}
|
# Set terminals title if this is a scratchpad-terminal
|
||||||
|
[ -z "$SCRATCHPAD_TERMINAL" ] || printf "\x1b\x5d\x30\x3bscratchpad-terminal\x07"
|
||||||
|
|
||||||
# Enable Powerlevel10k instant prompt. Should stay at the top of ~/.config/zsh/.zshrc.
|
# Enable Powerlevel10k instant prompt. Should stay at the top of ~/.config/zsh/.zshrc.
|
||||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user