Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Configs/.local/bin/hyde-shell
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,18 @@ export BIN_DIR LIB_DIR SHARE_DIR PATH HYDE_SCRIPTS_PATH

#*--------------------------------------------------------------------------------

if [[ -z "${XDG_RUNTIME_DIR:-}" ]]; then
if [[ "$(uname -s)" == "FreeBSD" ]]; then
export XDG_RUNTIME_DIR="/tmp/runtime-$(id -u)"
else
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
fi
fi
[[ -d "${XDG_RUNTIME_DIR}" ]] || mkdir -p "${XDG_RUNTIME_DIR}"
chmod 700 "${XDG_RUNTIME_DIR}" 2>/dev/null || true

# Prepare runtime directory for hyde
[[ -d "${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/hyde" ]] || mkdir -p "${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/hyde"
[[ -d "${XDG_RUNTIME_DIR}/hyde" ]] || mkdir -p "${XDG_RUNTIME_DIR}/hyde"

# Priority commands
case "$1" in
Expand Down
13 changes: 11 additions & 2 deletions Configs/.local/lib/hyde/globalcontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
if [[ -z "${XDG_RUNTIME_DIR:-}" ]]; then
if [[ "$(uname -s)" == "FreeBSD" ]]; then
export XDG_RUNTIME_DIR="/tmp/runtime-$(id -u)"
else
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
fi
fi
[[ -d "${XDG_RUNTIME_DIR}" ]] || mkdir -p "${XDG_RUNTIME_DIR}"
chmod 700 "${XDG_RUNTIME_DIR}" 2>/dev/null || true
export HYDE_CONFIG_HOME="$XDG_CONFIG_HOME/hyde"
export HYDE_DATA_HOME="$XDG_DATA_HOME/hyde"
export HYDE_CACHE_HOME="$XDG_CACHE_HOME/hyde"
Expand Down Expand Up @@ -178,6 +186,7 @@ get_themes() {
unset thmSort
unset thmList
unset thmWall
[ -d "$HYDE_CONFIG_HOME/themes" ] || return 0
while read -r thmDir; do
local realWallPath
realWallPath="$(readlink "$thmDir/wall.set")"
Expand Down Expand Up @@ -215,7 +224,7 @@ case "$enableWallDcol" in
esac
if [ -z "$HYDE_THEME" ] || [ ! -d "$HYDE_CONFIG_HOME/themes/$HYDE_THEME" ]; then
get_themes
HYDE_THEME="${thmList[0]}"
[ "${#thmList[@]}" -gt 0 ] && HYDE_THEME="${thmList[0]}"
fi
HYDE_THEME_DIR="$HYDE_CONFIG_HOME/themes/$HYDE_THEME"
WALLBASH_DIRS=(
Expand Down
37 changes: 36 additions & 1 deletion Configs/.local/lib/hyde/pm.sh

@kRHYME7 kRHYME7 Apr 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are comfortable with python too please add a backend for pm.py in ./pm/. The python backend will be use for internal stuff and can have advance flags compared to pm.sh.

Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ skip_table_header() {
xargs_self() {
xargs -r sh -c '"$0" "$@" </dev/tty' "$0" "$@"
}
PMS="paru yay pacman apt dnf zypper apk brew scoop flatpak"
PMS="paru yay pacman pkg apt dnf zypper apk brew scoop flatpak"
pm_detect() {
if [ ! "${PM-}" ]; then
for NAME in $PMS; do
Expand Down Expand Up @@ -290,6 +290,41 @@ pacman_is_installed() {
pacman_file_query() {
pacman -F "$1"
}
pkg_install() {
sudo pkg install -y "$@"
}
pkg_remove() {
sudo pkg delete -y "$@"
}
pkg_upgrade() {
sudo pkg upgrade -y
}
pkg_fetch() {
sudo pkg update
}
pkg_info() {
pkg info "$1" 2> /dev/null || pkg search -x "$1"
}
pkg_list_all() {
pkg rquery '%n %v'
}
pkg_list_installed() {
pkg query '%n %v'
}
pkg_format_all() {
awk "{ print $FMT_NAME \$1 $FMT_VERSION \$2 $FMT_RESET }"
}
pkg_format_installed() {
awk "{ print $FMT_NAME \$1 $FMT_VERSION \$2 $FMT_RESET }"
}
pkg_is_installed() {
pkg info -e "$1" > /dev/null 2>&1 && echo "Installed" || {
echo "Not installed" && return 1
}
}
pkg_file_query() {
pkg which "$1"
}
AUR_HELPERS="paru paru-bin yay yay-bin"
aur_helpers_contain() {
for NAME in $AUR_HELPERS; do
Expand Down
17 changes: 10 additions & 7 deletions Configs/.local/lib/hyde/pyutils/pip_env.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use uv now.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

def is_venv_valid(venv_path):
"""Returns whether the venv is valid or not

Args:
venv_path: Path to the virtual environment to validate
"""
Expand All @@ -32,8 +32,8 @@ def is_venv_valid(venv_path):
# 1.- Must have its own python file and it must be executable
if not (os.path.isfile(python_exe) and os.access(python_exe, os.X_OK)):
return False
# 2.- Python inside venv must be able to import pip

# 2.- Python inside venv must be able to import pip
try:
res = subprocess.run(
[python_exe, "-c", "import pip"],
Expand All @@ -45,7 +45,7 @@ def is_venv_valid(venv_path):
return False
except Exception:
return False

# 3.- Python version used to create the venv must match current one
if os.path.exists(pyvenv_cfg):
try:
Expand Down Expand Up @@ -345,9 +345,12 @@ def main(args):
args = parser.parse_args(args)

venv_path = get_venv_path()
requirements_file = os.path.join(
xdg_base_dirs.user_lib_dir(), "hyde", "pyutils", "requirements.txt"
)
requirements_dir = os.path.join(xdg_base_dirs.user_lib_dir(), "hyde", "pyutils")
requirements_file = os.path.join(requirements_dir, "requirements.txt")
if sys.platform.startswith("freebsd"):
freebsd_requirements = os.path.join(requirements_dir, "requirements-freebsd.txt")
if os.path.exists(freebsd_requirements):
requirements_file = freebsd_requirements

if args.command == "create":
args.func(venv_path, requirements_file)
Expand Down
4 changes: 4 additions & 0 deletions Configs/.local/lib/hyde/pyutils/requirements-freebsd.txt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks identical to the HyDE.

Image

But if you intend to have new requirements then this is fine as long as the pyproject-freebsd.toml is added as optional like how we add sed

O |  ${HOME}/.local/lib/hyde|  pyproject-freebsd.toml  | pkg  

BTW I use pkg as requirment package so it only triggers on BSD.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
loguru==0.7.3
pulsectl==24.12.0
requests==2.32.4
PyGObject
2 changes: 2 additions & 0 deletions Configs/.local/lib/hyde/resetxdgportal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ killall -e xdg-desktop-portal
sleep 1
if [ -d /run/current-system/sw/libexec ]; then
libDir=/run/current-system/sw/libexec
elif [ -d /usr/local/libexec ]; then
libDir=/usr/local/libexec
else
libDir=/usr/lib
fi
Expand Down
41 changes: 26 additions & 15 deletions Configs/.local/lib/hyde/theme.switch.sh

@kRHYME7 kRHYME7 Apr 20, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will handle this differently

I suggest doing this:

  1. Revert all sed changes

  2. Now as you might already notice, you know we can ship our own sed version
    ~/.local/lib/hyde/sed (or $LIB_DIR/hyde/sed) <- this is a script to handle any patch to any binary, you can handle the handover or the override here

# your custom sed
sed -i '' "${@}"
  1. Ship it with your installer of HyDE as I suggested here.

you can customize your own restore_cfg.psv and add stuff

O |  ${HOME}/.local/lib/hyde| sed  | pkg  

This will force users to haeve there sed wrapper that is accustomed for bsd. Put it below the other Core HyDE packages.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
[ -z "$HYDE_THEME" ] && echo "ERROR: unable to detect theme" && exit 1
get_themes
confDir="${XDG_CONFIG_HOME:-$HOME/.config}"
sed_in_place() {
if sed --version >/dev/null 2>&1; then
sed -i "$@"
else
sed -i '' "$@"
fi
}
Theme_Change() {
local x_switch=$1
for i in "${!thmList[@]}"; do
Expand Down Expand Up @@ -85,7 +92,7 @@ sanitize_hypr_theme() {
dirty_regex+=("${HYPR_CONFIG_SANITIZE[@]}")
for pattern in "${dirty_regex[@]}"; do
grep -E "$pattern" "$buffer_file" | while read -r line; do
sed -i "\|$line|d" "$buffer_file"
sed_in_place "\|$line|d" "$buffer_file"
print_log -sec "theme" -warn "sanitize" "$line"
done
done
Expand Down Expand Up @@ -130,8 +137,12 @@ if [[ -r $HYPRLAND_CONFIG ]]; then
load_hypr_variables "${XDG_STATE_DIR:-$HOME/.local/state}/hyde/hyprland.conf"
fi
show_theme_status
if ! dconf write /org/gnome/desktop/interface/icon-theme "'$ICON_THEME'"; then
print_log -sec "theme" -warn "dconf" "failed to set icon theme"
if command -v dconf >/dev/null 2>&1 && { [[ -n "${DBUS_SESSION_BUS_ADDRESS:-}" ]] || [[ -n "${DISPLAY:-}" ]]; }; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this BSD related if not please send as separate patch please.

if ! dconf write /org/gnome/desktop/interface/icon-theme "'$ICON_THEME'"; then
print_log -sec "theme" -warn "dconf" "failed to set icon theme"
fi
else
print_log -sec "theme" -warn "dconf" "no active DBus session; skipping icon theme write"
fi
if [ -d /run/current-system/sw/share/themes ]; then
export themesDir=/run/current-system/sw/share/themes
Expand Down Expand Up @@ -159,10 +170,10 @@ toml_write "$confDir/kdeglobals" "UiSettings" "ColorScheme" "colors"
toml_write "$confDir/kdeglobals" "KDE" "widgetStyle" "kvantum"
toml_write "$XDG_DATA_HOME/icons/default/index.theme" "Icon Theme" "Inherits" "$CURSOR_THEME"
toml_write "$HOME/.icons/default/index.theme" "Icon Theme" "Inherits" "$CURSOR_THEME"
sed -i -e "/^gtk-theme-name=/c\gtk-theme-name=\"$GTK_THEME\"" \
-e "/^include /c\include \"$HOME/.gtkrc-2.0.mime\"" \
-e "/^gtk-cursor-theme-name=/c\gtk-cursor-theme-name=\"$CURSOR_THEME\"" \
-e "/^gtk-icon-theme-name=/c\gtk-icon-theme-name=\"$ICON_THEME\"" "$HOME/.gtkrc-2.0"
sed_in_place -e "s|^gtk-theme-name=.*$|gtk-theme-name=\"$GTK_THEME\"|" \
-e "s|^include .*$|include \"$HOME/.gtkrc-2.0.mime\"|" \
-e "s|^gtk-cursor-theme-name=.*$|gtk-cursor-theme-name=\"$CURSOR_THEME\"|" \
-e "s|^gtk-icon-theme-name=.*$|gtk-icon-theme-name=\"$ICON_THEME\"|" "$HOME/.gtkrc-2.0"
GTK3_FONT="${GTK3_FONT:-$FONT}"
GTK3_FONT_SIZE="${GTK3_FONT_SIZE:-$FONT_SIZE}"
toml_write "$confDir/gtk-3.0/settings.ini" "Settings" "gtk-theme-name" "$GTK_THEME"
Expand Down Expand Up @@ -193,10 +204,10 @@ if pkg_installed flatpak; then
--env=ICON_THEME="$ICON_THEME"
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo &
fi
sed -i -e "/^Net\/ThemeName /c\Net\/ThemeName \"$GTK_THEME\"" \
-e "/^Net\/IconThemeName /c\Net\/IconThemeName \"$ICON_THEME\"" \
-e "/^Gtk\/CursorThemeName /c\Gtk\/CursorThemeName \"$CURSOR_THEME\"" \
-e "/^Gtk\/CursorThemeSize /c\Gtk\/CursorThemeSize $CURSOR_SIZE" \
sed_in_place -e "s|^Net/ThemeName .*$|Net/ThemeName \"$GTK_THEME\"|" \
-e "s|^Net/IconThemeName .*$|Net/IconThemeName \"$ICON_THEME\"|" \
-e "s|^Gtk/CursorThemeName .*$|Gtk/CursorThemeName \"$CURSOR_THEME\"|" \
-e "s|^Gtk/CursorThemeSize .*$|Gtk/CursorThemeSize $CURSOR_SIZE|" \
"$confDir/xsettingsd/xsettingsd.conf"
if [ ! -L "$HOME/.themes/$GTK_THEME" ] && [ -d "$themesDir/$GTK_THEME" ]; then
print_log -sec "theme" -warn "linking" "$GTK_THEME to ~/.themes to fix GTK4 not following xdg"
Expand All @@ -205,8 +216,8 @@ if [ ! -L "$HOME/.themes/$GTK_THEME" ] && [ -d "$themesDir/$GTK_THEME" ]; then
ln -snf "$themesDir/$GTK_THEME" "$HOME/.themes/"
fi
if [ -f "$HOME/.Xresources" ]; then
sed -i -e "/^Xcursor\.theme:/c\Xcursor.theme: $CURSOR_THEME" \
-e "/^Xcursor\.size:/c\Xcursor.size: $CURSOR_SIZE" "$HOME/.Xresources"
sed_in_place -e "s|^Xcursor\.theme:.*$|Xcursor.theme: $CURSOR_THEME|" \
-e "s|^Xcursor\.size:.*$|Xcursor.size: $CURSOR_SIZE|" "$HOME/.Xresources"
grep -q "^Xcursor\.theme:" "$HOME/.Xresources" || echo "Xcursor.theme: $CURSOR_THEME" >>"$HOME/.Xresources"
grep -q "^Xcursor\.size:" "$HOME/.Xresources" || echo "Xcursor.size: 30" >>"$HOME/.Xresources"
else
Expand All @@ -216,8 +227,8 @@ Xcursor.size: $CURSOR_SIZE
EOF
fi
if [ -f "$HOME/.Xdefaults" ]; then
sed -i -e "/^Xcursor\.theme:/c\Xcursor.theme: $CURSOR_THEME" \
-e "/^Xcursor\.size:/c\Xcursor.size: $CURSOR_SIZE" "$HOME/.Xdefaults"
sed_in_place -e "s|^Xcursor\.theme:.*$|Xcursor.theme: $CURSOR_THEME|" \
-e "s|^Xcursor\.size:.*$|Xcursor.size: $CURSOR_SIZE|" "$HOME/.Xdefaults"
grep -q "^Xcursor\.theme:" "$HOME/.Xdefaults" || echo "Xcursor.theme: $CURSOR_THEME" >>"$HOME/.Xdefaults"
grep -q "^Xcursor\.size:" "$HOME/.Xdefaults" || echo "Xcursor.size: 30" >>"$HOME/.Xdefaults"
fi
Expand Down
29 changes: 27 additions & 2 deletions Configs/.local/lib/hyde/waybar.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also for this one this might be a separate patch that targets non systemd. So this should be a separate PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add this patches in advance so for the BSD specific patchs are easier to review.

Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
STATE_FILE = Path(os.path.join(str(xdg_state_home()), "hyde", "staterc"))
HYDE_CONFIG = Path(os.path.join(str(xdg_state_home()), "hyde", "config"))
UNIT_NAME = f"hyde-{os.environ.get('XDG_SESSION_DESKTOP', 'unknown')}-bar.service"
HAS_SYSTEMCTL = shutil.which("systemctl") is not None


def source_env_file(filepath):
Expand Down Expand Up @@ -500,6 +501,10 @@ def signal_handler(sig, frame):

def is_waybar_running_for_current_user():
"""Check if Waybar or Waybar-wrapped is running for the current user only."""
if not HAS_SYSTEMCTL:
result = subprocess.run(["pgrep", "-x", "waybar"], capture_output=True, text=True)
return result.returncode == 0

check_cmd = ["systemctl", "--user", "is-active", UNIT_NAME]
try:
result = subprocess.run(check_cmd, capture_output=True, text=True)
Expand All @@ -514,6 +519,14 @@ def is_waybar_running_for_current_user():

def run_waybar():
"""Run Waybar using hyde-shell app with systemd unit, let systemd handle logging."""
if not HAS_SYSTEMCTL:
if not is_waybar_running_for_current_user():
subprocess.Popen(["waybar"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
logger.debug("Waybar launched directly (no systemctl available)")
else:
logger.debug("Waybar already running (direct mode)")
return

# check_cmd = ["systemctl", "--user", "is-active", "--quiet", UNIT_NAME]
run_cmd = ["hyde-shell", "app", "-u", UNIT_NAME, "-t", "service", "--", "waybar"]
# Check if the unit is active
Expand All @@ -528,6 +541,11 @@ def run_waybar():
def kill_waybar():
"""Kill only the current user's Waybar process."""
"""Stop Waybar systemd unit for current session desktop."""
if not HAS_SYSTEMCTL:
subprocess.run(["pkill", "-x", "waybar"])
logger.debug("Stopped Waybar process directly (no systemctl available)")
return

subprocess.run(["systemctl", "--user", "stop", UNIT_NAME])
logger.debug(f"Stopped Waybar systemd unit: {UNIT_NAME}")

Expand All @@ -544,6 +562,9 @@ def kill_waybar_and_watcher():
kill_waybar()
logger.debug("Killed Waybar processes for current user.")

if not HAS_SYSTEMCTL:
return

try:
watcher_unit = f"hyde-{os.getenv('XDG_SESSION_DESKTOP')}-waybar-watcher.service"
result = subprocess.run(
Expand Down Expand Up @@ -1441,8 +1462,12 @@ def main():

if args.hide:
# Send SIGUSR1 to Waybar systemd unit
cmd = ["systemctl", "--user", "kill", "-s", "SIGUSR1", UNIT_NAME]
logger.info(f"Sending SIGUSR1 to {UNIT_NAME} via systemctl")
if HAS_SYSTEMCTL:
cmd = ["systemctl", "--user", "kill", "-s", "SIGUSR1", UNIT_NAME]
logger.info(f"Sending SIGUSR1 to {UNIT_NAME} via systemctl")
else:
cmd = ["pkill", "-USR1", "-x", "waybar"]
logger.info("Sending SIGUSR1 to waybar directly (no systemctl)")
subprocess.run(cmd)
sys.exit(0)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Multi-language README support
<img src="Source/assets/endeavouros.png" alt="EndeavourOS" style="width: 10%; margin: 10px;"/>
<img src="Source/assets/garuda.png" alt="Garuda" style="width: 10%; margin: 10px;"/>
<img src="Source/assets/nixos.png" alt="NixOS" style="width: 10%; margin: 10px;"/>
<img src="Source/assets/freebsd.png" alt="FreeBSD" style="width: 10%; margin: 10px;"/>
</div>
</div>

Expand All @@ -73,6 +74,8 @@ While installing HyDE alongside another [DE](https://wiki.archlinux.org/title/De

For NixOS support there is a separate project being maintained @ [Hydenix](https://github.com/richen604/hydenix/tree/main)

[FreeBSD](https://www.freebsd.org) is supported via HydeBSD. Due to differences in bootloader, kernel, userspace, and package availability, not all features of HyDE may be present.

> [!IMPORTANT]
> The install script will auto-detect an NVIDIA card and install nvidia-open-dkms drivers for your kernel.
> For legacy cards [check this first](./Scripts/nvidia-db/)
Expand Down
13 changes: 12 additions & 1 deletion Scripts/global_fn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ export shlList

pkg_installed() {
local PkgIn=$1
local PkgResolved

if pacman -Q "${PkgIn}" &>/dev/null; then
case "${PkgIn}" in
kvantum) PkgResolved="Kvantum" ;;
imagemagick) PkgResolved="ImageMagick7" ;;
*) PkgResolved="${PkgIn}" ;;
esac

if [[ "${PkgIn}" == "zsh-theme-powerlevel10k" ]] && [[ -d "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k" ]]; then
return 0
fi

if "${pacmanCmd}" query "${PkgResolved}" &>/dev/null; then
return 0
else
return 1
Expand Down
Loading
Loading