~kris/dots

srice

ref: e98f3b030dc24445bd55c68d95d2d81933fd68b3 srice/.config/eww/scripts/fullscreen-monitor.sh -rw-r--r-- 821 bytes
e98f3b03 — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago
                                                                                
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
#!/bin/bash

# Fungsi untuk cek apakah ada window aplikasi yang fullscreen
is_fullscreen() {
    fullscreen_count=$(i3-msg -t get_tree 2>/dev/null | jq '[.. | select(.window? != null and .fullscreen_mode? == 1)] | length' 2>/dev/null)
    
    if [ "$fullscreen_count" -gt 0 ]; then
        return 0
    else
        return 1
    fi
}

# Loop terus menerus
prev_state="not_fullscreen"

while true; do
    if is_fullscreen; then
        current_state="fullscreen"
        if [ "$prev_state" != "fullscreen" ]; then
            eww close bar 2>/dev/null
            prev_state="fullscreen"
        fi
    else
        current_state="not_fullscreen"
        if [ "$prev_state" != "not_fullscreen" ]; then
            eww open bar 2>/dev/null
            prev_state="not_fullscreen"
        fi
    fi
    
    sleep 0.3
done