diff --git a/etc/Makefile b/etc/Makefile index 9d2eeaeea..225c9e305 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -9,7 +9,8 @@ include $(TOPDIR)/build/system-inc.mk ###################################### ETC = cfg_notion.lua cfg_notioncore.lua cfg_kludges.lua cfg_defaults.lua \ - cfg_tiling.lua cfg_query.lua cfg_menu.lua \ + cfg_tiling.lua cfg_query.lua cfg_menu.lua cfg_bindings.lua \ + cfg_notion3_bindings.lua cfg_notion3_tiling.lua \ cfg_statusbar.lua cfg_dock.lua cfg_layouts.lua \ look_brownsteel.lua look_clean.lua look_dusky.lua \ look_greyviolet.lua look_ios.lua look_cleanviolet.lua \ diff --git a/etc/cfg_bindings.lua b/etc/cfg_bindings.lua new file mode 100644 index 000000000..3838f420b --- /dev/null +++ b/etc/cfg_bindings.lua @@ -0,0 +1,371 @@ +-- +-- Notion core configuration file +-- + + +-- +-- Bindings. This includes global bindings and bindings common to +-- screens and all types of frames only. See modules' configuration +-- files for other bindings. +-- + + +-- WScreen context bindings +-- +-- The bindings in this context are available all the time. +-- +-- The variable META should contain a string of the form 'Mod4+' +-- where Mod4 maybe replaced with the modifier you want to use for most +-- of the bindings. Similarly ALTMETA may be redefined to add a +-- modifier to some of the F-key bindings. + +defbindings("WScreen", { + bdoc("Switch to n:th object (workspace, full screen client window) ".. + "within current screen."), + kpress(META.."1", "WScreen.switch_nth(_, 0)"), + kpress(META.."2", "WScreen.switch_nth(_, 1)"), + kpress(META.."3", "WScreen.switch_nth(_, 2)"), + kpress(META.."4", "WScreen.switch_nth(_, 3)"), + kpress(META.."5", "WScreen.switch_nth(_, 4)"), + kpress(META.."6", "WScreen.switch_nth(_, 5)"), + kpress(META.."7", "WScreen.switch_nth(_, 6)"), + kpress(META.."8", "WScreen.switch_nth(_, 7)"), + kpress(META.."9", "WScreen.switch_nth(_, 8)"), + kpress(META.."0", "WScreen.switch_nth(_, 9)"), + + bdoc("Switch to next/previous object within current screen."), + kpress(META.."grave", "WScreen.switch_next(_)"), + kpress(ALTMETA.."asciitilde", "WScreen.switch_prev(_)"), + + submap(META.."O", { + bdoc("Open first region demanding attention or previously active one."), + kpress("O", "mod_menu.grabmenu(_, _sub, 'focuslist')"), + -- Alternative without (cyclable) menu + --kpress("O", "ioncore.goto_activity() or ioncore.goto_previous()"), + + --bdoc("Go to previous active object."), + --kpress("O", "ioncore.goto_previous()"), + + --bdoc("Go to first object on activity/urgency list."), + --kpress("I", "ioncore.goto_activity()"), + + }), + + bdoc("Go to n:th screen on multihead setup."), + kpress(META.."Shift+1", "ioncore.goto_nth_screen(0)"), + kpress(META.."F1", "ioncore.goto_nth_screen(0)"), + kpress(META.."Shift+2", "ioncore.goto_nth_screen(1)"), + kpress(META.."F2", "ioncore.goto_nth_screen(1)"), + kpress(META.."Shift+3", "ioncore.goto_nth_screen(2)"), + kpress(META.."F3", "ioncore.goto_nth_screen(2)"), + kpress(META.."Shift+4", "ioncore.goto_nth_screen(3)"), + -- kpress(META.."F4", "ioncore.goto_nth_screen(3)"), + + bdoc("Go to next/previous screen on multihead setup."), + kpress(ALTMETA.."Escape", "ioncore.goto_prev_screen()"), + kpress(META.."Escape", "ioncore.goto_next_screen()"), + + bdoc("Create a new workspace of chosen default type."), + kpress(META.."F9", "ioncore.create_ws(_)"), + + bdoc("Display the main menu."), + kpress("F12", "mod_menu.menu(_, _sub, 'mainmenu', {big=true})"), + kpress(META.."F12", "mod_query.query_menu(_, _sub, 'mainmenu', 'Main menu:')"), + mpress("Button3", "mod_menu.pmenu(_, _sub, 'mainmenu')"), + + bdoc("Display the window list menu."), + mpress("Button2", "mod_menu.pmenu(_, _sub, 'windowlist')"), + + bdoc("Forward-circulate focus."), + -- '_chld' used here stands to for an actual child window that may not + -- be managed by the screen itself, unlike '_sub', that is likely to be + -- the managing group of that window. The right/left directions are + -- used instead of next/prev, because they work better in conjunction + -- with tilings. + kpress(META.."Tab", "ioncore.goto_next(_chld, 'right')", + "_chld:non-nil"), + + bdoc("Backward-circulate focus."), + kpress(ALTMETA.."Tab", "ioncore.goto_next(_chld, 'left')", + "_chld:non-nil"), + + bdoc("Raise focused object, if possible."), + kpress(ALTMETA.."R", "WRegion.rqorder(_chld, 'front')", + "_chld:non-nil"), +}) + + +-- Client window bindings +-- +-- These bindings affect client windows directly. + +defbindings("WClientWin", { + bdoc("Nudge the client window. This might help with some ".. + "programs' resizing problems."), + kpress_wait(ALTMETA.."L", "WClientWin.nudge(_)"), + + bdoc("Kill client owning the client window."), + kpress(ALTMETA.."C", "WClientWin.kill(_)"), + + bdoc("Send next key press to the client window. ".. + "Some programs may not allow this by default."), + kpress(ALTMETA.."Q", "WClientWin.quote_next(_)"), +}) + + +-- Client window group bindings + +defbindings("WGroupCW", { + bdoc("Toggle client window group full-screen mode"), + kpress_wait(META.."Q", "WGroup.set_fullscreen(_, 'toggle')"), +}) + + +-- WMPlex context bindings +-- +-- These bindings work in frames and on screens. The innermost of such +-- contexts/objects always gets to handle the key press. + +defbindings("WMPlex", { + bdoc("Close current object."), + kpress_wait(META.."C", "WRegion.rqclose_propagate(_, _sub)"), + + bdoc("Detach (float) or reattach an object to its previous location."), + -- By using _chld instead of _sub, we can detach/reattach queries + -- attached to a group. The detach code checks if the parameter + -- (_chld) is a group 'bottom' and detaches the whole group in that + -- case. + kpress(ALTMETA.."D", "ioncore.detach(_chld, 'toggle')", "_chld:non-nil"), +}) + +-- Frames for transient windows ignore this bindmap + +defbindings("WMPlex.toplevel", { + bdoc("Toggle tag of current object."), + kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"), + + bdoc("Clear all tags."), + kpress(ALTMETA.."T", "ioncore.clear_tags()"), + + bdoc("Lock screen"), + kpress(META.."L", "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"), + + bdoc("Run a terminal emulator."), + kpress(META.."Return", "mod_query.exec_on_merr(_, XTERM or 'xterm')"), + kpress("F2", "mod_query.exec_on_merr(_, XTERM or 'xterm')"), + + bdoc("Query for command line to execute."), + kpress(META.."J", "mod_query.query_exec(_)"), + + bdoc("Query for Lua code to execute."), + kpress(ALTMETA.."J", "mod_query.query_lua(_)"), + + bdoc("Query for host to connect to with SSH."), + kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"), + + bdoc("Query for file to edit."), + kpress(ALTMETA.."F5", + "mod_query.query_editfile(_, 'run-mailcap --action=edit')"), + + bdoc("Query for file to view."), + kpress(ALTMETA.."F6", + "mod_query.query_runfile(_, 'run-mailcap --action=view')"), + + bdoc("Query for workspace to go to or create a new one."), + kpress(ALTMETA.."F9", "mod_query.query_workspace(_)"), + + bdoc("Query for a client window to go to."), + kpress(META.."G", "mod_query.query_gotoclient(_)"), + + bdoc("Display context menu."), + kpress(META.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"), + kpress(ALTMETA.."M", "mod_query.query_menu(_, _sub, 'ctxmenu', 'Context menu:')"), + + bdoc("Query for manual page to be displayed."), + kpress(META.."slash", "mod_query.query_man(_, ':man')"), +}) + +-- WFrame context bindings +-- +-- These bindings are common to all types of frames. Some additional +-- frame bindings are found in some modules' configuration files. + +defbindings("WFrame", { + bdoc("Maximize the frame horizontally/vertically."), + kpress(ALTMETA.."H", "WFrame.maximize_horiz(_)"), + kpress(ALTMETA.."V", "WFrame.maximize_vert(_)"), + + bdoc("Display context menu."), + mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"), + + bdoc("Begin move/resize mode."), + kpress(META.."R", "WFrame.begin_kbresize(_)"), + + bdoc("Switch the frame to display the object indicated by the tab."), + mclick("Button1@tab", "WFrame.p_switch_tab(_)"), + mclick("Button2@tab", "WFrame.p_switch_tab(_)"), + + bdoc("Resize the frame."), + mdrag("Button1@border", "WFrame.p_resize(_)"), + mdrag(META.."Button3", "WFrame.p_resize(_)"), + + bdoc("Move the frame."), + mdrag(META.."Button1", "WFrame.p_move(_)"), + + bdoc("Move objects between frames by dragging and dropping the tab."), + mdrag("Button1@tab", "WFrame.p_tabdrag(_)"), + mdrag("Button2@tab", "WFrame.p_tabdrag(_)"), + + bdoc("Switch to next/previous object within the frame."), + -- See docs on how to disable capslock caps behaviour + kpress(META.."Caps_Lock", "WFrame.switch_next(_)"), + mclick(META.."Button4", "WFrame.switch_next(_)"), + mclick(META.."Button5", "WFrame.switch_prev(_)"), +}) + +-- Frames for transient windows ignore this bindmap + +defbindings("WFrame.toplevel", { + bdoc("Query for a client window to attach ('nick')."), + kpress(META.."N", "mod_query.query_attachclient(_)"), + + kpress(META.."A", "WFrame.switch_nth(_, 0)"), + kpress(META.."S", "WFrame.switch_nth(_, 1)"), + kpress(META.."D", "WFrame.switch_nth(_, 2)"), + kpress(META.."F", "WFrame.switch_nth(_, 3)"), + + bdoc("Move current object within the frame left/right."), + kpress(ALTMETA.."comma", "WFrame.dec_index(_, _sub)", "_sub:non-nil"), + kpress(ALTMETA.."period", "WFrame.inc_index(_, _sub)", "_sub:non-nil"), + + bdoc("Maximize the frame horizontally/vertically."), + kpress(ALTMETA.."H", "WFrame.maximize_horiz(_)"), + kpress(ALTMETA.."V", "WFrame.maximize_vert(_)"), + + bdoc("Attach tagged objects to this frame."), + kpress(META.."Y", "ioncore.tagged_attach(_)"), +}) + +-- Bindings for floating frames + +defbindings("WFrame.floating", { + bdoc("Toggle shade mode"), + mdblclick("Button1@tab", "WFrame.set_shaded(_, 'toggle')"), + + bdoc("Raise the frame."), + mpress("Button1@tab", "WRegion.rqorder(_, 'front')"), + mpress("Button1@border", "WRegion.rqorder(_, 'front')"), + mclick(META.."Button1", "WRegion.rqorder(_, 'front')"), + + bdoc("Lower the frame."), + mclick(META.."Button3", "WRegion.rqorder(_, 'back')"), + + bdoc("Move the frame."), + mdrag("Button1@tab", "WFrame.p_move(_)"), +}) + + +-- WMoveresMode context bindings +-- +-- These bindings are available keyboard move/resize mode. The mode +-- is activated on frames with the command begin_kbresize (bound to +-- META.."R" above by default). + +defbindings("WMoveresMode", { + bdoc("Cancel the resize mode."), + kpress("AnyModifier+Escape","WMoveresMode.cancel(_)"), + + bdoc("End the resize mode."), + kpress("AnyModifier+Return","WMoveresMode.finish(_)"), + + bdoc("Grow in specified direction."), + kpress("Left", "WMoveresMode.resize(_, 1, 0, 0, 0)"), + kpress("Right", "WMoveresMode.resize(_, 0, 1, 0, 0)"), + kpress("Up", "WMoveresMode.resize(_, 0, 0, 1, 0)"), + kpress("Down", "WMoveresMode.resize(_, 0, 0, 0, 1)"), + kpress("F", "WMoveresMode.resize(_, 1, 0, 0, 0)"), + kpress("B", "WMoveresMode.resize(_, 0, 1, 0, 0)"), + kpress("P", "WMoveresMode.resize(_, 0, 0, 1, 0)"), + kpress("N", "WMoveresMode.resize(_, 0, 0, 0, 1)"), + + bdoc("Shrink in specified direction."), + kpress("Shift+Left", "WMoveresMode.resize(_,-1, 0, 0, 0)"), + kpress("Shift+Right", "WMoveresMode.resize(_, 0,-1, 0, 0)"), + kpress("Shift+Up", "WMoveresMode.resize(_, 0, 0,-1, 0)"), + kpress("Shift+Down", "WMoveresMode.resize(_, 0, 0, 0,-1)"), + kpress("Shift+F", "WMoveresMode.resize(_,-1, 0, 0, 0)"), + kpress("Shift+B", "WMoveresMode.resize(_, 0,-1, 0, 0)"), + kpress("Shift+P", "WMoveresMode.resize(_, 0, 0,-1, 0)"), + kpress("Shift+N", "WMoveresMode.resize(_, 0, 0, 0,-1)"), + + bdoc("Move in specified direction."), + kpress(META.."Left", "WMoveresMode.move(_,-1, 0)"), + kpress(META.."Right", "WMoveresMode.move(_, 1, 0)"), + kpress(META.."Up", "WMoveresMode.move(_, 0,-1)"), + kpress(META.."Down", "WMoveresMode.move(_, 0, 1)"), + kpress(META.."F", "WMoveresMode.move(_,-1, 0)"), + kpress(META.."B", "WMoveresMode.move(_, 1, 0)"), + kpress(META.."P", "WMoveresMode.move(_, 0,-1)"), + kpress(META.."N", "WMoveresMode.move(_, 0, 1)"), +}) + + +-- +-- Menu definitions +-- + + +-- Main menu +defmenu("mainmenu", { + menuentry("Run...", "mod_query.query_exec(_)"), + menuentry("Terminal", "mod_query.exec_on_merr(_, XTERM or 'xterm')"), + menuentry("Lock screen", + "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"), + menuentry("Help", "mod_query.query_man(_)"), + menuentry("About Notion", "mod_query.show_about_ion(_)"), + submenu("Styles", "stylemenu"), + submenu("Session", "sessionmenu"), +}) + + +-- Session control menu +defmenu("sessionmenu", { + menuentry("Save", "ioncore.snapshot()"), + menuentry("Restart", "ioncore.restart()"), + menuentry("Restart TWM", "ioncore.restart_other('twm')"), + menuentry("Exit", "ioncore.shutdown()"), +}) + + +-- Context menu (frame actions etc.) +defctxmenu("WFrame", "Frame", { + -- Note: this propagates the close to any subwindows; it does not + -- destroy the frame itself, unless empty. An entry to destroy tiled + -- frames is configured in cfg_tiling.lua. + menuentry("Close", "WRegion.rqclose_propagate(_, _sub)"), + -- Low-priority entries + menuentry("Attach tagged", "ioncore.tagged_attach(_)", { priority = 0 }), + menuentry("Clear tags", "ioncore.clear_tags()", { priority = 0 }), + menuentry("Window info", "mod_query.show_tree(_, _sub)", { priority = 0 }), +}) + + +-- Context menu for groups (workspaces, client windows) +defctxmenu("WGroup", "Group", { + menuentry("Toggle tag", "WRegion.set_tagged(_, 'toggle')"), + menuentry("De/reattach", "ioncore.detach(_, 'toggle')"), +}) + + +-- Context menu for workspaces +defctxmenu("WGroupWS", "Workspace", { + menuentry("Close", "WRegion.rqclose(_)"), + menuentry("Rename", "mod_query.query_renameworkspace(nil, _)"), + menuentry("Attach tagged", "ioncore.tagged_attach(_)"), +}) + + +-- Context menu for client windows +defctxmenu("WClientWin", "Client window", { + menuentry("Kill", "WClientWin.kill(_)"), +}) diff --git a/etc/cfg_defaults.lua b/etc/cfg_defaults.lua index 2f89bc07d..41b58cb46 100644 --- a/etc/cfg_defaults.lua +++ b/etc/cfg_defaults.lua @@ -2,7 +2,6 @@ -- Notion default settings -- -dopath("cfg_notioncore") dopath("cfg_kludges") dopath("cfg_layouts") @@ -15,3 +14,6 @@ dopath("mod_notionflux") dopath("mod_xrandr") dopath("net_client_list") + +-- loads cfg_bindings +dopath("cfg_notioncore") diff --git a/etc/cfg_notion.lua b/etc/cfg_notion.lua index 1e17ccec3..8287e5946 100644 --- a/etc/cfg_notion.lua +++ b/etc/cfg_notion.lua @@ -15,7 +15,7 @@ -- to which modifiers, and the 'xev' tool can be used to see what codes are -- generated by particular keys. --META="Mod4+" ---ALTMETA="" +ALTMETA=META.."Shift+" -- Terminal emulator. --XTERM="xterm" diff --git a/etc/cfg_notion3_keybindings.lua b/etc/cfg_notion3_keybindings.lua new file mode 100644 index 000000000..213867df9 --- /dev/null +++ b/etc/cfg_notion3_keybindings.lua @@ -0,0 +1,393 @@ +-- +-- Notion core configuration file +-- + + +-- +-- Bindings. This includes global bindings and bindings common to +-- screens and all types of frames only. See modules' configuration +-- files for other bindings. +-- + + +-- WScreen context bindings +-- +-- The bindings in this context are available all the time. +-- +-- The variable META should contain a string of the form 'Mod4+' +-- where Mod4 maybe replaced with the modifier you want to use for most +-- of the bindings. Similarly ALTMETA may be redefined to add a +-- modifier to some of the F-key bindings. + +defbindings("WScreen", { + bdoc("Switch to n:th object (workspace, full screen client window) ".. + "within current screen."), + kpress(META.."1", "WScreen.switch_nth(_, 0)"), + kpress(META.."2", "WScreen.switch_nth(_, 1)"), + kpress(META.."3", "WScreen.switch_nth(_, 2)"), + kpress(META.."4", "WScreen.switch_nth(_, 3)"), + kpress(META.."5", "WScreen.switch_nth(_, 4)"), + kpress(META.."6", "WScreen.switch_nth(_, 5)"), + kpress(META.."7", "WScreen.switch_nth(_, 6)"), + kpress(META.."8", "WScreen.switch_nth(_, 7)"), + kpress(META.."9", "WScreen.switch_nth(_, 8)"), + kpress(META.."0", "WScreen.switch_nth(_, 9)"), + + bdoc("Switch to next/previous object within current screen."), + kpress(META.."comma", "WScreen.switch_prev(_)"), + kpress(META.."period", "WScreen.switch_next(_)"), + + submap(META.."K", { + bdoc("Go to first region demanding attention or previously active one."), + kpress("K", "mod_menu.grabmenu(_, _sub, 'focuslist')"), + -- Alternative without (cyclable) menu + --kpress("K", "ioncore.goto_activity() or ioncore.goto_previous()"), + + --bdoc("Go to previous active object."), + --kpress("K", "ioncore.goto_previous()"), + + --bdoc("Go to first object on activity/urgency list."), + --kpress("I", "ioncore.goto_activity()"), + + bdoc("Clear all tags."), + kpress("T", "ioncore.clear_tags()"), + }), + + bdoc("Go to n:th screen on multihead setup."), + kpress(META.."Shift+1", "ioncore.goto_nth_screen(0)"), + kpress(META.."Q", "ioncore.goto_nth_screen(0)"), + kpress(META.."Shift+2", "ioncore.goto_nth_screen(1)"), + kpress(META.."W", "ioncore.goto_nth_screen(1)"), + kpress(META.."Shift+3", "ioncore.goto_nth_screen(2)"), + kpress(META.."E", "ioncore.goto_nth_screen(2)"), + + bdoc("Go to next/previous screen on multihead setup."), + kpress(META.."Shift+comma", "ioncore.goto_prev_screen()"), + kpress(META.."I", "ioncore.goto_prev_screen()"), + kpress(META.."O", "ioncore.goto_next_screen()"), + kpress(META.."grave", "ioncore.goto_next_screen()"), + + bdoc("Create a new workspace of chosen default type."), + kpress(META.."F9", "ioncore.create_ws(_)"), + + bdoc("Display the main menu."), + kpress(ALTMETA.."F12", "mod_query.query_menu(_, _sub, 'mainmenu', 'Main menu:')"), + --kpress(ALTMETA.."F12", "mod_menu.menu(_, _sub, 'mainmenu', {big=true})"), + mpress("Button3", "mod_menu.pmenu(_, _sub, 'mainmenu')"), + + bdoc("Display the window list menu."), + mpress("Button2", "mod_menu.pmenu(_, _sub, 'windowlist')"), + + bdoc("Forward-circulate focus."), + -- '_chld' used here stands to for an actual child window that may not + -- be managed by the screen itself, unlike '_sub', that is likely to be + -- the managing group of that window. The right/left directions are + -- used instead of next/prev, because they work better in conjunction + -- with tilings. + kpress(META.."Tab", "ioncore.goto_next(_chld, 'right')", + "_chld:non-nil"), + submap(META.."K", { + bdoc("Backward-circulate focus."), + kpress("AnyModifier+Tab", "ioncore.goto_next(_chld, 'left')", + "_chld:non-nil"), + + bdoc("Raise focused object, if possible."), + kpress("AnyModifier+R", "WRegion.rqorder(_chld, 'front')", + "_chld:non-nil"), + }), + +}) + + +-- Client window bindings +-- +-- These bindings affect client windows directly. + +defbindings("WClientWin", { + submap(META.."K", { + bdoc("Nudge the client window. This might help with some ".. + "programs' resizing problems."), + kpress_wait(META.."L", "WClientWin.nudge(_)"), + + bdoc("Kill client owning the client window."), + kpress("C", "WClientWin.kill(_)"), + + bdoc("Send next key press to the client window. ".. + "Some programs may not allow this by default."), + kpress("Q", "WClientWin.quote_next(_)"), + }), +}) + + +-- Client window group bindings + +defbindings("WGroupCW", { + bdoc("Toggle client window group full-screen mode"), + kpress_wait(META.."Return", "WGroup.set_fullscreen(_, 'toggle')"), +}) + + +-- WMPlex context bindings +-- +-- These bindings work in frames and on screens. The innermost of such +-- contexts/objects always gets to handle the key press. + +defbindings("WMPlex", { + bdoc("Close current object."), + kpress_wait(META.."C", "WRegion.rqclose_propagate(_, _sub)"), + + submap(META.."K", { + bdoc("Detach (float) or reattach an object to its previous location."), + -- By using _chld instead of _sub, we can detach/reattach queries + -- attached to a group. The detach code checks if the parameter + -- (_chld) is a group 'bottom' and detaches the whole group in that + -- case. + kpress("D", "ioncore.detach(_chld, 'toggle')", "_chld:non-nil"), + }), +}) + +-- Frames for transient windows ignore this bindmap + +defbindings("WMPlex.toplevel", { + bdoc("Toggle tag of current object."), + kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"), + + bdoc("Lock screen"), + kpress(META.."L", "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"), + + bdoc("Query for manual page to be displayed."), + kpress(ALTMETA.."F1", "mod_query.query_man(_, ':man')"), + + bdoc("Show the Notion manual page."), + kpress(META.."F1", "ioncore.exec_on(_, ':man notion')"), + + bdoc("Run a terminal emulator."), + kpress(ALTMETA.."F2", "mod_query.exec_on_merr(_, XTERM or 'xterm')"), + + bdoc("Query for command line to execute."), + kpress(ALTMETA.."F3", "mod_query.query_exec(_)"), + + bdoc("Query for Lua code to execute."), + kpress(META.."F3", "mod_query.query_lua(_)"), + + bdoc("Query for host to connect to with SSH."), + kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"), + + bdoc("Query for file to edit."), + kpress(ALTMETA.."F5", + "mod_query.query_editfile(_, 'run-mailcap --action=edit')"), + + bdoc("Query for file to view."), + kpress(ALTMETA.."F6", + "mod_query.query_runfile(_, 'run-mailcap --action=view')"), + + bdoc("Query for workspace to go to or create a new one."), + kpress(ALTMETA.."F9", "mod_query.query_workspace(_)"), + + bdoc("Query for a client window to go to."), + kpress(META.."G", "mod_query.query_gotoclient(_)"), + + bdoc("Display context menu."), + --kpress(META.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"), + kpress(META.."M", "mod_query.query_menu(_, _sub, 'ctxmenu', 'Context menu:')"), +}) + + +-- WFrame context bindings +-- +-- These bindings are common to all types of frames. Some additional +-- frame bindings are found in some modules' configuration files. + +defbindings("WFrame", { + submap(META.."K", { + bdoc("Maximize the frame horizontally/vertically."), + kpress("H", "WFrame.maximize_horiz(_)"), + kpress("V", "WFrame.maximize_vert(_)"), + }), + + bdoc("Display context menu."), + mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"), + + bdoc("Begin move/resize mode."), + kpress(META.."R", "WFrame.begin_kbresize(_)"), + + bdoc("Switch the frame to display the object indicated by the tab."), + mclick("Button1@tab", "WFrame.p_switch_tab(_)"), + mclick("Button2@tab", "WFrame.p_switch_tab(_)"), + + bdoc("Resize the frame."), + mdrag("Button1@border", "WFrame.p_resize(_)"), + mdrag(META.."Button3", "WFrame.p_resize(_)"), + + bdoc("Move the frame."), + mdrag(META.."Button1", "WFrame.p_move(_)"), + + bdoc("Move objects between frames by dragging and dropping the tab."), + mdrag("Button1@tab", "WFrame.p_tabdrag(_)"), + mdrag("Button2@tab", "WFrame.p_tabdrag(_)"), + + bdoc("Switch to next/previous object within the frame."), + mclick(META.."Button4", "WFrame.switch_next(_)"), + mclick(META.."Button5", "WFrame.switch_prev(_)"), +}) + +-- Frames for transient windows ignore this bindmap + +defbindings("WFrame.toplevel", { + bdoc("Query for a client window to attach."), + kpress(META.."A", "mod_query.query_attachclient(_)"), + + kpress(META.."K", "WFrame.set_numbers(_, 'during_grab')"), + submap(META.."K", { + bdoc("Switch to n:th object within the frame."), + kpress("1", "WFrame.switch_nth(_, 0)"), + kpress("2", "WFrame.switch_nth(_, 1)"), + kpress("3", "WFrame.switch_nth(_, 2)"), + kpress("4", "WFrame.switch_nth(_, 3)"), + kpress("5", "WFrame.switch_nth(_, 4)"), + kpress("6", "WFrame.switch_nth(_, 5)"), + kpress("7", "WFrame.switch_nth(_, 6)"), + kpress("8", "WFrame.switch_nth(_, 7)"), + kpress("9", "WFrame.switch_nth(_, 8)"), + kpress("0", "WFrame.switch_nth(_, 9)"), + + bdoc("Switch to next/previous object within the frame."), + kpress("N", "WFrame.switch_next(_)"), + kpress("P", "WFrame.switch_prev(_)"), + + bdoc("Move current object within the frame left/right."), + kpress("comma", "WFrame.dec_index(_, _sub)", "_sub:non-nil"), + kpress("period", "WFrame.inc_index(_, _sub)", "_sub:non-nil"), + + bdoc("Maximize the frame horizontally/vertically."), + kpress("H", "WFrame.maximize_horiz(_)"), + kpress("V", "WFrame.maximize_vert(_)"), + + bdoc("Attach tagged objects to this frame."), + kpress("A", "ioncore.tagged_attach(_)"), + }), +}) + +-- Bindings for floating frames + +defbindings("WFrame.floating", { + bdoc("Toggle shade mode"), + mdblclick("Button1@tab", "WFrame.set_shaded(_, 'toggle')"), + + bdoc("Raise the frame."), + mpress("Button1@tab", "WRegion.rqorder(_, 'front')"), + mpress("Button1@border", "WRegion.rqorder(_, 'front')"), + mclick(META.."Button1", "WRegion.rqorder(_, 'front')"), + + bdoc("Lower the frame."), + mclick(META.."Button3", "WRegion.rqorder(_, 'back')"), + + bdoc("Move the frame."), + mdrag("Button1@tab", "WFrame.p_move(_)"), +}) + + +-- WMoveresMode context bindings +-- +-- These bindings are available keyboard move/resize mode. The mode +-- is activated on frames with the command begin_kbresize (bound to +-- META.."R" above by default). + +defbindings("WMoveresMode", { + bdoc("Cancel the resize mode."), + kpress("AnyModifier+Escape","WMoveresMode.cancel(_)"), + + bdoc("End the resize mode."), + kpress("AnyModifier+Return","WMoveresMode.finish(_)"), + + bdoc("Grow in specified direction."), + kpress("Left", "WMoveresMode.resize(_, 1, 0, 0, 0)"), + kpress("Right", "WMoveresMode.resize(_, 0, 1, 0, 0)"), + kpress("Up", "WMoveresMode.resize(_, 0, 0, 1, 0)"), + kpress("Down", "WMoveresMode.resize(_, 0, 0, 0, 1)"), + kpress("F", "WMoveresMode.resize(_, 1, 0, 0, 0)"), + kpress("B", "WMoveresMode.resize(_, 0, 1, 0, 0)"), + kpress("P", "WMoveresMode.resize(_, 0, 0, 1, 0)"), + kpress("N", "WMoveresMode.resize(_, 0, 0, 0, 1)"), + + bdoc("Shrink in specified direction."), + kpress("Shift+Left", "WMoveresMode.resize(_,-1, 0, 0, 0)"), + kpress("Shift+Right", "WMoveresMode.resize(_, 0,-1, 0, 0)"), + kpress("Shift+Up", "WMoveresMode.resize(_, 0, 0,-1, 0)"), + kpress("Shift+Down", "WMoveresMode.resize(_, 0, 0, 0,-1)"), + kpress("Shift+F", "WMoveresMode.resize(_,-1, 0, 0, 0)"), + kpress("Shift+B", "WMoveresMode.resize(_, 0,-1, 0, 0)"), + kpress("Shift+P", "WMoveresMode.resize(_, 0, 0,-1, 0)"), + kpress("Shift+N", "WMoveresMode.resize(_, 0, 0, 0,-1)"), + + bdoc("Move in specified direction."), + kpress(META.."Left", "WMoveresMode.move(_,-1, 0)"), + kpress(META.."Right", "WMoveresMode.move(_, 1, 0)"), + kpress(META.."Up", "WMoveresMode.move(_, 0,-1)"), + kpress(META.."Down", "WMoveresMode.move(_, 0, 1)"), + kpress(META.."F", "WMoveresMode.move(_,-1, 0)"), + kpress(META.."B", "WMoveresMode.move(_, 1, 0)"), + kpress(META.."P", "WMoveresMode.move(_, 0,-1)"), + kpress(META.."N", "WMoveresMode.move(_, 0, 1)"), +}) + + +-- +-- Menu definitions +-- + + +-- Main menu +defmenu("mainmenu", { + menuentry("Run...", "mod_query.query_exec(_)"), + menuentry("Terminal", "mod_query.exec_on_merr(_, XTERM or 'xterm')"), + menuentry("Lock screen", + "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"), + menuentry("Help", "mod_query.query_man(_)"), + menuentry("About Notion", "mod_query.show_about_ion(_)"), + submenu("Styles", "stylemenu"), + submenu("Session", "sessionmenu"), +}) + + +-- Session control menu +defmenu("sessionmenu", { + menuentry("Save", "ioncore.snapshot()"), + menuentry("Restart", "ioncore.restart()"), + menuentry("Restart TWM", "ioncore.restart_other('twm')"), + menuentry("Exit", "ioncore.shutdown()"), +}) + + +-- Context menu (frame actions etc.) +defctxmenu("WFrame", "Frame", { + -- Note: this propagates the close to any subwindows; it does not + -- destroy the frame itself, unless empty. An entry to destroy tiled + -- frames is configured in cfg_tiling.lua. + menuentry("Close", "WRegion.rqclose_propagate(_, _sub)"), + -- Low-priority entries + menuentry("Attach tagged", "ioncore.tagged_attach(_)", { priority = 0 }), + menuentry("Clear tags", "ioncore.clear_tags()", { priority = 0 }), + menuentry("Window info", "mod_query.show_tree(_, _sub)", { priority = 0 }), +}) + + +-- Context menu for groups (workspaces, client windows) +defctxmenu("WGroup", "Group", { + menuentry("Toggle tag", "WRegion.set_tagged(_, 'toggle')"), + menuentry("De/reattach", "ioncore.detach(_, 'toggle')"), +}) + + +-- Context menu for workspaces +defctxmenu("WGroupWS", "Workspace", { + menuentry("Close", "WRegion.rqclose(_)"), + menuentry("Rename", "mod_query.query_renameworkspace(nil, _)"), + menuentry("Attach tagged", "ioncore.tagged_attach(_)"), +}) + + +-- Context menu for client windows +defctxmenu("WClientWin", "Client window", { + menuentry("Kill", "WClientWin.kill(_)"), +}) diff --git a/etc/cfg_notion3_tiling.lua b/etc/cfg_notion3_tiling.lua new file mode 100644 index 000000000..f315bbad9 --- /dev/null +++ b/etc/cfg_notion3_tiling.lua @@ -0,0 +1,77 @@ +-- +-- Notion tiling module configuration file +-- + +-- Bindings for the tilings. +defbindings("WTiling", { + bdoc("Split current frame vertically."), + kpress(META.."S", "WTiling.split_at(_, _sub, 'bottom', true)"), + + bdoc("Go to frame above/below current frame."), + kpress(META.."P", "ioncore.goto_next(_sub, 'up', {no_ascend=_})"), + kpress(META.."N", "ioncore.goto_next(_sub, 'down', {no_ascend=_})"), + mclick(META.."Shift+Button4", "ioncore.goto_next(_sub, 'up', {no_ascend=_})"), + mclick(META.."Shift+Button5", "ioncore.goto_next(_sub, 'down', {no_ascend=_})"), + + bdoc("Go to frame right/left of current frame."), + kpress(META.."Tab", "ioncore.goto_next(_sub, 'right')"), + submap(META.."K", { + kpress("Tab", "ioncore.goto_next(_sub, 'left')"), + + bdoc("Split current frame horizontally."), + kpress("S", "WTiling.split_at(_, _sub, 'right', true)"), + + bdoc("Destroy current frame."), + kpress("X", "WTiling.unsplit_at(_, _sub)"), + }), +}) + +-- Frame bindings. +defbindings("WFrame.floating", { + submap(META.."K", { + bdoc("Tile frame, if no tiling exists on the workspace"), + kpress("B", "mod_tiling.mkbottom(_)"), + }), +}) + +-- Context menu for tiled workspaces. +defctxmenu("WTiling", "Tiling", { + menuentry("Destroy frame", + "WTiling.unsplit_at(_, _sub)"), + + menuentry("Split vertically", + "WTiling.split_at(_, _sub, 'bottom', true)"), + menuentry("Split horizontally", + "WTiling.split_at(_, _sub, 'right', true)"), + + menuentry("Flip", "WTiling.flip_at(_, _sub)"), + menuentry("Transpose", "WTiling.transpose_at(_, _sub)"), + + menuentry("Untile", "mod_tiling.untile(_)"), + + submenu("Float split", { + menuentry("At left", + "WTiling.set_floating_at(_, _sub, 'toggle', 'left')"), + menuentry("At right", + "WTiling.set_floating_at(_, _sub, 'toggle', 'right')"), + menuentry("Above", + "WTiling.set_floating_at(_, _sub, 'toggle', 'up')"), + menuentry("Below", + "WTiling.set_floating_at(_, _sub, 'toggle', 'down')"), + }), + + submenu("At root", { + menuentry("Split vertically", + "WTiling.split_top(_, 'bottom')"), + menuentry("Split horizontally", + "WTiling.split_top(_, 'right')"), + menuentry("Flip", "WTiling.flip_at(_)"), + menuentry("Transpose", "WTiling.transpose_at(_)"), + }), +}) + +-- Extra context menu extra entries for floatframes. +defctxmenu("WFrame.floating", "Floating frame", { + append=true, + menuentry("New tiling", "mod_tiling.mkbottom(_)"), +}) diff --git a/etc/cfg_notioncore.lua b/etc/cfg_notioncore.lua index 213867df9..8117f09ef 100644 --- a/etc/cfg_notioncore.lua +++ b/etc/cfg_notioncore.lua @@ -1,393 +1 @@ --- --- Notion core configuration file --- - - --- --- Bindings. This includes global bindings and bindings common to --- screens and all types of frames only. See modules' configuration --- files for other bindings. --- - - --- WScreen context bindings --- --- The bindings in this context are available all the time. --- --- The variable META should contain a string of the form 'Mod4+' --- where Mod4 maybe replaced with the modifier you want to use for most --- of the bindings. Similarly ALTMETA may be redefined to add a --- modifier to some of the F-key bindings. - -defbindings("WScreen", { - bdoc("Switch to n:th object (workspace, full screen client window) ".. - "within current screen."), - kpress(META.."1", "WScreen.switch_nth(_, 0)"), - kpress(META.."2", "WScreen.switch_nth(_, 1)"), - kpress(META.."3", "WScreen.switch_nth(_, 2)"), - kpress(META.."4", "WScreen.switch_nth(_, 3)"), - kpress(META.."5", "WScreen.switch_nth(_, 4)"), - kpress(META.."6", "WScreen.switch_nth(_, 5)"), - kpress(META.."7", "WScreen.switch_nth(_, 6)"), - kpress(META.."8", "WScreen.switch_nth(_, 7)"), - kpress(META.."9", "WScreen.switch_nth(_, 8)"), - kpress(META.."0", "WScreen.switch_nth(_, 9)"), - - bdoc("Switch to next/previous object within current screen."), - kpress(META.."comma", "WScreen.switch_prev(_)"), - kpress(META.."period", "WScreen.switch_next(_)"), - - submap(META.."K", { - bdoc("Go to first region demanding attention or previously active one."), - kpress("K", "mod_menu.grabmenu(_, _sub, 'focuslist')"), - -- Alternative without (cyclable) menu - --kpress("K", "ioncore.goto_activity() or ioncore.goto_previous()"), - - --bdoc("Go to previous active object."), - --kpress("K", "ioncore.goto_previous()"), - - --bdoc("Go to first object on activity/urgency list."), - --kpress("I", "ioncore.goto_activity()"), - - bdoc("Clear all tags."), - kpress("T", "ioncore.clear_tags()"), - }), - - bdoc("Go to n:th screen on multihead setup."), - kpress(META.."Shift+1", "ioncore.goto_nth_screen(0)"), - kpress(META.."Q", "ioncore.goto_nth_screen(0)"), - kpress(META.."Shift+2", "ioncore.goto_nth_screen(1)"), - kpress(META.."W", "ioncore.goto_nth_screen(1)"), - kpress(META.."Shift+3", "ioncore.goto_nth_screen(2)"), - kpress(META.."E", "ioncore.goto_nth_screen(2)"), - - bdoc("Go to next/previous screen on multihead setup."), - kpress(META.."Shift+comma", "ioncore.goto_prev_screen()"), - kpress(META.."I", "ioncore.goto_prev_screen()"), - kpress(META.."O", "ioncore.goto_next_screen()"), - kpress(META.."grave", "ioncore.goto_next_screen()"), - - bdoc("Create a new workspace of chosen default type."), - kpress(META.."F9", "ioncore.create_ws(_)"), - - bdoc("Display the main menu."), - kpress(ALTMETA.."F12", "mod_query.query_menu(_, _sub, 'mainmenu', 'Main menu:')"), - --kpress(ALTMETA.."F12", "mod_menu.menu(_, _sub, 'mainmenu', {big=true})"), - mpress("Button3", "mod_menu.pmenu(_, _sub, 'mainmenu')"), - - bdoc("Display the window list menu."), - mpress("Button2", "mod_menu.pmenu(_, _sub, 'windowlist')"), - - bdoc("Forward-circulate focus."), - -- '_chld' used here stands to for an actual child window that may not - -- be managed by the screen itself, unlike '_sub', that is likely to be - -- the managing group of that window. The right/left directions are - -- used instead of next/prev, because they work better in conjunction - -- with tilings. - kpress(META.."Tab", "ioncore.goto_next(_chld, 'right')", - "_chld:non-nil"), - submap(META.."K", { - bdoc("Backward-circulate focus."), - kpress("AnyModifier+Tab", "ioncore.goto_next(_chld, 'left')", - "_chld:non-nil"), - - bdoc("Raise focused object, if possible."), - kpress("AnyModifier+R", "WRegion.rqorder(_chld, 'front')", - "_chld:non-nil"), - }), - -}) - - --- Client window bindings --- --- These bindings affect client windows directly. - -defbindings("WClientWin", { - submap(META.."K", { - bdoc("Nudge the client window. This might help with some ".. - "programs' resizing problems."), - kpress_wait(META.."L", "WClientWin.nudge(_)"), - - bdoc("Kill client owning the client window."), - kpress("C", "WClientWin.kill(_)"), - - bdoc("Send next key press to the client window. ".. - "Some programs may not allow this by default."), - kpress("Q", "WClientWin.quote_next(_)"), - }), -}) - - --- Client window group bindings - -defbindings("WGroupCW", { - bdoc("Toggle client window group full-screen mode"), - kpress_wait(META.."Return", "WGroup.set_fullscreen(_, 'toggle')"), -}) - - --- WMPlex context bindings --- --- These bindings work in frames and on screens. The innermost of such --- contexts/objects always gets to handle the key press. - -defbindings("WMPlex", { - bdoc("Close current object."), - kpress_wait(META.."C", "WRegion.rqclose_propagate(_, _sub)"), - - submap(META.."K", { - bdoc("Detach (float) or reattach an object to its previous location."), - -- By using _chld instead of _sub, we can detach/reattach queries - -- attached to a group. The detach code checks if the parameter - -- (_chld) is a group 'bottom' and detaches the whole group in that - -- case. - kpress("D", "ioncore.detach(_chld, 'toggle')", "_chld:non-nil"), - }), -}) - --- Frames for transient windows ignore this bindmap - -defbindings("WMPlex.toplevel", { - bdoc("Toggle tag of current object."), - kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"), - - bdoc("Lock screen"), - kpress(META.."L", "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"), - - bdoc("Query for manual page to be displayed."), - kpress(ALTMETA.."F1", "mod_query.query_man(_, ':man')"), - - bdoc("Show the Notion manual page."), - kpress(META.."F1", "ioncore.exec_on(_, ':man notion')"), - - bdoc("Run a terminal emulator."), - kpress(ALTMETA.."F2", "mod_query.exec_on_merr(_, XTERM or 'xterm')"), - - bdoc("Query for command line to execute."), - kpress(ALTMETA.."F3", "mod_query.query_exec(_)"), - - bdoc("Query for Lua code to execute."), - kpress(META.."F3", "mod_query.query_lua(_)"), - - bdoc("Query for host to connect to with SSH."), - kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"), - - bdoc("Query for file to edit."), - kpress(ALTMETA.."F5", - "mod_query.query_editfile(_, 'run-mailcap --action=edit')"), - - bdoc("Query for file to view."), - kpress(ALTMETA.."F6", - "mod_query.query_runfile(_, 'run-mailcap --action=view')"), - - bdoc("Query for workspace to go to or create a new one."), - kpress(ALTMETA.."F9", "mod_query.query_workspace(_)"), - - bdoc("Query for a client window to go to."), - kpress(META.."G", "mod_query.query_gotoclient(_)"), - - bdoc("Display context menu."), - --kpress(META.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"), - kpress(META.."M", "mod_query.query_menu(_, _sub, 'ctxmenu', 'Context menu:')"), -}) - - --- WFrame context bindings --- --- These bindings are common to all types of frames. Some additional --- frame bindings are found in some modules' configuration files. - -defbindings("WFrame", { - submap(META.."K", { - bdoc("Maximize the frame horizontally/vertically."), - kpress("H", "WFrame.maximize_horiz(_)"), - kpress("V", "WFrame.maximize_vert(_)"), - }), - - bdoc("Display context menu."), - mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"), - - bdoc("Begin move/resize mode."), - kpress(META.."R", "WFrame.begin_kbresize(_)"), - - bdoc("Switch the frame to display the object indicated by the tab."), - mclick("Button1@tab", "WFrame.p_switch_tab(_)"), - mclick("Button2@tab", "WFrame.p_switch_tab(_)"), - - bdoc("Resize the frame."), - mdrag("Button1@border", "WFrame.p_resize(_)"), - mdrag(META.."Button3", "WFrame.p_resize(_)"), - - bdoc("Move the frame."), - mdrag(META.."Button1", "WFrame.p_move(_)"), - - bdoc("Move objects between frames by dragging and dropping the tab."), - mdrag("Button1@tab", "WFrame.p_tabdrag(_)"), - mdrag("Button2@tab", "WFrame.p_tabdrag(_)"), - - bdoc("Switch to next/previous object within the frame."), - mclick(META.."Button4", "WFrame.switch_next(_)"), - mclick(META.."Button5", "WFrame.switch_prev(_)"), -}) - --- Frames for transient windows ignore this bindmap - -defbindings("WFrame.toplevel", { - bdoc("Query for a client window to attach."), - kpress(META.."A", "mod_query.query_attachclient(_)"), - - kpress(META.."K", "WFrame.set_numbers(_, 'during_grab')"), - submap(META.."K", { - bdoc("Switch to n:th object within the frame."), - kpress("1", "WFrame.switch_nth(_, 0)"), - kpress("2", "WFrame.switch_nth(_, 1)"), - kpress("3", "WFrame.switch_nth(_, 2)"), - kpress("4", "WFrame.switch_nth(_, 3)"), - kpress("5", "WFrame.switch_nth(_, 4)"), - kpress("6", "WFrame.switch_nth(_, 5)"), - kpress("7", "WFrame.switch_nth(_, 6)"), - kpress("8", "WFrame.switch_nth(_, 7)"), - kpress("9", "WFrame.switch_nth(_, 8)"), - kpress("0", "WFrame.switch_nth(_, 9)"), - - bdoc("Switch to next/previous object within the frame."), - kpress("N", "WFrame.switch_next(_)"), - kpress("P", "WFrame.switch_prev(_)"), - - bdoc("Move current object within the frame left/right."), - kpress("comma", "WFrame.dec_index(_, _sub)", "_sub:non-nil"), - kpress("period", "WFrame.inc_index(_, _sub)", "_sub:non-nil"), - - bdoc("Maximize the frame horizontally/vertically."), - kpress("H", "WFrame.maximize_horiz(_)"), - kpress("V", "WFrame.maximize_vert(_)"), - - bdoc("Attach tagged objects to this frame."), - kpress("A", "ioncore.tagged_attach(_)"), - }), -}) - --- Bindings for floating frames - -defbindings("WFrame.floating", { - bdoc("Toggle shade mode"), - mdblclick("Button1@tab", "WFrame.set_shaded(_, 'toggle')"), - - bdoc("Raise the frame."), - mpress("Button1@tab", "WRegion.rqorder(_, 'front')"), - mpress("Button1@border", "WRegion.rqorder(_, 'front')"), - mclick(META.."Button1", "WRegion.rqorder(_, 'front')"), - - bdoc("Lower the frame."), - mclick(META.."Button3", "WRegion.rqorder(_, 'back')"), - - bdoc("Move the frame."), - mdrag("Button1@tab", "WFrame.p_move(_)"), -}) - - --- WMoveresMode context bindings --- --- These bindings are available keyboard move/resize mode. The mode --- is activated on frames with the command begin_kbresize (bound to --- META.."R" above by default). - -defbindings("WMoveresMode", { - bdoc("Cancel the resize mode."), - kpress("AnyModifier+Escape","WMoveresMode.cancel(_)"), - - bdoc("End the resize mode."), - kpress("AnyModifier+Return","WMoveresMode.finish(_)"), - - bdoc("Grow in specified direction."), - kpress("Left", "WMoveresMode.resize(_, 1, 0, 0, 0)"), - kpress("Right", "WMoveresMode.resize(_, 0, 1, 0, 0)"), - kpress("Up", "WMoveresMode.resize(_, 0, 0, 1, 0)"), - kpress("Down", "WMoveresMode.resize(_, 0, 0, 0, 1)"), - kpress("F", "WMoveresMode.resize(_, 1, 0, 0, 0)"), - kpress("B", "WMoveresMode.resize(_, 0, 1, 0, 0)"), - kpress("P", "WMoveresMode.resize(_, 0, 0, 1, 0)"), - kpress("N", "WMoveresMode.resize(_, 0, 0, 0, 1)"), - - bdoc("Shrink in specified direction."), - kpress("Shift+Left", "WMoveresMode.resize(_,-1, 0, 0, 0)"), - kpress("Shift+Right", "WMoveresMode.resize(_, 0,-1, 0, 0)"), - kpress("Shift+Up", "WMoveresMode.resize(_, 0, 0,-1, 0)"), - kpress("Shift+Down", "WMoveresMode.resize(_, 0, 0, 0,-1)"), - kpress("Shift+F", "WMoveresMode.resize(_,-1, 0, 0, 0)"), - kpress("Shift+B", "WMoveresMode.resize(_, 0,-1, 0, 0)"), - kpress("Shift+P", "WMoveresMode.resize(_, 0, 0,-1, 0)"), - kpress("Shift+N", "WMoveresMode.resize(_, 0, 0, 0,-1)"), - - bdoc("Move in specified direction."), - kpress(META.."Left", "WMoveresMode.move(_,-1, 0)"), - kpress(META.."Right", "WMoveresMode.move(_, 1, 0)"), - kpress(META.."Up", "WMoveresMode.move(_, 0,-1)"), - kpress(META.."Down", "WMoveresMode.move(_, 0, 1)"), - kpress(META.."F", "WMoveresMode.move(_,-1, 0)"), - kpress(META.."B", "WMoveresMode.move(_, 1, 0)"), - kpress(META.."P", "WMoveresMode.move(_, 0,-1)"), - kpress(META.."N", "WMoveresMode.move(_, 0, 1)"), -}) - - --- --- Menu definitions --- - - --- Main menu -defmenu("mainmenu", { - menuentry("Run...", "mod_query.query_exec(_)"), - menuentry("Terminal", "mod_query.exec_on_merr(_, XTERM or 'xterm')"), - menuentry("Lock screen", - "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"), - menuentry("Help", "mod_query.query_man(_)"), - menuentry("About Notion", "mod_query.show_about_ion(_)"), - submenu("Styles", "stylemenu"), - submenu("Session", "sessionmenu"), -}) - - --- Session control menu -defmenu("sessionmenu", { - menuentry("Save", "ioncore.snapshot()"), - menuentry("Restart", "ioncore.restart()"), - menuentry("Restart TWM", "ioncore.restart_other('twm')"), - menuentry("Exit", "ioncore.shutdown()"), -}) - - --- Context menu (frame actions etc.) -defctxmenu("WFrame", "Frame", { - -- Note: this propagates the close to any subwindows; it does not - -- destroy the frame itself, unless empty. An entry to destroy tiled - -- frames is configured in cfg_tiling.lua. - menuentry("Close", "WRegion.rqclose_propagate(_, _sub)"), - -- Low-priority entries - menuentry("Attach tagged", "ioncore.tagged_attach(_)", { priority = 0 }), - menuentry("Clear tags", "ioncore.clear_tags()", { priority = 0 }), - menuentry("Window info", "mod_query.show_tree(_, _sub)", { priority = 0 }), -}) - - --- Context menu for groups (workspaces, client windows) -defctxmenu("WGroup", "Group", { - menuentry("Toggle tag", "WRegion.set_tagged(_, 'toggle')"), - menuentry("De/reattach", "ioncore.detach(_, 'toggle')"), -}) - - --- Context menu for workspaces -defctxmenu("WGroupWS", "Workspace", { - menuentry("Close", "WRegion.rqclose(_)"), - menuentry("Rename", "mod_query.query_renameworkspace(nil, _)"), - menuentry("Attach tagged", "ioncore.tagged_attach(_)"), -}) - - --- Context menu for client windows -defctxmenu("WClientWin", "Client window", { - menuentry("Kill", "WClientWin.kill(_)"), -}) +dopath("cfg_bindings") diff --git a/etc/cfg_tiling.lua b/etc/cfg_tiling.lua index f315bbad9..199dbc89a 100644 --- a/etc/cfg_tiling.lua +++ b/etc/cfg_tiling.lua @@ -4,26 +4,20 @@ -- Bindings for the tilings. defbindings("WTiling", { + bdoc("Split current frame horizontally."), + kpress(META.."I", "WTiling.split_at(_, _sub, 'right', true)"), + bdoc("Split current frame vertically."), - kpress(META.."S", "WTiling.split_at(_, _sub, 'bottom', true)"), + kpress(ALTMETA.."I", "WTiling.split_at(_, _sub, 'bottom', true)"), + + bdoc("Destroy current frame."), + kpress(META.."X", "WTiling.unsplit_at(_, _sub)"), bdoc("Go to frame above/below current frame."), - kpress(META.."P", "ioncore.goto_next(_sub, 'up', {no_ascend=_})"), - kpress(META.."N", "ioncore.goto_next(_sub, 'down', {no_ascend=_})"), + kpress(META.."W", "ioncore.goto_next(_sub, 'up', {no_ascend=_})"), + kpress(ALTMETA.."W", "ioncore.goto_next(_sub, 'down', {no_ascend=_})"), mclick(META.."Shift+Button4", "ioncore.goto_next(_sub, 'up', {no_ascend=_})"), mclick(META.."Shift+Button5", "ioncore.goto_next(_sub, 'down', {no_ascend=_})"), - - bdoc("Go to frame right/left of current frame."), - kpress(META.."Tab", "ioncore.goto_next(_sub, 'right')"), - submap(META.."K", { - kpress("Tab", "ioncore.goto_next(_sub, 'left')"), - - bdoc("Split current frame horizontally."), - kpress("S", "WTiling.split_at(_, _sub, 'right', true)"), - - bdoc("Destroy current frame."), - kpress("X", "WTiling.unsplit_at(_, _sub)"), - }), }) -- Frame bindings.