Commit be6127f3 authored by epsi sayidina's avatar epsi sayidina

awesome: 4.3: arrow statusbar

parent ed701421
......@@ -109,7 +109,7 @@ function _M.get()
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Prompt
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
awful.key({ modkey }, "r", function () awful.screen.focused().promptbox:run() end,
{description = "run prompt", group = "launcher"}),
awful.key({ modkey }, "x",
......
......@@ -73,7 +73,9 @@ require("main.signals")
-- Statusbar: Wibar
--local statusbar = require("statusbar.default.statusbar")
--local statusbar = require("statusbar.stacked.statusbar")
--local statusbar = require("statusbar.vicious.statusbar")
local statusbar = require("statusbar.lain.statusbar")
--local statusbar = require("statusbar.lain.statusbar")
local statusbar = require("statusbar.arrow.statusbar")
statusbar()
--[[
Original Source Modified From: github.com/copycat-killer
https://github.com/copycat-killer/awesome-copycats/blob/master/rc.lua.copland
--]]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
local W = clone_widget_set -- object name
local I = clone_icon_set -- object name
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- ALSA volume from copycat-multicolor
I.uptime = wibox.widget.imagebox(beautiful.widget_fs)
W.uptime = wibox.widget.textbox()
W.update_uptime = function()
local fg_color = "#000000"
local cmd = {"uptime", "-p"}
awful.spawn.easy_async(cmd, function(stdout, stderr, reason, exit_code)
W.uptime:set_markup(markup(fg_color, stdout))
end)
end
W.update_uptime()
local mytimer = timer({ timeout = 30 })
mytimer:connect_signal("timeout", W.update_uptime)
mytimer:start()
-- {{{ Required libraries
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
local lain = require("lain")
-- Custom Local Library
require("statusbar.arrow.lain")
local gmc = require("themes.gmc")
-- }}}
-- Separators lain
local separators = lain.util.separators
-- shortcuts
local setbg = wibox.widget.background
local setar = separators.arrow_right
local setal = separators.arrow_left
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = wibox_package
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_top_left (s)
return { -- Left widgets
layout = wibox.layout.fixed.horizontal,
RC.launcher,
WB.spacer,
s.taglist,
WB.spacer,
WB.arrow_dr, WB.arrow_rd,
WB.spacer,
s.promptbox,
}
end
function WB.add_widgets_top_right (s)
local cws = clone_widget_set
local cis = clone_icon_set
return { -- Right widgets
layout = wibox.layout.fixed.horizontal,
--setar("alpha", gmc.color['blue500']),
--setbg(cis.weather, gmc.color['blue500']),
--setbg(cws.weather, gmc.color['blue500']),
--setar(gmc.color['blue500'], "alpha"),
-- progressbar
cis.volume_dynamic, cws.volumewidget,
cis.disk, cws.disk_bar_widget,
cis.battery, cws.battery_bar_widget,
-- default
WB.arrow_dl, WB.arrow_ld,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.layoutbox,
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.generate_wibox_one (s)
-- layout: l_left, nil, l_right
-- Create the wibox
s.wibox_top_top = awful.wibar({ position = "top", screen = s, height = "24" })
-- Add widgets to the wibox
s.wibox_top_top:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_top_left (s),
nil,
WB.add_widgets_top_right (s),
}
end
function WB.generate_wibox_tasklist (s)
-- layout: tasklist
-- Create the wibox
s.wibox_top_bottom = awful.wibar({
position = "top",
screen = s,
height = "20",
widget = s.tasklist
})
end
-- {{{ Required libraries
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
local wibox = require("wibox")
local lain = require("lain")
-- Custom Local Library
local gmc = require("themes.gmc")
-- }}}
-- Separators lain
local separators = lain.util.separators
-- shortcuts
local setbg = wibox.widget.background
local setar = separators.arrow_right
local setal = separators.arrow_left
local cws = clone_widget_set
local cis = clone_icon_set
-- example
local icon_example = wibox.widget.imagebox(beautiful.widget_example)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local WB = wibox_package
function WB.initdeco ()
-- Spacer
WB.spacer = wibox.widget.textbox(" ")
WB.spacerline = wibox.widget.textbox(" | ")
-- Separators lain
local separators = lain.util.separators
local arrow_color = gmc.color['red300']
WB.arrow_dl = separators.arrow_left("alpha", arrow_color)
WB.arrow_ld = separators.arrow_left(arrow_color, "alpha")
WB.arrow_dr = separators.arrow_right("alpha", arrow_color)
WB.arrow_rd = separators.arrow_right(arrow_color, "alpha")
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_monitor_left (line, s)
return {
layout = wibox.layout.fixed.horizontal,
WB.arrow_rd,
WB.spacer,
setar("alpha", gmc.color['blue200']),
setar(gmc.color['blue200'], gmc.color['blue300']),
setbg(cis.netdown, gmc.color['blue300']),
setbg(cws.netdowninfo, gmc.color['blue300']),
setar(gmc.color['blue300'], gmc.color['blue500']),
setbg(cis.netup, gmc.color['blue500']),
setbg(cws.netupinfo, gmc.color['blue500']),
setar(gmc.color['blue500'], gmc.color['blue700']),
setbg(cis.mem, gmc.color['blue700']),
setbg(cws.mem, gmc.color['blue700']),
setar(gmc.color['blue700'], gmc.color['blue900']),
setbg(cis.cpu, gmc.color['blue900']),
setbg(cws.cpu, gmc.color['blue900']),
setal(gmc.color['blue900'], gmc.color['blue700']),
setbg(cis.fs, gmc.color['blue700']),
setbg(cws.fs, gmc.color['blue700']),
setal(gmc.color['blue700'], gmc.color['blue500']),
setbg(cis.temp, gmc.color['blue500']),
setbg(cws.temp, gmc.color['blue500']),
setal(gmc.color['blue500'], gmc.color['blue300']),
setbg(cis.bat, gmc.color['blue300']),
setbg(cws.bat, gmc.color['blue300']),
setal(gmc.color['blue300'], gmc.color['blue200']),
setal(gmc.color['blue200'], "alpha"),
WB.spacer,
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.add_widgets_monitor_right (line, s)
return {
layout = wibox.layout.fixed.horizontal,
WB.arrow_dl, WB.arrow_ld,
WB.spacer,
cis.volume, cws.volume,
cis.mpd, cws.mpd,
WB.spacer,
WB.arrow_dl, WB.arrow_ld,
cis.uptime, cws.uptime,
WB.spacerline,
WB.arrow_dl,
}
end
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function WB.generate_wibox_two (s)
-- layout: l_left, nil, tasklist
-- Create the wibox
s.wibox_two = awful.wibar({ position = "bottom", screen = s })
-- Add widgets to the wibox
s.wibox_two:setup {
layout = wibox.layout.align.horizontal,
WB.add_widgets_monitor_left (s),
nil,
WB.add_widgets_monitor_right (s),
}
end
--[[
Original Source Modified From: github.com/copycat-killer
https://github.com/copycat-killer/awesome-copycats/blob/master/rc.lua.copland
--]]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
-- Wibox handling library
local wibox = require("wibox")
local lain = require("lain")
local W = clone_widget_set -- object name
local I = clone_icon_set -- object name
-- Custom Local Library
local gmc = require("themes.gmc")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Battery from copycat-multicolor
I.bat = wibox.widget.imagebox(beautiful.widget_batt)
W.bat = wibox.widget.textbox()
W.update_bat = lain.widget.bat({
settings = function()
if bat_now.perc == "N/A" then
perc = "AC "
else
perc = bat_now.perc .. "% "
end
W.bat:set_markup(markup(gmc.color['white'], perc))
end
})
-- Battery from copycat-copland
I.battery = wibox.widget.imagebox(beautiful.monitor_bat)
W.battery_bar = wibox.widget {
forced_height = dpi(1),
forced_width = dpi(59),
color = theme.fg_normal,
background_color = theme.bg_normal,
margins = 1,
paddings = 1,
ticks = true,
ticks_size = dpi(6),
widget = wibox.widget.progressbar,
}
W.battery_margin = wibox.layout.margin(W.battery_bar, 2, 7)
W.battery_margin:set_top(6)
W.battery_margin:set_bottom(9)
-- Update bar, also in widgets popups
local battery_widget_settings = function()
if bat_now.status == "N/A" then return end
perc = tonumber(bat_now.perc)
if perc == nil then return end
if bat_now.status == "Charging" then
I.battery:set_image(beautiful.monitor_ac)
if perc >= 98 then
W.battery_bar:set_color(gmc.color['green300'])
elseif perc > 50 then
W.battery_bar:set_color(gmc.color['blue300'])
elseif perc > 15 then
W.battery_bar:set_color(beautiful.fg_normal)
else
W.battery_bar:set_color(gmc.color['red300'])
end
else
if perc >= 98 then
W.battery_bar:set_color(gmc.color['green300'])
elseif perc > 50 then
W.battery_bar:set_color(gmc.color['blue300'])
I.battery:set_image(beautiful.monitor_bat)
elseif perc > 15 then
W.battery_bar:set_color(beautiful.fg_normal)
I.battery:set_image(beautiful.monitor_bat_low)
else
W.battery_bar:set_color(gmc.color['red300'])
I.battery:set_image(beautiful.monitor_bat_no)
end
end
W.battery_bar:set_value(perc / 100)
end
W.battery_widget_update = lain.widget.bat({
settings = battery_widget_settings
})
W.batbg = wibox.container.background(
W.battery_bar, gmc.color['grey500'], gears.shape.rectangle)
W.battery_bar_widget = wibox.container.margin(
W.batbg, dpi(2), dpi(7), dpi(6), dpi(6))
--[[
Original Source Modified From: github.com/copycat-killer
https://github.com/copycat-killer/awesome-copycats/blob/master/rc.lua.copland
--]]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
-- Wibox handling library
local wibox = require("wibox")
local lain = require("lain")
local W = clone_widget_set -- object name
local I = clone_icon_set -- object name
-- Custom Local Library
local gmc = require("themes.gmc")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- / fs
I.fs = wibox.widget.imagebox(beautiful.widget_fs)
W.fs = wibox.widget.textbox()
--
-- Can't create more than one fs widget
W.update_fs = lain.widget.fs({
settings = function()
W.fs:set_markup(markup(gmc.color['white'], fs_now["/"].percentage .. "% "))
end
})
-- /home fs
I.disk = wibox.widget.imagebox(beautiful.monitor_disk)
W.disk_bar = wibox.widget {
forced_height = dpi(1),
forced_width = dpi(59),
color = theme.fg_normal,
background_color = theme.bg_normal,
margins = 1,
paddings = 1,
ticks = true,
ticks_size = dpi(6),
widget = wibox.widget.progressbar,
}
W.disk_margin = wibox.layout.margin(W.disk_bar, 2, 7)
W.disk_margin:set_top(6)
W.disk_margin:set_bottom(9)
-- Update bar, also in widgets popups
local disk_widget_settings = function()
if fs_now["/"].used < 90 then
W.disk_bar:set_color(gmc.color['red300'])
else
W.disk_bar:set_color(gmc.color['blue300'])
end
W.disk_bar:set_value(fs_now["/"].percentage)
end
W.disk_widget = lain.widget.fs {
notification_preset = { fg = theme.fg_normal, bg = theme.bg_normal, font = "Terminus 10.5" },
settings = disk_widget_settings
}
W.disk_bar_widget = wibox.widget.background(W.disk_margin)
W.disk_bar_widget:set_bgimage(beautiful.bar_bg_copland)
W.disk_bg = wibox.container.background(
W.disk_bar, gmc.color['grey500'], gears.shape.rectangle)
W.disk_bar_widget = wibox.container.margin(
W.disk_bg, dpi(2), dpi(7), dpi(6), dpi(6))
--[[
Original Source Modified From: github.com/copycat-killer
https://github.com/copycat-killer/awesome-copycats/blob/master/rc.lua.copland
--]]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Standard awesome library
local beautiful = require("beautiful")
local bfont = beautiful.font
local gears = require("gears")
local awful = require("awful")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
-- Wibox handling library
local wibox = require("wibox")
local lain = require("lain")
local W = clone_widget_set -- object name
local I = clone_icon_set -- object name
-- Custom Local Library
local gmc = require("themes.gmc")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- ALSA volume from copycat-multicolor
I.volume = wibox.widget.imagebox(beautiful.widget_vol)
W.volume = lain.widget.alsa({
settings = function()
if volume_now.status == "off" then
volume_now.level = volume_now.level .. "M"
end
widget:set_markup(markup(gmc.color['blue900'], volume_now.level .. "% "))
end
})
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- ALSA volume bar
-- global terminal is required in alsabar, unfortunately
terminal = RC.vars.terminal
-- ALSA volume bar from copycat-copland
I.volume_dynamic = wibox.widget.imagebox(beautiful.monitor_vol)
local volume_wibox_settings = function()
if volume_now.status == "off" then
I.volume_dynamic:set_image(beautiful.monitor_vol_mute)
elseif volume_now.level == 0 then
I.volume_dynamic:set_image(beautiful.monitor_vol_no)
elseif volume_now.level <= 50 then
I.volume_dynamic:set_image(beautiful.monitor_vol_low)
else
I.volume_dynamic:set_image(beautiful.monitor_vol)
end
end
local volume_wibox_colors = {
background = beautiful.bg_normal,
mute = gmc.color['red300'],
unmute = gmc.color['blue300']
}
W.volume_wibox = lain.widget.alsabar({
width = 55, ticks = true, ticks_size = 6, step = "2%",
settings = volume_wibox_settings,
colors = volume_wibox_colors
})
W.volume_wibox_buttons = my_table.join (
awful.button({}, 1, function()
awful.spawn(string.format("%s -e alsamixer", terminal))
end),
awful.button({}, 2, function()
os.execute(string.format("%s set %s 100%%", W.volume_wibox.cmd, W.volume_wibox.channel))
W.volume_wibox.update()
end),
awful.button({}, 3, function()
os.execute(string.format("%s set %s toggle", W.volume_wibox.cmd, W.volume_wibox.togglechannel or W.volume_wibox.channel))
W.volume_wibox.update()
end),
awful.button({}, 4, function()
os.execute(string.format("%s set %s 1%%+", W.volume_wibox.cmd, W.volume_wibox.channel))
W.volume_wibox.update()
end),
awful.button({}, 5, function()
os.execute(string.format("%s set %s 1%%-", W.volume_wibox.cmd, W.volume_wibox.channel))
W.volume_wibox.update()
end)
)
W.volume_wibox.tooltip.wibox.fg = beautiful.fg_focus
W.volume_wibox.bar:buttons(W.volume_wibox_buttons)
W.volumebg = wibox.container.background(
W.volume_wibox.bar, gmc.color['grey500'], gears.shape.rectangle)
W.volumewidget = wibox.container.margin(
W.volumebg, dpi(2), dpi(7), dpi(6), dpi(6))
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- MPD from copycat-multicolor
I.mpd = wibox.widget.imagebox(beautiful.widget_note)
W.mpd = lain.widget.mpd({
settings = function()
mpd_notification_preset = {
text = string.format("%s [%s] - %s\n%s", mpd_now.artist,
mpd_now.album, mpd_now.date, mpd_now.title)
}
if mpd_now.state == "play" then
artist = mpd_now.artist .. " > "
title = mpd_now.title .. " "
I.mpd:set_image(beautiful.widget_note_on)
elseif mpd_now.state == "pause" then
artist = "mpd "
title = "paused "
else
artist = ""
title = ""
I.mpd:set_image(nil)
end
widget:set_markup(markup(gmc.color['blue900'], artist)
.. markup(gmc.color['green900'], title))
end
})
--[[
Original Source Modified From: github.com/copycat-killer
https://github.com/copycat-killer/awesome-copycats/blob/master/rc.lua.multicolor
--]]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Standard awesome library
local awful = require("awful")
local beautiful = require("beautiful")
-- Wibox handling library
local wibox = require("wibox")
local lain = require("lain")
-- Custom Local Library
local gmc = require("themes.gmc")
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
local W = {}
clone_widget_set = W -- object name
local I = {}
clone_icon_set = I -- object name
-- split module, to make each file shorter,
-- all must have same package name
-- global for all splited
markup = lain.util.markup
-- progress bar related widgets -- after global markup
local config_path = awful.util.getdir("config") .. "statusbar/arrow/"
dofile(config_path .. "lain-diskfree.lua")
dofile(config_path .. "lain-battery.lua")
dofile(config_path .. "lain-sound.lua")
dofile(config_path .. "custom.lua")
local fg_color = gmc.color['white']
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- MEM
I.mem = wibox.widget.imagebox(beautiful.widget_mem)
W.mem = wibox.widget.textbox()
W.update_mem = lain.widget.mem({
settings = function()
W.mem:set_markup(markup(fg_color, mem_now.used .. "M "))
end
})
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- CPU
I.cpu = wibox.widget.imagebox()
I.cpu:set_image(beautiful.widget_cpu)
W.cpu = wibox.widget.textbox()
W.update_cpu = lain.widget.cpu({
settings = function()
W.cpu:set_markup(markup(fg_color, cpu_now.usage .. "% "))
end
})
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Coretemp
I.temp = wibox.widget.imagebox(beautiful.widget_temp)
W.temp = wibox.widget.textbox()
W.update_temp = lain.widget.temp({
settings = function()
W.temp:set_markup(markup(fg_color, coretemp_now .. "°C "))
end
})
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Textclock
I.clock = wibox.widget.imagebox(beautiful.widget_clock)
W.textclock = awful.widget.textclock(
markup(gmc.color['blue900'], "%A %d %B ")
.. markup(gmc.color['black'], ">")
.. markup(gmc.color['green900'], " %H:%M "))
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Calendar