From 1c58ccb7855719483490abe1982afa12b0488f24 Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Fri, 15 May 2026 22:36:21 -0400 Subject: refactor and battery notifier --- scripts/util/open-emacs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/util/open-emacs (limited to 'scripts/util/open-emacs') diff --git a/scripts/util/open-emacs b/scripts/util/open-emacs new file mode 100755 index 0000000..2f63efd --- /dev/null +++ b/scripts/util/open-emacs @@ -0,0 +1,12 @@ +#!/bin/bash + +emacs_attached() { + [ "$(emacsclient -e '(- (length (frame-list)) 1)')" = 0 ] && return 1 || return 0 +} + +if emacs_attached; then + # focus emacs + swaymsg [con_id="$(swaymsg -t get_tree | jq -r '.nodes[1].nodes[].nodes[] | .. | (.id|tostring) + " " + .app_id?' | grep emacs | awk '{print $1}')"] focus +else + emacsclient -c +fi -- cgit v1.2.3