summaryrefslogtreecommitdiff
path: root/rc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rc.lua')
-rw-r--r--rc.lua38
1 files changed, 21 insertions, 17 deletions
diff --git a/rc.lua b/rc.lua
index 97b1d59..645431a 100644
--- a/rc.lua
+++ b/rc.lua
@@ -114,6 +114,25 @@ awful.layout.layouts = {
-- Config function definitions {{{
+function crcparse(substr)
+ local file=assert(io.open(config_dir .. "/computerrc","r"))
+ local line = ""
+ repeat
+ line=file:read("*line")
+ if line and line:find(string.format("^%s=",substr)) then
+ return string.sub(line,#substr + 2,-1)
+ end
+ until not line
+end
+
+function is_linux ()
+ return crcparse("OS") == "Linux"
+end
+
+function is_obsd ()
+ return crcparse("OS") == "OpenBSD"
+end
+
function terminal_sp_cmd (spc, cmd)
if terminal == "st" then
local cflag = "-c"
@@ -134,21 +153,6 @@ function terminal_sp_cmd (spc, cmd)
end
end
-function crcparse(substr)
- local file=assert(io.open(config_dir .. "/computerrc","r"))
- local line = ""
- repeat
- line=file:read("*line")
- if line and line:find(string.format("^%s=",substr)) then
- return string.sub(line,#substr + 2,-1)
- end
- until not line
-end
-
-function islinux ()
- return crcparse("OS") == "Linux"
-end
-
-- }}}
-- {{{ Menu
@@ -269,7 +273,7 @@ awful.screen.connect_for_each_screen(function(s)
-- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s, height = 24})
- if islinux() then
+ if is_linux() then
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
@@ -306,7 +310,7 @@ awful.screen.connect_for_each_screen(function(s)
s.mylayoutbox,
},
}
- elseif isobsd() then
+ elseif is_obsd() then
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,