hyprwm / hyprland-plugins

Official plugins for Hyprland
BSD 3-Clause "New" or "Revised" License
462 stars 43 forks source link

Hyprwinwrap running on only one monitor #103

Closed hugoeustaquio closed 3 months ago

hugoeustaquio commented 3 months ago

I use the following configuration on my hyprland config:

exec-once = kitty --class=kitty-bg --config=/home/hugo/.config/kitty/kitty_background.conf -e ~/bin/hypr/workspace.zsh

plugin {
    hyprwinwrap {
        class = kitty-bg
    }
}

The script I wrote only prints the current desktop number on the desktop:

#!/usr/bin/zsh

cols=$(tput cols)
cols=$(( cols / 2 ))
print "\033[?25l"

while true; do
    title=`hyprctl -j activeworkspace | jq -r '.name'`
    lenght=${#title}
    lenght=$((lenght / 2))
    spaces=$((cols-lenght))
    printf '%*s' "$spaces"
    print $title
    sleep 1.1
    clear
done

But that makes the desktop background print only on my first monitor. If I open a terminal on my second monitor and runs again the command "kitty --class=kitty-bg --config=/home/hugo/.config/kitty/kitty_background.conf -e ~/bin/hypr/workspace.zsh", then I will have Hyprwinwrap working on both monitors. But I don't feel confortable putting two "exec-once" commands on my config, because I use a notebook, and most of the times I work on my desk with a big monitor, but sometimes on another places, without a second monitor.

Since all desktop background tools work on multiple monitors, do you guys have some parameter or solution for a single instance of a window to be shown on all monitors with Hyprwinwrap?

Thanks in advance.

hugoeustaquio commented 3 months ago

I changed my script to show the current workspace instead of the focused one. I had to write two scripts because of that, like the following:

#!/usr/bin/zsh

cols=$(tput cols)
cols=$(( cols / 2 ))

previous_title=""

print "\033[?25l"

while true; do
    title=`hyprctl -j clients | jq -r '.[] | select(.class == "kitty-bg" and .monitor == 0) .workspace .name'`
    if [[ previous_title != title ]] then
        clear
        lenght=${#title}
        lenght=$((lenght / 2))
        spaces=$((cols-lenght))
        printf '%*s' "$spaces"
        print $title
        previous_title=$title
    fi
    sleep 1.1
done

The second script is equals the first one but with a "monitor == 1" instead of zero.

I achived what I wanted with the following configuration on hyprland.conf:

exec-once = [workspace 1] kitty --class=kitty-bg --config=/home/hugo/.config/kitty/kitty_background.conf -e ~/bin/hypr/workspace1.zsh
exec-once = [workspace 2] kitty --class=kitty-bg --config=/home/hugo/.config/kitty/kitty_background.conf -e ~/bin/hypr/workspace2.zsh

I would need to run one script per monitor anyway, so I don't think this issue is in fact an issue. I'm now closing it. Sorry for the inconvenience.