keep chrome apps from floating
[awesome-config] / rc.lua
diff --git a/rc.lua b/rc.lua
index 9458979455685d0f79157c387f1be7eca7e99f26..5c35eb73b4d4871105462b2915dace5dbf0b4972 100644 (file)
--- a/rc.lua
+++ b/rc.lua
@@ -1,3 +1,16 @@
+-- read the timezone from /etc/timezone (this doesn't work, somehow)
+local function read_tz_file(path)
+    local file = io.open(path, "r") -- r read mode and b binary mode
+    if not file then return nil end
+    local content = file:read "*a" -- *a or *all reads the whole file
+    file:close()
+    content = content:gsub("^%s*", "")
+    content = content:gsub("%s*$", "")
+    return content
+end
+
+local tz_string = read_tz_file("/etc/timezone")
+
 -- If LuaRocks is installed, make sure that packages installed through it are
 -- found (e.g. lgi). If LuaRocks is not installed, do nothing.
 pcall(require, "luarocks.loader")
@@ -18,6 +31,10 @@ local hotkeys_popup = require("awful.hotkeys_popup")
 -- when client with a matching name is opened:
 require("awful.hotkeys_popup.keys")
 
+-- load the volume widget code and set settings
+local volume_control = require("volume-control")
+volumecfg = volume_control({})
+
 -- Load Debian menu entries
 local debian = require("debian.menu")
 local has_fdo, freedesktop = pcall(require, "freedesktop")
@@ -49,7 +66,8 @@ end
 
 -- {{{ Variable definitions
 -- Themes define colours, icons, font and wallpapers.
-beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
+beautiful.init(awful.util.get_themes_dir() .. "sky/theme.lua")
+beautiful.wallpaper = "/home/mako/images/Flag_of_Cascadia.png"
 
 -- This is used later as the default terminal and editor to run.
 terminal = "x-terminal-emulator"
@@ -65,22 +83,9 @@ modkey = "Mod4"
 
 -- Table of layouts to cover with awful.layout.inc, order matters.
 awful.layout.layouts = {
-    awful.layout.suit.floating,
     awful.layout.suit.tile,
-    awful.layout.suit.tile.left,
-    awful.layout.suit.tile.bottom,
-    awful.layout.suit.tile.top,
-    awful.layout.suit.fair,
-    awful.layout.suit.fair.horizontal,
-    awful.layout.suit.spiral,
-    awful.layout.suit.spiral.dwindle,
     awful.layout.suit.max,
-    awful.layout.suit.max.fullscreen,
-    awful.layout.suit.magnifier,
-    awful.layout.suit.corner.nw,
-    -- awful.layout.suit.corner.ne,
-    -- awful.layout.suit.corner.sw,
-    -- awful.layout.suit.corner.se,
+    awful.layout.suit.floating
 }
 -- }}}
 
@@ -125,7 +130,7 @@ mykeyboardlayout = awful.widget.keyboardlayout()
 
 -- {{{ Wibar
 -- Create a textclock widget
-mytextclock = wibox.widget.textclock()
+mytextclock = wibox.widget.textclock("%a %m %d %H:%M", 60, tz_string)
 
 -- Create a wibox for each screen and add it
 local taglist_buttons = gears.table.join(
@@ -230,6 +235,7 @@ awful.screen.connect_for_each_screen(function(s)
             layout = wibox.layout.fixed.horizontal,
             mykeyboardlayout,
             wibox.widget.systray(),
+           -- volumecfg.widget,
             mytextclock,
             s.mylayoutbox,
         },
@@ -237,6 +243,8 @@ awful.screen.connect_for_each_screen(function(s)
 end)
 -- }}}
 
+-- right_layout:add(volumecfg.widget)
+
 -- {{{ Mouse bindings
 root.buttons(gears.table.join(
     awful.button({ }, 3, function () mymainmenu:toggle() end),
@@ -331,8 +339,20 @@ globalkeys = gears.table.join(
     -- Prompt
     awful.key({ modkey },            "r",     function () awful.screen.focused().mypromptbox:run() end,
               {description = "run prompt", group = "launcher"}),
+    
+    awful.key({ modkey,  }, "x",
+              function ()
+                  awful.prompt.run {
+                    prompt       = "Run in terminal: ",
+                    textbox      = awful.screen.focused().mypromptbox.widget,
+                    exe_callback = function (prog) awful.util.spawn_with_shell(terminal .. " -title " .. prog .. " -e " .. prog) end
+                  }
+              end,
+              {description = "terminal execute prompt", group = "awesome"}),
 
-    awful.key({ modkey }, "x",
+    -- Mako's additional keybindings
+    --- {{{
+    awful.key({ modkey, "Shift", }, "x",
               function ()
                   awful.prompt.run {
                     prompt       = "Run Lua code: ",
@@ -342,6 +362,17 @@ globalkeys = gears.table.join(
                   }
               end,
               {description = "lua execute prompt", group = "awesome"}),
+
+    awful.key({ modkey }, "q",
+                  function ()
+                      awful.tag.incnmaster(-1)
+                      awful.tag.incncol(3)
+              end),
+
+    awful.key({ modkey, "Shift" }, "t", awful.titlebar.toggle),
+
+    --- }}}
+
     -- Menubar
     awful.key({ modkey }, "p", function() menubar.show() end,
               {description = "show the menubar", group = "launcher"})
@@ -437,7 +468,10 @@ for i = 1, 9 do
                           end
                       end
                   end,
-                  {description = "toggle focused client on tag #" .. i, group = "tag"})
+                  {description = "toggle focused client on tag #" .. i, group = "tag"}),
+        awful.key({}, "XF86AudioRaiseVolume", function() volumecfg:up() end),
+        awful.key({}, "XF86AudioLowerVolume", function() volumecfg:down() end),
+        awful.key({}, "XF86AudioMute",        function() volumecfg:toggle() end)
     )
 end
 
@@ -474,7 +508,6 @@ awful.rules.rules = {
                      placement = awful.placement.no_overlap+awful.placement.no_offscreen
      }
     },
-
     -- Floating clients.
     { rule_any = {
         instance = {
@@ -502,13 +535,18 @@ awful.rules.rules = {
         role = {
           "AlarmWindow",  -- Thunderbird's calendar.
           "ConfigManager",  -- Thunderbird's about:config.
-          "pop-up",       -- e.g. Google Chrome's (detached) Developer Tools.
+          -- this is commented out to try to keep all chrom(e|ium) apps from being floating
+          -- "pop-up",       -- e.g. Google Chrome's (detached) Developer Tools.
         }
       }, properties = { floating = true }},
 
     -- Add titlebars to normal clients and dialogs
-    { rule_any = {type = { "normal", "dialog" }
-      }, properties = { titlebars_enabled = true }
+    -- { rule_any = {type = { "normal", "dialog" }
+    --   }, properties = { titlebars_enabled = true }
+    -- },
+    -- make so that overleaf is not floating
+    { rule = { class = "crx_gjoaplgcpnmemdaklplebdapjihcoibe" },
+      properties = {floating = false}
     },
 
     -- Set Firefox to always map on the tag named "2" on screen 1.
@@ -579,4 +617,4 @@ end)
 
 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
 client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
--- }}}
\ No newline at end of file
+-- }}}

Benjamin Mako Hill || Want to submit a patch?