Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Opening/closing windows in fullscreen

Open Dickby opened this issue 3 years ago • 7 comments
trafficstars

Not shure if that is desired, but i would prefer that openging/closing a window doesn't exits the fullscreen state:

  • when a window is shown in fullscreen and another window is opened, that new window would become the new fullscreen window.
  • when a fullscreen window is being closed and it was not the only window on the current workspace, the next window that gains focus would become the new fullscreen window

Dickby avatar Aug 12 '22 16:08 Dickby

Can't you already make a group of windows and show only one fullscreen?

Estebiu avatar Aug 14 '22 09:08 Estebiu

Well yes, so give me the possibility to make a group of 1 window that would work too. Otherwise i get that behaviour only if i have more than one window open when creating the group, and i lose it whenever i close the second last window. Another way (I would prefer) to make a new layout, that is just fullscreen windows. If i can toggle that layout per workspace, it would basicly be the same thing. But to be honest to have that behaviour whenever fullscreen is enabled would make most sense.

Dickby avatar Aug 27 '22 16:08 Dickby

Not giving up on this one yet!

Dickby avatar Aug 27 '22 16:08 Dickby

@vaxerski I still think that this would make a lot of sense! I often have a fullscreen application, open another window, and have turn it into fullscreen again. Maybe a boolean viariable like window_open_close_exits_fullscreen could be used if you think it's not for everybody. If you don't want this at all, since this issue is more than a month old and you never commented on it, feel free to close this issue.

Dickby avatar Sep 21 '22 11:09 Dickby

I never commented on it because I have nothing to say. It's a reasonable and perfectly fine request, just haven't gotten around to implementing it yet.

vaxerski avatar Sep 21 '22 11:09 vaxerski

I think it would be also cool to have an option to make a window fullsceen only if it's the only open app in a given workspace. Like you make firefox automatically open in fullscreen; then you open a terminal with nmtui to connect to the network and it goes in tiling mode; and when you exit nmtui firefox goes back to fullscreen.

Estebiu avatar Sep 25 '22 12:09 Estebiu

lookup no_gaps_when_only

Dickby avatar Sep 25 '22 12:09 Dickby

half implemented in b814ba98a7c74e29afe4e5e543ee6d0283a67d67

vaxerski avatar Oct 02 '23 15:10 vaxerski

I mentioned something similar to that. Unfortunately, this solution still doesn't solve my problem. What I mentioned in the previous method was an option. If activated, it would allow me to completely ignore the fullscreen window within the tiling layout. This means the next opened window, which is part of the tiling layout, wouldn't automatically unfullscreen the previous window. It would also consider the new window as the first in the tiling layout and fill the whole screen.

For a more detailed explanation and a video example demonstrating this functionality, i've linked this comment to my last post explaining the reason why it would be a reasonable thing and also how it would work using example of another window manager.

https://github.com/hyprwm/Hyprland/issues/3349

RyanOrigens avatar Oct 16 '23 12:10 RyanOrigens

Regarding

when a fullscreen window is being closed and it was not the only window on the current workspace, the next window that gains focus would become the new fullscreen window

There was a Reddit discussion between @huup and @luravoid here:

They eventually arrived at the solution that makes use of UNIX Sockets (see docs for IPC).

The final shell script that @luravoid posted was:

#!/bin/sh

handle() {
  case $1 in 
    fullscreen* | workspace* | focusedmon*)
      clients=$(hyprctl -j clients)
    ;;
    closewindow*)
      closed_window=$(echo "$1" | cut -d'>' -f3)
      closed_window="0x${closed_window}"
      monitors=$(hyprctl -j monitors)
      active_workspace=$(echo "$monitors" | jq -r '.[] | select(.focused == true) | if .specialWorkspace.name != "" then .specialWorkspace.name else .activeWorkspace.name end')
      fullscreen=$(echo "$clients" | jq -r ".[] | select(.address == \"$closed_window\" and .workspace.name == \"$active_workspace\" and .fullscreen == true) | .address")
      fullscreen_mode=$(echo "$clients" | jq -r ".[] | select(.address == \"$closed_window\" and .workspace.name == \"$active_workspace\" and .fullscreen == true) | .fullscreenMode")

      if [ -n "$fullscreen" ]; then
        if [ "$fullscreen_mode" -eq 0 ]; then
          hyprctl dispatch fullscreen 0
        elif [ "$fullscreen_mode" -eq 1 ]; then
          hyprctl dispatch fullscreen 1
        fi
      fi
    ;;
  esac
}

socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done

Source: https://www.reddit.com/r/hyprland/comments/1cup8cx/comment/l5ejvdz/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button


Would be great if there was an option to support this natively in config. Will look to see if I can draft a pull request.

nktnet1 avatar Jul 13 '24 14:07 nktnet1