From 3013b531d73fc70eb0981a9041932fc0b0177878 Mon Sep 17 00:00:00 2001 From: Viyurz <128215328+Viyurz@users.noreply.github.com> Date: Fri, 27 Oct 2023 13:01:15 +0200 Subject: [PATCH] Removed swaync for Mako & reorganize/move wallpaper script. --- .config/hypr/hyprland.conf | 3 +- .config/mako/config | 8 + .config/swaync/config.json | 60 ------ .config/swaync/style.css | 215 --------------------- .config/wofi/style.css | 1 + .local/bin/sw => .scripts/set-wallpaper.sh | 157 ++++++++------- .scripts/swaylock.sh | 4 +- 7 files changed, 99 insertions(+), 349 deletions(-) create mode 100644 .config/mako/config delete mode 100644 .config/swaync/config.json delete mode 100644 .config/swaync/style.css rename .local/bin/sw => .scripts/set-wallpaper.sh (70%) diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf index f66914d..7543650 100644 --- a/.config/hypr/hyprland.conf +++ b/.config/hypr/hyprland.conf @@ -21,7 +21,6 @@ exec-once = artix-pipewire-launcher exec-once = nm-applet exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec-once = $HOME/.scripts/swayidle.sh -exec-once = swayosd-server # XWayland exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 @@ -43,7 +42,7 @@ exec-once = gnome-keyring-daemon -s -f # Theming exec-once = echo 1 > "$HOME/.cache/weeb-mode" -exec-once = sw -r +exec-once = $HOME/.scripts/set-wallpaper.sh -r # Prevent hidden Wine System Tray window from keeping workspace existing exec-once = $HOME/.scripts/kill-wine-explorer.sh diff --git a/.config/mako/config b/.config/mako/config new file mode 100644 index 0000000..adab154 --- /dev/null +++ b/.config/mako/config @@ -0,0 +1,8 @@ +default-timeout=5000 +text-color=#c8e0f0 +border-color=#579ce7 +background-color=#0d3259 +border-radius=4 +border-size=2 +font='JetBrainsMono Nerd Font' 11 +outer-margin=30,30,0,0 diff --git a/.config/swaync/config.json b/.config/swaync/config.json deleted file mode 100644 index aaf71b2..0000000 --- a/.config/swaync/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "$schema": "/etc/xdg/swaync/configSchema.json", - "positionX": "right", - "positionY": "top", - "layer": "top", - "cssPriority": "application", - "control-center-margin-top": 0, - "control-center-margin-bottom": 0, - "control-center-margin-right": 0, - "control-center-margin-left": 0, - "notification-icon-size": 64, - "notification-body-image-height": 100, - "notification-body-image-width": 200, - "timeout": 10, - "timeout-low": 5, - "timeout-critical": 0, - "fit-to-screen": true, - "control-center-width": 500, - "control-center-height": 600, - "notification-window-width": 500, - "keyboard-shortcuts": true, - "image-visibility": "when-available", - "transition-time": 200, - "hide-on-clear": false, - "hide-on-action": true, - "script-fail-notify": true, - "scripts": { - "example-script": { - "exec": "echo 'Do something...'", - "urgency": "Normal" - } - }, - "notification-visibility": { - "example-name": { - "state": "muted", - "urgency": "Low", - "app-name": "Spotify" - } - }, - "widgets": [ - "title", - "dnd", - "notifications", - "mpris" - ], - "widget-config": { - "title": { - "text": "Notifications", - "clear-all-button": true, - "button-text": "Clear All" - }, - "dnd": { - "text": "Do Not Disturb" - }, - "mpris": { - "image-size": 96, - "image-radius": 12 - } - } -} diff --git a/.config/swaync/style.css b/.config/swaync/style.css deleted file mode 100644 index 736e38d..0000000 --- a/.config/swaync/style.css +++ /dev/null @@ -1,215 +0,0 @@ -@import url('file:///home/viyurz/.config/gtk-3.0/colors-gtk.css'); - -* { - font-family: "Cantarell"; - color: @foreground; -} - -.blank-window { - background: transparent; -} - -.notification-row { - outline: none; -} - -.notification-row:focus, -.notification-row:hover { - background: @hovered; -} - -.notification, .control-center { - border: 2px solid transparent; - border-radius: 4px; - margin: 30px; - background-image: linear-gradient(160deg, @background1, @background2), linear-gradient(160deg, @accent1, @accent2); - background-clip: padding-box, border-box; - background-origin: border-box; - box-shadow: none; -} - -.widget-title, -.widget-dnd, -.control-center .notification { - margin: 10px; -} - -.notification-default-action, -.notification-action { - padding: 0; - margin: 0; - box-shadow: none; - background: transparent; - border: none; - border-radius: 0px; -} - -.notification-default-action:hover, -.notification-action:hover { - /*-gtk-icon-effect: none;*/ - background-image: linear-gradient(160deg, @hovered, @hovered), linear-gradient(160deg, @accent1, @accent2); -} - -.notification-content { - background: transparent; - padding: 6px; -} - -/* Uncomment to enable specific urgency colors -.low { - background: yellow; - padding: 6px; - border-radius: 12px; -} - -.normal { - background: green; - padding: 6px; - border-radius: 12px; -} - -.critical { - background: red; - padding: 6px; - border-radius: 12px; -} -*/ - - -.close-button { - background: transparent; - text-shadow: none; - padding: 0; - border-radius: 100%; - margin: 32px; - box-shadow: none; - border: none; - min-width: 24px; - min-height: 24px; -} - -.close-button:hover { - box-shadow: none; - background-color: @bad; - transition: all 0.15s ease-in-out; - border: none; -} - -/* When alternative actions are visible */ -.notification-default-action:not(:only-child) { - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; -} - -/* add bottom border radius to eliminate clipping */ -.notification-action:first-child { - border-bottom-left-radius: 10px; -} - -.notification-action:last-child { - border-bottom-right-radius: 10px; - border-right: 1px solid @noti-border-color; -} - -.image { -} - -.body-image { - margin-top: 6px; - background-color: white; - border-radius: 12px; -} - -.summary { - font-size: 16px; - font-weight: bold; - background: transparent; - text-shadow: none; -} - -.time { - font-size: 16px; - font-weight: bold; - background: transparent; - text-shadow: none; -} - -.body { - font-size: 15px; - font-weight: normal; - background: transparent; - text-shadow: none; -} - -/* The "Notifications" and "Do Not Disturb" text widget */ -.top-action-title { - text-shadow: none; -} - -.control-center-list { - background: transparent; -} - -.floating-notifications { - background: transparent; -} - -/*** Widgets ***/ - -/* Title widget */ -.widget-title { - font-size: 1.5rem; -} - -.widget-title > button { - font-size: initial; - text-shadow: none; - border: 2px solid transparent; - border-radius: 4px; - background-image: linear-gradient(160deg, @background1, @background2), linear-gradient(160deg, @accent1, @accent2); - background-clip: padding-box, border-box; - background-origin: border-box; - box-shadow: none; -} - -.widget-title > button:hover { - background-image: linear-gradient(160deg, @selected, @selected), linear-gradient(160deg, @accent1, @accent2); -} - -/* DND widget */ -.widget-dnd > switch { - border: 2px solid transparent; - border-radius: 16px; - background-image: linear-gradient(160deg, @background1, @background2), linear-gradient(160deg, @accent1, @accent2); - background-clip: padding-box, border-box; - background-origin: border-box; - box-shadow: none; -} - -.widget-dnd > switch:checked { - background-image: linear-gradient(160deg, @selected, @selected), linear-gradient(160deg, @accent1, @accent2); -} - -.widget-dnd > switch slider { - background-color: alpha(@disabled, 0.5); -} - -.widget-dnd > switch:checked slider { - background-color: alpha(@accent1, 0.5); -} - -/* Mpris widget */ -.widget-mpris { - /* The parent to all players */ -} -.widget-mpris-player { - padding: 8px; - margin: 8px; -} -.widget-mpris-title { - font-weight: bold; - font-size: 1.25rem; -} -.widget-mpris-subtitle { - font-size: 1.1rem; -} diff --git a/.config/wofi/style.css b/.config/wofi/style.css index 567cb55..4ad73f5 100644 --- a/.config/wofi/style.css +++ b/.config/wofi/style.css @@ -8,6 +8,7 @@ window { background-origin: border-box; border: 2px solid transparent; border-radius: 4px; + opacity: 0.85; } #scroll { diff --git a/.local/bin/sw b/.scripts/set-wallpaper.sh similarity index 70% rename from .local/bin/sw rename to .scripts/set-wallpaper.sh index b2b5175..17e8680 100755 --- a/.local/bin/sw +++ b/.scripts/set-wallpaper.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash wp_base_dir="$HOME/Images/Wallpapers/Desktop" declare -A wp_dirs=([SFW]="$wp_base_dir/SFW" @@ -27,7 +27,6 @@ function pick_random_wallpaper { - function help { cat <<- EOF Usage: $(basename "$0") [options...] @@ -78,6 +77,7 @@ done +# Set/pick wallpaper accordingly to arguments passed if [[ $opt_random -eq 1 && $opt_wallpaper -eq 1 ]]; then echo "Option -r and -w can't be used together." exit 1 @@ -98,10 +98,7 @@ else source "$HOME/.cache/wal/colors.sh" fi - - echo "Selected wallpaper: $wallpaper" -#viu -h 15 "$wallpaper" @@ -109,9 +106,10 @@ echo "Selected wallpaper: $wallpaper" echo "Generating color scheme using pywal." wal -qni "$wallpaper" --saturate 0.75 -# Pour si ya un apostrophe dans le nom du fichier -sed -iE "/^wallpaper=/,/#/ s/='/=\"/" /home/viyurz/.cache/wal/colors.sh -sed -iE "/^wallpaper=/,/#/ s/'$/\"/" /home/viyurz/.cache/wal/colors.sh +# Replace apostrophes around the wallpaper path with quotes +# in case there is an apostrophe in the file name +sed -iE "/^wallpaper=/,/#/ s/='/=\"/" "$HOME/.cache/wal/colors.sh" +sed -iE "/^wallpaper=/,/#/ s/'$/\"/" "$HOME/.cache/wal/colors.sh" @@ -147,29 +145,20 @@ declare -A params=( ) # Display accent colors -pastel color "${colors[accent1]}" -pastel color "${colors[accent2]}" - - - -# Set wallpaper using swaybg -if grep 1 "$HOME/.cache/weeb-mode"; then - echo "Setting wallpaper using swaybg." - pkill -u "$USER" swaybg &> /dev/null - hyprctl dispatch exec "swaybg -i \"$wallpaper\"" > /dev/null -fi +# pastel color "${colors[accent1]}" +# pastel color "${colors[accent2]}" # Clear colors/params files echo -n '' > "$HOME/.config/gtk-3.0/colors-gtk.css" echo -n '' > "$HOME/.config/hypr/colors.conf" -echo "wallpaper=\"$wallpaper\"" > "$HOME/.config/hypr/colors.sh" +echo "wallpaper=\"$wallpaper\"" > "$HOME/.cache/colors.sh" # Set colors variables in files -echo "Writing colors to .conf/css/sh files." +echo "Writing theme colors in files." for key in "${!colors[@]}"; do value="${colors[$key]}" # Hyprland @@ -177,24 +166,25 @@ for key in "${!colors[@]}"; do # GTK echo "@define-color $key $value;" >> "$HOME/.config/gtk-3.0/colors-gtk.css" # Shell - echo "${key}=$value" >> "$HOME/.config/hypr/colors.sh" + echo "${key}=$value" >> "$HOME/.cache/colors.sh" + # i3 + sed -i "s/^set \$$key.*/set \$$key $value/" "$HOME/.config/i3/config" done -# Add Hyprland params -echo "Adding parameters to Hyprland .conf file." +# Add Hyprland/i3 params +echo "Writing parameters to Hyprland & i3 files." for key in "${!params[@]}"; do value="${params[$key]}" + # Hyprland echo '$'"$key=$value" >> "$HOME/.config/hypr/colors.conf" + # i3 + sed -i "s/^set \$$key.*/set \$$key $value/" "$HOME/.config/i3/config" done -# Reload Hyprland -echo "Reloading Hyprland." -hyprctl reload &> /dev/null - # Set Kitty params -echo "Setting Kitty parameters." +echo "Changing colors/params in Kitty config file." declare -A kitty_vars=( [font_family]="${params[font]}" [url_color]="${colors[accent1]}" @@ -208,20 +198,11 @@ for key in "${!kitty_vars[@]}"; do value="${kitty_vars[$key]}" sed -i "s/^$key.*/$key $value/" "$HOME/.config/kitty/kitty.conf" done -echo "Reloading opened Kitties." -killall -SIGUSR1 kitty &> /dev/null - - - -# Convert CSS to SCSS for eww -# echo "Converting CSS colors file to SCSS for eww." -# cp "$HOME/.config/gtk-3.0/colors-gtk.css" "$HOME/.config/eww/colors.scss" -# sed -i -E 's/^@define-color /$/; s/^\$\S*/&:/' "$HOME/.config/eww/colors.scss" # Set Waybar params -echo "Setting Waybar parameters." +echo "Changing params in Waybar styling file." declare -A waybar_vars=( [font-family]="${params[font]}" [border-bottom]="${params[border_size]}px solid transparent" @@ -232,17 +213,10 @@ for key in "${!waybar_vars[@]}"; do sed -i "s~$key:[^;]*~$key: $value~" "$HOME/.config/waybar/style.css" done -echo "Reloading Waybar." -if pgrep -x -u "$USER" waybar > /dev/null; then - killall -SIGUSR2 waybar -else - hyprctl dispatch exec waybar > /dev/null -fi - # Set Wofi params -echo "Setting Wofi parameters." +echo "Changing params in Wofi styling file." declare -A wofi_vars_window=( [font-family]="${params[font]}" [border]="${params[border_size]}px solid transparent" @@ -267,31 +241,34 @@ sed -i "/^#entry:selected/,/border-radius:/ s/border-radius:[^;]*/border-radius: -# Set swaync params -#echo "Setting swaync parameters." -#sed -zi "s/border-radius:[^;]*/border-radius: ${params[border_radius]}px/1" "$HOME/.config/swaync/style.css" -#sed -i "s/border: [0-9]+.*/border: ${params[border_size]}px solid transparent;/" "$HOME/.config/swaync/style.css" -#sed -zi "s/margin:[^;]*/margin: $((params[gaps_out]*2))px/1" "$HOME/.config/swaync/style.css" -#sed -zi "s/margin:[^;]*/margin: ${params[gaps_out]}px/3" "$HOME/.config/swaync/style.css" -#sed -zi "s/border-radius:[^;]*/border-radius: ${params[border_radius]}px/8" "$HOME/.config/swaync/style.css" -echo "Reloading swaync." -if pgrep -x -u "$USER" swaync > /dev/null; then - swaync-client -rs > /dev/null -else - hyprctl dispatch exec swaync > /dev/null -fi +# Set Mako params +echo "Changing colors/params in Mako config file." +declare -A mako_vars=( + [font]="${params[font]} 11" + [border-radius]="${params[border_radius]}" + [border-size]="${params[border_size]}" + [outer-margin]="$((params[gaps_out]*2)),$((params[gaps_out]*2)),0,0" + [text-color]="${colors[foreground]}" + [background-color]="${colors[background1]}" + [border-color]="${colors[accent1]}" +) +for key in "${!mako_vars[@]}"; do + value="${mako_vars[$key]}" + sed -i "s/$key=.*/$key=$value/" "$HOME/.config/mako/config" +done # BetterDiscord if [[ -x /bin/betterdiscordctl ]]; then + echo "Executable found for betterdiscordctl." if [[ ! -f "$HOME/.config/BetterDiscord/data/stable/custom.css" ]]; then echo "Downloading ClearVision theme for BetterDiscord." mkdir -p "$HOME/.config/BetterDiscord/data/stable" wget -O "$HOME/.config/BetterDiscord/data/stable/custom.css" "https://betterdiscord.app/Download?id=23" fi - echo "Setting BetterDiscord colors." + echo "Changing BetterDiscord theme colors." declare -A bd_vars=( [main-color]="${colors[accent1]}" [hover-color]="${colors[accent2]}" @@ -304,6 +281,8 @@ if [[ -x /bin/betterdiscordctl ]]; then value="${bd_vars[$key]}" sed -i "s~--$key:[^;]*~--$key: $value~" "$HOME/.config/BetterDiscord/data/stable/custom.css" done +else + echo "No executable found for betterdiscordctl, skipping." fi @@ -318,21 +297,59 @@ done -# Reload pywalfox -if pgrep firefox &> /dev/null; then - echo "Reloading pywalfox." - pywalfox update 2> /dev/null +# Reload/restart stuff +if [[ -z "$WAYLAND_DISPLAY" ]]; then + echo "Reloading i3." + i3-msg reload > /dev/null & + + echo "Changing wallpaper using feh." + feh --no-fehbg --bg-fill "$wallpaper" & +else + echo "Reloading Hyprland." + hyprctl reload > /dev/null & + + if grep -q 1 "$HOME/.cache/weeb-mode"; then + echo "Changing wallpaper using swaybg." + pkill -u "$USER" swaybg &> /dev/null + hyprctl dispatch exec "swaybg -i \"$wallpaper\"" > /dev/null & + fi + + if pgrep -u "$USER" waybar > /dev/null; then + echo "Reloading Waybar." + killall -SIGUSR2 waybar & + else + echo "Starting Waybar." + hyprctl dispatch exec waybar > /dev/null & + fi + + if pgrep -u "$USER" mako > /dev/null; then + echo "Reloading Mako." + makoctl reload & + else + echo "Starting Mako." + hyprctl dispatch exec mako > /dev/null & + fi fi +# Reload Kitty +echo "Reloading opened Kitty windows." +killall -SIGUSR1 kitty &> /dev/null & + + +# Reload pywalfox +#if pgrep -u "$USER" firefox &> /dev/null; then +# echo "Reloading pywalfox." +# pywalfox update & +#fi + # OpenRGB if [[ -x /bin/openrgb ]]; then - echo "Setting keyboard colors." - openrgb --noautoconnect -c "${colors[accent1]:1}" > /dev/null + echo "Changing OpenRGB colors." + openrgb --noautoconnect -c "${colors[accent1]:1}" > /dev/null & fi - -# To use with swaylock -convert "$wallpaper" -blur 0x5 "$HOME/.cache/wallpaper-blurred.jpg" & +# Generate blurred wallpaper to use with swaylock/i3lock +convert "$wallpaper" -blur 0x5 -resize 1920x1080 "$HOME/.cache/wallpaper-blurred.jpg" & diff --git a/.scripts/swaylock.sh b/.scripts/swaylock.sh index b91fb2f..31a96e5 100755 --- a/.scripts/swaylock.sh +++ b/.scripts/swaylock.sh @@ -1,6 +1,6 @@ #!/bin/sh -source "$HOME/.config/hypr/colors.sh" +source "$HOME/.cache/colors.sh" options=( --daemonize @@ -63,4 +63,4 @@ fi swaylock "${options[@]}" -sw -r +$HOME/.scripts/set-wallpaper.sh -r