From 92b14329299f0d8cc5123471efcef9c21565a079 Mon Sep 17 00:00:00 2001 From: ulises-jeremias Date: Mon, 2 Dec 2024 01:34:56 -0300 Subject: [PATCH] feat: Add picom rules configuration for window effects and animations --- README.md | 2 +- docs/Home.md | 2 +- ...onchange_before_install-compositor.sh.tmpl | 2 +- home/dot_config/alacritty/alacritty.toml | 5 + home/dot_config/i3/config.d/autostart.conf | 2 +- home/dot_config/picom/picom-rules.conf | 203 ++++++++++++++++++ home/dot_config/picom/picom.conf | 110 +--------- 7 files changed, 219 insertions(+), 107 deletions(-) create mode 100644 home/dot_config/picom/picom-rules.conf diff --git a/README.md b/README.md index 4a5e259f..c357353c 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Most were written from scratch. Some details: - **Desktop Notification** 🌿 [Dunst](https://github.com/dunst-project/dunst) which is minimalist! - **Terminal Emulator** 🌿 [Alacritty](https://alacritty.org/) which is GPU accelerated! - **Shell** 🐚 [Zsh](https://zsh.org) with several post-installation tweaks! -- **Compositor** 🍧 [Picom fork by FT-Labs](https://github.com/FT-Labs/picom) for that perfection topping with Animations! +- **Compositor** 🍧 [Picom](https://github.com/yshui/picom) for that perfection topping with Animations! - **File Manager** 🃏 [Thunar](https://docs.xfce.org/xfce/thunar/start) with a customized side pane! - **Widgets** 🎨 [Eww](https://github.com/elkowar/eww) with 2 different pre-backed widgets! - and many more! diff --git a/docs/Home.md b/docs/Home.md index 5e6247c5..ec4c9797 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -39,7 +39,7 @@ Most were written from scratch. Some details: - **Desktop Notification** 🌿 [Dunst](https://github.com/dunst-project/dunst) which is minimalist! - **Terminal Emulator** 🌿 [Alacritty](https://alacritty.org/) which is GPU accelerated! - **Shell** 🐚 [Zsh](https://zsh.org) with several post-installation tweaks! -- **Compositor** 🍧 [Picom fork by FT-Labs](https://github.com/FT-Labs/picom) for that perfection topping with Animations! +- **Compositor** 🍧 [Picom](https://github.com/yshui/picom) for that perfection topping with Animations! - **File Manager** 🃏 [Thunar](https://docs.xfce.org/xfce/thunar/start) with a customized side pane! - **Widgets** 🎨 [Eww](https://github.com/elkowar/eww) with 2 different pre-backed widgets! - and many more! diff --git a/home/.chezmoiscripts/linux/run_onchange_before_install-compositor.sh.tmpl b/home/.chezmoiscripts/linux/run_onchange_before_install-compositor.sh.tmpl index 67a3973f..087b5323 100644 --- a/home/.chezmoiscripts/linux/run_onchange_before_install-compositor.sh.tmpl +++ b/home/.chezmoiscripts/linux/run_onchange_before_install-compositor.sh.tmpl @@ -3,7 +3,7 @@ {{ if eq .osid "linux-arch" -}} #!/usr/bin/env bash -yay -S --noconfirm --needed picom-ftlabs-git +sudo pacman -S --noconfirm --needed picom {{ end -}} {{ end -}} diff --git a/home/dot_config/alacritty/alacritty.toml b/home/dot_config/alacritty/alacritty.toml index 9cd3f52c..b5fcc863 100644 --- a/home/dot_config/alacritty/alacritty.toml +++ b/home/dot_config/alacritty/alacritty.toml @@ -180,3 +180,8 @@ lines = 24 [window.padding] x = 25 y = 20 + +[bell] +animation = "Linear" +duration = 0 +command = { program = "paplay", args = ["/usr/share/sounds/freedesktop/stereo/dialog-error.oga"] } diff --git a/home/dot_config/i3/config.d/autostart.conf b/home/dot_config/i3/config.d/autostart.conf index 7e84271c..45bd2cc0 100644 --- a/home/dot_config/i3/config.d/autostart.conf +++ b/home/dot_config/i3/config.d/autostart.conf @@ -8,7 +8,7 @@ exec --no-startup-id xdg-autostart & exec_always --no-startup-id ~/.config/polybar/launch.sh & # Fix wm gaps -exec ~/.config/i3/setup-gaps.sh +exec_always --no-startup-id ~/.config/i3/setup-gaps.sh # Run i3-layouts exec i3-layouts diff --git a/home/dot_config/picom/picom-rules.conf b/home/dot_config/picom/picom-rules.conf new file mode 100644 index 00000000..bdec8345 --- /dev/null +++ b/home/dot_config/picom/picom-rules.conf @@ -0,0 +1,203 @@ +rules: ( + # Per window type rules + { + match = "window_type = 'dropdown_menu'"; + shadow = false; + corner-radius = 0; + }, + + { + match = "window_type = 'popup_menu'"; + shadow = false; + corner-radius = 0; + }, + + { + match = "window_type = 'popup'"; + shadow = false; + corner-radius = 0; + }, + + { + match = "window_type = 'dock'"; + shadow = false; + corner-radius = 0; + fade = true; + }, + + { + match = "window_type = 'tooltip'"; + shadow = false; + corner-radius = 0; + fade = false; + opacity = 0.90; + full-shadow = false; + }, + + { + match = "window_type = 'splash'"; + shadow = false; + }, + + { + match = "window_type = 'dialog'"; + shadow = false; + }, + + { + match = "window_type = 'menu'"; + shadow = false; + corner-radius = 0; + }, + + # Shadows rules + { + match = "name = 'Notification' || " + "class_g ?= 'Notify-osd' || " + "class_g = 'Dunst' || " + "class_g = 'Polybar' || " + "class_g = 'jgmenu' || " + "class_g = 'scratch' || " + "class_g = 'Spotify' || " + "class_g = 'retroarch' || " + "class_g = 'firefox' || " + "class_g = 'Rofi' || " + "class_g = 'Screenkey' || " + "class_g = 'mpv' || " + "class_g = 'Viewnior' || " + "_GTK_FRAME_EXTENTS@"; + shadow = false; + }, + + # Fading animation rules + { + match = "class_g = 'slop' || " + "class_g = 'scratch' || " + "class_g = 'firefox'"; + fade = false; + }, + + # Transparency for terminals depending on rice you are + { + match = "class_g = 'Alacritty' || " + "class_g = 'kitty' || " + "class_g = 'FloaTerm'"; + opacity = 1; + }, + + { + match = "class_g = 'scratch'"; opacity = 0.95; + }, + + { + match = "class_g = 'Updating'"; opacity = 0.95; + }, + + # Corner radius rules + { + match = "class_g = 'Polybar' || " + "class_g = 'eww-bar' || " + "class_g = 'Viewnior' || " + "class_g = 'Rofi' || " + "class_g = 'mpv' || " + "class_g = 'firefox' || " + "class_g = 'scratch' || " + "class_g = 'retroarch'"; + corner-radius = 0; + }, + # Animations for normal windows + { + match = "window_type = 'normal'"; + animations = ( + { + triggers = ["open", "show"]; + opacity = { + curve = "cubic-bezier(0,1,1,1)"; + duration = 0.4; + start = 0; + end = "window-raw-opacity"; + }; + scale-x = { + curve = "cubic-bezier(0,1.3,1,1)"; + duration = 0.4; + start = 0.8; + end = 1; + }; + scale-y = "scale-x"; + }, + { + triggers = ["close", "hide"]; + opacity = { + curve = "linear"; + duration = 0.3; + start = "window-raw-opacity-before"; + end = 0; + }; + scale-x = { + curve = "cubic-bezier(0.3,0,0.7,1)"; + duration = 0.3; + start = 1; + end = 0.8; + }; + scale-y = "scale-x"; + } + ) + }, + + # Animations for Rofi + { + match = "class_g = 'Rofi'"; + animations = ( + { + triggers = ["open", "show"]; + preset = "slide-in"; + direction = "up"; + duration = 0.3; + }, + { + triggers = ["close", "hide"]; + preset = "slide-out"; + direction = "down"; + duration = 0.2; + } + ) + }, + + # Animations for Dunst + { + match = "class_g = 'Dunst'"; + animations = ( + { + triggers = ["open", "show"]; + preset = "fly-in"; + direction = "right"; + duration = 0.2; + }, + { + triggers = ["close", "hide"]; + preset = "fly-out"; + direction = "left"; + duration = 0.2; + } + ) + }, + + # Animations for Scratchpad + { + match = "class_g = 'scratch'"; + animations = ( + { + triggers = ["open", "show"]; + preset = "slide-in"; + direction = "up"; + duration = 0.3; + }, + { + triggers = ["close", "hide"]; + preset = "slide-out"; + direction = "down"; + duration = 0.3; + } + ) + } +) diff --git a/home/dot_config/picom/picom.conf b/home/dot_config/picom/picom.conf index fac4b4aa..1b6e806e 100644 --- a/home/dot_config/picom/picom.conf +++ b/home/dot_config/picom/picom.conf @@ -2,71 +2,6 @@ # Currently patched: "awesome", "dwm", "herb" wm-support = "none"; -################################# -# Animations # - -# !These animations WILL NOT work correctly for any other wm other than phyOS-dwm fork! - -# fly-in: Windows fly in from random directions to the screen -# maximize: Windows pop from center of the screen to their respective positions -# minimize: Windows minimize from their position to the center of the screen -# slide-in-center: Windows move from upper-center of the screen to their respective positions -# slide-out-center: Windows move to the upper-center of the screen -# slide-left: Windows are created from the right-most window position and slide leftwards -# slide right: Windows are created from the left-most window position and slide rightwards -# slide-down: Windows are moved from the top of the screen and slide downward -# slide-up: Windows are moved from their position to top of the screen -# squeeze: Windows are either closed or created to/from their center y-position (the animation is similar to a blinking eye) -# squeeze-bottom: Similar to squeeze, but the animation starts from bottom-most y-position -# zoom: Windows are either created or destroyed from/to their center (not the screen center) - -################################# - -# enable or disable animations -animations = true; - -# change animation speed of windows in current tag e.g open window in current tag -animation-stiffness-in-tag = 125; - -# change animation speed of windows when tag changes -animation-stiffness-tag-change = 90.0; - -# change the mass of windows -# modifying the mass of windows makes them virtually heavier and therefore slower to animate. -animation-window-mass = 0.4; - -# change dampening applied during the animation -# this setting basically does what it says. It dampens the animation of windows. -animation-dampening = 12; - -# toggles clamping -# if you are using a animation setting that would make the window extend larger than it would be after, -# the animation has played then it will cut the animation off once the window reaches its physical geometry. -animation-clamping = true; - -# open windows -# available options: slide-up, slide-down, slide-left, slide-right, squeeze, squeeze-bottom, zoom -animation-for-open-window = "zoom"; - -# minimize or close windows -# available options: slide-up, slide-down, slide-left, slide-right, squeeze, squeeze-bottom, zoom -animation-for-unmap-window = "none"; - -# popup windows -animation-for-transient-window = "zoom"; - -# set animation for windows being transitioned out while changings tags -animation-for-prev-tag = "minimize"; - -# enables fading for windows being transitioned out while changings tags -enable-fading-prev-tag = true; - -# set animation for windows being transitioned in while changings tags -animation-for-next-tag = "slide-in-center"; - -# enables fading for windows being transitioned in while changings tags -enable-fading-next-tag = true; - ################################# # Corners # ################################# @@ -93,44 +28,7 @@ rounded-corners-exclude = [ # Backend to use: "xrender" or "glx". # GLX backend is typically much faster but depends on a sane driver. -backend = "glx"; - -################################# -# -# GLX backend -# -################################# - -glx-no-stencil = true; - -# GLX backend: Copy unmodified regions from front buffer instead of redrawing them all. -# My tests with nvidia-drivers show a 10% decrease in performance when the whole screen is modified, -# but a 20% increase when only 1/4 is. -# My tests on nouveau show terrible slowdown. -glx-copy-from-front = true; - -# GLX backend: Use MESA_copy_sub_buffer to do partial screen update. -# My tests on nouveau shows a 200% performance boost when only 1/4 of the screen is updated. -# May break VSync and is not available on some drivers. -# Overrides --glx-copy-from-front. -glx-use-copysubbuffermesa = false; - -# GLX backend: Avoid rebinding pixmap on window damage. -# Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe). -# Recommended if it works. -# glx-no-rebind-pixmap = true; - -# GLX backend: GLX buffer swap method we assume. -# Could be undefined (0), copy (1), exchange (2), 3-6, or buffer-age (-1). -# undefined is the slowest and the safest, and the default value. -# copy is fastest, but may fail on some drivers, -# 2-6 are gradually slower but safer (6 is still faster than 0). -# Usually, double buffer means 2, triple buffer means 3. -# buffer-age means auto-detect using GLX_EXT_buffer_age, supported by some drivers. -# Useless with --glx-use-copysubbuffermesa. -# Partially breaks --resize-damage. -# Defaults to undefined. -#glx-swap-method = "undefined"; +backend = "xrender"; ################################# # @@ -365,3 +263,9 @@ wintypes: # Use X Sync fence to sync clients' draw calls. Needed on nvidia-drivers with GLX backend for some users. xrender-sync-fence = false; + + +###################### +# Picom Rules +###################### +@include "picom-rules.conf"