From 876f11177d7be138e2637552c9a9952622d929e4 Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Wed, 9 Oct 2024 15:23:52 +0200 Subject: [PATCH] Recover removed host-mode script --- .bin/host-mode##hostname.portalo | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 .bin/host-mode##hostname.portalo diff --git a/.bin/host-mode##hostname.portalo b/.bin/host-mode##hostname.portalo new file mode 100755 index 0000000..464e9b0 --- /dev/null +++ b/.bin/host-mode##hostname.portalo @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +modes="monitor-std +monitor-single +monitor-single-sec +zellij" + +portalo_mode_monitor () { + echo "Loading portalo monitor layout ${1:-std}" + yadm config --unset-all local.class monitor-* + + if [ -n "$1" ]; then + yadm config --add local.class "$1" + fi + + swaymsg reload +} + +portalo_mode_zellij () { + layout_dir="$HOME/.config/zellij/layouts" + layouts=$(\ls -1 "$layout_dir") + layout=$(echo "$layouts" | $DMENU -p "layout") + if [ -n "$layout" ]; then + $TERMINAL -e zellij --layout="$layout_dir/$layout" + fi +} + +if [ -z "$1" ]; then + mode=$(echo "$modes" | $DMENU -p "mode") +else + mode=$1 +fi + +case $mode in + "monitor-std") portalo_mode_monitor ;; + "monitor-"*) portalo_mode_monitor "$mode" ;; + "zellij") portalo_mode_zellij ;; + *) echo "'$mode' is not a valid mode (single, std)" ;; +esac