mirror of
https://github.com/hyprwm/hyprland-wiki.git
synced 2025-12-20 03:30:02 +01:00
Configuring/Uncommon-tips-&-tricks: Improved User-Experience of "Alt tab behaviour" (#1306)
* Configuring/Uncommon-tips-&-tricks: Improved User-Experience of "Alt tab behaviour" The previous implementation executed the `focuswindow` and `alterzorder` dispatchers before the footclient process terminated. This created a timing issue that is particularly noticable during window focusing across workspaces. For example: A user on workspace 2 uses the alt-tab command to focus one out of several windows on workspace 1 which was not previously focused when the user was working on workspace 1. The focus is correctly updated but Hyprland fails to draw the active border around the newly focused window. This is fixed by updating the focus after the footclient has terminated. * Alt Tab Behaviour uses XDG_RUNTIME_DIR instead of /tmp to support multiple users on the same machine
This commit is contained in:
parent
39b4f2c566
commit
a69112ddbd
1 changed files with 9 additions and 5 deletions
|
|
@ -294,7 +294,7 @@ Dependencies :
|
||||||
1. add this to your config
|
1. add this to your config
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
exec-once = foot --server
|
exec-once = foot --server -c $XDG_CONFIG_HOME/foot/foot.ini
|
||||||
|
|
||||||
bind = ALT, TAB, exec, $HOME/.config/hypr/scripts/alttab/enable.sh 'down'
|
bind = ALT, TAB, exec, $HOME/.config/hypr/scripts/alttab/enable.sh 'down'
|
||||||
bind = ALT SHIFT, TAB, exec, $HOME/.config/hypr/scripts/alttab/enable.sh 'up'
|
bind = ALT SHIFT, TAB, exec, $HOME/.config/hypr/scripts/alttab/enable.sh 'up'
|
||||||
|
|
@ -322,6 +322,7 @@ windowrule = match:class alttab, border_size 0
|
||||||
|
|
||||||
```bash {filename="alttab.sh"}
|
```bash {filename="alttab.sh"}
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
hyprctl -q dispatch submap alttab
|
||||||
start=$1
|
start=$1
|
||||||
address=$(hyprctl -j clients | jq -r 'sort_by(.focusHistoryID) | .[] | select(.workspace.id >= 0) | "\(.address)\t\(.title)"' |
|
address=$(hyprctl -j clients | jq -r 'sort_by(.focusHistoryID) | .[] | select(.workspace.id >= 0) | "\(.address)\t\(.title)"' |
|
||||||
fzf --color prompt:green,pointer:green,current-bg:-1,current-fg:green,gutter:-1,border:bright-black,current-hl:red,hl:red \
|
fzf --color prompt:green,pointer:green,current-bg:-1,current-fg:green,gutter:-1,border:bright-black,current-hl:red,hl:red \
|
||||||
|
|
@ -337,7 +338,7 @@ address=$(hyprctl -j clients | jq -r 'sort_by(.focusHistoryID) | .[] | select(.w
|
||||||
awk -F"\t" '{print $1}')
|
awk -F"\t" '{print $1}')
|
||||||
|
|
||||||
if [ -n "$address" ] ; then
|
if [ -n "$address" ] ; then
|
||||||
hyprctl --batch -q "dispatch focuswindow address:$address ; dispatch alterzorder top"
|
echo "$address" > $XDG_RUNTIME_DIR/hypr/alttab/address
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hyprctl -q dispatch submap reset
|
hyprctl -q dispatch submap reset
|
||||||
|
|
@ -354,8 +355,8 @@ line="$1"
|
||||||
IFS=$'\t' read -r addr _ <<< "$line"
|
IFS=$'\t' read -r addr _ <<< "$line"
|
||||||
dim=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}
|
dim=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}
|
||||||
|
|
||||||
grim -t png -l 0 -w "$addr" ~/.config/hypr/scripts/alttab/preview.png
|
grim -t png -l 0 -w "$addr" $XDG_RUNTIME_DIR/hypr/alttab/preview.png
|
||||||
chafa --animate false -s "$dim" "$XDG_CONFIG_HOME/hypr/scripts/alttab/preview.png"
|
chafa --animate false --dither=none -s "$dim" "$XDG_RUNTIME_DIR/hypr/alttab/preview.png"
|
||||||
```
|
```
|
||||||
|
|
||||||
4. create file `touch $XDG_CONFIG_HOME/hypr/scripts/alttab/disable.sh && chmod +x $XDG_CONFIG_HOME/hypr/scripts/alttab/disable.sh` and add:
|
4. create file `touch $XDG_CONFIG_HOME/hypr/scripts/alttab/disable.sh && chmod +x $XDG_CONFIG_HOME/hypr/scripts/alttab/disable.sh` and add:
|
||||||
|
|
@ -370,7 +371,10 @@ hyprctl -q --batch "keyword unbind ALT, TAB ; keyword unbind ALT SHIFT, TAB ; ke
|
||||||
5. create file `touch $XDG_CONFIG_HOME/hypr/scripts/alttab/enable.sh && chmod +x $XDG_CONFIG_HOME/hypr/scripts/alttab/enable.sh` and add:
|
5. create file `touch $XDG_CONFIG_HOME/hypr/scripts/alttab/enable.sh && chmod +x $XDG_CONFIG_HOME/hypr/scripts/alttab/enable.sh` and add:
|
||||||
```bash {filename="enable.sh"}
|
```bash {filename="enable.sh"}
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
hyprctl -q --batch "keyword animations:enabled false ; dispatch exec footclient -a alttab ~/.config/hypr/scripts/alttab/alttab.sh $1 ; keyword unbind ALT, TAB ; keyword unbind ALT SHIFT, TAB ; dispatch submap alttab"
|
mkdir -p $XDG_RUNTIME_DIR/hypr/alttab
|
||||||
|
hyprctl -q --batch "keyword animations:enabled false; keyword unbind ALT, TAB ; keyword unbind ALT SHIFT, TAB"
|
||||||
|
footclient -a alttab $HOME/.config/hypr/scripts/alttab/alttab.sh $1
|
||||||
|
hyprctl --batch -q "dispatch focuswindow address:$(cat $XDG_RUNTIME_DIR/hypr/alttab/address) ; dispatch alterzorder top"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Config versioning
|
## Config versioning
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue