Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package alttab for openSUSE:Factory checked in at 2023-03-09 17:46:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/alttab (Old) and /work/SRC/openSUSE:Factory/.alttab.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "alttab" Thu Mar 9 17:46:31 2023 rev:7 rq:1070336 version:1.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/alttab/alttab.changes 2021-12-07 00:01:24.264135304 +0100 +++ /work/SRC/openSUSE:Factory/.alttab.new.31432/alttab.changes 2023-03-09 17:46:31.635159334 +0100 @@ -1,0 +2,15 @@ +Thu Mar 9 06:49:43 UTC 2023 - Michael Vetter <mvet...@suse.com> + +- Update to 1.7.0: + * Option -e to keep the switcher. + * Document usage on mobile devices. + * Configurable bordercolor. + * Build scripts for OpenBSD. + * Fix xpm icon bug. + * Feature: kill window by pressing 'k'. + * Feature: line at the bottom of tile. + * Show windows on scratchpad only: -d 4 + * Disable icons: -s 4 + * Prevent segfault on zero size tile or icon. + +------------------------------------------------------------------- Old: ---- v1.6.1.tar.gz New: ---- v1.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ alttab.spec ++++++ --- /var/tmp/diff_new_pack.BY8ky8/_old 2023-03-09 17:46:33.715170405 +0100 +++ /var/tmp/diff_new_pack.BY8ky8/_new 2023-03-09 17:46:33.719170427 +0100 @@ -1,7 +1,7 @@ # # spec file for package alttab # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: alttab -Version: 1.6.1 +Version: 1.7.0 Release: 0 Summary: Task Switcher License: GPL-3.0-only ++++++ v1.6.1.tar.gz -> v1.7.0.tar.gz ++++++ ++++ 1617 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/.gitignore new/alttab-1.7.0/.gitignore --- old/alttab-1.6.1/.gitignore 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/.gitignore 2023-03-08 15:45:56.000000000 +0100 @@ -9,6 +9,7 @@ src/.deps test/.deps src/tags +tags config.h *~ *.swo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/ChangeLog new/alttab-1.7.0/ChangeLog --- old/alttab-1.6.1/ChangeLog 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/ChangeLog 2023-03-08 15:45:56.000000000 +0100 @@ -1,3 +1,20 @@ +2023-03-08 Alexander Kulak <sa-dev@odd.systems> + + version 1.7.0 + + Option -e to keep the switcher. + Document usage on mobile devices. + Configurable bordercolor. + Build scripts for OpenBSD. + Fix xpm icon bug. + Feature: kill window by pressing 'k'. + Feature: line at the bottom of tile. + Show windows on scratchpad only: -d 4 + Disable icons: -s 4 + Prevent segfault on zero size tile or icon. + + Closes: #132, #144, #146, #113, #139, #130, #115. + 2021-12-06 Alexander Kulak <sa-dev@odd.systems> version 1.6.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/INSTALL.md new/alttab-1.7.0/INSTALL.md --- old/alttab-1.6.1/INSTALL.md 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/INSTALL.md 2023-03-08 15:45:56.000000000 +0100 @@ -73,5 +73,47 @@ make install make check # optional ``` - See README for usage notes. +### In OpenBSD (as of November 2022 and OpenBSD 7.2 amd64): + +1. Install build dependencies. + `Xlib`, `Xft`, `Xrender`, `Xrandr` and `libxpm` come from [`xbase` file set](https://www.openbsd.org/faq/faq4.html#FilesNeeded) + `perl` is part of `base` file set. + In order to install others: + + ``` + # may omit autoconf-2.69 as it is pulled in as a dependency of automake-1.16.5 + pkg_add git png uthash automake-1.16.5 + ``` + + If you intend to run `make check`, then also: + + ``` + pkg_add gawk + ``` + +2. Download: + + ``` + git clone https://github.com/sagb/alttab.git && cd alttab + ``` + +3. Update autotools stuff. Mandatory step. + + ``` + ./bootstrap.sh -f + ``` + +4. Build: + + ``` + CPATH=/usr/local/include ./configure + CPATH=/usr/local/include make + make install + make check # optional + ``` + +Usage notes +----------- + +See `README.md` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/README.md new/alttab-1.7.0/README.md --- old/alttab-1.6.1/README.md 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/README.md 2023-03-08 15:45:56.000000000 +0100 @@ -14,10 +14,10 @@ or standalone X11 session. ``` alttab [-w N] [-d N] [-sc N] [-mk <str>] [-kk <str>] [-bk <str>] - [-pk <str>] [-nk <str>] [-ck <str>] [-mm <N>] [-bm <N>] + [-pk <str>] [-nk <str>] [-ck <str>] [-dk <str>] [-mm <N>] [-bm <N>] [-t NxM] [-i NxM] [-vp str] [-p str] [-s N] [-theme name] [-bg color] - [-fg color] [-frame color] [-bc color] [-bw <N>] [-font name] - [-vertical] [-v|-vv] + [-fg color] [-frame color] [-inact color] [-bc color] [-bw <N>] + [-font name] [-vertical] [-e] [-b N] [-v|-vv] ``` (see man page for details) <!-- ronn page has elements invalid for github markdown, don't link to it --> @@ -35,8 +35,9 @@ cd alttab ./configure && sudo make install ``` -See [INSTALL.md](INSTALL.md) for details and [doc/wm-setup.md](doc/wm-setup.md) -for window manager settings. +See [INSTALL.md](INSTALL.md) for details, [doc/wm-setup.md](doc/wm-setup.md) +for window manager settings, +[doc/mobile.md](doc/mobile.md) for usage on mobile devices. Usually it should run fully functional without any argument: `alttab`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/bootstrap.sh new/alttab-1.7.0/bootstrap.sh --- old/alttab-1.6.1/bootstrap.sh 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/bootstrap.sh 2023-03-08 15:45:56.000000000 +0100 @@ -5,13 +5,15 @@ # Update autotools stuff and documentation. # To be run by maintainers and packagers. -set +e +autoreconf=autoreconf +project="$(dirname "$0")" + if [ "$1" \= "-h" ] ; then - echo "Update autotools stuff and documentation. To be run by maintainers and packagers." >&2 - echo "Use: $0 [-f]" >&2 - echo " -f : force regenerate everything" >&2 - exit 1 + echo "Update autotools stuff and documentation. To be run by maintainers and packagers." + echo "Use: $0 [-f]" + echo " -f : force regenerate everything" + exit 0 fi if [ "$1" \= "-f" ] ; then @@ -19,13 +21,24 @@ ac_flag="-f" fi -project=`dirname $0` +if [ "$(uname)" '=' "OpenBSD" ] ; then + _arc="$(find /usr/local/bin -name 'autoreconf-*' 2>/dev/null | sort | tail -n 1)" + if [ -n "$_arc" ] ; then + export autoreconf="$_arc" + export AUTOCONF_VERSION="${_arc##*-}" + fi + _am="$(find /usr/local/bin -name 'automake-*' 2>/dev/null | sort | tail -n 1)" + if [ -n "$_am" ] ; then + export AUTOMAKE_VERSION="${_am##*-}" + fi +fi -cd "$project" -autoreconf -vi $ac_flag +cd "$project" || { >&2 echo 'Error: Can not `cd '"$project"'`'; exit 1 ;} +"$autoreconf" -vi $ac_flag -cd doc -if [ alttab.1.ronn -nt alttab.1 -o "$force" \= "yes" ] ; then - ronn --roff alttab.1.ronn +if which ronn >/dev/null 2>&1 ; then + cd doc || { >&2 echo 'Error: Can not `cd ''doc''`'; exit 1 ;} + if [ alttab.1.ronn -nt alttab.1 ] || [ "$force" \= "yes" ] ; then + ronn --roff alttab.1.ronn + fi fi - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/configure.ac new/alttab-1.7.0/configure.ac --- old/alttab-1.6.1/configure.ac 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/configure.ac 2023-03-08 15:45:56.000000000 +0100 @@ -1,4 +1,4 @@ -AC_INIT([alttab], [1.6.1]) +AC_INIT([alttab], [1.7.0]) AM_INIT_AUTOMAKE([foreign subdir-objects]) AC_CONFIG_SRCDIR([configure.ac]) AC_CONFIG_HEADERS([config.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/doc/README new/alttab-1.7.0/doc/README --- old/alttab-1.6.1/doc/README 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/doc/README 2023-03-08 15:45:56.000000000 +0100 @@ -2,10 +2,10 @@ or standalone X11 session. alttab [-w N] [-d N] [-sc N] [-mk <str>] [-kk <str>] [-bk <str>] - [-pk <str>] [-nk <str>] [-ck <str>] [-mm <N>] [-bm <N>] + [-pk <str>] [-nk <str>] [-ck <str>] [-dk <str>] [-mm <N>] [-bm <N>] [-t NxM] [-i NxM] [-vp str] [-p str] [-s N] [-theme name] [-bg color] - [-fg color] [-frame color] [-bc color] [-bw N] [-font name] - [-vertical] [-v|-vv] + [-fg color] [-frame color] [-inact color] [-bc color] [-bw N] + [-font name] [-vertical] [-e] [-b N] [-v|-vv] (see man page for details) @@ -20,18 +20,19 @@ ----- Usually it should run fully functional without any argument. -Start alttab after WM, to let it auto-recognize the WM. For examples, add -the following to ~/.ratpoisonrc: +Start alttab after WM, to let it automatically recognize the WM. +For example, add the following to ~/.ratpoisonrc: exec alttab For details about window manager configuration, see doc/wm-setup.md. +For usage on mobile devices, see [doc/mobile.md](doc/mobile.md). If there are no WM at all, then start alttab in ~/.xsession or elsewhere. Source ------ -Copyright 2017-2021 Alexander Kulak <sa-dev AT odd POINT systems>. +Copyright 2017-2023 Alexander Kulak <sa-dev AT odd POINT systems>. License: GPLv3 (see COPYING). Repository: https://github.com/sagb/alttab Chat: #alttab on Freenode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/doc/alttab.1 new/alttab-1.7.0/doc/alttab.1 --- old/alttab-1.6.1/doc/alttab.1 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/doc/alttab.1 2023-03-08 15:45:56.000000000 +0100 @@ -1,10 +1,10 @@ .\" generated with Ronn-NG/v0.9.1 .\" http://github.com/apjanke/ronn-ng/tree/0.9.1 -.TH "ALTTAB" "1" "December 2021" "" +.TH "ALTTAB" "1" "March 2023" "" .SH "NAME" \fBalttab\fR \- the task switcher .SH "SYNOPSIS" -\fBalttab\fR [\fB\-w\fR \fIN\fR] [\fB\-d\fR \fIN\fR] [\fB\-sc\fR \fIN\fR] [\fB\-mk\fR \fIstr\fR] [\fB\-kk\fR \fIstr\fR] [\fB\-bk\fR \fIstr\fR] [\fB\-pk\fR \fIstr\fR] [\fB\-nk\fR \fIstr\fR] [\fB\-mm\fR \fIN\fR] [\fB\-bm\fR \fIN\fR] [\fB\-t\fR \fINxM\fR] [\fB\-i\fR \fINxM\fR] [\fB\-vp\fR \fIstr\fR] [\fB\-p\fR \fIstr\fR] [\fB\-s\fR \fIN\fR] [\fB\-theme\fR \fIname\fR] [\fB\-bg\fR \fIcolor\fR] [\fB\-fg\fR \fIcolor\fR] [\fB\-frame\fR \fIcolor\fR] [\fB\-bc\fR \fIcolor\fR] [\fB\-bw\fR \fIN\fR] [\fB\-font\fR \fIname\fR] [\fB\-vertical\fR] [\fB\-v\fR|\fB\-vv\fR] +\fBalttab\fR [\fB\-w\fR \fIN\fR] [\fB\-d\fR \fIN\fR] [\fB\-sc\fR \fIN\fR] [\fB\-mk\fR \fIstr\fR] [\fB\-kk\fR \fIstr\fR] [\fB\-bk\fR \fIstr\fR] [\fB\-pk\fR \fIstr\fR] [\fB\-nk\fR \fIstr\fR] [\fB\-ck\fR \fIstr\fR] [\fB\-dk\fR \fIstr\fR] [\fB\-mm\fR \fIN\fR] [\fB\-bm\fR \fIN\fR] [\fB\-t\fR \fINxM\fR] [\fB\-i\fR \fINxM\fR] [\fB\-vp\fR \fIstr\fR] [\fB\-p\fR \fIstr\fR] [\fB\-s\fR \fIN\fR] [\fB\-theme\fR \fIname\fR] [\fB\-bg\fR \fIcolor\fR] [\fB\-fg\fR \fIcolor\fR] [\fB\-frame\fR \fIcolor\fR] [\fB\-inact\fR \fIcolor\fR] [\fB\-bc\fR \fIcolor\fR] [\fB\-bw\fR \fIN\fR] [\fB\-font\fR \fIname\fR] [\fB\-vertical\fR] [\fB\-e\fR] [\fB\-b\fR \fIN\fR] [\fB\-v\fR|\fB\-vv\fR] .SH "DESCRIPTION" The task switcher designed for minimalistic window managers or standalone X11 session\. .P @@ -42,7 +42,7 @@ .br default: \fI0\fR .IP -Show windows belonging to desktops (workspaces, groups)\. \fINUMBER\fR must be between 0 and 3: +Show windows belonging to desktops (workspaces, groups)\. \fINUMBER\fR must be between 0 and 4: .IP \fI0\fR: Current desktop\. .IP @@ -55,6 +55,8 @@ In various EWMH WM this desktop may be designed hidden or containing sticky windows\. In i3, it's "scratchpad"\. .IP \fI3\fR: All desktops, excluding current and special\. +.IP +\fI4\fR: Special (\-1) desktop only\. .TP \fB\-sc\fR \fINUMBER\fR resource: alttab\.screens @@ -113,6 +115,13 @@ .IP Keysym of auxiliary 'cancel' key\. .TP +\fB\-dk\fR \fIstr\fR +resource: alttab\.killkey\.keysym +.br +default: k +.IP +Keysym of key for killing X client to which currently selected window belongs\. +.TP \fB\-mm\fR \fINUM\fR resource: alttab\.modifier\.mask .IP @@ -170,7 +179,7 @@ .br default: 2 .IP -Source of icons\. \fINUMBER\fR must be between 0 and 3: +Source of icons\. \fINUMBER\fR must be between 0 and 4: .IP \fI0\fR: Use icons from X11 window attributes only\. .IP @@ -197,6 +206,8 @@ \fI2\fR: Prefer icon from file when it matches requested size better (see \fB\-i\fR option)\. .IP \fI3\fR: Use icons from files only\. +.IP +\fI4\fR: Don't draw icons\. .TP \fB\-theme\fR \fIname\fR resource: alttab\.theme @@ -205,7 +216,7 @@ .IP Desktop theme for application icons\. Used when \fB\-s\fR is 1, 2 or 3\. .P -The following three options accept color names or \fI#rrggbb\fR\. Special value \fI_rnd_low\fR or \fI_rnd_high\fR produce random color from lower or upper RGB space respectively\. +The following five options accept color names or \fI#rrggbb\fR\. Special value \fI_rnd_low\fR or \fI_rnd_high\fR produce random color from lower or upper RGB space respectively\. .TP \fB\-bg\fR \fIcolor\fR resource: alttab\.background @@ -228,6 +239,13 @@ .IP Color of frame around selected tile\. .TP +\fB\-inact\fR \fIcolor\fR +resource: alttab\.inactcolor +.br +default: foreground color +.IP +Color of frame around non\-selected tiles\. +.TP \fB\-bc\fR \fIcolor\fR resource: alttab\.bordercolor .br @@ -262,7 +280,25 @@ .br default: no .IP -Vertical layout (experimental)\. +Vertical layout\. +.TP +\fB\-e\fR +resource: alttab\.keep +.br +default: no +.IP +On release of Alt, don't switch, keep showing the switcher\. This allows for external call: xdotool key alt+Tab \. See doc/mobile\.md for possible usage\. +.TP +\fB\-b\fR \fINUMBER\fR +resource: alttab\.bottomline +.br +default: \fI0\fR in single\-desktop mode, \fI1\fR otherwise +.IP +Content of auxiliary line at the bottom of each tile\. \fINUMBER\fR must be 0 or 1: +.IP +\fI0\fR: Empty\. +.IP +\fI1\fR: Desktop to which the window belongs\. .TP \fB\-v\fR, \fB\-vv\fR resource: no @@ -276,7 +312,7 @@ .SH "CAVEATS" Run alttab after WM, or autodetection will fail\. .SH "AUTHOR" -Copyright 2017\-2021 Alexander Kulak \fB<sa\-dev AT odd POINT systems>\fR\. +Copyright 2017\-2023 Alexander Kulak \fB<sa\-dev AT odd POINT systems>\fR\. .SH "REPORTING BUGS" Please report issues on github \fIhttps://github\.com/sagb/alttab/issues\fR\. .SH "SEE ALSO" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/doc/alttab.1.ronn new/alttab-1.7.0/doc/alttab.1.ronn --- old/alttab-1.6.1/doc/alttab.1.ronn 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/doc/alttab.1.ronn 2023-03-08 15:45:56.000000000 +0100 @@ -2,7 +2,7 @@ The source of alttab.1. Read doc/development.md. vim:ft=markdown -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. Copying and distribution of this file, with or without modification, @@ -16,7 +16,7 @@ ## SYNOPSIS -`alttab` [`-w` <N>] [`-d` <N>] [`-sc` <N>] [`-mk` <str>] [`-kk` <str>] [`-bk` <str>] [`-pk` <str>] [`-nk` <str>] [`-mm` <N>] [`-bm` <N>] [`-t` <NxM>] [`-i` <NxM>] [`-vp` <str>] [`-p` <str>] [`-s` <N>] [`-theme` <name>] [`-bg` <color>] [`-fg` <color>] [`-frame` <color>] [`-bc` <color>] [`-bw` <N>] [`-font` <name>] [`-vertical`] [`-v`\|`-vv`] +`alttab` [`-w` <N>] [`-d` <N>] [`-sc` <N>] [`-mk` <str>] [`-kk` <str>] [`-bk` <str>] [`-pk` <str>] [`-nk` <str>] [`-ck` <str>] [`-dk` <str>] [`-mm` <N>] [`-bm` <N>] [`-t` <NxM>] [`-i` <NxM>] [`-vp` <str>] [`-p` <str>] [`-s` <N>] [`-theme` <name>] [`-bg` <color>] [`-fg` <color>] [`-frame` <color>] [`-inact` <color>] [`-bc` <color>] [`-bw` <N>] [`-font` <name>] [`-vertical`] [`-e`] [`-b` <N>] [`-v`\|`-vv`] ## DESCRIPTION @@ -71,7 +71,7 @@ resource: alttab.desktops default: <0> - Show windows belonging to desktops (workspaces, groups). <NUMBER> must be between 0 and 3: + Show windows belonging to desktops (workspaces, groups). <NUMBER> must be between 0 and 4: <0>: Current desktop. @@ -86,6 +86,8 @@ <3>: All desktops, excluding current and special. + <4>: Special (-1) desktop only. + * `-sc` <NUMBER>: resource: alttab.screens default: <1> @@ -140,6 +142,12 @@ Keysym of auxiliary 'cancel' key. + * `-dk` <str>: + resource: alttab.killkey.keysym + default: k + + Keysym of key for killing X client to which currently selected window belongs. + * `-mm` <NUM>: resource: alttab.modifier.mask @@ -210,7 +218,7 @@ resource: alttab.icon.source default: 2 - Source of icons. <NUMBER> must be between 0 and 3: + Source of icons. <NUMBER> must be between 0 and 4: <0>: Use icons from X11 window attributes only. @@ -239,13 +247,15 @@ <3>: Use icons from files only. + <4>: Don't draw icons. + * `-theme` <name>: resource: alttab.theme default: <hicolor> Desktop theme for application icons. Used when `-s` is 1, 2 or 3. -The following three options accept color names or <#rrggbb>. Special value <_rnd_low> or <_rnd_high> produce random color from lower or upper RGB space respectively. +The following five options accept color names or <#rrggbb>. Special value <_rnd_low> or <_rnd_high> produce random color from lower or upper RGB space respectively. * `-bg` <color>: resource: alttab.background @@ -265,6 +275,12 @@ Color of frame around selected tile. + * `-inact` <color>: + resource: alttab.inactcolor + default: foreground color + + Color of frame around non-selected tiles. + * `-bc` <color>: resource: alttab.bordercolor default: <black> @@ -293,7 +309,24 @@ resource: alttab.vertical default: no - Vertical layout (experimental). + Vertical layout. + + * `-e`: + resource: alttab.keep + default: no + + On release of Alt, don't switch, keep showing the switcher. This allows for external call: xdotool key alt+Tab . See doc/mobile.md for possible usage. + + * `-b` <NUMBER>: + resource: alttab.bottomline + default: <0> in single-desktop mode, <1> otherwise + + Content of auxiliary line at the bottom of each tile. + <NUMBER> must be 0 or 1: + + <0>: Empty. + + <1>: Desktop to which the window belongs. * `-v`, `-vv`: resource: no @@ -310,7 +343,7 @@ ##AUTHOR -Copyright 2017-2021 Alexander Kulak `<sa-dev AT odd POINT systems>`. +Copyright 2017-2023 Alexander Kulak `<sa-dev AT odd POINT systems>`. ##REPORTING BUGS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/doc/alttab.ad new/alttab-1.7.0/doc/alttab.ad --- old/alttab-1.6.1/doc/alttab.ad 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/doc/alttab.ad 2023-03-08 15:45:56.000000000 +0100 @@ -33,6 +33,9 @@ ! auxiliary 'cancel' key !alttab.cancelkey.keysym: Escape +! auxiliary 'kill' key +!alttab.killkey.keysym: k + ! Limit the switcher to this rectangle ! instead of default screen size !alttab.viewport: 1280x1024+1280+0 @@ -63,9 +66,12 @@ ! Red letters alttab.foreground: #600000 -! Random dark frame +! Random dark frame around selected tile alttab.framecolor: _rnd_low +! Gray42 frame around deselected tiles +!alttab.framecolor: #6b6b6b + ! Show X11 window border around the switcher !alttab.borderwidth: 4 @@ -76,5 +82,11 @@ !alttab.font: xft:DejaVu Sans Condensed-18 ! Vertical layout -!alttab.vertical: anything +!alttab.vertical: true + +! Keep switcher after Alt-Tab release +!alttab.keep: true + +! Force showing desktop number at the bottom of each tile +!alttab.bottomline: 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/doc/mobile.md new/alttab-1.7.0/doc/mobile.md --- old/alttab-1.6.1/doc/mobile.md 1970-01-01 01:00:00.000000000 +0100 +++ new/alttab-1.7.0/doc/mobile.md 2023-03-08 15:45:56.000000000 +0100 @@ -0,0 +1,34 @@ +Alttab on mobile devices +======================== + +Alttab runs on every device that can run X11. + +It's trivial with Linux phone (Pinephone, Librem, Pro1-X, Volla). + +With Android, alttab runs fine in Linux chroot +displaying in [XServer XSDL](https://play.google.com/store/apps/details?id=x.org.server). + + +Touchscreen control +------------------- + +Using `-e` option, an external program can pop up the switcher: + +```shell +alttab -e & +xdotool key alt+Tab +``` + +This is particularly useful with Linux phone and +[gesture daemon](https://git.sr.ht/~mil/lisgd). +To call alttab by swipe to the right at the left screen edge: + +```shell +alttab -mk Control_L -e & +lisgd \ + -g '1,LR,L,*,/usr/bin/xdotool key ctrl+Tab' \ + ...other lisgd options... & +``` + +It looks like this: [2.3M mp4 video](screenshots/alttab-mobile.mp4). + Binary files old/alttab-1.6.1/doc/screenshots/alttab-mobile.mp4 and new/alttab-1.7.0/doc/screenshots/alttab-mobile.mp4 differ Binary files old/alttab-1.6.1/doc/screenshots/alttab-vertical.png and new/alttab-1.7.0/doc/screenshots/alttab-vertical.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/doc/screenshots/screenshots.md new/alttab-1.7.0/doc/screenshots/screenshots.md --- old/alttab-1.6.1/doc/screenshots/screenshots.md 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/doc/screenshots/screenshots.md 2023-03-08 15:45:56.000000000 +0100 @@ -25,3 +25,7 @@ © Jay Ta'ala ([source](https://confluence.jaytaala.com/display/TKB/My+Manjaro+i3+setup#MyManjaroi3setup-Ricingalttab)) +## Mobile + +[2.3M mp4 video](alttab-mobile.mp4) ([details](../mobile.md)). + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/alttab.c new/alttab-1.7.0/src/alttab.c --- old/alttab-1.6.1/src/alttab.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/alttab.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Parsing options/resources, top-level keygrab functions and main(). -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -50,27 +50,33 @@ msg(-1, "the task switcher, v%s\n\ Options:\n\ -w N window manager: 0=no, 1=ewmh-compatible, 2=ratpoison, 3=old fashion\n\ - -d N desktop: 0=current 1=all, 2=all but special, 3=all but current\n\ + -d N desktop: 0=current 1=all, 2=all but special, 3=all but current, 4=special\n\ -sc N screen: 0=current 1=all\n\ -kk str keysym of main key\n\ -mk str keysym of main modifier\n\ -bk str keysym of backscroll modifier\n\ -pk str keysym of 'prev' key\n\ -nk str keysym of 'next' key\n\ + -ck str keysym of 'cancel' key\n\ + -dk str keysym of 'kill' key\n\ -mm N (obsoleted) main modifier mask\n\ -bm N (obsoleted) backward scroll modifier mask\n\ -t NxM tile geometry\n\ -i NxM icon geometry\n\ -vp str switcher viewport: focus, pointer, total, WxH+X+Y\n\ -p str switcher position: center, none, +X+Y\n\ - -s N icon source: 0=X11 only, 1=fallback to files, 2=best size, 3=files only\n\ + -s N icon source: 0=X11, 1=fallback to files, 2=best size, 3=files only, 4=no\n\ -theme name icon theme\n\ -bg color background color\n\ -fg color foreground color\n\ -frame color active frame color\n\ +-inact color inactive frame color\n\ -bc color extra border color\n\ -bw N extra border width\n\ -font name font name in the form xft:fontconfig_pattern\n\ + -vertical verticat layout\n\ + -e keep switcher after keys release\n\ + -b N bottom line: 0=no, 1=desktop\n\ -v|-vv verbose\n\ -h help\n\ See man alttab for details.\n", PACKAGE_VERSION); @@ -89,7 +95,7 @@ char *errmsg; int ksi; KeyCode BC; - unsigned int wmindex, dsindex, scindex, isrc; + unsigned int wmindex, dsindex, scindex, isrc, bindex; char *gtile, *gicon, *gview, *gpos; int x, y; unsigned int w, h, bw; @@ -114,6 +120,7 @@ {"-pk", "*prevkey.keysym", XrmoptionSepArg, NULL}, {"-nk", "*nextkey.keysym", XrmoptionSepArg, NULL}, {"-ck", "*cancelkey.keysym", XrmoptionSepArg, NULL}, + {"-dk", "*killkey.keysym", XrmoptionSepArg, NULL}, {"-t", "*tile.geometry", XrmoptionSepArg, NULL}, {"-i", "*icon.geometry", XrmoptionSepArg, NULL}, {"-vp", "*viewport", XrmoptionSepArg, NULL}, @@ -123,10 +130,13 @@ {"-bg", "*background", XrmoptionSepArg, NULL}, {"-fg", "*foreground", XrmoptionSepArg, NULL}, {"-frame", "*framecolor", XrmoptionSepArg, NULL}, + {"-inact", "*inactcolor", XrmoptionSepArg, NULL}, {"-bc", "*bordercolor", XrmoptionSepArg, NULL}, {"-bw", "*borderwidth", XrmoptionSepArg, NULL}, {"-font", "*font", XrmoptionSepArg, NULL}, - {"-vertical", "*vertical", XrmoptionIsArg, NULL} + {"-vertical", "*vertical", XrmoptionIsArg, NULL}, + {"-e", "*keep", XrmoptionIsArg, NULL}, + {"-b", "*bottomline", XrmoptionSepArg, NULL} }; const char *inv = "invalid %s, use -h for help\n"; const char *rmb = "can't figure out modmask from keycode 0x%x\n"; @@ -251,6 +261,7 @@ #define prevC g.option_prevCode #define nextC g.option_nextCode #define cancelC g.option_cancelCode +#define killC g.option_killCode #define GMM g.option_modMask #define GBM g.option_backMask @@ -279,6 +290,11 @@ die("%s\n", errmsg); cancelC = ksi != 0 ? ksi : XKeysymToKeycode(dpy, DEFCANCELKS); + ksi = ksym_option_to_keycode(&db, XRMAPPNAME, "killkey", &errmsg); + if (ksi == -1) + die("%s\n", errmsg); + killC = ksi != 0 ? ksi : XKeysymToKeycode(dpy, DEFKILLKS); + switch (xresource_load_int(&db, XRMAPPNAME, "modifier.mask", &(GMM))) { case 1: msg(-1, @@ -316,6 +332,8 @@ msg(0, "modMask %d, backMask %d, modCode %d, keyCode %d\n", GMM, GBM, MC, KC); + msg(0, "cancelCode %d, killCode %d\n", + cancelC, killC); g.option_tileW = DEFTILEW; g.option_tileH = DEFTILEH; @@ -331,6 +349,8 @@ else die(inv, "tile height"); } + if (g.option_tileW == 0 || g.option_tileH == 0) + die(inv, "tile width or height: can't be zero"); g.option_iconW = DEFICONW; g.option_iconH = DEFICONH; @@ -346,6 +366,8 @@ else die(inv, "icon height"); } + if (g.option_iconW == 0 || g.option_iconH == 0) + die(inv, "icon width or height: can't be zero"); msg(0, "%dx%d tile, %dx%d icon\n", g.option_tileW, g.option_tileH, g.option_iconW, g.option_iconH); @@ -444,6 +466,8 @@ g.color[COLFG].name = s ? s : DEFCOLFG; s = xresource_load_string(&db, XRMAPPNAME, "framecolor"); g.color[COLFRAME].name = s ? s : DEFCOLFRAME; + s = xresource_load_string(&db, XRMAPPNAME, "inactcolor"); + g.color[COLINACT].name = s ? s : g.color[COLFG].name; s = xresource_load_string(&db, XRMAPPNAME, "bordercolor"); g.color[COLBORDER].name = s ? s : DEFCOLBORDER; @@ -471,6 +495,29 @@ // no need for an option g.option_max_reclevel = (g.option_wm == WM_NO) ? 1 : -1; + s = xresource_load_string(&db, XRMAPPNAME, "keep"); + g.option_keep_ui = (s != NULL); + msg(0, "keep_ui: %d\n", g.option_keep_ui); + + switch (xresource_load_int(&db, XRMAPPNAME, "bottomline", &bindex)) { + case 1: + if (bindex >= BL_MIN && bindex <= BL_MAX) + g.option_bottom_line = bindex; + else + die(inv, "bottomline argument range"); + break; + case 0: + g.option_bottom_line = + (g.option_desktop == DESK_CURRENT + || g.option_desktop == DESK_SPECIAL) ? + BL_NONE : BL_DESKTOP; + break; + case -1: + die(inv, "bottomline argument"); + break; + } + msg(0, "bottomline: %d\n", g.option_bottom_line); + return 1; } @@ -514,6 +561,13 @@ return 0; } +// see #97 +#define CHECK_97 \ + XQueryKeymap(dpy, keys_pressed); \ + if (!(keys_pressed[octet] & kmask)) { \ + msg(1, "Wrong modifier, skip event\n"); \ + continue; \ + } int main(int argc, char **argv) { @@ -552,7 +606,7 @@ while (true) { memset(&(ev.xkey), 0, sizeof(ev.xkey)); - if (g.uiShowHasRun) { + if (g.uiShowHasRun && ! g.option_keep_ui) { // poll: lag and consume cpu, but necessary because of bug #1 and #2 XQueryKeymap(dpy, keys_pressed); if (!(keys_pressed[octet] & kmask)) { // Alt released @@ -574,12 +628,7 @@ ev.xkey.window, ev.xkey.state, ev.xkey.keycode); if (ev.xkey.state & g.option_modMask) { // alt if (ev.xkey.keycode == g.option_keyCode) { // tab - // additional check, see #97 - XQueryKeymap(dpy, keys_pressed); - if (!(keys_pressed[octet] & kmask)) { - msg(1, "Wrong modifier, skip event\n"); - continue; - } + CHECK_97; if (!g.uiShowHasRun) { uiShow((ev.xkey.state & g.option_backMask)); } else { @@ -590,13 +639,11 @@ } } } else if (ev.xkey.keycode == g.option_cancelCode) { // escape - // additional check, see #97 - XQueryKeymap(dpy, keys_pressed); - if (!(keys_pressed[octet] & kmask)) { - msg(1, "Wrong modifier, skip event\n"); - continue; - } + CHECK_97; uiSelectWindow(0); + } else if (ev.xkey.keycode == g.option_killCode) { // k + CHECK_97; + uiKillWindow(); } else { // non-tab switch (isPrevNextKey(ev.xkey.keycode)) { case 1: @@ -618,6 +665,9 @@ && ev.xkey.keycode == g.option_modCode && g.uiShowHasRun)) { break; } + if (g.option_keep_ui) { + break; + } uiHide(); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/alttab.h new/alttab-1.7.0/src/alttab.h --- old/alttab-1.6.1/src/alttab.h 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/alttab.h 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Global includes. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -46,7 +46,8 @@ #define COLFG 1 #define COLFRAME 2 #define COLBORDER 3 -#define NCOLORS 4 +#define COLINACT 4 +#define NCOLORS 5 #define DEFCOLBG "black" #define DEFCOLFG "grey" #define DEFCOLFRAME "#a0abab" @@ -61,6 +62,7 @@ #define DEFPREVKEYKS XK_VoidSymbol #define DEFNEXTKEYKS XK_VoidSymbol #define DEFCANCELKS XK_Escape +#define DEFKILLKS XK_k #include "icon.h" @@ -79,6 +81,7 @@ Window id; int wm_id; // wm's internal window id, when WM has it (ratpoison) char name[MAXNAMESZ]; + char bottom_line[MAXNAMESZ]; int reclevel; Pixmap icon_drawable; // Window or Pixmap Pixmap icon_mask; @@ -143,7 +146,8 @@ #define DESK_ALL 1 #define DESK_NOSPECIAL 2 #define DESK_NOCURRENT 3 -#define DESK_MAX 3 +#define DESK_SPECIAL 4 +#define DESK_MAX 4 #define DESK_DEFAULT DESK_CURRENT int option_desktop; #define SCR_MIN 0 @@ -179,14 +183,20 @@ #define ISRC_FALLBACK 1 #define ISRC_SIZE 2 #define ISRC_FILES 3 -#define ISRC_MAX 3 +#define ISRC_NONE 4 +#define ISRC_MAX 4 #define ISRC_DEFAULT ISRC_SIZE int option_iconSrc; char *option_theme; unsigned int option_modMask, option_backMask; KeyCode option_modCode, option_keyCode; KeyCode option_prevCode, option_nextCode; - KeyCode option_cancelCode; + KeyCode option_cancelCode, option_killCode; +#define BL_MIN 0 +#define BL_NONE 0 +#define BL_DESKTOP 1 +#define BL_MAX 1 + int option_bottom_line; Color color[NCOLORS]; GC gcDirect, gcReverse, gcFrame; // used in both gui.c and win.c unsigned int ignored_modmask; @@ -194,6 +204,7 @@ EwmhFeatures ewmh; // guessed by ewmh_detectFeatures Atom naw; // _NET_ACTIVE_WINDOW // SwitchMoment last; // for detecting false focus events from WM + bool option_keep_ui; } Globals; // gui @@ -203,6 +214,7 @@ int uiHide(); int uiNextWindow(); int uiPrevWindow(); +int uiKillWindow(); int uiSelectWindow(int ndx); void uiButtonEvent(XButtonEvent e); Window getUiwin(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/autil.c new/alttab-1.7.0/src/autil.c --- old/alttab-1.6.1/src/autil.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/autil.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Helper functions specific to alttab. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/ewmh.c new/alttab-1.7.0/src/ewmh.c --- old/alttab-1.6.1/src/ewmh.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/ewmh.c 2023-03-08 15:45:56.000000000 +0100 @@ -2,7 +2,7 @@ Interface with EWMH-compatible window managers. Note: _WIN fallbacks are not part of EWMH or ICCCM, but kept here anyway. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/gui.c new/alttab-1.7.0/src/gui.c --- old/alttab-1.6.1/src/gui.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/gui.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Draw and interface with our switcher window. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -74,11 +74,11 @@ switch (type) { case 1: XSetForeground(dpy, gc, g.color[COLBG].xcolor.pixel); - XSetBackground(dpy, gc, g.color[COLFG].xcolor.pixel); + XSetBackground(dpy, gc, g.color[COLINACT].xcolor.pixel); XSetLineAttributes(dpy, gc, FRAME_W, line_style, cap_style, join_style); break; case 0: - XSetForeground(dpy, gc, g.color[COLFG].xcolor.pixel); + XSetForeground(dpy, gc, g.color[COLINACT].xcolor.pixel); XSetBackground(dpy, gc, g.color[COLBG].xcolor.pixel); XSetLineAttributes(dpy, gc, 1, line_style, cap_style, join_style); break; @@ -160,6 +160,9 @@ // static void prepareTile(WindowInfo * wi) { + XGlyphInfo ext; + int bottW = 0, bottH = 0, bottX = 0, bottY = 0; + wi->tile = XCreatePixmap(dpy, root, tileW, tileH, XDEPTH); if (!wi->tile) die("can't create tile"); @@ -173,6 +176,8 @@ // in my simple environments (as reported by xwininfo) // // place icons + if (g.option_iconSrc == ISRC_NONE) + goto endIcon; if (wi->icon_drawable) { if (wi->icon_w == iconW && wi->icon_h == iconH) { // direct copy @@ -229,19 +234,48 @@ } } endIcon: - // draw labels + + // draw bottom line if there at least the same + // space for main label as for bottom line + if (wi->bottom_line[0] == '\0') + goto endBottomLine; + XftTextExtentsUtf8(dpy, fontLabel, + (unsigned char *)(wi->bottom_line), strlen(wi->bottom_line), &ext); + msg(1, "bottom line of size %dx%d requested\n", ext.width, ext.height); + if ((!g.option_vertical && (tileH - iconH - 5) / 2 >= ext.height + 1) + || ( g.option_vertical && (tileW - iconW - 5) / 2 >= ext.width + 5)) { + bottW = ext.width; + bottH = ext.height; + bottX = tileW - bottW - 5; // 5 to avoid overlap with frame + bottY = tileH - bottH - 1; + int dr = drawSingleLine(wi->tile, fontLabel, + &(g.color[COLFG].xftcolor), + wi->bottom_line, + bottX, bottY, bottW, bottH); + if (dr != 1) { + msg(-1, "can't draw bottom line '%s'\n", wi->bottom_line); + } + msg(1, "bottom line '%s' drawn at %dx%d+%d+%d\n", + wi->bottom_line, bottW, bottH, bottX, bottY); + } else { + msg(1, "bottom line skipped\n"); + } +endBottomLine: + + // draw label if (wi->name && fontLabel) { int x, y, w, h; if (g.option_vertical) { x = iconW + 5; y = FRAME_W; // avoids overlapping with frames - w = tileW - iconW - 5; + w = tileW - iconW - 5 - bottW; + if (bottW > 0) w = w - 5 - 5; // avoids label too close to bottom line h = tileH - FRAME_W; } else { x = 0; y = iconH + 5; w = tileW; - h = tileH - iconH - 5; + h = tileH - iconH - 5 - bottH; } int dr = drawMultiLine(wi->tile, fontLabel, &(g.color[COLFG].xftcolor), @@ -254,40 +288,61 @@ } // prepareTile // -// grab auxiliary keys: arrows +// grab auxiliary keys: arrows, cancel, kill // rely on pre-calculated g.ignored_modmask and g.option_modMask // static int grabKeysAtUiShow(bool grabUngrab) { char *grabhint = "Error while (un)grabbing key 0x%x with mask 0x%x/0x%x.\n"; - if (g.option_prevCode != 0) { - if (!changeKeygrab - (root, grabUngrab, g.option_prevCode, g.option_modMask, - g.ignored_modmask)) { - msg(0, grabhint, g.option_prevCode, g.option_modMask, g.ignored_modmask); - return 0; - } - } - if (g.option_nextCode != 0) { - if (!changeKeygrab - (root, grabUngrab, g.option_nextCode, g.option_modMask, - g.ignored_modmask)) { - msg(0, grabhint, g.option_nextCode, g.option_modMask, g.ignored_modmask); - return 0; - } - } - if (g.option_cancelCode != 0) { - if (!changeKeygrab - (root, grabUngrab, g.option_cancelCode, g.option_modMask, - g.ignored_modmask)) { - msg(0, grabhint, g.option_cancelCode, g.option_modMask, g.ignored_modmask); - return 0; +#define nkeys 4 + KeyCode key[nkeys] = { + g.option_prevCode, + g.option_nextCode, + g.option_cancelCode, + g.option_killCode + }; + int k; + + for (k = 0; k < nkeys; k++) { + if (key[k] != 0) { + if (!changeKeygrab + (root, grabUngrab, key[k], g.option_modMask, + g.ignored_modmask)) { + msg(0, grabhint, key[k], g.option_modMask, g.ignored_modmask); + return 0; + } } } return 1; } +// +// copy single tile to canvas +// +static int placeSingleTile (int j) { + int dest_x, dest_y, r; + + if (! g.winlist[j].tile) + return -1; + msg(1, "copying tile %d to canvas\n", j); + //XSync (dpy, false); + if (g.option_vertical) { + dest_x = FRAME_W; + dest_y = j * (tileH + FRAME_W) + FRAME_W; + } else { + dest_x = j * (tileW + FRAME_W) + FRAME_W; + dest_y = FRAME_W; + } + r = XCopyArea(dpy, g.winlist[j].tile, uiwin, + g.gcDirect, 0, 0, tileW, tileH, // src + dest_x, dest_y); // dst + //XSync (dpy, false); + msg(1, "XCopyArea returned %d\n", r); + return r; +} + + // PUBLIC // @@ -462,8 +517,12 @@ // calculate dimensions tileW = g.option_tileW; tileH = g.option_tileH; - iconW = g.option_iconW; - iconH = g.option_iconH; + if (g.option_iconSrc != ISRC_NONE) { + iconW = g.option_iconW; + iconH = g.option_iconH; + } else { + iconW = iconH = 0; + } float rt = 1.0; // for subsequent calculation of width(s), use 'avail_w'/'avail_h' // instead of g.vp.w, because they don't match for POS_SPECIFIC @@ -672,23 +731,7 @@ // icons int j; for (j = 0; j < g.maxNdx; j++) { - if (g.winlist[j].tile) { - msg(1, "copying tile %d to canvas\n", j); - //XSync (dpy, false); - int dest_x, dest_y; - if (g.option_vertical) { - dest_x = FRAME_W; - dest_y = j * (tileH + FRAME_W) + FRAME_W; - } else { - dest_x = j * (tileW + FRAME_W) + FRAME_W; - dest_y = FRAME_W; - } - int r = XCopyArea(dpy, g.winlist[j].tile, uiwin, - g.gcDirect, 0, 0, tileW, tileH, // src - dest_x, dest_y); // dst - //XSync (dpy, false); - msg(1, "XCopyArea returned %d\n", r); - } + placeSingleTile(j); } // frame framesRedraw(); @@ -764,6 +807,37 @@ return 1; } +// +// kill X client of current window +// +int uiKillWindow() +{ + Window w; + char *n; + + if (!uiwin) + return 0; + WindowInfo wi = g.winlist[selNdx]; + w = wi.id; + n = wi.name; + msg(0, "killing client of window %d, %s\n", w, n); + if (XKillClient(dpy, w) == BadValue) { + msg(-1, "can't kill X client\n"); + return 0; + } + msg(1, "blanking tile %d\n", selNdx); + if (! XFillRectangle(dpy, wi.tile, g.gcReverse, 0, 0, + tileW, tileH)) { + msg(-1, "can't fill tile\n"); + return 0; + } + if (! placeSingleTile(selNdx)) { + msg(-1, "can't copy tile to canvas\n"); + return 0; + } + return 1; +} + // // select item in g.winlist // diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/icon.c new/alttab-1.7.0/src/icon.c --- old/alttab-1.6.1/src/icon.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/icon.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Icon object. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -416,6 +416,8 @@ strncpy(ic->src_path, pe->fts_path, MAXICONPATHLEN-1); ic->src_w = ix; ic->src_h = iy; + ic->ext = ext; + ic->dir = dir; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/icon.h new/alttab-1.7.0/src/icon.h --- old/alttab-1.6.1/src/icon.h 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/icon.h 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* icon.c definitions. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/pngd.c new/alttab-1.7.0/src/pngd.c --- old/alttab-1.6.1/src/pngd.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/pngd.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Reading PNG into Drawable. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/pngd.h new/alttab-1.7.0/src/pngd.h --- old/alttab-1.6.1/src/pngd.h 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/pngd.h 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* pngd.c definitions. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/randr.c new/alttab-1.7.0/src/randr.c --- old/alttab-1.6.1/src/randr.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/randr.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Interface to XRANDR -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/rp.c new/alttab-1.7.0/src/rp.c --- old/alttab-1.6.1/src/rp.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/rp.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Interface with Ratpoison window manager. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/util.c new/alttab-1.7.0/src/util.c --- old/alttab-1.6.1/src/util.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/util.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Helper functions. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -542,6 +542,34 @@ } // +// Draw single utf-8 string str on window/pixmap d, +// using *font and *xftcolor, at (x1,y1,width*height). +// Return 1 if ok. +// +int drawSingleLine(Drawable d, XftFont * font, + XftColor * xftcolor, char *str, unsigned int x1, + unsigned int y1, unsigned int width, unsigned int height) +{ + int debug = 0; + XftDraw *xftdraw; + int line_clen; + + if ((*str) == '\0') + return 1; + xftdraw = XftDrawCreate(dpy, d, DefaultVisual(dpy, 0), + DefaultColormap(dpy, scr)); + line_clen = strlen(str); + XftDrawStringUtf8(xftdraw, xftcolor, font, x1, y1+height, + (unsigned char *)str, line_clen); + if (debug > 0) { + GC gc = DefaultGC(dpy, scr); + XSetForeground(dpy, gc, WhitePixel(dpy, scr)); + XDrawRectangle(dpy, d, gc, x1, y1, x1 + width, y1 + height); + } + return 1; +} + +// // check procedure for XCheckIfEvent which always returns true // Bool predproc_true(Display * display, XEvent * event, char *arg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/util.h new/alttab-1.7.0/src/util.h --- old/alttab-1.6.1/src/util.h 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/util.h 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* util.c definitions. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -92,6 +92,9 @@ unsigned int x1, unsigned int y1, unsigned int width, unsigned int height); int drawMultiLine_test(); +int drawSingleLine(Drawable d, XftFont * font, XftColor * xftcolor, char *str, + unsigned int x1, unsigned int y1, unsigned int width, + unsigned int height); Bool predproc_true(Display * display, XEvent * event, char *arg); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/win.c new/alttab-1.7.0/src/win.c --- old/alttab-1.6.1/src/win.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/win.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Interface with foreign windows common for all WMs. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify @@ -149,7 +149,7 @@ g.sortlist = NULL; // utlist head must be initialized to NULL g.ic = NULL; // uthash too - if (g.option_iconSrc != ISRC_RAM) { + if (g.option_iconSrc != ISRC_RAM && g.option_iconSrc != ISRC_NONE) { initIconHash(&(g.ic)); } // root: watching for _NET_ACTIVE_WINDOW @@ -375,18 +375,19 @@ // used by x, rp, ... // only dpy and win are mandatory // +#define WI g.winlist[g.maxNdx] // current WindowInfo int addWindowInfo(Window win, int reclevel, int wm_id, unsigned long desktop, char *wm_name) { if (!(g.winlist = realloc(g.winlist, (g.maxNdx + 1) * sizeof(WindowInfo)))) return 0; - g.winlist[g.maxNdx].id = win; - g.winlist[g.maxNdx].wm_id = wm_id; + WI.id = win; + WI.wm_id = wm_id; // 1. get name if (wm_name) { - strncpy(g.winlist[g.maxNdx].name, wm_name, MAXNAMESZ-1); + strncpy(WI.name, wm_name, MAXNAMESZ-1); } else { unsigned char *wn; Atom prop = XInternAtom(dpy, "WM_NAME", false), type; @@ -395,11 +396,11 @@ if (XGetWindowProperty(dpy, win, prop, 0, MAXNAMESZ, false, AnyPropertyType, &type, &form, &len, &remain, &wn) == Success && wn) { - strncpy(g.winlist[g.maxNdx].name, (char *)wn, MAXNAMESZ-1); - g.winlist[g.maxNdx].name[MAXNAMESZ - 1] = '\0'; + strncpy(WI.name, (char *)wn, MAXNAMESZ-1); + WI.name[MAXNAMESZ - 1] = '\0'; XFree(wn); } else { - g.winlist[g.maxNdx].name[0] = '\0'; + WI.name[0] = '\0'; } } // guessing name without WM hints @@ -412,76 +413,92 @@ // it's more sophisticated than icon_drawable=win, because hidden window contents aren't available. // * understand hints->icon_window (twm concept, xterm). - g.winlist[g.maxNdx].icon_drawable = - g.winlist[g.maxNdx].icon_mask = - g.winlist[g.maxNdx].icon_w = g.winlist[g.maxNdx].icon_h = 0; + WI.icon_drawable = + WI.icon_mask = + WI.icon_w = WI.icon_h = 0; unsigned int icon_depth = 0; - g.winlist[g.maxNdx].icon_allocated = false; + WI.icon_allocated = false; // search for icon in window properties, hints or file hash int opt = g.option_iconSrc; int icon_in_x = 0; + if (opt == ISRC_NONE) + goto endIcon; if (opt != ISRC_FILES) { - icon_in_x = addIconFromProperty(&(g.winlist[g.maxNdx])); + icon_in_x = addIconFromProperty(&(WI)); if (!icon_in_x) - icon_in_x = addIconFromHints(&(g.winlist[g.maxNdx])); + icon_in_x = addIconFromHints(&(WI)); } if ((opt == ISRC_FALLBACK && !icon_in_x) || opt == ISRC_SIZE || opt == ISRC_FILES) - addIconFromFiles(&(g.winlist[g.maxNdx])); + addIconFromFiles(&(WI)); // extract icon width/height/depth Window root_return; int x_return, y_return; unsigned int border_width_return; - if (g.winlist[g.maxNdx].icon_drawable) { - if (XGetGeometry(dpy, g.winlist[g.maxNdx].icon_drawable, + if (WI.icon_drawable) { + if (XGetGeometry(dpy, WI.icon_drawable, &root_return, &x_return, &y_return, - &(g.winlist[g.maxNdx].icon_w), - &(g.winlist[g.maxNdx].icon_h), + &(WI.icon_w), + &(WI.icon_h), &border_width_return, &icon_depth) == 0) { - msg(0, "icon dimensions unknown (%s)\n", g.winlist[g.maxNdx].name); + msg(0, "icon dimensions unknown (%s)\n", WI.name); // probably draw placeholder? - g.winlist[g.maxNdx].icon_drawable = 0; + WI.icon_drawable = 0; } else { msg(1, "depth=%d\n", icon_depth); } } // convert icon with different depth (currently 1 only) into default depth - if (g.winlist[g.maxNdx].icon_drawable && icon_depth == 1) { + if (WI.icon_drawable && icon_depth == 1) { msg(0, "rebuilding icon from depth %d to %d (%s)\n", - icon_depth, XDEPTH, g.winlist[g.maxNdx].name); - Pixmap pswap = XCreatePixmap(dpy, g.winlist[g.maxNdx].icon_drawable, - g.winlist[g.maxNdx].icon_w, - g.winlist[g.maxNdx].icon_h, XDEPTH); + icon_depth, XDEPTH, WI.name); + Pixmap pswap = XCreatePixmap(dpy, WI.icon_drawable, + WI.icon_w, + WI.icon_h, XDEPTH); if (!pswap) die("can't create pixmap"); // GC should be already prepared in uiShow if (!XCopyPlane - (dpy, g.winlist[g.maxNdx].icon_drawable, pswap, g.gcDirect, - 0, 0, g.winlist[g.maxNdx].icon_w, - g.winlist[g.maxNdx].icon_h, 0, 0, 1)) + (dpy, WI.icon_drawable, pswap, g.gcDirect, + 0, 0, WI.icon_w, + WI.icon_h, 0, 0, 1)) die("can't copy plane"); // plane #1? - g.winlist[g.maxNdx].icon_drawable = pswap; - g.winlist[g.maxNdx].icon_allocated = true; // for subsequent free() + WI.icon_drawable = pswap; + WI.icon_allocated = true; // for subsequent free() icon_depth = XDEPTH; } - if (g.winlist[g.maxNdx].icon_drawable && icon_depth != XDEPTH) { + if (WI.icon_drawable && icon_depth != XDEPTH) { msg(-1, "can't handle icon depth other than %d or 1 (%d, %s). Please report this condition.\n", - XDEPTH, icon_depth, g.winlist[g.maxNdx].name); - g.winlist[g.maxNdx].icon_drawable = g.winlist[g.maxNdx].icon_w = - g.winlist[g.maxNdx].icon_h = 0; + XDEPTH, icon_depth, WI.name); + WI.icon_drawable = WI.icon_w = + WI.icon_h = 0; } +endIcon: + // 3. sort addToSortlist(win, false, false); -// 4. other window data +// 4. bottom line + + WI.bottom_line[0] = '\0'; + switch(g.option_bottom_line) { + case BL_DESKTOP: + if (desktop != DESKTOP_UNKNOWN) + snprintf(WI.bottom_line, MAXNAMESZ, "%ld", desktop); + else + strncpy(WI.bottom_line, "?", 2); + break; + } - g.winlist[g.maxNdx].reclevel = reclevel; - g.winlist[g.maxNdx].desktop = desktop; +// 5. other window data + + WI.reclevel = reclevel; + WI.desktop = desktop; g.maxNdx++; msg(1, "window %d, id %lx added to list\n", g.maxNdx, win); @@ -716,6 +733,10 @@ msg(1, "window on current or -1 desktop, skipped\n"); return true; } + if (g.option_desktop == DESK_SPECIAL && window_desktop != -1) { + msg(1, "window not on -1 desktop, skipped\n"); + return true; + } // man page: -sc 0: Screen is defined according to -vp pointer or -vp focus. // assuming g.vp already calculated in gui.c if (g.option_screen == SCR_CURRENT && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/src/x.c new/alttab-1.7.0/src/x.c --- old/alttab-1.6.1/src/x.c 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/src/x.c 2023-03-08 15:45:56.000000000 +0100 @@ -1,7 +1,7 @@ /* Interface with foreign windows in raw X11. -Copyright 2017-2021 Alexander Kulak. +Copyright 2017-2023 Alexander Kulak. This file is part of alttab program. alttab is free software: you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/alttab-1.6.1/test/run-in-xvfb.test new/alttab-1.7.0/test/run-in-xvfb.test --- old/alttab-1.6.1/test/run-in-xvfb.test 2021-12-06 00:22:57.000000000 +0100 +++ new/alttab-1.7.0/test/run-in-xvfb.test 2023-03-08 15:45:56.000000000 +0100 @@ -3,7 +3,7 @@ # Tests in headless X server. # http://www.gnu.org/software/automake/manual/automake.html#Using-the-TAP-test-protocol -# Copyright 2017-2021 Alexander Kulak. +# Copyright 2017-2023 Alexander Kulak. # This file is part of alttab program. # # alttab is free software: you can redistribute it and/or modify