aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/Dock.sh
blob: 9c6afbe0e83b3301385cd51f7439e8aaa6f9548e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# ==================================================
#  KoolDots (2026)
#  Project URL: https://github.com/LinuxBeginnings
#  License: GNU GPLv3
#  SPDX-License-Identifier: GPL-3.0-or-later
# ==================================================
# nwg-dock-hyprland launcher and toggle script

SCRIPTSDIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts"
DOCK_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nwg-dock-hyprland"

# Ensure dock configuration and wallust directory exist
mkdir -p "$DOCK_CONFIG_DIR/wallust" 2>/dev/null || true

# Check if nwg-dock-hyprland is installed
if ! command -v nwg-dock-hyprland >/dev/null 2>&1; then
  notify-send -u normal "Dock" "nwg-dock-hyprland is not installed" 2>/dev/null || true
  exit 1
fi

is_dock_running() {
  pgrep -x "nwg-dock-hyprla" >/dev/null 2>&1 || pgrep -x "nwg-dock-hyprland" >/dev/null 2>&1 || pgrep -f "nwg-dock-hyprland" >/dev/null 2>&1
}

kill_dock() {
  pkill -x "nwg-dock-hyprla" 2>/dev/null || true
  pkill -x "nwg-dock-hyprland" 2>/dev/null || true
  pkill -f "nwg-dock-hyprland" 2>/dev/null || true
}

start_dock() {
  # Dock configuration:
  # -p bottom : bottom dock position
  # -x : exclusive zone (moves other windows aside)
  # -i 32 : icon size 32
  # -mb 10 : margin bottom 10px
  # -c : launcher button command (rofi menu)
  # (no -d : no auto-hide)
  local launcher_cmd="${SCRIPTSDIR}/RofiLauncher.sh"
  nwg-dock-hyprland -p bottom -x -i 32 -mb 7 -mt 5 -c "$launcher_cmd" >/dev/null 2>&1 &
}

case "${1:-toggle}" in
--restart | restart)
  kill_dock
  sleep 0.2
  start_dock
  ;;
--start | start | activate)
  if ! is_dock_running; then
    start_dock
  fi
  ;;
--stop | stop | deactivate)
  kill_dock
  ;;
--toggle | toggle | *)
  if is_dock_running; then
    kill_dock
  else
    start_dock
  fi
  ;;
esac

exit 0
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage