From: Don Armstrong Date: Sat, 13 Jan 2007 22:19:26 +0000 (+0000) Subject: add more lua configuration stuff X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f6a12499a60e68352bb90296a2e827147e03f29b;p=x_base.git add more lua configuration stuff --- diff --git a/.ion3/cfg_statusbar.lua b/.ion3/cfg_statusbar.lua index 3953cc4..1034dad 100644 --- a/.ion3/cfg_statusbar.lua +++ b/.ion3/cfg_statusbar.lua @@ -36,7 +36,7 @@ mod_statusbar.create{ -- right, respectively, and %systray is a placeholder for system tray -- windows and icons. -- - template="[ %date || %>load || %>workspace_pager || %batt ] %filler%systray", + template="[ %date || %>load ] %filler%systray", --template="[ %date || load: %05load_1min || mail: %02mail_new/%02mail_total ] %filler%systray", } diff --git a/.ion3/cfg_user.lua b/.ion3/cfg_user.lua index 50559b6..48353e1 100644 --- a/.ion3/cfg_user.lua +++ b/.ion3/cfg_user.lua @@ -1,5 +1,5 @@ dopath("xinerama_switcher"); -defbindings("WIonWS", { +defbindings("WGroupWS", { kpress(MOD1.."Up", "xinerama_switcher_up(_)"), kpress(MOD1.."Down", "xinerama_switcher_down(_)"), kpress(MOD1.."Right", "xinerama_switcher_right(_)"), diff --git a/.ion3/xinerama_switcher.lua b/.ion3/xinerama_switcher.lua new file mode 100644 index 0000000..97aa565 --- /dev/null +++ b/.ion3/xinerama_switcher.lua @@ -0,0 +1,107 @@ +-- xinerama_switcher.lua +-- +-- Goes to the frame in the specified direction. If there is no frame in the +-- given direction (the user is trying to move off the edge of the screen), it +-- switches workspace or screen. I assume that left/right switch between +-- screens, since xinerama displays are usually next to each other. Up/down, +-- on the other hand switch between workspaces. For me, the next workspace is +-- down as if I was reading a webpage. +-- +-- The following keybindings may be useful: +-- +--defbindings("WIonWS", { +-- kpress(MOD1.."Up", "xinerama_switcher_up(_)"), +-- kpress(MOD1.."Down", "xinerama_switcher_down(_)"), +-- kpress(MOD1.."Right", "xinerama_switcher_right(_)"), +-- kpress(MOD1.."Left", "xinerama_switcher_left(_)"), +--}) +-- +-- Based on go_desk_or_desk lua by Rene van Bevern , 2005 +-- +-- This script is (c) copyright 2005 by martin f. krafft +-- and released under the terms of the Artistic Licence. +-- +-- Version 2005.08.14.1515 +-- +-- TODO: prevent switching screens when there is none on that side. E.g. +-- moving off the left edge of the left screen should either do nothing or +-- wrap to the right side of the right screen. This likely needs +-- a configuration file which would also solve the problem about assigning +-- left/right to next/prev according to xinerama configuration. +-- When solving this, don't just solve it for dual-head. :) +-- + +function goto_right_screen() + -- do whatever it takes to switch to the screen on the right + -- this may be either the previous or next screen, depending on how you set + -- up xinerama. + + return ioncore.goto_prev_screen() + --return ioncore.goto_next_screen() +end + +function goto_left_screen() + -- do whatever it takes to switch to the screen on the right + -- this may be either the previous or next screen, depending on how you set + -- up xinerama. + + --return ioncore.goto_prev_screen() + return ioncore.goto_next_screen() +end + +function goto_workspace_down(screen) + -- do whatever it takes to switch to the workspace below + -- in my book, that's the next workspace + screen:switch_next() +end + +function goto_workspace_up(screen) + -- do whatever it takes to switch to the workspace below + -- in my book, that's the previous workspace + screen:switch_prev() +end + +function xinerama_switcher(workspace,direction) + + if direction == "left" then + -- we move to the screen on the left + local screen = goto_left_screen() + screen:current():farthest("right"):goto() + + elseif direction == "right" then + -- we move to the screen on the right + local screen = goto_right_screen() + screen:current():farthest("left"):goto() + + elseif direction == "up" then + -- we switch to the workspace above this one + local screen = workspace:screen_of() + goto_workspace_up(screen) + screen:current():farthest("down"):goto() + + elseif direction == "down" then + -- we switch to the workspace below this one + local screen = workspace:screen_of() + goto_workspace_down(screen) + screen:current():farthest("up"):goto() + + end +end + +-- helper functions for easier keybindings (see top of the file) + +function xinerama_switcher_left(reg) + xinerama_switcher(reg, "left") +end + +function xinerama_switcher_right(reg) + xinerama_switcher(reg, "right") +end + +function xinerama_switcher_up(reg) + xinerama_switcher(reg, "up") +end + +function xinerama_switcher_down(reg) + xinerama_switcher(reg, "down") +end