From 171d6408d1a2b9af5cc89c3812f5619534f91d04 Mon Sep 17 00:00:00 2001 From: retrozinndev Date: Sun, 15 Jun 2025 23:37:04 -0300 Subject: [PATCH] :wrench: chore(hypr): add $exec variable, use uwsm everywhere --- hypr/scripts/exec.sh | 16 ++++++++++++++++ hypr/shell/autostart.conf | 10 +++++----- hypr/shell/bindings.conf | 18 ++++++++++-------- hypr/shell/environment.conf | 2 +- hypr/shell/variables.conf | 6 ++++-- 5 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 hypr/scripts/exec.sh diff --git a/hypr/scripts/exec.sh b/hypr/scripts/exec.sh new file mode 100644 index 0000000..d0ddf68 --- /dev/null +++ b/hypr/scripts/exec.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# This script executes the provided program with UWSM +# if in usage or launches it normally with hyprctl. +# --------------- +# Licensed under the MIT License +# Made by retrozinndev (João Dias) +# From: https://github.com/retrozinndev/colorshell + + +if uwsm check is-active; then + hyprctl dispatch exec "uwsm app -- $@" > /dev/null + exit 0 +fi + +hyprctl dispatch exec "$@" > /dev/null diff --git a/hypr/shell/autostart.conf b/hypr/shell/autostart.conf index 1ed3cd7..458e956 100644 --- a/hypr/shell/autostart.conf +++ b/hypr/shell/autostart.conf @@ -6,16 +6,16 @@ exec-once = systemctl enable --user --now hyprpolkitagent # Hyprland's PolKit exec-once = systemctl enable --user --now hypridle exec-once = systemctl enable --user --now gnome-keyring-daemon -exec-once = uwsm app -- wl-paste --type text --watch cliphist store -exec-once = uwsm app -- wl-paste --type image --watch cliphist store +exec-once = $exec wl-paste --type text --watch cliphist store +exec-once = $exec wl-paste --type image --watch cliphist store # Tools exec-once = systemctl enable --user --now hyprsunset exec-once = systemctl enable --user --now hyprpaper # Scripts -exec-once = uwsm app -- sh $XDG_CONFIG_HOME/hypr/scripts/gen-pywal.sh -exec-once = uwsm app -- sleep 3 && sh $XDG_CONFIG_HOME/hypr/scripts/load-hyprsunset.sh # wait some time to actually set the filters +exec-once = $exec sh $XDG_CONFIG_HOME/hypr/scripts/gen-pywal.sh +exec-once = $exec sleep 3 && sh $XDG_CONFIG_HOME/hypr/scripts/load-hyprsunset.sh # wait some time to actually set the filters # Shell -exec-once = uwsm app -- ags run +exec-once = $exec ags run diff --git a/hypr/shell/bindings.conf b/hypr/shell/bindings.conf index 996802f..72d8a85 100644 --- a/hypr/shell/bindings.conf +++ b/hypr/shell/bindings.conf @@ -1,26 +1,28 @@ # color-shell specific configuration, please don't modify unless you know what you're doing! +# `astal` and some `.*ctl` commands don't need $exec (uwsm), since it's just some process communication + bind = $mainMod, SPACE, exec, $menu bind = $mainMod, F11, fullscreen -bind = , Print, exec, sh $XDG_CONFIG_HOME/hypr/scripts/screenshot.sh -bind = $mainMod, Print, exec, sh $XDG_CONFIG_HOME/hypr/scripts/screenshot.sh full +bind = , Print, exec, $exec sh $XDG_CONFIG_HOME/hypr/scripts/screenshot.sh +bind = $mainMod, Print, exec, $exec sh $XDG_CONFIG_HOME/hypr/scripts/screenshot.sh full -# Test-only bind, restarts colorshell -bind = $mainMod, F7, exec, ags request reload +# restarts colorshell +bind = $mainMod, F7, exec, astal reload -bind = $mainMod, K, exec, $terminal +bind = $mainMod, K, exec, $exec $terminal bind = $mainMod, Q, killactive -bind = $mainMod, E, exec, $fm +bind = $mainMod, E, exec, $exec $fm bind = $mainMod, F, togglefloating bind = $mainMod, P, pseudo, bind = $mainMod, J, togglesplit bind = $mainMod, N, exec, astal toggle control-center bind = $mainMod, M, exec, astal toggle center-window -bind = $mainMod, L, exec, hyprlock -bind = $mainMod, V, exec, astal runner '>' || sh $XDG_CONFIG_HOME/hypr/scripts/clipboard-menu.sh +bind = $mainMod, L, exec, $exec hyprlock +bind = $mainMod, V, exec, astal runner '>' || $exec sh $XDG_CONFIG_HOME/hypr/scripts/clipboard-menu.sh bind = $mainMod, W, exec, astal runner '##' # bind = $mainMod, $mainMod_L, exec, astal toggle apps-window diff --git a/hypr/shell/environment.conf b/hypr/shell/environment.conf index 091d622..ccce967 100644 --- a/hypr/shell/environment.conf +++ b/hypr/shell/environment.conf @@ -25,5 +25,5 @@ env = QT_QPA_PLATFORMTHEME, qt5ct env = QT_AUTO_SCREEN_SCALE_FACTOR, 1 # Others -env = ADW_DISABLE_PORTAL, 1 # Fixes prefer-dark theme setting in some flatpak apps +env = ADW_DISABLE_PORTAL, 1 # Fixes prefer-dark setting in some gtk flatpak apps env = WALLPAPERS, $HOME/wallpapers diff --git a/hypr/shell/variables.conf b/hypr/shell/variables.conf index de75150..1bdf451 100644 --- a/hypr/shell/variables.conf +++ b/hypr/shell/variables.conf @@ -6,8 +6,10 @@ ############### # Wiki: https://wiki.hyprland.org/Hypr-Ecosystem/hyprlang#defining-variables +# Use this variable to execute apps dinamically (runs with uwsm if being used by compositor) +$exec = sh $XDG_CONFIG_HOME/hypr/scripts/exec.sh + $mainMod = SUPER $terminal = kitty $fm = nautilus -$menu = astal runner || anyrun -$dmenu = anyrun --plugins libstdin.so +$menu = astal runner