]> git.donarmstrong.com Git - x_base.git/commitdiff
add more lua configuration stuff
authorDon Armstrong <don@donarmstrong.com>
Sat, 13 Jan 2007 22:19:26 +0000 (22:19 +0000)
committerDon Armstrong <don@donarmstrong.com>
Sat, 13 Jan 2007 22:19:26 +0000 (22:19 +0000)
.ion3/cfg_statusbar.lua
.ion3/cfg_user.lua
.ion3/xinerama_switcher.lua [new file with mode: 0644]

index 3953cc4e4b28b0a3f71fc4c1edac51ed42642b95..1034dade7356058828ae3c81746819a8c2661803 100644 (file)
@@ -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",
 }
 
index 50559b6eec2c1e78b2a9785951e450e850a35f3f..48353e1e2dca54dd3def2a9c1ef18ef8e3264a83 100644 (file)
@@ -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 (file)
index 0000000..97aa565
--- /dev/null
@@ -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 <rvb@pro-linux.de>, 2005
+--
+-- This script is (c) copyright 2005 by martin f. krafft <madduck@madduck.net>
+-- 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