unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: fn key to bring emacs forward / focus it as if c-tab were used
Date: Sun, 17 Apr 2022 02:06:58 +0200	[thread overview]
Message-ID: <87h76so9nh.fsf@zoho.eu> (raw)
In-Reply-To: CAJcAo8unmJjHUasnXa1NCaKRmFiGdYso=FCh6L+jFi2rLto5kA@mail.gmail.com

Samuel Wales wrote:

> is there bring to front functionality in elisp/emacsclient?

This is something you do in your WW, normally and easily.

From Emacs - from Emacs and _with_ Emacs I should add - you
can also do it, of course, either by using e.g. EXWM which is
the Emacs X Window Manager, or simply by having Elisp execute
shell commands.

I include a bunch of commands to get you started/inspired with
that if so ...

#! /bin/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/wm

alias {wins,wl}='wmctrl -l'

win-id () {
    case $# in
        (0) xprop -id $(xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}') \
                  WM_CLIENT_LEADER | awk '{print $5}'                        ;;
        (1) wins | awk "/$1/{print \$1}"                                     ;;
        (*) echo "error: $0 accepts 0 or 1 argument (got $#)" >&2            ;;
    esac
}

show-win () {
    local win=$1
    wmctrl -a $win
}

hide-win () {
    local win=$1
    wmctrl -r $win -b toggle,hidden
}

hide-all-wins () {
    DISPLAY=":0" wmctrl -k on
}
alias hide=hide-all-wins

max-win  () {
    local win
    case $# in
        (0) win=$(win-id)
            wmctrl -i -r $win -b toggle,fullscreen ;;
        (1) win=$1
            wmctrl -r $win -b toggle,fullscreen ;;
        (*) echo "error: $0 accepts 0 or 1 argument (got $#)" >&2
    esac
}
alias fullscreen=max-win

half-win () {
    local win=$1
    wmctrl -r $win -b remove,fullscreen
    wmctrl -r $win -e 0,0,358,1024,381
}

max-wait () {
    local prog=$1
    while (( ! $(wmctrl -l | grep $prog | wc -l) )) {}
    max-win $prog
}

fullscreen-exec () {
    local prog=$1
    $prog &;
    max-wait $prog
}

-- 
underground experts united
https://dataswamp.org/~incal




  reply	other threads:[~2022-04-17  0:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  5:41 fn key to bring emacs forward / focus it as if c-tab were used Samuel Wales
2022-04-05 21:19 ` TRS-80
2022-04-16 23:29   ` Samuel Wales
2022-04-17  0:06     ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2022-04-17 14:16     ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h76so9nh.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).