From eaa86d44258ce72dbee5e9fa5304dfe002819036 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Thu, 21 Sep 2023 11:44:10 +0200
Subject: Try out this hyprland script
---
.config/hypr/hyprland.conf | 18 ++---
.local/bin/hyprland-switch-tag | 161 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 170 insertions(+), 9 deletions(-)
create mode 100755 .local/bin/hyprland-switch-tag
diff --git a/.config/hypr/hyprland.conf b/.config/hypr/hyprland.conf
index 109675d..5e75df6 100644
--- a/.config/hypr/hyprland.conf
+++ b/.config/hypr/hyprland.conf
@@ -99,15 +99,15 @@ bind=SUPER,SPACE,layoutmsg,orientationnext
bind=SUPER_SHIFT,SPACE,layoutmsg,orientationprev
bind=SUPER,M,fullscreen,1
-bind=SUPER,2,workspace,1
-bind=SUPER,3,workspace,2
-bind=SUPER,4,workspace,3
-bind=SUPER,5,workspace,4
-bind=SUPER,6,workspace,5
-bind=SUPER,7,workspace,6
-bind=SUPER,8,workspace,7
-bind=SUPER,9,workspace,8
-bind=SUPER,0,workspace,9
+bind=SUPER,2,exec,~/.local/bin/hyprland-switch-tag 1
+bind=SUPER,3,exec,~/.local/bin/hyprland-switch-tag 2
+bind=SUPER,4,exec,~/.local/bin/hyprland-switch-tag 3
+bind=SUPER,5,exec,~/.local/bin/hyprland-switch-tag 4
+bind=SUPER,6,exec,~/.local/bin/hyprland-switch-tag 5
+bind=SUPER,7,exec,~/.local/bin/hyprland-switch-tag 6
+bind=SUPER,8,exec,~/.local/bin/hyprland-switch-tag 7
+bind=SUPER,9,exec,~/.local/bin/hyprland-switch-tag 8
+bind=SUPER,0,exec,~/.local/bin/hyprland-switch-tag 9
bind=SUPER_SHIFT,2,movetoworkspacesilent,1
bind=SUPER_SHIFT,3,movetoworkspacesilent,2
diff --git a/.local/bin/hyprland-switch-tag b/.local/bin/hyprland-switch-tag
new file mode 100755
index 0000000..06840c9
--- /dev/null
+++ b/.local/bin/hyprland-switch-tag
@@ -0,0 +1,161 @@
+#!/usr/bin/env bash
+
+# Pascal Jaeger
+
+# utils
+green="\033[0;32m"
+red="\033[0;31m"
+blue="\033[0;34m"
+nocolor="\033[0m"
+
+#util functions
+check() {
+ command -v "$1" 1>/dev/null
+}
+
+ok() {
+ echo -e "[$green $nocolor] $*"
+}
+
+err() {
+ echo -e "[$red $nocolor] $*"
+}
+optional() {
+ echo -e "[$blue $nocolor] $*"
+}
+
+notify() {
+ # shellcheck disable=SC2015
+ check notify-send && {
+ notify-send "$@"
+ } || {
+ echo "$@"
+ }
+}
+
+checkUtils() {
+ # shellcheck disable=SC2015
+ check grep && ok "grep" || err "grep"
+ # shellcheck disable=SC2015
+ check grep && ok "cut" || err "cut"
+ # shellcheck disable=SC2015
+ check notify-send && ok "notify-send (Optional)" || optional "notify-send (Optional)"
+ exit
+}
+
+basicChecks() {
+ check hyprctl || {
+ notify "Seriously mate!!" "Start Hyprland before this script"
+ exit 1
+ }
+ pgrep -x Hyprland &>/dev/null || {
+ notify "Make Sure Hyprland Session is running."
+ exit 1
+ }
+}
+
+help() {
+ cat <