From e3779b4ab7a56d1edea9897f3fff8f23d3f74c06 Mon Sep 17 00:00:00 2001 From: John Costa Date: Tue, 24 Sep 2024 16:45:38 +0100 Subject: [PATCH] adding hyprland dotfiles --- hypr/hypridle.conf | 23 ++ hypr/hyprland.conf | 10 + hypr/hyprland/colors.conf | 34 ++ hypr/hyprland/env.conf | 21 + hypr/hyprland/execs.conf | 33 ++ hypr/hyprland/general.conf | 162 ++++++++ hypr/hyprland/keybinds.conf | 212 ++++++++++ hypr/hyprland/rules.conf | 79 ++++ hypr/hyprlock.conf | 102 +++++ hypr/hyprlock/status.sh | 29 ++ hypr/shaders/chromatic_abberation.frag | 24 ++ hypr/shaders/crt.frag | 511 +++++++++++++++++++++++++ hypr/shaders/drugs.frag | 42 ++ hypr/shaders/extradark.frag | 21 + hypr/shaders/invert.frag | 13 + hypr/shaders/solarized.frag | 41 ++ 16 files changed, 1357 insertions(+) create mode 100755 hypr/hypridle.conf create mode 100644 hypr/hyprland.conf create mode 100644 hypr/hyprland/colors.conf create mode 100644 hypr/hyprland/env.conf create mode 100644 hypr/hyprland/execs.conf create mode 100644 hypr/hyprland/general.conf create mode 100644 hypr/hyprland/keybinds.conf create mode 100644 hypr/hyprland/rules.conf create mode 100755 hypr/hyprlock.conf create mode 100755 hypr/hyprlock/status.sh create mode 100644 hypr/shaders/chromatic_abberation.frag create mode 100644 hypr/shaders/crt.frag create mode 100644 hypr/shaders/drugs.frag create mode 100644 hypr/shaders/extradark.frag create mode 100644 hypr/shaders/invert.frag create mode 100644 hypr/shaders/solarized.frag diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf new file mode 100755 index 00000000..a11179d0 --- /dev/null +++ b/hypr/hypridle.conf @@ -0,0 +1,23 @@ +$lock_cmd = pidof hyprlock || hyprlock +$suspend_cmd = pidof steam || systemctl suspend || loginctl suspend # fuck nvidia + +general { + lock_cmd = $lock_cmd + before_sleep_cmd = loginctl lock-session +} + +listener { + timeout = 180 # 3mins + on-timeout = loginctl lock-session +} + +listener { + timeout = 240 # 4mins + on-timeout = hyprctl dispatch dpms off + on-resume = hyprctl dispatch dpms on +} + +listener { + timeout = 540 # 9mins + on-timeout = $suspend_cmd +} diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf new file mode 100644 index 00000000..832e7d6b --- /dev/null +++ b/hypr/hyprland.conf @@ -0,0 +1,10 @@ +# This file sources other files in `hyprland` and `custom` folders +# You wanna add your stuff in file in `custom` + +# Defaults +source=~/.config/hypr/hyprland/env.conf +source=~/.config/hypr/hyprland/execs.conf +source=~/.config/hypr/hyprland/general.conf +source=~/.config/hypr/hyprland/rules.conf +source=~/.config/hypr/hyprland/colors.conf +source=~/.config/hypr/hyprland/keybinds.conf diff --git a/hypr/hyprland/colors.conf b/hypr/hyprland/colors.conf new file mode 100644 index 00000000..2eef0252 --- /dev/null +++ b/hypr/hyprland/colors.conf @@ -0,0 +1,34 @@ +# exec = export SLURP_ARGS='-d -c E2DFFFBB -b 44446544 -s 00000000' + +general { + col.active_border = rgba(E0E2EF39) + col.inactive_border = rgba(8D909F30) +} + +misc { + background_color = rgba(10131CFF) +} + +plugin { + hyprbars { + # Honestly idk if it works like css, but well, why not + bar_text_font = Rubik, Geist, AR One Sans, Reddit Sans, Inter, Roboto, Ubuntu, Noto Sans, sans-serif + bar_height = 30 + bar_padding = 10 + bar_button_padding = 5 + bar_precedence_over_border = true + bar_part_of_window = true + + bar_color = rgba(10131CFF) + col.text = rgba(E0E2EFFF) + + + # example buttons (R -> L) + # hyprbars-button = color, size, on-click + hyprbars-button = rgb(E0E2EF), 13, 󰖭, hyprctl dispatch killactive + hyprbars-button = rgb(E0E2EF), 13, 󰖯, hyprctl dispatch fullscreen 1 + hyprbars-button = rgb(E0E2EF), 13, 󰖰, hyprctl dispatch movetoworkspacesilent special + } +} + +windowrulev2 = bordercolor rgba(B3C5FFAA) rgba(B3C5FF77),pinned:1 \ No newline at end of file diff --git a/hypr/hyprland/env.conf b/hypr/hyprland/env.conf new file mode 100644 index 00000000..0c9464bb --- /dev/null +++ b/hypr/hyprland/env.conf @@ -0,0 +1,21 @@ +# ######### Input method ########## +# See https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland +env = QT_IM_MODULE, fcitx +env = XMODIFIERS, @im=fcitx +# env = GTK_IM_MODULE, wayland # Crashes electron apps in xwayland +# env = GTK_IM_MODULE, fcitx # My Gtk apps no longer require this to work with fcitx5 hmm +env = SDL_IM_MODULE, fcitx +env = GLFW_IM_MODULE, ibus +env = INPUT_METHOD, fcitx + +# ############ Themes ############# +env = QT_QPA_PLATFORM, wayland +env = QT_QPA_PLATFORMTHEME, qt6ct +# env = QT_STYLE_OVERRIDE,kvantum +# env = WLR_NO_HARDWARE_CURSORS, 1 + +# ######## Screen tearing ######### +# env = WLR_DRM_NO_ATOMIC, 1 + +# ############ Others ############# + diff --git a/hypr/hyprland/execs.conf b/hypr/hyprland/execs.conf new file mode 100644 index 00000000..1388d00f --- /dev/null +++ b/hypr/hyprland/execs.conf @@ -0,0 +1,33 @@ +# Bar, wallpaper +exec-once = swww-daemon --format xrgb +exec-once = /usr/lib/geoclue-2.0/demos/agent & gammastep +exec-once = ags & + +exec-once = XDG_MENU_PREFIX=arch- kbuildsycoca6 + +exec = gsettings set org.gnome.desktop.interface gtk-theme "Nordic" # for GTK3 apps +exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps +env = QT_QPA_PLATFORMTHEME,qt6ct # for Qt apps + +# Input method +exec-once = fcitx5 + +# Core components (authentication, lock screen, notification daemon) +exec-once = hypridle +exec-once = dbus-update-activation-environment --all +exec-once = sleep 1 && dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # Some fix idk +exec-once = hyprpm reload + +exec-once = python ../../ags/scripts/wayland-idle-inhibitor.py + +# Audio +exec-once = easyeffects --gapplication-service + +# Clipboard: history +# exec-once = wl-paste --watch cliphist store & +exec-once = wl-paste --type text --watch cliphist store +exec-once = wl-paste --type image --watch cliphist store + +# Cursor +exec-once = hyprctl setcursor Bibata-Modern-Classic 24 + diff --git a/hypr/hyprland/general.conf b/hypr/hyprland/general.conf new file mode 100644 index 00000000..60594d78 --- /dev/null +++ b/hypr/hyprland/general.conf @@ -0,0 +1,162 @@ +# MONITOR CONFIG +# monitor=,preferred,auto,1 +# monitor=,addreserved, 0, 0, 0, 0 # Custom reserved area + +# HDMI port: mirror display. To see device name, use `hyprctl monitors` +monitor=HDMI-A-1,2560x1440@144,1920x0,1,mirror,eDP-1 + +input { + # Keyboard: Add a layout and uncomment kb_options for Win+Space switching shortcut + kb_layout = us + # kb_options = grp:win_space_toggle + numlock_by_default = true + repeat_delay = 250 + repeat_rate = 35 + + touchpad { + natural_scroll = yes + disable_while_typing = true + clickfinger_behavior = true + scroll_factor = 0.5 + } + special_fallthrough = true + follow_mouse = 1 +} + +binds { + # focus_window_on_workspace_c# For Auto-run stuff see execs.confhange = true + scroll_event_delay = 0 +} + +gestures { + workspace_swipe = true + workspace_swipe_distance = 700 + workspace_swipe_fingers = 4 + workspace_swipe_cancel_ratio = 0.2 + workspace_swipe_min_speed_to_force = 5 + workspace_swipe_direction_lock = true + workspace_swipe_direction_lock_threshold = 10 + workspace_swipe_create_new = true +} + +general { + # Gaps and border + gaps_in = 4 + gaps_out = 12 + gaps_workspaces = 50 + border_size = 2 + + # Fallback colors + col.active_border = rgba(0DB7D4FF) + col.inactive_border = rgba(31313600) + + resize_on_border = true + no_focus_fallback = true + layout = dwindle + + #focus_to_other_workspaces = true # ahhhh i still haven't properly implemented this + allow_tearing = true # This just allows the `immediate` window rule to work +} + +dwindle { + preserve_split = true + # no_gaps_when_only = 1 + smart_split = false + smart_resizing = false +} + +decoration { + rounding = 20 + + blur { + enabled = true + xray = true + special = false + new_optimizations = true + size = 14 + passes = 4 + brightness = 1 + noise = 0.01 + contrast = 1 + popups = true + popups_ignorealpha = 0.6 + } + # Shadow + drop_shadow = true + shadow_ignore_window = true + shadow_range = 20 + shadow_offset = 0 2 + shadow_render_power = 4 + col.shadow = rgba(0000002A) + + # Dim + dim_inactive = false + dim_strength = 0.1 + dim_special = 0 +} + +animations { + enabled = true + # Animation curves + + bezier = linear, 0, 0, 1, 1 + bezier = md3_standard, 0.2, 0, 0, 1 + bezier = md3_decel, 0.05, 0.7, 0.1, 1 + bezier = md3_accel, 0.3, 0, 0.8, 0.15 + bezier = overshot, 0.05, 0.9, 0.1, 1.1 + bezier = crazyshot, 0.1, 1.5, 0.76, 0.92 + bezier = hyprnostretch, 0.05, 0.9, 0.1, 1.0 + bezier = menu_decel, 0.1, 1, 0, 1 + bezier = menu_accel, 0.38, 0.04, 1, 0.07 + bezier = easeInOutCirc, 0.85, 0, 0.15, 1 + bezier = easeOutCirc, 0, 0.55, 0.45, 1 + bezier = easeOutExpo, 0.16, 1, 0.3, 1 + bezier = softAcDecel, 0.26, 0.26, 0.15, 1 + bezier = md2, 0.4, 0, 0.2, 1 # use with .2s duration + # Animation configs + animation = windows, 1, 3, md3_decel, popin 60% + animation = windowsIn, 1, 3, md3_decel, popin 60% + animation = windowsOut, 1, 3, md3_accel, popin 60% + animation = border, 1, 10, default + animation = fade, 1, 3, md3_decel + # animation = layers, 1, 2, md3_decel, slide + animation = layersIn, 1, 3, menu_decel, slide + animation = layersOut, 1, 1.6, menu_accel + animation = fadeLayersIn, 1, 2, menu_decel + animation = fadeLayersOut, 1, 4.5, menu_accel + animation = workspaces, 1, 7, menu_decel, slide + # animation = workspaces, 1, 2.5, softAcDecel, slide + # animation = workspaces, 1, 7, menu_decel, slidefade 15% + # animation = specialWorkspace, 1, 3, md3_decel, slidefadevert 15% + animation = specialWorkspace, 1, 3, md3_decel, slidevert +} + +misc { + vfr = 1 + vrr = 1 + animate_manual_resizes = false + animate_mouse_windowdragging = false + enable_swallow = false + swallow_regex = (foot|kitty|allacritty|Alacritty) + + disable_hyprland_logo = true + force_default_wallpaper = 0 + new_window_takes_over_fullscreen = 2 + allow_session_lock_restore = true + + initial_workspace_tracking = false +} + +# Overview +plugin { + hyprexpo { + columns = 3 + gap_size = 5 + bg_col = rgb(000000) + workspace_method = first 1 # [center/first] [workspace] e.g. first 1 or center m+1 + + enable_gesture = false # laptop touchpad, 4 fingers + gesture_distance = 300 # how far is the "max" + gesture_positive = false + } +} diff --git a/hypr/hyprland/keybinds.conf b/hypr/hyprland/keybinds.conf new file mode 100644 index 00000000..362c589e --- /dev/null +++ b/hypr/hyprland/keybinds.conf @@ -0,0 +1,212 @@ +# Lines ending with `# [hidden]` won't be shown on cheatsheet +# Lines starting with #! are section headings + +bindl = Alt ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle # [hidden] +bindl = Super ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle # [hidden] +bindl = ,XF86AudioMute, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0% # [hidden] +bindl = Super+Shift,M, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0% # [hidden] +bindle=, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ # [hidden] +bindle=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- # [hidden] + +bindl = Ctrl,m, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle # [hidden] + +# Uncomment these if you can't get AGS to work +#bindle=, XF86MonBrightnessUp, exec, brightnessctl set '12.75+' +#bindle=, XF86MonBrightnessDown, exec, brightnessctl set '12.75-' + +#! +##! Essentials for beginners + +bind = , Super, exec, true # Open app launcher +bind = Ctrl+Super, T, exec, ~/.config/ags/scripts/color_generation/switchwall.sh # Change wallpaper +##! Actions +# Screenshot, Record, OCR, Color picker, Clipboard history +bind = Super, V, exec, pkill fuzzel || cliphist list | fuzzel --no-fuzzy --dmenu | cliphist decode | wl-copy # Clipboard history >> clipboard +bind = Super, Period, exec, pkill fuzzel || ~/.local/bin/fuzzel-emoji # Pick emoji >> clipboard +bind = Ctrl+Shift+Alt, Delete, exec, pkill wlogout || wlogout -p layer-shell # [hidden] +bind = Super+Shift, S, exec, ~/.config/ags/scripts/grimblast.sh --freeze copy area # Screen snip +bind = Super+Shift+Alt, S, exec, grim -g "$(slurp)" - | swappy -f - # Screen snip >> edit +# OCR +bind = Super+Shift,T,exec,grim -g "$(slurp $SLURP_ARGS)" "tmp.png" && tesseract -l eng "tmp.png" - | wl-copy && rm "tmp.png" # Screen snip to text >> clipboard +bind = Ctrl+Super+Shift,S,exec,grim -g "$(slurp $SLURP_ARGS)" "tmp.png" && tesseract "tmp.png" - | wl-copy && rm "tmp.png" # [hidden] +# Color picker +bind = Super+Shift, C, exec, hyprpicker -a # Pick color (Hex) >> clipboard +# Fullscreen screenshot +bindl=,Print,exec,grim - | wl-copy # Screenshot >> clipboard +bindl= Ctrl,Print, exec, mkdir -p ~/Pictures/Screenshots && ~/.config/ags/scripts/grimblast.sh copysave screen ~/Pictures/Screenshots/Screenshot_"$(date '+%Y-%m-%d_%H.%M.%S')".png # Screenshot >> clipboard & file +# Recording stuff +bind = Super+Alt, R, exec, ~/.config/ags/scripts/record-script.sh # Record region (no sound) +bind = Ctrl+Alt, R, exec, ~/.config/ags/scripts/record-script.sh --fullscreen # [hidden] Record screen (no sound) +bind = Super+Shift+Alt, R, exec, ~/.config/ags/scripts/record-script.sh --fullscreen-sound # Record screen (with sound) +##! Session +bind = Ctrl+Super, L, exec, ags run-js 'lock.lock()' # [hidden] +bind = Super, L, exec, loginctl lock-session # Lock +bind = Super+Shift, L, exec, loginctl lock-session # [hidden] +bindl = Super+Shift, L, exec, sleep 0.1 && systemctl suspend || loginctl suspend # Suspend system +bind = Ctrl+Shift+Alt+Super, Delete, exec, systemctl poweroff || loginctl poweroff # [hidden] Power off + +#! +##! Window management +# Focusing +#/# bind = Super, ←/↑/→/↓,, # Move focus in direction +bind = Super, Left, movefocus, l # [hidden] +bind = Super, Right, movefocus, r # [hidden] +bind = Super, Up, movefocus, u # [hidden] +bind = Super, Down, movefocus, d # [hidden] +bind = Super, BracketLeft, movefocus, l # [hidden] +bind = Super, BracketRight, movefocus, r # [hidden] +bindm = Super, mouse:272, movewindow +bindm = Super, mouse:273, resizewindow +bind = Super, Q, killactive, +bind = Super+Shift+Alt, Q, exec, hyprctl kill # Pick and kill a window +##! Window arrangement +#/# bind = Super+Shift, ←/↑/→/↓,, # Window: move in direction +bind = Super+Shift, Left, movewindow, l # [hidden] +bind = Super+Shift, Right, movewindow, r # [hidden] +bind = Super+Shift, Up, movewindow, u # [hidden] +bind = Super+Shift, Down, movewindow, d # [hidden] +# Window split ratio +#/# binde = Super, +/-,, # Window: split ratio +/- 0.1 +binde = Super, Minus, splitratio, -0.1 # [hidden] +binde = Super, Equal, splitratio, +0.1 # [hidden] +binde = Super, Semicolon, splitratio, -0.1 # [hidden] +binde = Super, Apostrophe, splitratio, +0.1 # [hidden] +# Positioning mode +bind = Super+Alt, Space, togglefloating, +bind = Super+Alt, F, fullscreenstate, 0 3 # Toggle fake fullscreen +bind = Super, F, fullscreen, 0 +bind = Super, D, fullscreen, 1 + +#! +##! Workspace navigation +# Switching +#/# bind = Super, Hash,, # Focus workspace # (1, 2, 3, 4, ...) +bind = Super, 1, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 1 # [hidden] +bind = Super, 2, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 2 # [hidden] +bind = Super, 3, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 3 # [hidden] +bind = Super, 4, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 4 # [hidden] +bind = Super, 5, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 5 # [hidden] +bind = Super, 6, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 6 # [hidden] +bind = Super, 7, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 7 # [hidden] +bind = Super, 8, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 8 # [hidden] +bind = Super, 9, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 9 # [hidden] +bind = Super, 0, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh workspace 10 # [hidden] + +#/# bind = Ctrl+Super, ←/→,, # Workspace: focus left/right +bind = Ctrl+Super, Right, workspace, +1 # [hidden] +bind = Ctrl+Super, Left, workspace, -1 # [hidden] +#/# bind = Super, Scroll ↑/↓,, # Workspace: focus left/right +bind = Super, mouse_up, workspace, +1 # [hidden] +bind = Super, mouse_down, workspace, -1 # [hidden] +bind = Ctrl+Super, mouse_up, workspace, +1 # [hidden] +bind = Ctrl+Super, mouse_down, workspace, -1 # [hidden] +#/# bind = Super, Page_↑/↓,, # Workspace: focus left/right +bind = Super, Page_Down, workspace, +1 # [hidden] +bind = Super, Page_Up, workspace, -1 # [hidden] +bind = Ctrl+Super, Page_Down, workspace, +1 # [hidden] +bind = Ctrl+Super, Page_Up, workspace, -1 # [hidden] +## Special +bind = Super, S, togglespecialworkspace, +bind = Super, mouse:275, togglespecialworkspace, + +##! Workspace management +# Move window to workspace Super + Alt + [0-9] +#/# bind = Super+Alt, Hash,, # Window: move to workspace # (1, 2, 3, 4, ...) +bind = Super+Alt, 1, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 1 # [hidden] +bind = Super+Alt, 2, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 2 # [hidden] +bind = Super+Alt, 3, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 3 # [hidden] +bind = Super+Alt, 4, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 4 # [hidden] +bind = Super+Alt, 5, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 5 # [hidden] +bind = Super+Alt, 6, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 6 # [hidden] +bind = Super+Alt, 7, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 7 # [hidden] +bind = Super+Alt, 8, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 8 # [hidden] +bind = Super+Alt, 9, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 9 # [hidden] +bind = Super+Alt, 0, exec, ~/.config/ags/scripts/hyprland/workspace_action.sh movetoworkspacesilent 10 # [hidden] + +bind = Ctrl+Super+Shift, Up, movetoworkspacesilent, special # [hidden] + +bind = Ctrl+Super+Shift, Right, movetoworkspace, +1 # [hidden] +bind = Ctrl+Super+Shift, Left, movetoworkspace, -1 # [hidden] +bind = Ctrl+Super, BracketLeft, workspace, -1 # [hidden] +bind = Ctrl+Super, BracketRight, workspace, +1 # [hidden] +bind = Ctrl+Super, Up, workspace, -5 # [hidden] +bind = Ctrl+Super, Down, workspace, +5 # [hidden] +#/# bind = Super+Shift, Scroll ↑/↓,, # Window: move to workspace left/right +bind = Super+Shift, mouse_down, movetoworkspace, -1 # [hidden] +bind = Super+Shift, mouse_up, movetoworkspace, +1 # [hidden] +bind = Super+Alt, mouse_down, movetoworkspace, -1 # [hidden] +bind = Super+Alt, mouse_up, movetoworkspace, +1 # [hidden] +#/# bind = Super+Shift, Page_↑/↓,, # Window: move to workspace left/right +bind = Super+Alt, Page_Down, movetoworkspace, +1 # [hidden] +bind = Super+Alt, Page_Up, movetoworkspace, -1 # [hidden] +bind = Super+Shift, Page_Down, movetoworkspace, +1 # [hidden] +bind = Super+Shift, Page_Up, movetoworkspace, -1 # [hidden] +bind = Super+Alt, S, movetoworkspacesilent, special +bind = Super, P, pin + +bind = Ctrl+Super, S, togglespecialworkspace, # [hidden] +bind = Alt, Tab, cyclenext # [hidden] sus keybind +bind = Alt, Tab, bringactivetotop, # [hidden] bring it to the top + +#! +##! Widgets +bindr = Ctrl+Super, R, exec, killall ags ydotool; ags & # Restart widgets +bindr = Ctrl+Super+Alt, R, exec, hyprctl reload; killall ags ydotool; ags & # [hidden] +bind = Ctrl+Alt, Slash, exec, ags run-js 'cycleMode();' # Cycle bar mode (normal, focus) +bindir = Super, Super_L, exec, ags -t 'overview' # Toggle overview/launcher +bind = Super, Tab, exec, ags -t 'overview' # [hidden] +bind = Super, Slash, exec, for ((i=0; i<$(hyprctl monitors -j | jq length); i++)); do ags -t "cheatsheet""$i"; done # Show cheatsheet +bind = Super, B, exec, ags -t 'sideleft' # Toggle left sidebar +bind = Super, A, exec, ags -t 'sideleft' # [hidden] +bind = Super, O, exec, ags -t 'sideleft' # [hidden] +bind = Super, N, exec, ags -t 'sideright' # Toggle right sidebar +bind = Super, M, exec, ags run-js 'openMusicControls.value = (!mpris.getPlayer() ? false : !openMusicControls.value);' # Toggle music controls +bind = Super, Comma, exec, ags run-js 'openColorScheme.value = true; Utils.timeout(2000, () => openColorScheme.value = false);' # View color scheme and options +bind = Super, K, exec, for ((i=0; i<$(hyprctl monitors -j | jq length); i++)); do ags -t "osk""$i"; done # Toggle on-screen keyboard +bind = Ctrl+Alt, Delete, exec, for ((i=0; i<$(hyprctl monitors -j | jq length); i++)); do ags -t "session""$i"; done # Toggle power menu +bind = Ctrl+Super, G, exec, for ((i=0; i<$(hyprctl monitors -j | jq length); i++)); do ags -t "crosshair""$i"; done # Toggle crosshair +bindle=, XF86MonBrightnessUp, exec, ags run-js 'brightness.screen_value += 0.05; indicator.popup(1);' # [hidden] +bindle=, XF86MonBrightnessDown, exec, ags run-js 'brightness.screen_value -= 0.05; indicator.popup(1);' # [hidden] +bindl = , XF86AudioMute, exec, ags run-js 'indicator.popup(1);' # [hidden] +bindl = Super+Shift,M, exec, ags run-js 'indicator.popup(1);' # [hidden] + +# Testing +# bind = SuperAlt, f12, exec, notify-send "Hyprland version: $(hyprctl version | head -2 | tail -1 | cut -f2 -d ' ')" "owo" -a 'Hyprland keybind' +# bind = Super+Alt, f12, exec, notify-send "Millis since epoch" "$(date +%s%N | cut -b1-13)" -a 'Hyprland keybind' +bind = Super+Alt, f12, exec, notify-send 'Test notification' "Here's a really long message to test truncation and wrapping\nYou can middle click or flick this notification to dismiss it!" -a 'Shell' -A "Test1=I got it!" -A "Test2=Another action" -t 5000 # [hidden] +bind = Super+Alt, Equal, exec, notify-send "Urgent notification" "Ah hell no" -u critical -a 'Hyprland keybind' # [hidden] + +##! Media +bindl= Super+Shift, N, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # Next track +bindl= ,XF86AudioNext, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden] +bindl= ,XF86AudioPrev, exec, playerctl previous # [hidden] +bind = Super+Shift+Alt, mouse:275, exec, playerctl previous # [hidden] +bind = Super+Shift+Alt, mouse:276, exec, playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` # [hidden] +bindl= Super+Shift, B, exec, playerctl previous # Previous track +bindl= Super+Shift, P, exec, playerctl play-pause # Play/pause media +bindl= ,XF86AudioPlay, exec, playerctl play-pause # [hidden] +bindl= ,XF86AudioPause, exec, playerctl play-pause # [hidden] + +#! +##! Apps +bind = Super, T, exec, kitty # Launch foot (terminal) +bind = Super, Z, exec, Zed # Launch Zed (editor) +bind = Super, C, exec, code --password-store=gnome --enable-features=UseOzonePlatform --ozone-platform=wayland # Launch VSCode (editor) +bind = Super, E, exec, nautilus --new-window # Launch Nautilus (file manager) +bind = Super+Alt, E, exec, thunar # [hidden] +bind = Super, W, exec, google-chrome-stable # [hidden] Let's not give people (more) reason to shit on my rice +bind = Ctrl+Super, W, exec, firefox # Launch Firefox (browser) +bind = Super, X, exec, gnome-text-editor --new-window # Launch GNOME Text Editor +bind = Super+Shift, W, exec, wps # Launch WPS Office +bind = Super, I, exec, XDG_CURRENT_DESKTOP="gnome" gnome-control-center # Launch GNOME Settings +bind = Ctrl+Super, V, exec, pavucontrol # Launch pavucontrol (volume mixer) +bind = Ctrl+Super+Shift, V, exec, easyeffects # Launch EasyEffects (equalizer & other audio effects) +bind = Ctrl+Shift, Escape, exec, gnome-system-monitor # Launch GNOME System monitor +bind = Ctrl+Super, Slash, exec, pkill anyrun || anyrun # Toggle fallback launcher: anyrun +bind = Super+Alt, Slash, exec, pkill anyrun || fuzzel # Toggle fallback launcher: fuzzel + +# Cursed stuff +## Make window not amogus large +bind = Ctrl+Super, Backslash, resizeactive, exact 640 480 # [hidden] + + diff --git a/hypr/hyprland/rules.conf b/hypr/hyprland/rules.conf new file mode 100644 index 00000000..74cb10a0 --- /dev/null +++ b/hypr/hyprland/rules.conf @@ -0,0 +1,79 @@ +# ######## Window rules ######## +windowrule = noblur,.* +# windowrule = opacity 0.89 override 0.89 override, .* # Applies transparency to EVERY WINDOW +windowrule = float, ^(blueberry.py)$ +windowrule = float, ^(steam)$ +windowrule = float, ^(guifetch)$ # FlafyDev/guifetch +windowrulev2 = tile, class:(dev.warp.Warp) +windowrulev2 = float, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$ +windowrule = center, title:^(Open File)(.*)$ +windowrule = center, title:^(Select a File)(.*)$ +windowrule = center, title:^(Choose wallpaper)(.*)$ +windowrule = center, title:^(Open Folder)(.*)$ +windowrule = center, title:^(Save As)(.*)$ +windowrule = center, title:^(Library)(.*)$ +windowrule = center, title:^(File Upload)(.*)$ + +# Dialogs +windowrule=float,title:^(Open File)(.*)$ +windowrule=float,title:^(Select a File)(.*)$ +windowrule=float,title:^(Choose wallpaper)(.*)$ +windowrule=float,title:^(Open Folder)(.*)$ +windowrule=float,title:^(Save As)(.*)$ +windowrule=float,title:^(Library)(.*)$ +windowrule=float,title:^(File Upload)(.*)$ + +# Tearing +windowrule=immediate,.*\.exe +windowrulev2=immediate,class:(steam_app) + +# No shadow for tiled windows +windowrulev2 = noshadow,floating:0 + +# ######## Layer rules ######## +layerrule = xray 1, .* +# layerrule = noanim, .* +layerrule = noanim, walker +layerrule = noanim, selection +layerrule = noanim, overview +layerrule = noanim, anyrun +layerrule = noanim, indicator.* +layerrule = noanim, osk +layerrule = noanim, hyprpicker +layerrule = blur, shell:* +layerrule = ignorealpha 0.6, shell:* + +layerrule = noanim, noanim +layerrule = blur, gtk-layer-shell +layerrule = ignorezero, gtk-layer-shell +layerrule = blur, launcher +layerrule = ignorealpha 0.5, launcher +layerrule = blur, notifications +layerrule = ignorealpha 0.69, notifications + +# ags +layerrule = animation slide top, sideleft.* +layerrule = animation slide top, sideright.* +layerrule = blur, session + +layerrule = blur, bar +layerrule = ignorealpha 0.6, bar +layerrule = blur, corner.* +layerrule = ignorealpha 0.6, corner.* +layerrule = blur, dock +layerrule = ignorealpha 0.6, dock +layerrule = blur, indicator.* +layerrule = ignorealpha 0.6, indicator.* +layerrule = blur, overview +layerrule = ignorealpha 0.6, overview +layerrule = blur, cheatsheet +layerrule = ignorealpha 0.6, cheatsheet +layerrule = blur, sideright +layerrule = ignorealpha 0.6, sideright +layerrule = blur, sideleft +layerrule = ignorealpha 0.6, sideleft +layerrule = blur, indicator* +layerrule = ignorealpha 0.6, indicator* +layerrule = blur, osk +layerrule = ignorealpha 0.6, osk + diff --git a/hypr/hyprlock.conf b/hypr/hyprlock.conf new file mode 100755 index 00000000..786dd776 --- /dev/null +++ b/hypr/hyprlock.conf @@ -0,0 +1,102 @@ +# $text_color = rgba(E0E2EFFF) +# $entry_background_color = rgba(10131C11) +# $entry_border_color = rgba(8D909F55) +# $entry_color = rgba(C3C6D6FF) +$text_color = rgba(FFFFFFFF) +$entry_background_color = rgba(33333311) +$entry_border_color = rgba(3B3B3B55) +$entry_color = rgba(FFFFFFFF) +$font_family = Rubik Light +$font_family_clock = Rubik Light +$font_material_symbols = Material Symbols Rounded + +background { + # color = rgba(0B0E17FF) + color = rgba(000000FF) + # path = {{ SWWW_WALL }} + # path = screenshot + # blur_size = 5 + # blur_passes = 4 +} +input-field { + monitor = + size = 250, 50 + outline_thickness = 2 + dots_size = 0.1 + dots_spacing = 0.3 + outer_color = $entry_border_color + inner_color = $entry_background_color + font_color = $entry_color + # fade_on_empty = true + + position = 0, 20 + halign = center + valign = center +} + +label { # Clock + monitor = + text = $TIME + shadow_passes = 1 + shadow_boost = 0.5 + color = $text_color + font_size = 65 + font_family = $font_family_clock + + position = 0, 300 + halign = center + valign = center +} +label { # Greeting + monitor = + text = hi $USER !!! + shadow_passes = 1 + shadow_boost = 0.5 + color = $text_color + font_size = 20 + font_family = $font_family + + position = 0, 240 + halign = center + valign = center +} +label { # lock icon + monitor = + text = lock + shadow_passes = 1 + shadow_boost = 0.5 + color = $text_color + font_size = 21 + font_family = $font_material_symbols + + position = 0, 65 + halign = center + valign = bottom +} +label { # "locked" text + monitor = + text = locked + shadow_passes = 1 + shadow_boost = 0.5 + color = $text_color + font_size = 14 + font_family = $font_family + + position = 0, 45 + halign = center + valign = bottom +} + +label { # Status + monitor = + text = cmd[update:5000] ${XDG_CONFIG_HOME:-$HOME/.config}/hypr/hyprlock/status.sh + shadow_passes = 1 + shadow_boost = 0.5 + color = $text_color + font_size = 14 + font_family = $font_family + + position = 30, -30 + halign = left + valign = top +} \ No newline at end of file diff --git a/hypr/hyprlock/status.sh b/hypr/hyprlock/status.sh new file mode 100755 index 00000000..dd806337 --- /dev/null +++ b/hypr/hyprlock/status.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +############ Variables ############ +enable_battery=false +battery_charging=false + +####### Check availability ######## +for battery in /sys/class/power_supply/*BAT*; do + if [[ -f "$battery/uevent" ]]; then + enable_battery=true + if [[ $(cat /sys/class/power_supply/*/status | head -1) == "Charging" ]]; then + battery_charging=true + fi + break + fi +done + +############# Output ############# +if [[ $enable_battery == true ]]; then + if [[ $battery_charging == true ]]; then + echo -n "(+) " + fi + echo -n "$(cat /sys/class/power_supply/*/capacity | head -1)"% + if [[ $battery_charging == false ]]; then + echo -n " remaining" + fi +fi + +echo '' \ No newline at end of file diff --git a/hypr/shaders/chromatic_abberation.frag b/hypr/shaders/chromatic_abberation.frag new file mode 100644 index 00000000..5389241c --- /dev/null +++ b/hypr/shaders/chromatic_abberation.frag @@ -0,0 +1,24 @@ +// vim: set ft=glsl: + +precision highp float; +varying highp vec2 v_texcoord; +uniform highp sampler2D tex; + +#define STRENGTH 0.0027 + +void main() { + vec2 center = vec2(0.5, 0.5); + vec2 offset = (v_texcoord - center) * STRENGTH; + + float rSquared = dot(offset, offset); + float distortion = 1.0 + 1.0 * rSquared; + vec2 distortedOffset = offset * distortion; + + vec2 redOffset = vec2(distortedOffset.x, distortedOffset.y); + vec2 blueOffset = vec2(distortedOffset.x, distortedOffset.y); + + vec4 redColor = texture2D(tex, v_texcoord + redOffset); + vec4 blueColor = texture2D(tex, v_texcoord + blueOffset); + + gl_FragColor = vec4(redColor.r, texture2D(tex, v_texcoord).g, blueColor.b, 1.0); +} diff --git a/hypr/shaders/crt.frag b/hypr/shaders/crt.frag new file mode 100644 index 00000000..a37ff9fb --- /dev/null +++ b/hypr/shaders/crt.frag @@ -0,0 +1,511 @@ +#version 100 +precision highp float; +varying highp vec2 v_texcoord; +varying highp vec3 v_pos; +uniform highp sampler2D tex; +uniform lowp float time; + +#define BORDER_COLOR vec4(vec3(0.0, 0.0, 0.0), 1.0) // black border +#define BORDER_RADIUS 1.0 // larger vignette radius +#define BORDER_SIZE 0.01 // small border size +#define CHROMATIC_ABERRATION_STRENGTH 0.00 +#define DENOISE_INTENSITY 0.0001 // +#define DISTORTION_AMOUNT 0.00 // moderate distortion amount +#define HDR_BLOOM 0.75 // bloom intensity +#define HDR_BRIGHTNESS 0.011 // brightness +#define HDR_CONTRAST 0.011 // contrast +#define HDR_SATURATION 1.0// saturation +#define LENS_DISTORTION_AMOUNT 0.0 +#define NOISE_THRESHOLD 0.0001 +#define PHOSPHOR_BLUR_AMOUNT 0.77 // Amount of blur for phosphor glow +#define PHOSPHOR_GLOW_AMOUNT 0.77 // Amount of phosphor glow +#define SAMPLING_RADIUS 0.0001 +#define SCANLINE_FREQUENCY 540.0 +#define SCANLINE_THICKNESS 0.0507 +#define SCANLINE_TIME time * 471.24 +#define SHARPNESS 0.25 +#define SUPERSAMPLING_SAMPLES 16.0 +#define VIGNETTE_RADIUS 0.0 // larger vignette radius +#define PI 3.14159265359 +#define TWOPI 6.28318530718 + +vec2 applyBarrelDistortion(vec2 coord, float amt) { + vec2 p = coord.xy / vec2(1.0); + vec2 v = p * 2.0 - vec2(1.0); + float r = dot(v, v); + float k = 1.0 + pow(r, 2.0) * pow(amt, 2.0); + vec2 result = v * k; + return vec2(0.5, 0.5) + 0.5 * result.xy; +} + +vec4 applyColorCorrection(vec4 color) { + color.rgb *= vec3(1.0, 0.79, 0.89); + return vec4(color.rgb, 1.0); +} + +vec4 applyBorder(vec2 tc, vec4 color, float borderSize, vec4 borderColor) { + float dist_x = min(tc.x, 1.0 - tc.x); + float dist_y = min(tc.y, 1.0 - tc.y); + float dist = min(dist_x, dist_y) * -1.0; + float border = smoothstep(borderSize, 0.0, dist); + border += smoothstep(borderSize, 0.0, dist); + return mix(color, borderColor, border); +} + +vec4 applyFakeHDR(vec4 color, float brightness, float contrast, float saturation, float bloom) { + color.rgb = (color.rgb - vec3(0.5)) * exp2(brightness) + vec3(0.5); + vec3 crtfactor = vec3(1.05, 0.92, 1.0); + color.rgb = pow(color.rgb, crtfactor); + // // NTSC + // vec3 lumCoeff = vec3(0.2125, 0.7154, 0.0721); + + // // BT.709 + // vec3 lumCoeff = vec3(0.299, 0.587, 0.114); + + // BT.2020 + vec3 lumCoeff = vec3(0.2627, 0.6780, 0.0593); + + // // Warm NTSC + // vec3 lumCoeff = vec3(0.2125, 0.7010, 0.0865); + + float luminance = dot(color.rgb, lumCoeff); + luminance = pow(luminance, 2.2); + color.rgb = mix(vec3(luminance), color.rgb, saturation); + color.rgb = mix(color.rgb, vec3(1.0), pow(max(0.0, luminance - 1.0 + bloom), 4.0)); + return color; +} + +vec4 applyVignette(vec4 color) { + vec2 center = vec2(0.5, 0.5); // center of screen + float radius = VIGNETTE_RADIUS; // radius of vignette effect + float softness = 1.0; // softness of vignette effect + float intensity = 0.7; // intensity of vignette effect + vec2 offset = v_texcoord - center; // offset from center of screen + float distance = length(offset); // distance from center of screen + float alpha = smoothstep(radius, radius - radius * softness, distance) * intensity; // calculate alpha value for vignette effect + return mix(vec4(0.0, 0.0, 0.0, alpha), color, alpha); // mix black with color using calculated alpha value +} + +vec4 applyPhosphorGlow(vec2 tc, vec4 color, sampler2D tex) { + // Calculate average color value of the texture + vec4 texelColor = color; + float averageColor = (texelColor.r + texelColor.g + texelColor.b) / 3.0; + + // Determine brightness-dependent color factor + float factor = mix( + mix(0.09, + mix(0.005, 0.0075, (averageColor - 0.1) / 0.1), + step(0.01, averageColor)), 0.0005, + step(0.02, averageColor)); + // Apply phosphor glow effect + vec4 sum = vec4(0.0); + vec4 pixels[9]; + pixels[0] = texture2D(tex, tc - vec2(0.001, 0.001)); + pixels[1] = texture2D(tex, tc - vec2(0.001, 0.0)); + pixels[2] = texture2D(tex, tc - vec2(0.001, -0.001)); + pixels[3] = texture2D(tex, tc - vec2(0.0, 0.001)); + pixels[4] = texture2D(tex, tc); + pixels[5] = texture2D(tex, tc + vec2(0.001, 0.001)); + pixels[6] = texture2D(tex, tc + vec2(0.001, 0.0)); + pixels[7] = texture2D(tex, tc + vec2(0.001, -0.001)); + pixels[8] = texture2D(tex, tc + vec2(0.0, 0.001)); + +// Perform operations on input pixels in parallel + sum = pixels[0] + + pixels[1] + + pixels[2] + + pixels[3] + + pixels[4] + + pixels[5] + + pixels[6] + + pixels[7] + + pixels[8]; + sum /= 9.0; + sum += texture2D(tex, tc - vec2(0.01, 0.01)) * 0.001; + sum += texture2D(tex, tc - vec2(0.0, 0.01)) * 0.001; + sum += texture2D(tex, tc - vec2(-0.01, 0.01)) * 0.001; + sum += texture2D(tex, tc - vec2(0.01, 0.0)) * 0.001; + sum += color * PHOSPHOR_BLUR_AMOUNT; + sum += texture2D(tex, tc - vec2(-0.01, 0.0)) * 0.001; + sum += texture2D(tex, tc - vec2(0.01, -0.01)) * 0.001; + sum += texture2D(tex, tc - vec2(0.0, -0.01)) * 0.001; + sum += texture2D(tex, tc - vec2(-0.01, -0.01)) * 0.001; + sum *= PHOSPHOR_GLOW_AMOUNT; + + // Initialize sum_sum_factor to zero + vec4 sum_sum_factor = vec4(0.0); + // Compute sum_j for i = -1 + vec4 sum_j = vec4(0.0); + sum_j += texture2D(tex, tc + vec2(-1, -1) * 0.01); + sum_j += texture2D(tex, tc + vec2(0, -1) * 0.01); + sum_j += texture2D(tex, tc + vec2(1, -1) * 0.01); + sum_j += texture2D(tex, tc + vec2(-1, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(0, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(1, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(-1, 1) * 0.01); + sum_j += texture2D(tex, tc + vec2(0, 1) * 0.01); + sum_j += texture2D(tex, tc + vec2(1, 1) * 0.01); + sum_sum_factor += sum_j * vec4(0.011); + + // Compute sum_j for i = 0 + sum_j = vec4(0.0); + sum_j += texture2D(tex, tc + vec2(-1, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(0, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(1, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(-1, 1) * 0.01); + sum_j += texture2D(tex, tc + vec2(0, 1) * 0.01); + sum_j += texture2D(tex, tc + vec2(1, 1) * 0.01); + sum_sum_factor += sum_j * vec4(0.011); + + // Compute sum_j for i = 1 + sum_j = vec4(0.0); + sum_j += texture2D(tex, tc + vec2(-1, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(0, 1) * 0.01); + sum_j += texture2D(tex, tc + vec2(1, 0) * 0.01); + sum_j += texture2D(tex, tc + vec2(-1, 1) * 0.01); + sum_j += texture2D(tex, tc + vec2(0, 1) * 0.01); + sum_j += texture2D(tex, tc + vec2(1, 1) * 0.01); + sum_sum_factor += sum_j * vec4(0.011); + color += mix(sum_sum_factor * sum_sum_factor * vec4(factor), sum, 0.5); + return color; +} + +vec4 applyAdaptiveSharpen(vec2 tc, vec4 color, sampler2D tex) { + vec4 color_tl = texture2D(tex, tc + vec2(-1.0, -1.0) * 0.5 / 2160.0); + vec4 color_tr = texture2D(tex, tc + vec2(1.0, -1.0) * 0.5 / 2160.0); + vec4 color_bl = texture2D(tex, tc + vec2(-1.0, 1.0) * 0.5 / 2160.0); + vec4 color_br = texture2D(tex, tc + vec2(1.0, 1.0) * 0.5 / 2160.0); + float sharpness = SHARPNESS; + vec3 color_no_alpha = color.rgb; + vec3 color_tl_no_alpha = color_tl.rgb; + vec3 color_tr_no_alpha = color_tr.rgb; + vec3 color_bl_no_alpha = color_bl.rgb; + vec3 color_br_no_alpha = color_br.rgb; + float delta = (dot(color_no_alpha, vec3(0.333333)) + dot(color_tl_no_alpha, vec3(0.333333)) + dot(color_tr_no_alpha, vec3(0.333333)) + dot(color_bl_no_alpha, vec3(0.333333)) + dot(color_br_no_alpha, vec3(0.333333))) * 0.2 - dot(color_no_alpha, vec3(0.333333)); + vec3 sharp_color_no_alpha = color_no_alpha + min(vec3(0.0), vec3(delta * sharpness)); + vec4 sharp_color = vec4(sharp_color_no_alpha, color.a); + return sharp_color; +} + +vec4 applyScanlines(vec2 tc, vec4 color) { + float scanline = (cos(tc.y * SCANLINE_FREQUENCY + SCANLINE_TIME) * + sin(tc.y * SCANLINE_FREQUENCY + SCANLINE_TIME)) * SCANLINE_THICKNESS; + float alpha = clamp(1.0 - abs(scanline), 0.0, 1.0); + return vec4(color.rgb * alpha, color.a); +} + +vec4 applyChromaticAberration(vec2 uv, vec4 color) { + vec2 center = vec2(0.5, 0.5); // center of the screen + vec2 offset = (uv - center) * CHROMATIC_ABERRATION_STRENGTH; // calculate the offset from the center + + // apply lens distortion + float rSquared = dot(offset, offset); + float distortion = 1.0 + LENS_DISTORTION_AMOUNT * rSquared; + vec2 distortedOffset = offset * distortion; + + // apply chromatic aberration + vec2 redOffset = vec2(distortedOffset.x * 1.00, distortedOffset.y * 1.00); + vec2 blueOffset = vec2(distortedOffset.x * 1.00, distortedOffset.y * 1.00); + + vec4 redColor = texture2D(tex, uv + redOffset); + vec4 blueColor = texture2D(tex, uv + blueOffset); + + vec4 result = vec4(redColor.r, color.g, blueColor.b, color.a); + + return result; +} + +vec4 reduceGlare(vec4 color) { + // Calculate the intensity of the color by taking the average of the RGB components + float intensity = (color.r + color.g + color.b) / 3.0; + // Set the maximum intensity that can be considered for glare + float maxIntensity = 0.98; + // Use smoothstep to create a smooth transition from no glare to full glare + // based on the intensity of the color and the maximum intensity + float glareIntensity = smoothstep(maxIntensity - 0.02, maxIntensity, intensity); + // Set the amount of glare to apply to the color + float glareAmount = 0.02; + // Mix the original color with the reduced color that has glare applied to it + vec3 reducedColor = mix(color.rgb, vec3(glareIntensity), glareAmount); + // Return the reduced color with the original alpha value + return vec4(reducedColor, color.a); +} + +// Apply a fake HDR effect to the input color. +// Parameters: +// - inputColor: the color to apply the effect to. +// - brightness: the brightness of the image. Should be a value between 0 and 1. +// - contrast: the contrast of the image. Should be a value between 0 and 1. +// - saturation: the saturation of the image. Should be a value between 0 and 2. +// - bloom: the intensity of the bloom effect. Should be a value between 0 and 1. +vec4 applyFakeHDREffect(vec4 inputColor, float brightness, float contrast, float saturation, float bloom) { + const float minBrightness = 0.0; + const float maxBrightness = 1.0; + const float minContrast = 0.0; + const float maxContrast = 1.0; + const float minSaturation = 0.0; + const float maxSaturation = 2.0; + const float minBloom = 0.0; + const float maxBloom = 1.0; + + // Check input parameters for validity + if (brightness < minBrightness || brightness > maxBrightness) { + return vec4(0.0, 0.0, 0.0, 1.0); // Return black with alpha of 1.0 to indicate error + } + if (contrast < minContrast || contrast > maxContrast) { + return vec4(0.0, 0.0, 0.0, 1.0); + } + if (saturation < minSaturation || saturation > maxSaturation) { + return vec4(0.0, 0.0, 0.0, 1.0); + } + if (bloom < minBloom || bloom > maxBloom) { + return vec4(0.0, 0.0, 0.0, 1.0); + } + + // Apply brightness and contrast + vec3 color = inputColor.rgb; + color = (color - vec3(0.5)) * exp2(brightness * 10.0) + vec3(0.5); + color = mix(vec3(0.5), color, pow(contrast * 4.0 + 1.0, 2.0)); + + // // NTSC + // vec3 lumCoeff = vec3(0.2125, 0.7154, 0.0721); + + // // BT.709 + // vec3 lumCoeff = vec3(0.299, 0.587, 0.114); + + // // BT.2020 + // vec3 lumCoeff = vec3(0.2627, 0.6780, 0.0593); + + // Warm NTSC + vec3 lumCoeff = vec3(0.2125, 0.7010, 0.0865); + + // Apply saturation + float luminance = dot(color, lumCoeff); + vec3 grey = vec3(luminance); + color = mix(grey, color, saturation); + + // Apply bloom effect + float threshold = 1.0 - bloom; + vec3 bloomColor = max(color - threshold, vec3(0.0)); + bloomColor = pow(bloomColor, vec3(2.0)); + bloomColor = mix(vec3(0.0), bloomColor, pow(min(luminance, threshold), 4.0)); + color += bloomColor; + + return vec4(color, inputColor.a); +} + +vec4 bilateralFilter(sampler2D tex, vec2 uv, vec4 color, float sampleRadius, float noiseThreshold, float intensity) { + vec4 filteredColor = vec4(0.0); + float totalWeight = 0.0; + + // Top-left pixel + vec4 sample = texture2D(tex, uv + vec2(-1.0, -1.0)); + float dist = length(vec2(-1.0, -1.0)); + float colorDist = length(sample - color); + float weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + + // Top pixel + sample = texture2D(tex, uv + vec2(0.0, -1.0)); + dist = length(vec2(0.0, -1.0)); + colorDist = length(sample - color); + weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + + // Top-right pixel + sample = texture2D(tex, uv + vec2(1.0, -1.0)); + dist = length(vec2(1.0, -1.0)); + colorDist = length(sample - color); + weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + + // Left pixel + sample = texture2D(tex, uv + vec2(-1.0, 0.0)); + dist = length(vec2(-1.0, 0.0)); + colorDist = length(sample - color); + weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + + // Center pixel + sample = texture2D(tex, uv); + dist = 0.0; + colorDist = length(sample - color); + weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + + // Right pixel + sample = texture2D(tex, uv + vec2(1.0, 0.0)); + dist = length(vec2(1.0, 0.0)); + colorDist = length(sample - color); + weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + + // Bottom-left pixel + sample = texture2D(tex, uv + vec2(-1.0, 1.0)); + dist = length(vec2(-1.0, 1.0)); + colorDist = length(sample - color); + weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + +// Bottom pixel + sample = texture2D(tex, uv + vec2(0.0, sampleRadius)); + dist = length(vec2(0.0, sampleRadius)); + colorDist = length(sample - color); + weight = exp(-0.5 * (dist * dist + colorDist * colorDist * intensity) / (sampleRadius * sampleRadius)); + filteredColor += sample * weight; + totalWeight += weight; + + filteredColor /= totalWeight; + return mix(color, filteredColor, step(noiseThreshold, length(filteredColor - color))); +} + +vec4 supersample(sampler2D tex, vec2 uv, float sampleRadius, float noiseThreshold, float intensity) { + float radiusSq = sampleRadius * sampleRadius; + vec2 poissonDisk; + vec4 color = vec4(0.0); + + float r1_0 = sqrt(0.0 / 16.0); + float r2_0 = fract(1.0 / 3.0); + float theta_0 = TWOPI * r2_0; + poissonDisk = vec2(r1_0 * cos(theta_0), r1_0 * sin(theta_0)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_1 = sqrt(1.0 / 16.0); + float r2_1 = fract(2.0 / 3.0); + float theta_1 = TWOPI * r2_1; + poissonDisk = vec2(r1_1 * cos(theta_1), r1_1 * sin(theta_1)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_2 = sqrt(2.0 / 16.0); + float r2_2 = fract(3.0 / 3.0); + float theta_2 = TWOPI * r2_2; + poissonDisk = vec2(r1_2 * cos(theta_2), r1_2 * sin(theta_2)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_3 = sqrt(3.0 / 16.0); + float r2_3 = fract(4.0 / 3.0); + float theta_3 = TWOPI * r2_3; + poissonDisk = vec2(r1_3 * cos(theta_3), r1_3 * sin(theta_3)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_4 = sqrt(4.0 / 16.0); + float r2_4 = fract(5.0 / 3.0); + float theta_4 = TWOPI * r2_4; + poissonDisk = vec2(r1_4 * cos(theta_4), r1_4 * sin(theta_4)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_5 = sqrt(5.0 / 16.0); + float r2_5 = fract(6.0 / 3.0); + float theta_5 = TWOPI * r2_5; + poissonDisk = vec2(r1_5 * cos(theta_5), r1_5 * sin(theta_5)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_6 = sqrt(6.0 / 16.0); + float r2_6 = fract(7.0 / 3.0); + float theta_6 = TWOPI * r2_6; + poissonDisk = vec2(r1_6 * cos(theta_6), r1_6 * sin(theta_6)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_7 = sqrt(7.0 / 16.0); + float r2_7 = fract(8.0 / 3.0); + float theta_7 = TWOPI * r2_7; + poissonDisk = vec2(r1_7 * cos(theta_7), r1_7 * sin(theta_7)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_8 = sqrt(8.0 / 16.0); + float r2_8 = fract(9.0 / 3.0); + float theta_8 = TWOPI * r2_8; + poissonDisk = vec2(r1_8 * cos(theta_8), r1_8 * sin(theta_8)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_9 = sqrt(9.0 / 16.0); + float r2_9 = fract(10.0 / 3.0); + float theta_9 = TWOPI * r2_9; + poissonDisk = vec2(r1_9 * cos(theta_9), r1_9 * sin(theta_9)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_10 = sqrt(10.0 / 16.0); + float r2_10 = fract(11.0 / 3.0); + float theta_10 = TWOPI * r2_10; + poissonDisk = vec2(r1_10 * cos(theta_10), r1_10 * sin(theta_10)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_11 = sqrt(11.0 / 16.0); + float r2_11 = fract(12.0 / 3.0); + float theta_11 = TWOPI * r2_11; + poissonDisk = vec2(r1_11 * cos(theta_11), r1_11 * sin(theta_11)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_12 = sqrt(12.0 / 16.0); + float r2_12 = fract(13.0 / 3.0); + float theta_12 = TWOPI * r2_12; + poissonDisk = vec2(r1_12 * cos(theta_12), r1_12 * sin(theta_12)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_13 = sqrt(13.0 / 16.0); + float r2_13 = fract(14.0 / 3.0); + float theta_13 = TWOPI * r2_13; + poissonDisk = vec2(r1_13 * cos(theta_13), r1_13 * sin(theta_13)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_14 = sqrt(14.0 / 16.0); + float r2_14 = fract(15.0 / 3.0); + float theta_14 = TWOPI * r2_14; + poissonDisk = vec2(r1_14 * cos(theta_14), r1_14 * sin(theta_14)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + float r1_15 = sqrt(15.0 / 16.0); + float r2_15 = fract(16.0 / 3.0); + float theta_15 = TWOPI * r2_15; + poissonDisk = vec2(r1_15 * cos(theta_15), r1_15 * sin(theta_15)); + color += texture2D(tex, uv + poissonDisk * sampleRadius); + + return bilateralFilter(tex, uv, color, sampleRadius, noiseThreshold, intensity); +} +void main() { + vec2 tc_no_dist = v_texcoord; + + vec2 tc = applyBarrelDistortion(tc_no_dist, DISTORTION_AMOUNT); + + // [-1, 1] + vec2 tc_no_dist_symmetric = tc_no_dist * 2.0 - 1.0; + + // [0,1] + vec2 tc_no_dist_normalized = (tc_no_dist_symmetric + 1.0) / 2.0; + + // vec4 color = texture2D(tex, tc); + vec4 color = supersample(tex, tc, SAMPLING_RADIUS, NOISE_THRESHOLD, DENOISE_INTENSITY); + + color = applyAdaptiveSharpen(tc, color, tex); + + color = applyPhosphorGlow(tc, color, tex); + + color = reduceGlare(color); + + color = mix(applyFakeHDREffect(color, HDR_BRIGHTNESS, HDR_CONTRAST, HDR_SATURATION, HDR_BLOOM), color, 0.5); + + color = applyColorCorrection(color); + + color /= SUPERSAMPLING_SAMPLES; + + color = mix(applyChromaticAberration(tc, color), color, 0.25); + + color = mix(color, applyVignette(color), 0.37); + + color = applyBorder(tc_no_dist_normalized, color, 1.0 - BORDER_SIZE * BORDER_RADIUS, BORDER_COLOR); + + color = mix(applyBorder(tc, color, BORDER_SIZE, BORDER_COLOR), color, 0.05); + + color = applyScanlines(tc, color); + + gl_FragColor = color; + gl_FragColor.a = 1.0; +} + diff --git a/hypr/shaders/drugs.frag b/hypr/shaders/drugs.frag new file mode 100644 index 00000000..1190ed03 --- /dev/null +++ b/hypr/shaders/drugs.frag @@ -0,0 +1,42 @@ + +precision highp float; +varying vec2 v_texcoord; +uniform sampler2D tex; +uniform float time; + +void warpco(inout vec2 tc) { + tc -= 0.5; + tc *= length(tc) * 2.0; + tc += 0.5; +} + +float rand1d(float seed) { + return sin(seed*1454.0); +} + +float rand2d(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453); +} + +vec3 rgb(in vec2 tc, float freq, float amp, inout vec4 centre) { + vec2 off = vec2(1.0/800.0, 0.0) * sin(tc.t * freq + time) * amp; + vec2 off2 = vec2(1.0/800.0, 0.0) * sin(tc.t * freq - time * 1.5) * amp; + centre = texture2D(tex, tc); + return vec3(texture2D(tex, tc-off).r, centre.g, texture2D(tex, tc+off2).b); +} + +void main() { + // vec2 px = 1.0 / textureSize(tex, 0).st; + vec2 tc = v_texcoord; + warpco(tc); + tc = mix(v_texcoord, tc, sin(time * 2.0)*0.07); + tc.x += rand2d(floor(tc * 20.0 + floor(time * 2.5))) * 0.01; + tc.x += rand1d(floor(tc.x * 40.0)) * 0.005 * rand1d(time * 0.001); + tc.y += sin(tc.x + time) * 0.02; + vec4 centre; + vec3 bent = rgb(tc, 100.0, 5.0, centre); + vec3 col = mix(centre.rgb, bent, sin(time)); + gl_FragColor = vec4(col, centre.a); + // gl_FragColor = vec4(texture2D(tex, v_texcoord)); +} \ No newline at end of file diff --git a/hypr/shaders/extradark.frag b/hypr/shaders/extradark.frag new file mode 100644 index 00000000..089ee814 --- /dev/null +++ b/hypr/shaders/extradark.frag @@ -0,0 +1,21 @@ +// vim: set ft=glsl: +// blue light filter shader +// values from https://reshade.me/forum/shader-discussion/3673-blue-light-filter-similar-to-f-lux + +precision mediump float; +varying vec2 v_texcoord; +uniform sampler2D tex; + +void main() { + + vec4 pixColor = texture2D(tex, v_texcoord); + + // red + pixColor[0] *= 0.7; + // green + pixColor[1] *= 0.6; + // blue + pixColor[2] *= 0.5; + + gl_FragColor = pixColor; +} diff --git a/hypr/shaders/invert.frag b/hypr/shaders/invert.frag new file mode 100644 index 00000000..864f7188 --- /dev/null +++ b/hypr/shaders/invert.frag @@ -0,0 +1,13 @@ +// vim: set ft=glsl: +// blue light filter shader +// values from https://reshade.me/forum/shader-discussion/3673-blue-light-filter-similar-to-f-lux + +precision mediump float; +varying vec2 v_texcoord; +uniform sampler2D tex; + +void main() { + vec4 pixColor = texture2D(tex, v_texcoord); + pixColor.rgb = 1.0 - pixColor.rgb; + gl_FragColor = pixColor; +} \ No newline at end of file diff --git a/hypr/shaders/solarized.frag b/hypr/shaders/solarized.frag new file mode 100644 index 00000000..1c37f2cc --- /dev/null +++ b/hypr/shaders/solarized.frag @@ -0,0 +1,41 @@ +// -*- mode:c -*- +precision lowp float; +varying vec2 v_texcoord; +uniform sampler2D tex; + +float distanceSquared(vec3 pixColor, vec3 solarizedColor) { + vec3 distanceVector = pixColor - solarizedColor; + return dot(distanceVector, distanceVector); +} + +void main() { + vec3 solarized[16]; + solarized[0] = vec3(0.,0.169,0.212); + solarized[1] = vec3(0.027,0.212,0.259); + solarized[2] = vec3(0.345,0.431,0.459); + solarized[3] = vec3(0.396,0.482,0.514); + solarized[4] = vec3(0.514,0.58,0.588); + solarized[5] = vec3(0.576,0.631,0.631); + solarized[6] = vec3(0.933,0.91,0.835); + solarized[7] = vec3(0.992,0.965,0.89); + solarized[8] = vec3(0.71,0.537,0.); + solarized[9] = vec3(0.796,0.294,0.086); + solarized[10] = vec3(0.863,0.196,0.184); + solarized[11] = vec3(0.827,0.212,0.51); + solarized[12] = vec3(0.424,0.443,0.769); + solarized[13] = vec3(0.149,0.545,0.824); + solarized[14] = vec3(0.165,0.631,0.596); + solarized[15] = vec3(0.522,0.6,0.); + + vec3 pixColor = vec3(texture2D(tex, v_texcoord)); + int closest = 0; + float closestDistanceSquared = distanceSquared(pixColor, solarized[0]); + for (int i = 1; i < 15; i++) { + float newDistanceSquared = distanceSquared(pixColor, solarized[i]); + if (newDistanceSquared < closestDistanceSquared) { + closest = i; + closestDistanceSquared = newDistanceSquared; + } + } + gl_FragColor = vec4(solarized[closest], 1.); +}