Giter Club home page Giter Club logo

Comments (8)

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 23, 2024

ugh.. I didn't thought on that! it's a really good question.

I will look around. if you found a good solution that works for multiple and single monitors set up don't doubt on making a PR. Will be very appreciated.

I'm thinking to make the script that runs the glslViewer a bit more complex and probably using a better scripting language than bash... probably python. The motivation for that is also to support shaders that use geometries and vertex shaders and multiple images.... In that case I think the challenge would be how to excecute multiple instances of glslViewer one for each monitors. Do you have a clear idea how to execute glfw3 apps in different screens ?

from .glslscreensaver.

giezu avatar giezu commented on May 23, 2024

Sure thing, I will try to do it later on Gnome3 and i3wm :)

from .glslscreensaver.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 23, 2024

thanks! I'm excited to collaborate on it!

from .glslscreensaver.

giezu avatar giezu commented on May 23, 2024

I wrote script that may work, but there are some problems.
First I get list of resolution and position of connected displays with xrandr and some filtering with awk/cut.
Next I make screenshot of each display and filter offsets of displays (x and y, needed for xdotool later).
Now time for glslViewer instance with given screenshot (/tmp/glslScreensaver$i.png) running in background.
When I run second instance, I think first one is killed ? I'm not sure, but looks like it stops immediately.
Also there is problem with synchronization, when I want to move windows with xdotool sometimes they're not created yet so I can't get window id.
Sleep is just a hack that sometimes works sometimes not.

run.sh:
`#!/bin/sh

screenshotPath='/tmp/glslScreensaver'
extension='.png'
displays=$(xrandr | grep connected | awk '{gsub("primary ", "");print}' | cut -d" " -f3 | awk '{gsub(" ", "\n");print}')
i=1
echo "$displays" | while IFS= read -r display_pos; do
screenshot=${screenshotPath}${i}${extension}
import -window root -crop $display_pos $screenshot
glslViewer /home/$USER/.glslScreensaver/shader.frag -e cursor,off -ss $screenshot > /dev/null &
i=$((i+1))
done

sleep 5 #wait for glslViewer start?

i=1
echo "$displays" | while IFS= read -r display_pos; do
xoffset=$(echo $display_pos | cut -d"+" -f2)
yoffset=$(echo $display_pos | cut -d"+" -f3)
winID=$(xdotool search --name glslViewer | sed "${i}q;d")
echo $winID
echo $xoffset $yoffset
xdotool windowmove $winID $xoffset $yoffset
i=$((i+1))
done`

from .glslscreensaver.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 23, 2024

@giezu ! I was just looking into this.

  1. To give us more ease I'm porting the script that runs the screensaver to Python and adding it to glslViewer it's already a dependency so I figure would be useful to put it there in the mean time so this repository hold just my screensavers and ppl can make their own repos / clone or fork. Check it here: https://github.com/patriciogonzalezvivo/glslViewer/blob/master/bin/glslScreenSaver
  2. Add a YAML config file to leave on the ~ folder as ~/.glslScreenSaver.yaml. Take a look to it... the idea is that will give more flexibility on what kind of shaders we can load

Hope this changes gives you more high level tools to work in this

from .glslscreensaver.

giezu avatar giezu commented on May 23, 2024

That python script with YAML configuration file looks like a good way.
I was thinking about other way, creating multiple OpenGL windows with multiple contexts and passing list of screenshots created for each window to each shader instance but looks like you found easier way :)

from .glslscreensaver.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on May 23, 2024

I think you will be able to push your approach better in that Python script. I'm failing to lunch glslViewer in a particular screen with DISPLAY=:0.0 glslViewer ... I just look to your script and seams you lunch it and then move it with xdotool. Never use it? how it works?

from .glslscreensaver.

giezu avatar giezu commented on May 23, 2024

Well, I'm trying to move it with xdotool but I need window ID to do that. Sometimes I can get id of just one window, because first is killed already, sometimes I don't get any id because I run xdotool to early. It's tool for moving windows geometry, setting fullscreen/windowed mode etc.
DISPLAY=:0.0 approach may not work because in my case two displays are treated as one bigger screen, one of resolution 1920x1080 with offset 0+0, second one 1440x900 with offset 1920+0 (to the right of primary display).

from .glslscreensaver.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.