From 7520bd4b96fe74c85b6ca1da8e1ddbc298143530 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 13 Feb 2020 14:01:52 +0100 Subject: Include glava --- .config/glava/bars | 1 + .config/glava/bars.glsl | 34 +++++ .config/glava/circle | 1 + .config/glava/circle.glsl | 18 +++ .config/glava/env_KWin.glsl | 8 ++ .config/glava/env_Openbox.glsl | 2 + .config/glava/env_Xfwm4.glsl | 3 + .config/glava/env_awesome.glsl | 1 + .config/glava/env_default.glsl | 1 + .config/glava/env_i3.glsl | 1 + .config/glava/env_spectrwm.glsl | 1 + .config/glava/graph | 1 + .config/glava/graph.glsl | 25 ++++ .config/glava/radial | 1 + .config/glava/radial.glsl | 35 ++++++ .config/glava/rc.glsl | 237 ++++++++++++++++++++++++++++++++++ .config/glava/rc.glsl.new | 238 +++++++++++++++++++++++++++++++++++ .config/glava/smooth_parameters.glsl | 78 ++++++++++++ .config/glava/test | 1 + .config/glava/test_rc.glsl | 27 ++++ .config/glava/util | 1 + .config/glava/wave | 1 + .config/glava/wave.glsl | 10 ++ .local/bin/glava | 89 +++++++++++++ README.md | 11 ++ 25 files changed, 826 insertions(+) create mode 120000 .config/glava/bars create mode 100755 .config/glava/bars.glsl create mode 120000 .config/glava/circle create mode 100755 .config/glava/circle.glsl create mode 100755 .config/glava/env_KWin.glsl create mode 100755 .config/glava/env_Openbox.glsl create mode 100755 .config/glava/env_Xfwm4.glsl create mode 100755 .config/glava/env_awesome.glsl create mode 100755 .config/glava/env_default.glsl create mode 100755 .config/glava/env_i3.glsl create mode 100755 .config/glava/env_spectrwm.glsl create mode 120000 .config/glava/graph create mode 100755 .config/glava/graph.glsl create mode 120000 .config/glava/radial create mode 100755 .config/glava/radial.glsl create mode 100755 .config/glava/rc.glsl create mode 100644 .config/glava/rc.glsl.new create mode 100755 .config/glava/smooth_parameters.glsl create mode 120000 .config/glava/test create mode 100755 .config/glava/test_rc.glsl create mode 120000 .config/glava/util create mode 120000 .config/glava/wave create mode 100755 .config/glava/wave.glsl create mode 100755 .local/bin/glava diff --git a/.config/glava/bars b/.config/glava/bars new file mode 120000 index 0000000..db69cbc --- /dev/null +++ b/.config/glava/bars @@ -0,0 +1 @@ +/etc/xdg/glava/bars \ No newline at end of file diff --git a/.config/glava/bars.glsl b/.config/glava/bars.glsl new file mode 100755 index 0000000..6ff84c2 --- /dev/null +++ b/.config/glava/bars.glsl @@ -0,0 +1,34 @@ +/* Note: to only render a single channel, see `setmirror` in `rc.glsl`. */ + +/* Center line thickness (pixels) */ +#define C_LINE 1 +/* Width (in pixels) of each bar */ +#define BAR_WIDTH 5 +/* Width (in pixels) of each bar gap */ +#define BAR_GAP 1 +/* Outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 1 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* Whether the current settings use the alpha channel; + enabling this is required for alpha to function + correctly on X11 with `"native"` transparency */ +#define USE_ALPHA 0 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 80 +/* Bar color. By default this provides a blue-white gradient. */ +#define COLOR @fg:mix(#3366b2, #a0a0b2, clamp(d / GRADIENT, 0, 1)) +/* Outline color. By default this provides a 'glint' outline based on the bar color */ +#define BAR_OUTLINE @bg:vec4(COLOR.rgb * 1.5, COLOR.a) +/* Direction that the bars are facing, 0 for inward, 1 for outward */ +#define DIRECTION 0 +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to flip the output vertically */ +#define FLIP 0 +/* Whether to mirror output along `Y = X`, causing output to render on the left side of the window */ +/* Use with `FLIP 1` to render on the right side */ +#define MIRROR_YX 0 +/* Whether to disable mono rendering when `#request setmirror true` is set in `rc.glsl`. */ +#define DISABLE_MONO 0 + diff --git a/.config/glava/circle b/.config/glava/circle new file mode 120000 index 0000000..45f259a --- /dev/null +++ b/.config/glava/circle @@ -0,0 +1 @@ +/etc/xdg/glava/circle \ No newline at end of file diff --git a/.config/glava/circle.glsl b/.config/glava/circle.glsl new file mode 100755 index 0000000..30906d9 --- /dev/null +++ b/.config/glava/circle.glsl @@ -0,0 +1,18 @@ +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 1.5 +/* outline color */ +#define OUTLINE @fg:#333333 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 150 +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to switch left/right audio buffers */ +#define INVERT 0 +/* Whether to fill in the space between the line and inner circle */ +#define C_FILL 0 +/* Whether to apply a post-processing image smoothing effect + 1 to enable, 0 to disable. Only works with `xroot` transparency, + and improves performance if disabled. */ +#define C_SMOOTH 1 diff --git a/.config/glava/env_KWin.glsl b/.config/glava/env_KWin.glsl new file mode 100755 index 0000000..aa168ba --- /dev/null +++ b/.config/glava/env_KWin.glsl @@ -0,0 +1,8 @@ +#request setdecorated false +#request setxwintype "normal" +#request addxwinstate "below" +#request addxwinstate "skip_taskbar" +#request addxwinstate "skip_pager" +#request addxwinstate "pinned" +#request setclickthrough true + diff --git a/.config/glava/env_Openbox.glsl b/.config/glava/env_Openbox.glsl new file mode 100755 index 0000000..c95c616 --- /dev/null +++ b/.config/glava/env_Openbox.glsl @@ -0,0 +1,2 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" diff --git a/.config/glava/env_Xfwm4.glsl b/.config/glava/env_Xfwm4.glsl new file mode 100755 index 0000000..1c20359 --- /dev/null +++ b/.config/glava/env_Xfwm4.glsl @@ -0,0 +1,3 @@ +#request setxwintype "desktop" +#request addxwinstate "pinned" +#request addxwinstate "below" diff --git a/.config/glava/env_awesome.glsl b/.config/glava/env_awesome.glsl new file mode 100755 index 0000000..7f2bba3 --- /dev/null +++ b/.config/glava/env_awesome.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/.config/glava/env_default.glsl b/.config/glava/env_default.glsl new file mode 100755 index 0000000..90336cc --- /dev/null +++ b/.config/glava/env_default.glsl @@ -0,0 +1 @@ +#request setxwintype "desktop" diff --git a/.config/glava/env_i3.glsl b/.config/glava/env_i3.glsl new file mode 100755 index 0000000..7f2bba3 --- /dev/null +++ b/.config/glava/env_i3.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/.config/glava/env_spectrwm.glsl b/.config/glava/env_spectrwm.glsl new file mode 100755 index 0000000..7f2bba3 --- /dev/null +++ b/.config/glava/env_spectrwm.glsl @@ -0,0 +1 @@ +#request setxwintype "!-" diff --git a/.config/glava/graph b/.config/glava/graph new file mode 120000 index 0000000..ba3ea75 --- /dev/null +++ b/.config/glava/graph @@ -0,0 +1 @@ +/etc/xdg/glava/graph \ No newline at end of file diff --git a/.config/glava/graph.glsl b/.config/glava/graph.glsl new file mode 100755 index 0000000..cbcce46 --- /dev/null +++ b/.config/glava/graph.glsl @@ -0,0 +1,25 @@ + +/* Vertical scale, larger values will amplify output */ +#define VSCALE 300 +/* Rendering direction, either -1 (outwards) or 1 (inwards). */ +#define DIRECTION 1 + +/* Color gradient scale, (optionally) used in `COLOR` macro */ +#define GRADIENT 75 +/* Color definition. By default this is a gradient formed by mixing two colors. + `pos` represents the pixel position relative to the visualizer baseline. */ +#define COLOR @fg:mix(#802A2A, #4F4F92, clamp(pos / GRADIENT, 0, 1)) +/* 1 to draw outline, 0 to disable */ +#define DRAW_OUTLINE 0 +/* 1 to draw edge highlight, 0 to disable */ +#define DRAW_HIGHLIGHT 1 +/* Whether to anti-alias the border of the graph, creating a smoother curve. + This may have a small impact on performance. + Note: requires `xroot` or `none` opacity to be set */ +#define ANTI_ALIAS 0 +/* outline color */ +#define OUTLINE @bg:#262626 +/* 1 to join the two channels together in the middle, 0 to clamp both down to zero */ +#define JOIN_CHANNELS 0 +/* 1 to invert (vertically), 0 otherwise */ +#define INVERT 0 diff --git a/.config/glava/radial b/.config/glava/radial new file mode 120000 index 0000000..38c5033 --- /dev/null +++ b/.config/glava/radial @@ -0,0 +1 @@ +/etc/xdg/glava/radial \ No newline at end of file diff --git a/.config/glava/radial.glsl b/.config/glava/radial.glsl new file mode 100755 index 0000000..1ed0e8b --- /dev/null +++ b/.config/glava/radial.glsl @@ -0,0 +1,35 @@ +/* center radius (pixels) */ +#define C_RADIUS 128 +/* center line thickness (pixels) */ +#define C_LINE 2 +/* outline color */ +#define OUTLINE @bg:#333333 +/* number of bars (use even values for best results) */ +#define NBARS 160 +/* width (in pixels) of each bar*/ +#define BAR_WIDTH 4.5 +/* Amplify magnitude of the results each bar displays */ +#define AMPLIFY 300 +/* How quickly the gradient transitions, in pixels */ +#define GRADIENT 95 +/* Bar color. This is a gradient by default. */ +#define COLOR @fg:mix(#3381da, #c1c1c1, clamp(d / GRADIENT, 0, 1)) +/* Angle (in radians) for how much to rotate the visualizer */ +#define ROTATE (PI / 2) +/* Whether to swap left/right audio buffers, set to 1 to enable */ +#define INVERT 0 +/* Aliasing factors. Higher values mean more defined and jagged lines. + Note: aliasing does not have a notable impact on performance, but requires + `xroot` transparency to be enabled since it relies on alpha blending with + the background. */ +#define BAR_ALIAS_FACTOR 1.2 +#define C_ALIAS_FACTOR 1.8 +/* Offset (Y) of the visualization */ +#define CENTER_OFFSET_Y 0 +/* Offset (X) of the visualization */ +#define CENTER_OFFSET_X 0 + +/* (DEPRECATED) outline color */ +#define BAR_OUTLINE OUTLINE +/* (DEPRECATED) outline width (in pixels, set to 0 to disable outline drawing) */ +#define BAR_OUTLINE_WIDTH 0 diff --git a/.config/glava/rc.glsl b/.config/glava/rc.glsl new file mode 100755 index 0000000..6b990bf --- /dev/null +++ b/.config/glava/rc.glsl @@ -0,0 +1,237 @@ + +/* The module to use. A module is a set of shaders used to produce + the visualizer. The structure for a module is the following: + + module_name [directory] + 1.frag [file: fragment shader], + 2.frag [file: fragment shader], + ... + + Shaders are loaded in numerical order, starting at '1.frag', + continuing indefinitely. The results of each shader (except + for the final pass) is given to the next shader in the list + as a 2D sampler. + + See documentation for more details. */ +#request mod radial + +/* Window hints */ +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false + +/* Set window background opacity mode. Possible values are: + + "native" - True transparency provided by the compositor. Can + reduce performance on some systems, depending on + the compositor used. + + "xroot" - Maintain a copy of the root window's pixmap + (usually the desktop background) to provide a + pseudo-transparent effect. Useful when no compositor + is available or native transparency isn't nessecary. + Has very little performance impact. + + "none" - Disable window opacity completely. */ +#request setopacity "native" + +/* Whether to average and mirror left and right audio input channels. + This may cause some modules to only render a single channel. */ +#request setmirror false + +/* OpenGL context and GLSL shader versions, do not change unless + you *absolutely* know what you are doing. */ +#request setversion 3 3 +#request setshaderversion 330 + +/* Window title */ +#request settitle "GLava" + +/* Window geometry (x, y, width, height) */ +/* #request setgeometry 0 0 800 600 */ +#request setgeometry 1650 240 800 600 + +/* Window background color (RGBA format). + Does not work with `setopacity "xroot"` */ +#request setbg 00000000 + +/* (X11 only) EWMH Window type. Possible values are: + + "desktop", "dock", "toolbar", "menu", + "utility", "splash", "dialog", "normal" + + This will set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_(TYPE), + where (TYPE) is the one of the window types listed (after being + converted to uppercase). + + Alternatively, you can set this value to "!", which will cause + the window to be unmanaged. If this is set, then `addxwinstate` + will do nothing, but you can use "!+" and "!-" to stack on top + or below other windows. +*/ +#request setxwintype "normal" + +/* (X11 only) EWMH Window state atoms (multiple can be specified). + Possible values are: + + "modal", "sticky", "maximized_vert", "maximized_horz", + "shaded", "skip_taskbar", "skip_pager", "hidden", "fullscreen", + "above", "below", "demands_attention", "focused", "pinned" + + This will add _NET_WM_STATE_(TYPE) atoms to _NET_WM_STATE, + where (TYPE) is one of the window states listed (after being + converted to uppercase). + + The lines below (commented out by default) are of relevance + if you are trying to get GLava to behave as a desktop widget + and your WM is not correctly responding to the "desktop" value + for `setxwintype`. +*/ +// #request addxwinstate "sticky" +// #request addxwinstate "skip_taskbar" +// #request addxwinstate "skip_pager" +// #request addxwinstate "above" +// #request addxwinstate "pinned" + +/* (X11 only) Use the XShape extension to support clicking through + the GLava window. Useful when you want to interact with other + desktop windows (icons, menus, desktop shells). Enabled by + default when GLava itself is a desktop window. */ +#request setclickthrough false + +/* Audio source + + When the "pulseaudio" backend is set, this can be a number or + a name of an audio sink or device to record from. Set to "auto" + to use the default output device. + + When the "fifo" backend is set, "auto" is interpreted as + "/tmp/mpd.fifo". Otherwise, a valid path should be provided. */ +#request setsource "auto" + +/* Buffer swap interval (vsync), set to '0' to prevent + waiting for refresh, '1' (or more) to wait for the specified + amount of frames. */ +#request setswap 1 + +/* Linear interpolation for audio data frames. Drastically + improves smoothness with configurations that yield low UPS + (`setsamplerate` and `setsamplesize`), or monitors that have + high refresh rates. + + This feature itself, however, will effect performance as it + will have to interpolate data every frame on the CPU. It will + automatically (and temporarily) disable itself if the update + rate is close to, or higher than the framerate: + + if (update_rate / frame_rate > 0.9) disable_interpolation; + + This will delay data output by one update frame, so it can + desync audio with visual effects on low UPS configs. */ +#request setinterpolate false + +/* Frame limiter, set to the frames per second (FPS) desired or + simply set to zero (or lower) to disable the frame limiter. */ +#request setframerate 0 + +/* Suspends rendering if a fullscreen window is focused while + GLava is still visible (ie. on another monitor). This prevents + rendering from interfering with other graphically intensive + tasks. + + If GLava is minimized or completely obscured, it will not + render regardless of this option. */ +#request setfullscreencheck false + +/* Enable/disable printing framerate every second. 'FPS' stands + for 'Frames Per Second', and 'UPS' stands for 'Updates Per + Second'. Updates are performed when new data is submitted + by pulseaudio, and require transformations to be re-applied + (thus being a good measure of how much work your CPU has to + perform over time) */ +#request setprintframes true + +/* PulseAudio sample buffer size. Lower values result in more + frequent audio updates (also depends on sampling rate), but + will also require all transformations to be applied much + more frequently (CPU intensive). + + High (>2048, with 22050 Hz) values will decrease accuracy + (as some signals can be missed by transformations like FFT) + + The following settings (@22050 Hz) produce the listed rates: + + Sample UPS Description + - 2048 -> 43.0 (low accuracy, cheap), use with < 60 FPS + - 1024 -> 86.1 (high accuracy, expensive), use with >= 60 FPS + - 512 -> 172.3 (extreme accuracy, very expensive), use only + for graphing accurate spectrum data with + custom modules. + + If the framerate drops below the update rate, the update rate + will be locked to the framerate (to prevent wasting CPU time). + This behaviour means you can use a 1024 sample size on a 60Hz + monitor with vsync enabled to get 60FPS and 60UPS. + + For high refresh rate monitors (120+ Hz), it's recommended to + also stick with the 1024 sample size and use interpolation to + smooth the data, as accuracy beyond this setting is mostly + meaningless for visual purposes. +*/ +#request setsamplesize 1024 + +/* Audio buffer size to be used for processing and shaders. + Increasing this value can have the effect of adding 'gravity' + to FFT output, as the audio signal will remain in the buffer + longer. + + This value has a _massive_ effect on FFT performance and + quality for some modules. */ +#request setbufsize 4096 + +/* PulseAudio sample rate. Lower values can add 'gravity' to + FFT output, but can also reduce accuracy. Most hardware + samples at 44100Hz. + + Lower sample rates also can make output more choppy, when + not using interpolation. It's generally OK to leave this + value unless you have a strange PulseAudio configuration. + + This option does nothing when using the "fifo" audio + backend. Instead, an ideal rate should be be configured + in the application generating the output. */ +#request setsamplerate 22050 + +/* Enable GPU acceleration of the audio buffer's fourier transform. + This drastically reduces CPU usage, but should be avoided on + old integrated graphics hardware. + + Enabling this also enables acceleration for post-FFT processing + effects, such as gravity, averaging, windowing, and interpolation. */ +#request setaccelfft true + +/* ** DEPRECATED ** + Force window geometry (locking the window in place), useful + for some pesky WMs that try to reposition the window when + embedding in the desktop. + + This routinely sends X11 events and should be avoided. */ +#request setforcegeometry false + +/* ** DEPRECATED ** + Force window to be raised (focused in some WMs), useful for + WMs that have their own stacking order for desktop windows. + + This routinely sends X11 events and should be avoided. */ +#request setforceraised false + +/* ** DEPRECATED ** + Scale down the audio buffer before any operations are + performed on the data. Higher values are faster. + + This value can affect the output of various transformations, + since it applies (crude) averaging to the data when shrinking + the buffer. It is reccommended to use `setsamplerate` and + `setsamplesize` to improve performance or accuracy instead. */ +#request setbufscale 1 diff --git a/.config/glava/rc.glsl.new b/.config/glava/rc.glsl.new new file mode 100644 index 0000000..741e514 --- /dev/null +++ b/.config/glava/rc.glsl.new @@ -0,0 +1,238 @@ + +/* The module to use. A module is a set of shaders used to produce + the visualizer. The structure for a module is the following: + + module_name [directory] + 1.frag [file: fragment shader], + 2.frag [file: fragment shader], + ... + + Shaders are loaded in numerical order, starting at '1.frag', + continuing indefinitely. The results of each shader (except + for the final pass) is given to the next shader in the list + as a 2D sampler. + + See documentation for more details. */ +#request mod radial + +/* Window hints */ +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false + +/* Set window background opacity mode. Possible values are: + + "native" - True transparency provided by the compositor. Can + reduce performance on some systems, depending on + the compositor used. + + "xroot" - Maintain a copy of the root window's pixmap + (usually the desktop background) to provide a + pseudo-transparent effect. Useful when no compositor + is available or native transparency isn't nessecary. + Has very little performance impact. + + "none" - Disable window opacity completely. */ +#request setopacity "native" + +/* Whether to average and mirror left and right audio input channels. + This may cause some modules to only render a single channel. */ +#request setmirror false + +/* OpenGL context and GLSL shader versions, do not change unless + you *absolutely* know what you are doing. */ +#request setversion 3 3 +#request setshaderversion 330 + +/* Window title */ +#request settitle "GLava" + +/* Window geometry (x, y, width, height) */ +/* #request setgeometry 0 0 800 600 */ +#request setgeometry 1890 440 300 200 + +/* Window background color (RGBA format). + Does not work with `setopacity "xroot"` */ +#request setbg 00000000 + +/* (X11 only) EWMH Window type. Possible values are: + + "desktop", "dock", "toolbar", "menu", + "utility", "splash", "dialog", "normal" + + This will set _NET_WM_WINDOW_TYPE to _NET_WM_WINDOW_TYPE_(TYPE), + where (TYPE) is the one of the window types listed (after being + converted to uppercase). + + Alternatively, you can set this value to "!", which will cause + the window to be unmanaged. If this is set, then `addxwinstate` + will do nothing, but you can use "!+" and "!-" to stack on top + or below other windows. +*/ +#request setxwintype "normal" + +/* (X11 only) EWMH Window state atoms (multiple can be specified). + Possible values are: + + "modal", "sticky", "maximized_vert", "maximized_horz", + "shaded", "skip_taskbar", "skip_pager", "hidden", "fullscreen", + "above", "below", "demands_attention", "focused", "pinned" + + This will add _NET_WM_STATE_(TYPE) atoms to _NET_WM_STATE, + where (TYPE) is one of the window states listed (after being + converted to uppercase). + + The lines below (commented out by default) are of relevance + if you are trying to get GLava to behave as a desktop widget + and your WM is not correctly responding to the "desktop" value + for `setxwintype`. +*/ +// #request addxwinstate "sticky" +// #request addxwinstate "skip_taskbar" +// #request addxwinstate "skip_pager" +// #request addxwinstate "above" +// #request addxwinstate "pinned" + +/* (X11 only) Use the XShape extension to support clicking through + the GLava window. Useful when you want to interact with other + desktop windows (icons, menus, desktop shells). Enabled by + default when GLava itself is a desktop window. */ +#request setclickthrough false + +/* Audio source + + When the "pulseaudio" backend is set, this can be a number or + a name of an audio sink or device to record from. Set to "auto" + to use the default output device. + + When the "fifo" backend is set, "auto" is interpreted as + "/tmp/mpd.fifo". Otherwise, a valid path should be provided. */ +#request setsource "auto" + +/* Buffer swap interval (vsync), set to '0' to prevent + waiting for refresh, '1' (or more) to wait for the specified + amount of frames. */ +#request setswap 1 + +/* Linear interpolation for audio data frames. Drastically + improves smoothness with configurations that yield low UPS + (`setsamplerate` and `setsamplesize`), or monitors that have + high refresh rates. + + This feature itself, however, will effect performance as it + will have to interpolate data every frame on the CPU. It will + automatically (and temporarily) disable itself if the update + rate is close to, or higher than the framerate: + + if (update_rate / frame_rate > 0.9) disable_interpolation; + + This will delay data output by one update frame, so it can + desync audio with visual effects on low UPS configs. */ +#request setinterpolate false + +/* Frame limiter, set to the frames per second (FPS) desired or + simply set to zero (or lower) to disable the frame limiter. */ +#request setframerate 0 + +/* Suspends rendering if a fullscreen window is focused while + GLava is still visible (ie. on another monitor). This prevents + rendering from interfering with other graphically intensive + tasks. + + If GLava is minimized or completely obscured, it will not + render regardless of this option. */ +#request setfullscreencheck false + +/* Enable/disable printing framerate every second. 'FPS' stands + for 'Frames Per Second', and 'UPS' stands for 'Updates Per + Second'. Updates are performed when new data is submitted + by pulseaudio, and require transformations to be re-applied + (thus being a good measure of how much work your CPU has to + perform over time) */ +#request setprintframes true + +/* PulseAudio sample buffer size. Lower values result in more + frequent audio updates (also depends on sampling rate), but + will also require all transformations to be applied much + more frequently (CPU intensive). + + High (>2048, with 22050 Hz) values will decrease accuracy + (as some signals can be missed by transformations like FFT) + + The following settings (@22050 Hz) produce the listed rates: + + Sample UPS Description + - 2048 -> 43.0 (low accuracy, cheap), use with < 60 FPS + - 1024 -> 86.1 (high accuracy, expensive), use with >= 60 FPS + - 512 -> 172.3 (extreme accuracy, very expensive), use only + for graphing accurate spectrum data with + custom modules. + + If the framerate drops below the update rate, the update rate + will be locked to the framerate (to prevent wasting CPU time). + This behaviour means you can use a 1024 sample size on a 60Hz + monitor with vsync enabled to get 60FPS and 60UPS. + + For high refresh rate monitors (120+ Hz), it's recommended to + also stick with the 1024 sample size and use interpolation to + smooth the data, as accuracy beyond this setting is mostly + meaningless for visual purposes. +*/ +#request setsamplesize 1024 + +/* Audio buffer size to be used for processing and shaders. + Increasing this value can have the effect of adding 'gravity' + to FFT output, as the audio signal will remain in the buffer + longer. + + This value has a _massive_ effect on FFT performance and + quality for some modules. */ +#request setbufsize 4096 + +/* PulseAudio sample rate. Lower values can add 'gravity' to + FFT output, but can also reduce accuracy. Most hardware + samples at 44100Hz. + + Lower sample rates also can make output more choppy, when + not using interpolation. It's generally OK to leave this + value unless you have a strange PulseAudio configuration. + + This option does nothing when using the "fifo" audio + backend. Instead, an ideal rate should be be configured + in the application generating the output. */ +#request setsamplerate 22050 + +/* Enable GPU acceleration of the audio buffer's fourier transform. + This drastically reduces CPU usage, but should be avoided on + old integrated graphics hardware. + + Enabling this also enables acceleration for post-FFT processing + effects, such as gravity, averaging, windowing, and interpolation. */ +#request setaccelfft true + +/* ** DEPRECATED ** + Force window geometry (locking the window in place), useful + for some pesky WMs that try to reposition the window when + embedding in the desktop. + + This routinely sends X11 events and should be avoided. */ +#request setforcegeometry false + +/* ** DEPRECATED ** + Force window to be raised (focused in some WMs), useful for + WMs that have their own stacking order for desktop windows. + + This routinely sends X11 events and should be avoided. */ +#request setforceraised false + +/* ** DEPRECATED ** + Scale down the audio buffer before any operations are + performed on the data. Higher values are faster. + + This value can affect the output of various transformations, + since it applies (crude) averaging to the data when shrinking + the buffer. It is reccommended to use `setsamplerate` and + `setsamplesize` to improve performance or accuracy instead. */ +#request setbufscale 1 +yay diff --git a/.config/glava/smooth_parameters.glsl b/.config/glava/smooth_parameters.glsl new file mode 100755 index 0000000..09e829f --- /dev/null +++ b/.config/glava/smooth_parameters.glsl @@ -0,0 +1,78 @@ + +/* Settings for smoothing functions and transformations commonly + used to display FFT output. + + IMPORTANT: THESE VALUES CAN BE OVERRIDDEN IN MODULE CONFIG + FILES, IF CHANGING VALUES HERE DOES NOT WORK, CHECK + TO MAKE SURE THEY ARE NOT BEING SET ELSEWHERE. +*/ + +/* The type of formula to use for weighting values when smoothing. + Possible values: + + - circular heavily rounded points + - sinusoidal rounded at both low and high weighted values + like a sine wave + - linear not rounded at all; linear distance + */ +#define ROUND_FORMULA sinusoidal + +/* The sampling mode for processing raw FFT input: + + - average averages all the inputs in the sample range for + a given point. Produces smooth output, but peaks + are not well represented + - maximum obtains the best value from the closest peak in + the sample range. Very accurate peaks, but + output is jagged and sporadic. + - hybrid uses the results from both `average` and `maximum` + with the weight provided in `SAMPLE_HYBRID_WEIGHT` */ +#define SAMPLE_MODE average +/* Weight should be provided in the range (0, 1). Higher values favour + averaged results. `hybrid` mode only. */ +#define SAMPLE_HYBRID_WEIGHT 0.65 + +/* Factor used to scale frequencies. Lower values allows lower + frequencies to occupy more space. */ +#define SAMPLE_SCALE 8 + +/* The frequency range to sample. 1.0 would be the entire FFT output, + and lower values reduce the displayed frequencies in a log-like + scale. */ +#define SAMPLE_RANGE 0.9 + +/* Factor for how to scale higher frequencies. Used in a linear equation + which is multiplied by the result of the fft transformation. */ +#request setfftscale 10.2 + +/* Cutoff for the bass end of the audio data when scaling frequencies. + Higher values cause more of the bass frequencies to be skipped when + scaling. */ +#request setfftcutoff 0.3 + +/* How many frames to queue and run through the average function. + Increasing this value will create latency between the audio and the + animation, but will make for much smoother results. */ +#request setavgframes 5 + +/* Whether to window frames ran through the average function (new & old + frames are weighted less). This massively helps smoothing out + spontaneous values in the animation. */ +#request setavgwindow true + +/* Gravity step, higher values means faster drops. The step is applied + in a rate independant method like so: + + val -= (gravitystep) * (seconds per update) */ +#request setgravitystep 4.2 + +/* Smoothing factor. Larger values mean more smoothing in the output, + however high values can be expensive to compute. Values are in + normalized width: [0.0, 1.0) */ +#request setsmoothfactor 0.025 + +/* Whether to use a separate pass for audio data while smoothing. On + most hardware, this will improve performance, but involves doing a + separate render step for each audio texture and will add some driver + (CPU) overhead. */ +#request setsmoothpass true diff --git a/.config/glava/test b/.config/glava/test new file mode 120000 index 0000000..9c764b4 --- /dev/null +++ b/.config/glava/test @@ -0,0 +1 @@ +/etc/xdg/glava/test \ No newline at end of file diff --git a/.config/glava/test_rc.glsl b/.config/glava/test_rc.glsl new file mode 100755 index 0000000..60ebf43 --- /dev/null +++ b/.config/glava/test_rc.glsl @@ -0,0 +1,27 @@ +#request mod test +#request setfloating false +#request setdecorated true +#request setfocused false +#request setmaximized false +#request setopacity "native" +#request setmirror false +#request setversion 3 3 +#request setshaderversion 330 +#request settitle "GLava" +#request setgeometry 0 0 640 640 +#request setbg 00000000 +#request setxwintype "desktop" +#request setclickthrough false +#request setsource "auto" +#request setswap 0 +#request setinterpolate true +#request setframerate 0 +#request setfullscreencheck false +#request setprintframes true +#request setsamplesize 1024 +#request setbufsize 4096 +#request setsamplerate 22050 +#request setforcegeometry false +#request setforceraised false +#request setbufscale 1 +#request settesteval 55000055 diff --git a/.config/glava/util b/.config/glava/util new file mode 120000 index 0000000..929e70b --- /dev/null +++ b/.config/glava/util @@ -0,0 +1 @@ +/etc/xdg/glava/util \ No newline at end of file diff --git a/.config/glava/wave b/.config/glava/wave new file mode 120000 index 0000000..1eb95a8 --- /dev/null +++ b/.config/glava/wave @@ -0,0 +1 @@ +/etc/xdg/glava/wave \ No newline at end of file diff --git a/.config/glava/wave.glsl b/.config/glava/wave.glsl new file mode 100755 index 0000000..f23848d --- /dev/null +++ b/.config/glava/wave.glsl @@ -0,0 +1,10 @@ +/* Min (vertical) line thickness */ +#define MIN_THICKNESS 1 +/* Max (vertical) line thickness */ +#define MAX_THICKNESS 6 +/* Base color to use, distance from center will multiply the RGB components */ +#define BASE_COLOR @fg:vec4(0.7, 0.2, 0.45, 1) +/* Amplitude */ +#define AMPLIFY 500 +/* Outline color */ +#define OUTLINE @bg:vec4(0.15, 0.15, 0.15, 1) diff --git a/.local/bin/glava b/.local/bin/glava new file mode 100755 index 0000000..8979c71 --- /dev/null +++ b/.local/bin/glava @@ -0,0 +1,89 @@ +#! /usr/bin/env sh + +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU Affero General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +# details. + +readonly BIN=${OPT_BIN:-/usr/bin/glava} + +main() +{ + # Handle opts + opts "$@" + shift "$OPTS" + unset OPTS + + # Show help + [ "$OPT_HELP_ONLY" ] && usage && exit 0 + + # Get geometry + get_primary_monitor_geometry + width=${OPT_WIDTH:-$GEOMETRY_X} + height=${OPT_HEIGHT:-$GEOMETRY_Y} + + # Calculate dimensions + glava_x=$(( ((GEOMETRY_X - width) / 2) + GEOMETRY_OFFSET_X )) + glava_y=$(( ((GEOMETRY_Y - height) / 2) + GEOMETRY_OFFSET_Y )) + + # Run glava + "$BIN" \ + --force-mod="${OPT_MOD:-radial}" \ + --audio="${OPT_AUDIO:-pulseaudio}" \ + --request="setgeometry $glava_x $glava_y $width $height" \ + --desktop \ + "$@" +} + +opts() +{ + OPTS=0 + + while getopts ":b:hm:s:" opt + do + case "$opt" in + a) OPT_AUDIO=$OPTARG ; OPTS=$(( OPTS + 2 )) ;; + b) OPT_BIN=$OPTARG ; OPTS=$(( OPTS + 1 )) ;; + h) OPT_HELP_ONLY=1 ;; + m) OPT_MOD=$OPTARG ; OPTS=$(( OPTS + 2 )) ;; + s) OPT_WIDTH=${OPTARG%x*} ; OPT_HEIGHT=${OPTARG#*x} ; OPTS=$(( OPTS + 2)) ;; + *) + printf "Invalid option passed: %s\n" "$OPTARG" >&2 + ;; + esac + done + + unset opt +} + +get_primary_monitor_geometry() +{ + xrandr_output=$(xrandr | grep 'connected primary' | awk '{ print $4 }' | sed 's/[x+]/ /g') + + GEOMETRY_X=$(printf "%s" "$xrandr_output" | awk '{ print $1 }') + GEOMETRY_Y=$(printf "%s" "$xrandr_output" | awk '{ print $2 }') + GEOMETRY_OFFSET_X=$(printf "%s" "$xrandr_output" | awk '{ print $3 }') + GEOMETRY_OFFSET_Y=$(printf "%s" "$xrandr_output" | awk '{ print $4 }') + + unset xrandr_output +} + +usage() +{ + cat <