help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fn key to bring emacs forward / focus it as if c-tab were used


From: Emanuel Berg
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]