Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullscreen application in window #895

Open
maker2413 opened this issue Nov 6, 2022 · 9 comments
Open

Fullscreen application in window #895

maker2413 opened this issue Nov 6, 2022 · 9 comments

Comments

@maker2413
Copy link

Forgive me if I am using the wrong terminology, but is there currently a way to fullscreen a video or an application for that matter to take up the entire window within the current emacs frame as opposed to taking up the whole screen? My exact use case is that I would like a way to fullscreen a youtube video and have it use all of the screen real estate of its window without taking up the whole frame of the workspace.

Ideally there would be a function to called say exwm-fullscreen-in-window that could be set to a keybinding that would toggle whether window is fullscreened in the current window or the entire frame like default.

I had similar functionality setup in stumpwm, but stumpwm doesn't give me the same emacs-centric workflow that I get in exwm so I am trying to move back.

@maker2413
Copy link
Author

I'm not all that great at lisp but here is a link to a good entrypoint into the stumpwm logic to do this: https://github.com/stumpwm/stumpwm/blob/ff6cb73f48f0df4285948f1009ef3b285c78b351/tile-window.lisp#L120-L136

@eval-on-point
Copy link

The functions #'exwm-layout-unset-fullscreen and #'exwm-layout-toggle-fullscreen will take a fullscreen window such as a youtube video and shrink it into its associated Emacs window.

Since the modeline is not available in a fullscreen window (as fas as I know), you will need to bind these functions to a key sequence that you can execute with the fullscreen window selected.

I don't know if there is a way to prevent windows from going completely fullscreen in the first place, but I think that would be a nice option to override many apps such as games that default to a full screen window.

@maker2413
Copy link
Author

Thanks @eval-on-point for pointing this out, but maybe a used the wrong terminology, but this isn't what I meant. I was under the impression that in emacs terminology windows are the actual panes that fill a frame. What I am wanting is to split my frame into two windows and fullscreen an application within its window ie: it would be a fullscreened application that takes up half of my screen and not the entire screen.

This is what I'm basing my terminology off of: https://wikemacs.org/wiki/Emacs_Terminology.

Here is also an example of what this looks like in stumpwm: stumpwm/stumpwm#974 for a better picture.

@maker2413
Copy link
Author

maker2413 commented Nov 22, 2022

I don't quite have the elisp skills to pull this off on my own at the moment, but I would that this is a feature that has to be implemented to pull off this workflow from what I saw looking through the repo.

@medranocalvo
Copy link
Collaborator

@maker2413: I use "window" to refer to Emacs windows and "X window" to refer to... X windows.

I think this is an interesting feature, I'm not sure what it'd take to implement it.

@maker2413
Copy link
Author

@medranocalvo Thanks for adding those labels and for providing the terminology tips!

@eval-on-point
Copy link

eval-on-point commented Nov 30, 2022

I am not sure about a general solution, but your specific use case (a youtube video or similar full screen browser video being contained within an Emacs window) is solved by the procedure I've described above. It is kind of hacky because the video's window will first be fullscreened, then you will call #'exwm-layout-unset-fullscreen on it. I just wanted to clarify for future readers.

Here is a screenshot of what it looks like: scrot

@maker2413
Copy link
Author

Hey @eval-on-point thanks for providing this, sorry I didn't understand the first time you posted it. This work around does give me the functionality I was asking for. I'll still leave this issue open in case anyone with more elisp experience than myself wants to take a crack a more proper solution.

@maker2413
Copy link
Author

maker2413 commented May 24, 2023

Hey I circled back to this after not thinking about it for a few months and I think I've gotten closer to a solution to implement this. I modified the exwm-workspace--get-geometry function found here:

exwm/exwm-workspace.el

Lines 289 to 296 in 1c706da

(defun exwm-workspace--get-geometry (frame)
"Return the geometry of frame FRAME."
(or (frame-parameter frame 'exwm-geometry)
(make-instance 'xcb:RECTANGLE
:x 0
:y 0
:width (x-display-pixel-width)
:height (x-display-pixel-height))))
to use window-pixel-width and window-pixel-height as opposed to x-display-pixel-width and x-display-pixel-height. This does limit fullscreen applications to the window they currently exist in and this does work with youtube videos or video games. However being that this does disable actually being able to fullscreen an application I wouldn't consider this a proper fix still in it's current state. I think having a way to specify a list of applications that should only fullscreen in their perspective window and have a way to override that even for an application in the list with a keybinding would be a more proper implementation, but I wanted to share what I have found and potentially get other people's input. Here is the code snippet I have in my config currently:

(defun exwm-workspace--get-geometry (frame)
  "Return the geometry of frame FRAME."
  (or (frame-parameter frame 'exwm-geometry)
      (make-instance 'xcb:RECTANGLE
                     :x (window-pixel-left)
                     :y (window-pixel-top)
                     :width (window-pixel-width)
                     :height (window-pixel-height))))

I want to attempt to do a more proper implementation when I get time so let me know if you think there is a better way than what I suggested so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants