rc.lua cleanup
This commit is contained in:
parent
266743096d
commit
7c12072e1d
115
rc.lua
115
rc.lua
@ -20,6 +20,16 @@ local hotkeys_popup = require("awful.hotkeys_popup")
|
|||||||
require("awful.hotkeys_popup.keys")
|
require("awful.hotkeys_popup.keys")
|
||||||
local ram_widget = require("awesome-wm-widgets.ram-widget.ram-widget")
|
local ram_widget = require("awesome-wm-widgets.ram-widget.ram-widget")
|
||||||
local cpu_widget = require("awesome-wm-widgets.cpu-widget.cpu-widget")
|
local cpu_widget = require("awesome-wm-widgets.cpu-widget.cpu-widget")
|
||||||
|
local batteryarc_widget = require("awesome-wm-widgets.batteryarc-widget.batteryarc")
|
||||||
|
|
||||||
|
local function batteryarc() -- detect if there are any batteries before showing the battery arc widget
|
||||||
|
local c = io.popen("acpi")
|
||||||
|
if c:read("*a"):len() < 1 then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
return batteryarc_widget()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- {{{ Error handling
|
-- {{{ Error handling
|
||||||
-- Check if awesome encountered an error during startup and fell back to
|
-- Check if awesome encountered an error during startup and fell back to
|
||||||
@ -49,9 +59,7 @@ end
|
|||||||
-- {{{ Variable definitions
|
-- {{{ Variable definitions
|
||||||
-- Themes define colours, icons, font and wallpapers.
|
-- Themes define colours, icons, font and wallpapers.
|
||||||
--beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
|
--beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
|
||||||
beautiful.init("/home/izaya/.config/awesome/theme.lua")
|
beautiful.init(string.format("%s/.config/awesome/theme.lua",os.getenv("HOME")))
|
||||||
--local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), "default")
|
|
||||||
--beautiful.init(theme_path)
|
|
||||||
|
|
||||||
-- This is used later as the default terminal and editor to run.
|
-- This is used later as the default terminal and editor to run.
|
||||||
terminal = "xfce4-terminal"
|
terminal = "xfce4-terminal"
|
||||||
@ -160,9 +168,9 @@ local tasklist_buttons = gears.table.join(
|
|||||||
local function set_wallpaper(s)
|
local function set_wallpaper(s)
|
||||||
local wpath
|
local wpath
|
||||||
if s.geometry.width > s.geometry.height then -- landscape
|
if s.geometry.width > s.geometry.height then -- landscape
|
||||||
wpath = "/home/izaya/Pictures/wp/rotation"
|
wpath = "/home/izaya/Nextcloud/Pictures/Wallpapers"
|
||||||
else
|
else
|
||||||
wpath = "/home/izaya/Pictures/wp/rotation/portrait"
|
wpath = "/home/izaya/Nextcloud/Pictures/Wallpapers/Phone"
|
||||||
end
|
end
|
||||||
local tWP = {}
|
local tWP = {}
|
||||||
for line in io.popen(string.format('ls "%s"',wpath),"r"):read("*a"):gmatch("([^\n]+)") do
|
for line in io.popen(string.format('ls "%s"',wpath),"r"):read("*a"):gmatch("([^\n]+)") do
|
||||||
@ -194,18 +202,26 @@ awful.screen.connect_for_each_screen(function(s)
|
|||||||
|
|
||||||
-- Each screen has its own tag table.
|
-- Each screen has its own tag table.
|
||||||
local tags = {}
|
local tags = {}
|
||||||
if s.geometry.width > s.geometry.height then -- landscape
|
if screen:count() > 1 then
|
||||||
for i = 1, 2 do
|
if s.geometry.width > s.geometry.height then -- landscape
|
||||||
|
for i = 1, 2 do
|
||||||
|
tags[#tags+1] = tostring(workspaceCounter)
|
||||||
|
workspaceCounter = workspaceCounter + 1
|
||||||
|
end
|
||||||
|
awful.tag(tags, s, awful.layout.suit.floating)
|
||||||
|
else -- portrait
|
||||||
|
for i = 1, 4 do
|
||||||
|
tags[#tags+1] = tostring(workspaceCounter)
|
||||||
|
workspaceCounter = workspaceCounter + 1
|
||||||
|
end
|
||||||
|
awful.tag(tags, s, awful.layout.suit.fair.horizontal)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = 1, 10 do
|
||||||
tags[#tags+1] = tostring(workspaceCounter)
|
tags[#tags+1] = tostring(workspaceCounter)
|
||||||
workspaceCounter = workspaceCounter + 1
|
workspaceCounter = workspaceCounter + 1
|
||||||
end
|
end
|
||||||
awful.tag(tags, s, awful.layout.suit.floating)
|
awful.tag(tags, s, awful.layout.suit.fair)
|
||||||
else -- portrait
|
|
||||||
for i = 1, 4 do
|
|
||||||
tags[#tags+1] = tostring(workspaceCounter)
|
|
||||||
workspaceCounter = workspaceCounter + 1
|
|
||||||
end
|
|
||||||
awful.tag(tags, s, awful.layout.suit.fair.horizontal)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create a promptbox for each screen
|
-- Create a promptbox for each screen
|
||||||
@ -236,44 +252,6 @@ awful.screen.connect_for_each_screen(function(s)
|
|||||||
-- Create the wibox
|
-- Create the wibox
|
||||||
s.mywibox = awful.wibar({ position = "top", screen = s})
|
s.mywibox = awful.wibar({ position = "top", screen = s})
|
||||||
|
|
||||||
-- Add widgets to the wibox
|
|
||||||
--[[
|
|
||||||
if s.geometry.width > s.geometry.height then -- landscape
|
|
||||||
s.mywibox:setup {
|
|
||||||
layout = wibox.layout.align.horizontal,
|
|
||||||
{ -- Left widgets
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
mylauncher,
|
|
||||||
s.mytaglist,
|
|
||||||
s.mypromptbox,
|
|
||||||
},
|
|
||||||
s.mytasklist, -- Middle widget
|
|
||||||
{ -- Right widgets
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
cpu_widget(),
|
|
||||||
ram_widget(),
|
|
||||||
wibox.widget.systray(),
|
|
||||||
mytextclock,
|
|
||||||
s.mylayoutbox,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
else
|
|
||||||
s.mywibox:setup {
|
|
||||||
layout = wibox.layout.align.horizontal,
|
|
||||||
{ -- Left widgets
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
mylauncher,
|
|
||||||
s.mytaglist,
|
|
||||||
s.mypromptbox,
|
|
||||||
},
|
|
||||||
s.mytasklist, -- Middle widget
|
|
||||||
{ -- Right widgets
|
|
||||||
layout = wibox.layout.fixed.horizontal,
|
|
||||||
s.mylayoutbox,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
]]
|
|
||||||
local w,h = root.size()
|
local w,h = root.size()
|
||||||
if s.index == awful.screen.getbycoord(w,1) then -- top right
|
if s.index == awful.screen.getbycoord(w,1) then -- top right
|
||||||
mysystray.set_screen(s)
|
mysystray.set_screen(s)
|
||||||
@ -291,6 +269,7 @@ awful.screen.connect_for_each_screen(function(s)
|
|||||||
mysystray,
|
mysystray,
|
||||||
cpu_widget(),
|
cpu_widget(),
|
||||||
ram_widget(),
|
ram_widget(),
|
||||||
|
batteryarc(),
|
||||||
mytextclock,
|
mytextclock,
|
||||||
s.mylayoutbox,
|
s.mylayoutbox,
|
||||||
},
|
},
|
||||||
@ -707,29 +686,15 @@ client.connect_signal("request::titlebars", function(c)
|
|||||||
layout = wibox.layout.align.horizontal
|
layout = wibox.layout.align.horizontal
|
||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
awful.spawn.with_shell(
|
||||||
--os.execute("rwallpaper.sh")
|
'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' ..
|
||||||
|
'xrdb -merge <<< "awesome.started:true";' ..
|
||||||
-- Enable sloppy focus, so that focus follows mouse.
|
'corectrl' ..
|
||||||
--[[
|
'nextcloud' ..
|
||||||
client.connect_signal("mouse::enter", function(c)
|
'SSH_ASKPASS_REQUIRE=force ssh-add' ..
|
||||||
c:emit_signal("request::activate", "mouse_enter", {raise = false})
|
'xinput set-prop "Logitech MX518 Gaming Mouse" "libinput Accel Profile Enabled" 0, 0' ..
|
||||||
end)
|
'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex
|
||||||
|
)
|
||||||
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)
|
|
||||||
]]
|
|
||||||
-- }}}
|
|
||||||
awful.spawn.with_shell(
|
|
||||||
'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' ..
|
|
||||||
'xrdb -merge <<< "awesome.started:true";' ..
|
|
||||||
-- list each of your autostart commands, followed by ; inside single quotes, followed by ..
|
|
||||||
'corectrl' ..
|
|
||||||
'nextcloud' ..
|
|
||||||
'SSH_ASKPASS_REQUIRE=force ssh-add' ..
|
|
||||||
'xinput set-prop "Logitech MX518 Gaming Mouse" "libinput Accel Profile Enabled" 0, 0' ..
|
|
||||||
'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex
|
|
||||||
)
|
|
||||||
gears.wallpaper.set("#000000")
|
gears.wallpaper.set("#000000")
|
||||||
--[[
|
--[[
|
||||||
awful.spawn.with_shell("corectrl")
|
awful.spawn.with_shell("corectrl")
|
||||||
|
Loading…
Reference in New Issue
Block a user