summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachIR <zachir@librem.one>2022-07-28 17:52:48 -0500
committerZachIR <zachir@librem.one>2022-07-28 17:52:48 -0500
commita10a0274b2b329490fdbfdc82937f4c42357ecda (patch)
tree186f30b18504a9e858ff19f368f0493a0c166c9a
parentf52ad4441f33174caa137c260eb2ecdfb33d0199 (diff)
tidiness
-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,