blob: 53786a1cf53dfd6a62f2fb0cee97b793e780c932 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/usr/bin/env bash
# Available layouts
#
# "smartgrid", "justified", "masonry", "bands", "hero", "spiral"
# "satellite", "staggered", "columnar", "vortex", "random"
#
default_layout="smartgrid"
layout_config="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserConfigs/hyprview-layout.conf"
layout="${1:-}"
config_name="qs-hyprview"
config_path="${XDG_CONFIG_HOME:-$HOME/.config}/quickshell/${config_name}"
if [[ -z "$layout" ]]; then
if [[ -f "$layout_config" && -r "$layout_config" ]]; then
layout="$(sed -n '1p' "$layout_config" | tr -d '[:space:]')"
else
notify-send "Can't read hyprview-layout.conf, falling back to smartgrid"
fi
fi
case "$layout" in
smartgrid | justified | masonry | bands | hero | spiral | satellite | staggered | columnar | vortex | random) ;;
*) layout="$default_layout" ;;
esac
if ! pgrep -u "${UID}" -f "qs .* -p ${config_path}($| )" >/dev/null 2>&1; then
qs --log-rules "qt.qpa.wayland.textinput.warning=false" -p "${config_path}" >/dev/null 2>&1 &
sleep 0.2
fi
if ! qs -c "${config_name}" ipc call expose toggle "${layout}" >/dev/null 2>&1; then
sleep 0.3
qs -c "${config_name}" ipc call expose toggle "${layout}"
fi
|