From 9f29e9e6763eb33ba63133955d67556542249be9 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 31 Jan 2025 18:16:04 +1100 Subject: toggles: fix spawn-or-move + todo toggle --- completions/caelestia.fish | 2 +- main.fish | 2 +- toggles/todo.fish | 7 +++++++ toggles/util.fish | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 toggles/todo.fish diff --git a/completions/caelestia.fish b/completions/caelestia.fish index 38fbc7f..5a5cbd4 100644 --- a/completions/caelestia.fish +++ b/completions/caelestia.fish @@ -42,7 +42,7 @@ complete -c caelestia -n $not_seen -a 'previous' -d 'Go to previous song' complete -c caelestia -n $not_seen -a 'stop' -d 'Stop media' # Toggles -set -l commands communication music specialws sysmon +set -l commands communication music specialws sysmon todo complete -c caelestia -n "$seen toggle && not $seen $commands" -a "$commands" # Workspace action diff --git a/main.fish b/main.fish index a4f405e..56ecfaa 100755 --- a/main.fish +++ b/main.fish @@ -21,7 +21,7 @@ if test "$argv[1]" = shell end if test "$argv[1]" = toggle - set -l valid_toggles communication music sysmon specialws + set -l valid_toggles communication music sysmon specialws todo contains -- "$argv[2]" $valid_toggles && $src/toggles/$argv[2].fish || error "Invalid toggle: $argv[2]" exit end diff --git a/toggles/todo.fish b/toggles/todo.fish new file mode 100755 index 0000000..db189bb --- /dev/null +++ b/toggles/todo.fish @@ -0,0 +1,7 @@ +#!/bin/fish + +. (dirname (status filename))/util.fish + +spawn-or-move '.class == "Todoist"' todo todoist + +hyprctl dispatch togglespecialworkspace todo diff --git a/toggles/util.fish b/toggles/util.fish index 599627c..4d7df2c 100644 --- a/toggles/util.fish +++ b/toggles/util.fish @@ -13,7 +13,7 @@ function spawn-client -a selector if test $stat != 0 uwsm app -- $argv[2..] & disown end - return $stat + test $stat != 0 # Exit 1 if already exists end function spawn-or-move -a selector -a workspace -- cgit v1.2.3-freya