moved hypr scripts
This commit is contained in:
@@ -37,8 +37,5 @@ in
|
||||
] ++ map (name: { match.tag = "shader/${name}"; "darkwindow:shade" = "${name}";}) shaders;
|
||||
};
|
||||
|
||||
|
||||
|
||||
# TODO: symlink ./windowShaders into ~/.config/hypr/
|
||||
# TODO: symlink ./shaders into ~/.config/hypr/ <- should happen in desktop/hypr.nix prolly
|
||||
home-manager.users."djai".home.file.".config/hypr/windowShaders".source = ./windowShaders;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: symlink entire shellscript directory here.
|
||||
home-manager.users."djai".home.file.".config/hypr/scripts".source = ./scripts;
|
||||
home-manager.users."djai".home.file.".config/hypr/shaders".source = ./shaders;
|
||||
|
||||
home-manager.users."djai".wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
|
||||
66
modules/desktop/scripts/bg.fish
Executable file
66
modules/desktop/scripts/bg.fish
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# This script randomly switches the background (through fehbg) every 5 to 30 minutes.
|
||||
# It selects a random image from the ~/Pictures/Wallpapers folder (including subdirectories)
|
||||
# Any hidden files in this folder are excluded.
|
||||
|
||||
# in-place awk script
|
||||
set awkcommand '
|
||||
BEGIN {
|
||||
FS=", "
|
||||
width=1920
|
||||
height=1080
|
||||
}
|
||||
|
||||
|
||||
NR == 1 {
|
||||
x = $1
|
||||
y = $2
|
||||
|
||||
if (x < 0) {
|
||||
x = width + x
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
y = height + y
|
||||
}
|
||||
|
||||
print x "," y
|
||||
}
|
||||
'
|
||||
|
||||
# kill old instances
|
||||
for i in (ps -C (basename (status filename)) | awk 'FNR>1 {print $1}')
|
||||
if test $i -ne $fish_pid
|
||||
kill $i
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# set bg
|
||||
swaybg -i $(find ~/Pictures/wallpapers -type f -regextype posix-extended -iregex "/(.*/)*[^\.]*\.(png|jpe?g|webp|gif)" | sort -R | head -n1)
|
||||
while true
|
||||
set rand (math "(floor $(random 300 1800) / 60) * 60")
|
||||
|
||||
# countdown
|
||||
while test $rand -gt 0
|
||||
set minutes (math "floor $rand / 60 ")
|
||||
|
||||
printf '\r\033[K%.2d:00' $minutes
|
||||
|
||||
sleep 60
|
||||
set rand (math $rand - 60 )
|
||||
end
|
||||
|
||||
# update wallpaper
|
||||
swaybg -i $(find ~/Pictures/wallpapers -type f -regextype posix-extended -iregex "/(.*/)*[^\.]*\.(png|jpe?g|webp|gif)" | sort -R | head -n1)
|
||||
set newpid $last_pid
|
||||
sleep 0.2
|
||||
for pid in (pgrep -x swaybg)
|
||||
if test $pid -ne $last_pid
|
||||
kill $pid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
15
modules/desktop/scripts/gamemode_hypr.sh
Executable file
15
modules/desktop/scripts/gamemode_hypr.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
HYPRGAMEMODE=$(hyprctl getoption animations:enabled | awk 'NR==1{print $2}')
|
||||
GAMING_PROFILE="GAMEINK"
|
||||
|
||||
if [ "$HYPRGAMEMODE" = "true" ] ; then
|
||||
hyprctl eval 'hl.config({ animations = { enabled = false }, decoration = { blur = { enabled = false}, rounding = 0, shadow = { enabled = false }, fullscreen_opacity = 1}, general = { border_size = 1, gaps_in = 0, gaps_out = 0}})'
|
||||
tailor profile set "$GAMING_PROFILE"
|
||||
dunstify -r 55421 -t 2000 -u low -i ~/.icons/candy-icons/apps/scalable/teamspeak.svg "Gamemode on"
|
||||
exit
|
||||
else
|
||||
dunstify -r 55421 -t 2000 -u low -i ~/.icons/candy-icons/apps/scalable/teamspeak.svg "Gamemode off"
|
||||
hyprctl reload
|
||||
exit 0
|
||||
fi
|
||||
25
modules/desktop/scripts/gamemode_power.sh
Executable file
25
modules/desktop/scripts/gamemode_power.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Toggles the GAMING_PROFILE tuxedo power profile
|
||||
|
||||
GAMEMODE=$(tailor profile list | grep active | cut --fields 1 -d' ')
|
||||
GAMING_PROFILE="GAMEINK"
|
||||
DEFAULT_PROFILE="HOTHOTHOT"
|
||||
|
||||
function failure() {
|
||||
dunstify -r 55422 -t 4000 -u normal -i ~/.icons/candy-icons/apps/scalable/teamspeak.svg "Failed to toggle power profile!"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ "$GAMEMODE" =~ "GAMEINK" ]] ; then
|
||||
# Default profile
|
||||
tailor profile set "$DEFAULT_PROFILE" || failure
|
||||
dunstify -r 55422 -t 2000 -u low -i ~/.icons/candy-icons/apps/scalable/teamspeak.svg "Gaming power profile deactivated"
|
||||
exit 0
|
||||
else
|
||||
# gaming profile
|
||||
tailor profile set "$GAMING_PROFILE" || failure
|
||||
dunstify -r 55422 -t 2000 -u low -i ~/.icons/candy-icons/apps/scalable/teamspeak.svg "Gaming power profile activated"
|
||||
hyprctl reload
|
||||
exit 0
|
||||
fi
|
||||
75
modules/desktop/scripts/keybinds.sh
Executable file
75
modules/desktop/scripts/keybinds.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script visualizes all keybindings in the hyprland config.
|
||||
# It also executes the associated command, if a keybinding is selected.
|
||||
# It uses an Awk script, column -t, and rofi-dmenu to do so.
|
||||
# Furthermore, rofi-dmenu expects the file ~/.config/rofi/keybinds.rasi to exist for theming.
|
||||
|
||||
# Awk script used for parsing `hyprctl binds`
|
||||
# Basically:
|
||||
# $1 contains submap; if empty replace with Default; also replaces shutdown mode.
|
||||
# $2 contains modmap; parsed and replaced with human-readable modifiers
|
||||
# $3 contains key
|
||||
# $4 contains description
|
||||
awkcommand='
|
||||
BEGIN {
|
||||
FS="\t"
|
||||
}
|
||||
|
||||
{
|
||||
# submap
|
||||
if ($1 == "") {
|
||||
submap = "Default"
|
||||
} else {
|
||||
submap = $1
|
||||
if (submap == "l e s h r ^s") {
|
||||
submap = "Shutdown"
|
||||
}
|
||||
}
|
||||
|
||||
# modmap parse
|
||||
modmap = $2
|
||||
mods = "1"
|
||||
if (modmap >= 64) {
|
||||
mods = gensub(/1/, " 1", 1, mods)
|
||||
modmap = modmap - 64
|
||||
}
|
||||
if (modmap >= 8) {
|
||||
mods = gensub(/1/, "Alt 1", 1, mods)
|
||||
modmap = modmap - 8
|
||||
}
|
||||
if (modmap >= 4) {
|
||||
mods = gensub(/1/, "Ctrl 1", 1, mods)
|
||||
modmap = modmap - 4
|
||||
}
|
||||
if (modmap >= 1) {
|
||||
mods = gensub(/1/, "Shift 1", 1, mods)
|
||||
modmap = modmap - 1
|
||||
}
|
||||
mods = gensub(/1/, "", 1, mods)
|
||||
|
||||
# output
|
||||
printf "%s,%s%s,%s\n", submap, mods, $3, $4
|
||||
}
|
||||
'
|
||||
|
||||
|
||||
# get binds
|
||||
binds=$(hyprctl binds -j | jq -r '.[] | select(.description != "") | [.submap, .modmask, .key, .description, .dispatcher, .arg] | @tsv')
|
||||
idx=$(printf "%s" "$binds" | awk -F'\t' "$awkcommand" | column -ts',' | rofi -i -dmenu -p "Keybinds" -config ~/.config/rofi/keybinds.rasi -format d)
|
||||
|
||||
exit
|
||||
# This is permanently borked i think.
|
||||
# Since hyprland0.55 (the lua update), hyprctl binds no longer provides the actual command
|
||||
# Instead, a pointer to a lua fragment is printed instead, which we can't do anything with.
|
||||
|
||||
# exit if user does not make a selection.
|
||||
if [[ $idx -eq 0 ]]; then
|
||||
printf "No command selected.\nExiting..\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
# get line
|
||||
cmdline=$(printf "%s" "$binds" | awk -F'\t' "NR == $idx {printf \"%s %s\", \$5, \$6}")
|
||||
# run hyprctl dispatch $5 $6 (< 5,6 of line not shell script)
|
||||
hyprctl eval $cmdline
|
||||
25
modules/desktop/scripts/screenshot_float.sh
Executable file
25
modules/desktop/scripts/screenshot_float.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script allows the user to make a screenshot (through slurp)
|
||||
# and will then open said screenshot from the clipboard into feh
|
||||
# it will also make the feh window floating, and move it to the original position of the selection
|
||||
|
||||
|
||||
slop=$(slurp -f "%x,%y %wx%h" || exit 1)
|
||||
# If the capture was cancelled, out will be empty
|
||||
if [[ -n "$slop" ]]; then
|
||||
# get x,y of selection
|
||||
coords=$(echo "$slop" | awk -F' ' '{print $1}')
|
||||
x=$(echo "$coords" | awk -F',' '{print $1}')
|
||||
y=$(echo "$coords" | awk -F',' '{print $2}')
|
||||
|
||||
grim -g "$slop" - | wl-copy
|
||||
grim -g "$slop" - | feh - -T notitle --class 'floatme' &
|
||||
pid="$!"
|
||||
|
||||
while [[ -z $(wmctrl -lp | awk -vpid=$pid '$3==pid {print $1; exit}') ]]; do
|
||||
sleep 0.05
|
||||
done
|
||||
hyprctl dispatch "hl.dsp.window.move({ x = \"$x\", y = \"$y\", relative = false})"
|
||||
fi
|
||||
|
||||
43
modules/desktop/scripts/shader_picker.sh
Executable file
43
modules/desktop/scripts/shader_picker.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script allows toggling the active screen_shader used in hyprland.
|
||||
# It automatically discovers shader files in the $SHADERDIR folder.
|
||||
# And uses rofi for a graphical gui-- this uses the shaders.rasi configuration file.
|
||||
# (Also dunst for notifications.)
|
||||
|
||||
SHADERDIR="$HOME/.config/hypr/shaders/"
|
||||
|
||||
|
||||
function dunst() {
|
||||
dunstify \
|
||||
-r 2137 \
|
||||
-t 2000 \
|
||||
-u low \
|
||||
-i ~/.icons/candy-icons/apps/scalable/applets-screenshooter.svg \
|
||||
"${1/.*/}"
|
||||
}
|
||||
|
||||
|
||||
shaders="reset,
|
||||
$(find "$SHADERDIR" -type f -regextype posix-extended -iregex '.*(frag|vert|glsl)$' | awk -F'[./]' '{printf "%s,%s.%s\n", $(NF-1), $(NF-1), $NF}')"
|
||||
|
||||
idx=$(printf "%s" "$shaders" | awk -F',' '{print $1}' | rofi -i -dmenu -P Shaders -config ~/.config/rofi/shaders.rasi -format d)
|
||||
|
||||
|
||||
# apply selected shader (if any)
|
||||
if [[ $idx -eq 0 ]]; then
|
||||
printf "No shader selected.\nExiting..\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $idx -eq 1 ]]; then
|
||||
# selected reset, which is a special case
|
||||
hyprctl reload
|
||||
dunst "Reset shader"
|
||||
exit
|
||||
fi
|
||||
|
||||
file=$(printf "%s" "$shaders" | awk -F',' "NR == $idx {printf \"%s\n\", \$2}")
|
||||
hyprctl dispatch "hl.config({ decoration = { screen_shader = '$SHADERDIR/$file'}})"
|
||||
dunst "Applied shader $file"
|
||||
|
||||
44
modules/desktop/scripts/shader_picker_window.sh
Executable file
44
modules/desktop/scripts/shader_picker_window.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script allows toggling the active screen_shader used in hyprland.
|
||||
# It automatically discovers shader files in the $SHADERDIR folder.
|
||||
# And uses rofi for a graphical gui-- this uses the shaders.rasi configuration file.
|
||||
# (Also dunst for notifications.)
|
||||
|
||||
SHADERDIR="$HOME/.config/hypr/windowShaders/"
|
||||
|
||||
|
||||
function dunst() {
|
||||
dunstify \
|
||||
-r 2137 \
|
||||
-t 2000 \
|
||||
-u low \
|
||||
-i ~/.icons/candy-icons/apps/scalable/applets-screenshooter.svg \
|
||||
"${1/.*/}"
|
||||
}
|
||||
|
||||
|
||||
shaders="reset,
|
||||
$(find "$SHADERDIR" -type f,l -regextype posix-extended -iregex '.*(frag|vert|glsl)$' | awk -F'[./]' '{printf "%s,%s.%s\n", $(NF-1), $(NF-1), $NF}')"
|
||||
|
||||
idx=$(printf "%s" "$shaders" | awk -F',' '{print $1}' | rofi -i -dmenu -P Shaders -config ~/.config/rofi/shaders.rasi -format d)
|
||||
|
||||
|
||||
# apply selected shader (if any)
|
||||
if [[ $idx -eq 0 ]]; then
|
||||
printf "No shader selected.\nExiting..\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $idx -eq 1 ]]; then
|
||||
# selected reset, which is a special case
|
||||
hyprctl dispatch 'hl.dsp.window.clear_tags()'
|
||||
hyprctl reload
|
||||
dunst "Reset shader"
|
||||
exit
|
||||
fi
|
||||
|
||||
name=$(printf "%s" "$shaders" | awk -F',' "NR == $idx {printf \"%s\n\", \$1}")
|
||||
hyprctl dispatch "hl.dsp.window.tag({ tag = 'shader/$name'})"
|
||||
dunst "Applied shader $file"
|
||||
|
||||
14
modules/desktop/scripts/toggle_focus_floating.sh
Executable file
14
modules/desktop/scripts/toggle_focus_floating.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# toggles focus between floating and tiled windows.
|
||||
|
||||
# get floating state of active window
|
||||
floating=$(hyprctl activewindow -j | jq ".floating")
|
||||
|
||||
if [ "$floating" = "true" ]; then
|
||||
# focus tiled
|
||||
hyprctl dispatch "hl.dsp.window.cycle_next({ tiled = true })"
|
||||
else
|
||||
# focus floating
|
||||
hyprctl dispatch "hl.dsp.window.cycle_next({ floating = true })"
|
||||
fi
|
||||
28
modules/desktop/scripts/toggle_touchpad.sh
Executable file
28
modules/desktop/scripts/toggle_touchpad.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
touchpad="uniw0001:00-093a:0255-touchpad"
|
||||
statFile="/tmp/tpEnabled"
|
||||
|
||||
if [ ! -f "$statFile" ]; then
|
||||
echo "false" > "$statFile"
|
||||
fi
|
||||
|
||||
current=$(cat "$statFile")
|
||||
|
||||
if [[ "$current" = "true" ]]; then
|
||||
newState="false"
|
||||
msg="disabled"
|
||||
else
|
||||
newState="true"
|
||||
msg="enabled"
|
||||
fi
|
||||
|
||||
hyprctl eval "hl.device({ name = \"$touchpad\", enabled = $newState})"
|
||||
echo "$newState" > "$statFile"
|
||||
|
||||
dunstify -u low \
|
||||
-a Touchpad \
|
||||
-i ~/.icons/candy-icons/apps/scalable/cs-desktop.svg \
|
||||
-r 365 \
|
||||
-t 1000 \
|
||||
"Touchpad $msg"
|
||||
16
modules/desktop/scripts/waybar.sh
Executable file
16
modules/desktop/scripts/waybar.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash --packages killall envsubst waybar
|
||||
|
||||
#kill old instance
|
||||
kill $(ps aux | grep '[w]aybar -c /tmp/waybar-config' | awk -F' ' '{print $2}')
|
||||
while pgrep -u $UID -x waybar > /dev/null; do
|
||||
sleep 1;
|
||||
killall -q waybar
|
||||
kill $(ps aux | grep '[w]aybar -c /tmp/waybar-config' | awk -F' ' '{print $2}')
|
||||
done
|
||||
|
||||
IFS=$'\t\n'
|
||||
MONITOR=$(hyprctl monitors -j | jq -r '.[] | select(.x==0 and .y==0) | .name') envsubst < ~/.config/waybar/config > /tmp/waybar-config
|
||||
unset IFS
|
||||
|
||||
waybar -c /tmp/waybar-config &
|
||||
66
modules/desktop/shaders/crt.frag
Normal file
66
modules/desktop/shaders/crt.frag
Normal file
@@ -0,0 +1,66 @@
|
||||
//modified version of [this shader](https://github.com/wessles/GLSL-CRT/blob/master/shader.frag)
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
const vec3 VIB_RGB_BALANCE = vec3(1.0, 1.0, 1.0);
|
||||
const float VIB_VIBRANCE = 0.40;
|
||||
|
||||
|
||||
const vec3 VIB_coeffVibrance = VIB_RGB_BALANCE * -VIB_VIBRANCE;
|
||||
|
||||
void main() {
|
||||
vec2 tc = vec2(v_texcoord.x, v_texcoord.y);
|
||||
|
||||
// Distance from the center
|
||||
float dx = abs(0.5-tc.x);
|
||||
float dy = abs(0.5-tc.y);
|
||||
|
||||
// Square it to smooth the edges
|
||||
dx *= dx;
|
||||
dy *= dy;
|
||||
|
||||
tc.x -= 0.5;
|
||||
tc.x *= 1.0 + (dy * 0.05);
|
||||
tc.x += 0.5;
|
||||
|
||||
tc.y -= 0.5;
|
||||
tc.y *= 1.0 + (dx * 0.18);
|
||||
tc.y += 0.5;
|
||||
|
||||
// Get texel, and add in scanline if need be
|
||||
vec4 cta = texture(tex, vec2(tc.x, tc.y));
|
||||
|
||||
cta.rgb += sin(tc.y * 1250.0) * 0.02;
|
||||
|
||||
// Cutoff
|
||||
if(tc.y > 1.0 || tc.x < 0.0 || tc.x > 1.0 || tc.y < 0.0)
|
||||
cta = vec4(0.0);
|
||||
|
||||
|
||||
// RGB
|
||||
vec3 color = vec3(cta[0], cta[1], cta[2]);
|
||||
|
||||
|
||||
// vec3 VIB_coefLuma = vec3(0.333333, 0.333334, 0.333333); // was for `if VIB_LUMA == 1`
|
||||
vec3 VIB_coefLuma = vec3(0.212656, 0.715158, 0.072186); // try both and see which one looks nicer.
|
||||
|
||||
float luma = dot(VIB_coefLuma, color);
|
||||
|
||||
float max_color = max(color[0], max(color[1], color[2]));
|
||||
float min_color = min(color[0], min(color[1], color[2]));
|
||||
|
||||
float color_saturation = max_color - min_color;
|
||||
|
||||
vec3 p_col = vec3(vec3(vec3(vec3(sign(VIB_coeffVibrance) * color_saturation) - 1.0) * VIB_coeffVibrance) + 1.0);
|
||||
|
||||
cta[0] = mix(luma, color[0], p_col[0]);
|
||||
cta[1] = mix(luma, color[1], p_col[1]);
|
||||
cta[2] = mix(luma, color[2], p_col[2]);
|
||||
|
||||
// Apply
|
||||
FragColor = cta;
|
||||
}
|
||||
22
modules/desktop/shaders/dim.frag
Normal file
22
modules/desktop/shaders/dim.frag
Normal file
@@ -0,0 +1,22 @@
|
||||
// blue light filter shader
|
||||
// values from https://reshade.me/forum/shader-discussion/3673-blue-light-filter-similar-to-f-lux
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 pixColor = texture(tex, v_texcoord);
|
||||
|
||||
// red
|
||||
pixColor[0] *= 0.7;
|
||||
// green
|
||||
pixColor[1] *= 0.6;
|
||||
// blue
|
||||
pixColor[2] *= 0.5;
|
||||
|
||||
FragColor = pixColor;
|
||||
}
|
||||
18
modules/desktop/shaders/grey.frag
Normal file
18
modules/desktop/shaders/grey.frag
Normal file
@@ -0,0 +1,18 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
|
||||
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
|
||||
|
||||
void main() {
|
||||
vec4 c = texture(tex, v_texcoord);
|
||||
|
||||
// Desaturate to luma only
|
||||
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
|
||||
|
||||
FragColor = vec4(luma, luma, luma, c.a);
|
||||
}
|
||||
31
modules/desktop/shaders/horror.frag
Normal file
31
modules/desktop/shaders/horror.frag
Normal file
@@ -0,0 +1,31 @@
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform mediump float time;
|
||||
|
||||
const float display_framerate = 60.0;
|
||||
const vec2 display_resolution = vec2(2520.0, 1680.0);
|
||||
|
||||
const float gamma = 1.0;
|
||||
|
||||
float rand(vec2 uv, float t) {
|
||||
return fract(sin(dot(uv, vec2(1225.6548, 321.8942))) * 4251.4865 + t);
|
||||
}
|
||||
|
||||
float Sigmoid(float x) { return 1.0 / (1.0 + (exp(-(x - 0.5) * 14.0))); }
|
||||
|
||||
void main() {
|
||||
vec4 color = texture(tex, v_texcoord);
|
||||
|
||||
color = vec4(Sigmoid(color.r), Sigmoid(color.g), Sigmoid(color.b), 1.0);
|
||||
|
||||
color = pow(color, vec4(gamma));
|
||||
|
||||
color.a = 1.0;
|
||||
|
||||
FragColor = color;
|
||||
}
|
||||
11
modules/desktop/shaders/invert.frag
Normal file
11
modules/desktop/shaders/invert.frag
Normal file
@@ -0,0 +1,11 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
void main() {
|
||||
vec4 pixColor = texture(tex, v_texcoord);
|
||||
pixColor.rgb = 1.0 - pixColor.rgb;
|
||||
FragColor = pixColor;
|
||||
}
|
||||
23
modules/desktop/shaders/noblue.frag
Normal file
23
modules/desktop/shaders/noblue.frag
Normal file
@@ -0,0 +1,23 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
|
||||
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
|
||||
|
||||
void main() {
|
||||
vec4 c = texture(tex, v_texcoord);
|
||||
|
||||
// average brightness
|
||||
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
|
||||
|
||||
if (c.r < c.g) {
|
||||
FragColor = vec4(luma, c.g, luma, c.a);
|
||||
} else {
|
||||
FragColor = vec4(c.r, luma, luma, c.a);
|
||||
}
|
||||
// FragColor = vec4(c.r, c.g, luma, c.a);
|
||||
}
|
||||
23
modules/desktop/shaders/nogreen.frag
Normal file
23
modules/desktop/shaders/nogreen.frag
Normal file
@@ -0,0 +1,23 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
|
||||
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
|
||||
|
||||
void main() {
|
||||
vec4 c = texture(tex, v_texcoord);
|
||||
|
||||
// average brightness
|
||||
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
|
||||
|
||||
if (c.r < c.b) {
|
||||
FragColor = vec4(luma, luma, c.b, c.a);
|
||||
} else {
|
||||
FragColor = vec4(c.r, luma, luma, c.a);
|
||||
}
|
||||
// FragColor = vec4(c.r, luma, c.b, c.a);
|
||||
}
|
||||
23
modules/desktop/shaders/nored.frag
Normal file
23
modules/desktop/shaders/nored.frag
Normal file
@@ -0,0 +1,23 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
|
||||
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
|
||||
|
||||
void main() {
|
||||
vec4 c = texture(tex, v_texcoord);
|
||||
|
||||
// average brightness
|
||||
float luma = dot(vec3(c.r, c.g, c.b), LumaFactors);
|
||||
|
||||
if (c.g < c.b) {
|
||||
FragColor = vec4(luma, luma, c.b, c.a);
|
||||
} else {
|
||||
FragColor = vec4(luma, c.g, luma, c.a);
|
||||
}
|
||||
// FragColor = vec4(luma, c.g, c.b, c.a);
|
||||
}
|
||||
25
modules/desktop/shaders/rainbow.frag
Normal file
25
modules/desktop/shaders/rainbow.frag
Normal file
@@ -0,0 +1,25 @@
|
||||
//modified version of [this shader](https://github.com/wessles/GLSL-CRT/blob/master/shader.frag)
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
const float scaleFactor = 0.7;
|
||||
|
||||
float clamp(float x, float min, float max) {
|
||||
if (x > max) return max;
|
||||
if (x < min) return min;
|
||||
return x;
|
||||
}
|
||||
|
||||
// [0,1]
|
||||
void main() {
|
||||
vec4 cta = texture(tex, v_texcoord);
|
||||
|
||||
// cta += vec4(cos(v_texcoord.x)/4., sin(v_texcoord.y)/4., 0., 1.);
|
||||
cta += vec4(cos(v_texcoord.x)/4., cos(v_texcoord.y)/8., sin(v_texcoord.y)/4., 1.);
|
||||
|
||||
FragColor = vec4(clamp(cta.x, 0., 1.), clamp(cta.y, 0., 1.), clamp(cta.z, 0., 1.), clamp(cta.w, 0., 1.));
|
||||
}
|
||||
14
modules/desktop/shaders/rbinvert.frag
Normal file
14
modules/desktop/shaders/rbinvert.frag
Normal file
@@ -0,0 +1,14 @@
|
||||
//modified version of [this shader](https://github.com/wessles/GLSL-CRT/blob/master/shader.frag)
|
||||
#version 300 es
|
||||
|
||||
precision mediump float;
|
||||
in vec2 v_texcoord;
|
||||
uniform sampler2D tex;
|
||||
out vec4 FragColor;
|
||||
|
||||
|
||||
// [0,1]
|
||||
void main() {
|
||||
vec4 cta = texture(tex, v_texcoord);
|
||||
FragColor = vec4(cta.z, cta.y, cta.x, cta.a);
|
||||
}
|
||||
Reference in New Issue
Block a user