Skip to content

Commit

Permalink
Add preference QuickSwitchRaiseCandidate to raise a selected QuickSwi…
Browse files Browse the repository at this point in the history
…tch window for issue #558 and #564.
  • Loading branch information
gijsbers committed Mar 31, 2021
1 parent 2844285 commit bf87d02
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
32 changes: 17 additions & 15 deletions src/default.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef __DEFAULT_H
#define __DEFAULT_H
#ifndef DEFAULT_H
#define DEFAULT_H

#include "yconfig.h"

Expand Down Expand Up @@ -99,6 +99,7 @@ XIV(bool, quickSwitchToHidden, true)
XIV(bool, quickSwitchToUrgent, true)
XIV(bool, quickSwitchToAllWorkspaces, false)
XIV(bool, quickSwitchGroupWorkspaces, true)
XIV(bool, quickSwitchRaiseCandidate, false)
XIV(bool, quickSwitchAllIcons, true)
XIV(bool, quickSwitchTextFirst, false)
XIV(bool, quickSwitchVertical, true)
Expand Down Expand Up @@ -185,15 +186,15 @@ XSV(const char *, openCommand, 0)
XSV(const char *, terminalCommand, TERM " -hold")
XSV(const char *, logoutCommand, 0)
XSV(const char *, logoutCancelCommand, 0)
#if defined(__linux__)
#if __linux__
XSV(const char *, shutdownCommand, "test -e /run/systemd/system && systemctl poweroff")
XSV(const char *, rebootCommand, "test -e /run/systemd/system && systemctl reboot")
XSV(const char *, suspendCommand, "test -e /run/systemd/system && systemctl suspend")
#else
XSV(const char *, shutdownCommand, 0)
XSV(const char *, rebootCommand, 0)
XSV(const char *, suspendCommand, 0)
#endif // LINUX
#endif
XIV(int, taskBarCPUDelay, 500)
XIV(int, taskBarMEMDelay, 500)
XIV(int, taskBarNetSamples, 20)
Expand All @@ -202,7 +203,7 @@ XSV(const char *, cpuCommand, TERM " -name top -title Process\
XSV(const char *, cpuClassHint, "top.XTerm")
XIV(bool, cpuCombine, true)

#ifdef __linux__
#if __linux__
XSV(const char *, netCommand, TERM " -name 'ss' -title 'Socket Statistics' -hold -e sh -c 'which ss > /dev/null && watch -t ss -putswl || netstat -c'")
XSV(const char *, netClassHint, "ss.XTerm")
#else
Expand All @@ -211,7 +212,7 @@ XSV(const char *, netClassHint, "netstat.XTerm")
#endif

XSV(const char *, netDevice, "[ew]*"
#ifdef __OpenBSD__
#if __OpenBSD__
" vio*"
#endif
)
Expand All @@ -226,7 +227,7 @@ XSV(const char *, fmtTimeAlt, NULL)
XSV(const char *, fmtDate, "%Y-%m-%d %H:%M:%S %z %B %A")
#endif

#if defined(CFGDEF)
#ifdef CFGDEF

cfoption icewm_preferences[] = {
OBV("ClickToFocus", &clickFocus, "Focus windows by clicking"),
Expand Down Expand Up @@ -279,12 +280,13 @@ cfoption icewm_preferences[] = {
OBV("UseMouseWheel", &useMouseWheel, "Support mouse wheel"),
OBV("ShowPopupsAbovePointer", &showPopupsAbovePointer, "Show popup menus above mouse pointer"),
OBV("ReplayMenuCancelClick", &replayMenuCancelClick, "Send the clicks outside menus to target window"),
OBV("QuickSwitch", &quickSwitch, "Alt+Tab window switching"),
OBV("QuickSwitchToMinimized", &quickSwitchToMinimized, "Alt+Tab to minimized windows"),
OBV("QuickSwitchToHidden", &quickSwitchToHidden, "Alt+Tab to hidden windows"),
OBV("QuickSwitch", &quickSwitch, "Enable Alt+Tab window switching"),
OBV("QuickSwitchToMinimized", &quickSwitchToMinimized, "Enable Alt+Tab to minimized windows"),
OBV("QuickSwitchToHidden", &quickSwitchToHidden, "Enable Alt+Tab to hidden windows"),
OBV("QuickSwitchToUrgent", &quickSwitchToUrgent, "Prioritize Alt+Tab to urgent windows"),
OBV("QuickSwitchToAllWorkspaces", &quickSwitchToAllWorkspaces, "Alt+Tab to windows on other workspaces"),
OBV("QuickSwitchGroupWorkspaces", &quickSwitchGroupWorkspaces, "Alt+Tab: group windows on current workspace"),
OBV("QuickSwitchToAllWorkspaces", &quickSwitchToAllWorkspaces, "Include windows from all workspaces in Alt+Tab"),
OBV("QuickSwitchGroupWorkspaces", &quickSwitchGroupWorkspaces, "Group windows by workspace together in Alt+Tab"),
OBV("QuickSwitchRaiseCandidate", &quickSwitchRaiseCandidate, "Raise a selected window while Alt+Tabbing in the QuickSwitch"),
OBV("QuickSwitchAllIcons", &quickSwitchAllIcons, "Show all reachable icons when quick switching"),
OBV("QuickSwitchTextFirst", &quickSwitchTextFirst, "Show the window title above (all reachable) icons"),
OBV("QuickSwitchSmallWindow", &quickSwitchSmallWindow, "Create a smaller QuickSwitch window of 1/3 screen width"),
Expand Down Expand Up @@ -484,10 +486,10 @@ cfoption icewm_preferences[] = {
OKV("KeyWinArrangeNW", gKeyWinArrangeNW, "Moves the active window to the top left corner of the screen."),
OKV("KeyWinArrangeC", gKeyWinArrangeC, "Moves the active window to the top middle of the screen."),
OKV("KeyWinSmartPlace", gKeyWinSmartPlace, "Smart place the active window."),
OKV("KeySysSwitchNext", gKeySysSwitchNext, "Give focus to the next window and raise it."),
OKV("KeySysSwitchNext", gKeySysSwitchNext, "Opens the QuickSwitch popup and/or moves the selector in the QuickSwitch popup"),
OKV("KeySysSwitchLast", gKeySysSwitchLast, "Works like KeySysSwitchNext but moving in the opposite direction."),
OKV("KeySysSwitchClass", gKeySysSwitchClass, "Is like KeySysSwitchNext but only for windows with the same WM_CLASS property as the currently focused window."),
OKV("KeySysWinNext", gKeySysWinNext, "Opens the QuickSwitch popup and/or moves the selector in the QuickSwitch popup"),
OKV("KeySysWinNext", gKeySysWinNext, "Give focus to the next window and raise it."),
OKV("KeySysWinPrev", gKeySysWinPrev, "Give focus to the previous window and raise it."),
OKV("KeyTaskBarSwitchNext", gKeyTaskBarSwitchNext, "Switch to the next window in the Task Bar"),
OKV("KeyTaskBarSwitchPrev", gKeyTaskBarSwitchPrev, "Switch to the previous window in the Task Bar"),
Expand Down Expand Up @@ -568,6 +570,6 @@ cfoption wmapp_preferences[] = {
#endif

#include "themable.h"
#endif /* __DEFAULT_H */
#endif

// vim: set sw=4 ts=4 et:
9 changes: 6 additions & 3 deletions src/wmframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1335,8 +1335,10 @@ void YFrameWindow::doLower() {
}

void YFrameWindow::wmRaise() {
doRaise();
manager->restackWindows();
if (canRaise()) {
doRaise();
manager->restackWindows();
}
}

void YFrameWindow::doRaise() {
Expand Down Expand Up @@ -2666,7 +2668,8 @@ void YFrameWindow::updateLayer(bool restack) {
if (newLayer != fWinActiveLayer) {
removeFrame();
fWinActiveLayer = newLayer;
insertFrame(true);
insertFrame(oldLayer != WinLayerFullscreen
|| !manager->switchWindowVisible());

if (client() && !client()->destroyed())
client()->setLayerHint(fWinActiveLayer);
Expand Down
12 changes: 4 additions & 8 deletions src/wmmgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -959,8 +959,7 @@ void YWindowManager::setFocus(YFrameWindow *f, bool canWarp, bool reorder) {
MSG(("SET FOCUS f=%p", f));

if (f == nullptr) {
YFrameWindow *ff = getFocus();
if (ff) switchFocusFrom(ff);
switchFocusFrom(getFocus());
}

if (f && f->visible()) {
Expand Down Expand Up @@ -2015,7 +2014,7 @@ void YWindowManager::restackWindows() {
w.append(f->handle());
}

if (switchWindowVisible()) {
if (quickSwitchRaiseCandidate && switchWindowVisible()) {
YFrameWindow* active = fSwitchWindow->current();
if (active) {
Window handle = active->handle();
Expand Down Expand Up @@ -2970,12 +2969,9 @@ void YWindowManager::switchFocusTo(YFrameWindow *frame, bool reorderFocus) {
}

void YWindowManager::switchFocusFrom(YFrameWindow *frame) {
if (frame == fFocusWin) {
if (fFocusWin) {
///msg("losing %lX", fFocusWin);
fFocusWin->loseWinFocus();
}
if (fFocusWin == frame && frame) {
fFocusWin = nullptr;
frame->loseWinFocus();
}
}

Expand Down

0 comments on commit bf87d02

Please sign in to comment.