awesome-copycats/themes/powerarrow-dark/theme.lua

360 lines
15 KiB
Lua
Raw Normal View History

2013-09-13 21:20:22 +02:00
--[[
Powerarrow Dark Awesome WM theme
2017-10-07 13:10:43 +02:00
github.com/lcpz
2013-09-13 21:20:22 +02:00
--]]
2013-03-27 13:49:37 +01:00
2017-01-27 21:33:11 +01:00
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
2019-03-02 19:05:33 +01:00
local dpi = require("beautiful.xresources").apply_dpi
local os = os
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
2013-03-15 14:11:21 +01:00
2017-01-28 14:45:44 +01:00
local theme = {}
2017-02-22 13:51:38 +01:00
theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/powerarrow-dark"
theme.wallpaper = theme.dir .. "/wall.png"
2019-08-20 15:54:41 +02:00
theme.font = "Terminus 9"
theme.fg_normal = "#DDDDFF"
2017-01-15 18:22:53 +01:00
theme.fg_focus = "#EA6F81"
theme.fg_urgent = "#CC9393"
theme.bg_normal = "#1A1A1A"
theme.bg_focus = "#313131"
theme.bg_urgent = "#1A1A1A"
2019-03-02 19:05:33 +01:00
theme.border_width = dpi(1)
theme.border_normal = "#3F3F3F"
theme.border_focus = "#7F7F7F"
theme.border_marked = "#CC9393"
theme.tasklist_bg_focus = "#1A1A1A"
theme.titlebar_bg_focus = theme.bg_focus
theme.titlebar_bg_normal = theme.bg_normal
theme.titlebar_fg_focus = theme.fg_focus
2019-03-02 19:05:33 +01:00
theme.menu_height = dpi(16)
theme.menu_width = dpi(140)
theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png"
theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png"
theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png"
theme.layout_tile = theme.dir .. "/icons/tile.png"
theme.layout_tileleft = theme.dir .. "/icons/tileleft.png"
theme.layout_tilebottom = theme.dir .. "/icons/tilebottom.png"
theme.layout_tiletop = theme.dir .. "/icons/tiletop.png"
theme.layout_fairv = theme.dir .. "/icons/fairv.png"
theme.layout_fairh = theme.dir .. "/icons/fairh.png"
theme.layout_spiral = theme.dir .. "/icons/spiral.png"
theme.layout_dwindle = theme.dir .. "/icons/dwindle.png"
theme.layout_max = theme.dir .. "/icons/max.png"
theme.layout_fullscreen = theme.dir .. "/icons/fullscreen.png"
theme.layout_magnifier = theme.dir .. "/icons/magnifier.png"
theme.layout_floating = theme.dir .. "/icons/floating.png"
theme.widget_ac = theme.dir .. "/icons/ac.png"
theme.widget_battery = theme.dir .. "/icons/battery.png"
theme.widget_battery_low = theme.dir .. "/icons/battery_low.png"
theme.widget_battery_empty = theme.dir .. "/icons/battery_empty.png"
theme.widget_mem = theme.dir .. "/icons/mem.png"
theme.widget_cpu = theme.dir .. "/icons/cpu.png"
theme.widget_temp = theme.dir .. "/icons/temp.png"
theme.widget_net = theme.dir .. "/icons/net.png"
theme.widget_hdd = theme.dir .. "/icons/hdd.png"
theme.widget_music = theme.dir .. "/icons/note.png"
theme.widget_music_on = theme.dir .. "/icons/note_on.png"
theme.widget_vol = theme.dir .. "/icons/vol.png"
theme.widget_vol_low = theme.dir .. "/icons/vol_low.png"
theme.widget_vol_no = theme.dir .. "/icons/vol_no.png"
theme.widget_vol_mute = theme.dir .. "/icons/vol_mute.png"
theme.widget_mail = theme.dir .. "/icons/mail.png"
theme.widget_mail_on = theme.dir .. "/icons/mail_on.png"
theme.tasklist_plain_task_name = true
theme.tasklist_disable_icon = true
2019-03-02 19:05:33 +01:00
theme.useless_gap = dpi(0)
theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close_focus.png"
theme.titlebar_close_button_normal = theme.dir .. "/icons/titlebar/close_normal.png"
theme.titlebar_ontop_button_focus_active = theme.dir .. "/icons/titlebar/ontop_focus_active.png"
theme.titlebar_ontop_button_normal_active = theme.dir .. "/icons/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_inactive = theme.dir .. "/icons/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_inactive = theme.dir .. "/icons/titlebar/ontop_normal_inactive.png"
theme.titlebar_sticky_button_focus_active = theme.dir .. "/icons/titlebar/sticky_focus_active.png"
theme.titlebar_sticky_button_normal_active = theme.dir .. "/icons/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_inactive = theme.dir .. "/icons/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_inactive = theme.dir .. "/icons/titlebar/sticky_normal_inactive.png"
theme.titlebar_floating_button_focus_active = theme.dir .. "/icons/titlebar/floating_focus_active.png"
theme.titlebar_floating_button_normal_active = theme.dir .. "/icons/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_inactive = theme.dir .. "/icons/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_inactive = theme.dir .. "/icons/titlebar/floating_normal_inactive.png"
theme.titlebar_maximized_button_focus_active = theme.dir .. "/icons/titlebar/maximized_focus_active.png"
theme.titlebar_maximized_button_normal_active = theme.dir .. "/icons/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_inactive = theme.dir .. "/icons/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_inactive = theme.dir .. "/icons/titlebar/maximized_normal_inactive.png"
2013-03-15 14:11:21 +01:00
2017-01-27 21:33:11 +01:00
local markup = lain.util.markup
local separators = lain.util.separators
local keyboardlayout = awful.widget.keyboardlayout:new()
2017-01-28 14:45:44 +01:00
-- Textclock
2017-01-27 21:33:11 +01:00
local clockicon = wibox.widget.imagebox(theme.widget_clock)
local clock = awful.widget.watch(
"date +'%a %d %b %R'", 60,
function(widget, stdout)
widget:set_markup(" " .. markup.font(theme.font, stdout))
2017-01-27 21:33:11 +01:00
end
)
2017-01-27 21:33:11 +01:00
2017-01-28 14:45:44 +01:00
-- Calendar
theme.cal = lain.widget.cal({
attach_to = { clock },
2017-01-27 21:33:11 +01:00
notification_preset = {
2019-08-20 15:54:41 +02:00
font = "Terminus 10",
2017-01-27 21:33:11 +01:00
fg = theme.fg_normal,
bg = theme.bg_normal
2017-01-28 14:45:44 +01:00
}
2017-01-27 21:33:11 +01:00
})
-- Mail IMAP check
local mailicon = wibox.widget.imagebox(theme.widget_mail)
--[[ commented because it needs to be set before use
mailicon:buttons(my_table.join(awful.button({ }, 1, function () awful.spawn(mail) end)))
2018-09-17 21:35:27 +02:00
theme.mail = lain.widget.imap({
2017-01-27 21:33:11 +01:00
timeout = 180,
server = "server",
mail = "mail",
password = "keyring get mail",
settings = function()
if mailcount > 0 then
2019-03-04 04:28:00 +01:00
widget:set_markup(markup.font(theme.font, " " .. mailcount .. " "))
2017-01-27 21:33:11 +01:00
mailicon:set_image(theme.widget_mail_on)
else
widget:set_text("")
mailicon:set_image(theme.widget_mail)
end
end
})
--]]
-- MPD
local musicplr = awful.util.terminal .. " -title Music -e ncmpcpp"
2017-01-27 21:33:11 +01:00
local mpdicon = wibox.widget.imagebox(theme.widget_music)
mpdicon:buttons(my_table.join(
awful.button({ "Mod4" }, 1, function () awful.spawn(musicplr) end),
awful.button({ }, 1, function ()
2018-08-03 11:29:32 +02:00
os.execute("mpc prev")
theme.mpd.update()
end),
awful.button({ }, 2, function ()
2018-08-03 11:29:32 +02:00
os.execute("mpc toggle")
theme.mpd.update()
end),
awful.button({ }, 3, function ()
2018-08-03 11:29:32 +02:00
os.execute("mpc next")
theme.mpd.update()
end)))
2017-02-08 14:16:12 +01:00
theme.mpd = lain.widget.mpd({
2017-01-27 21:33:11 +01:00
settings = function()
if mpd_now.state == "play" then
artist = " " .. mpd_now.artist .. " "
title = mpd_now.title .. " "
mpdicon:set_image(theme.widget_music_on)
elseif mpd_now.state == "pause" then
artist = " mpd "
title = "paused "
else
artist = ""
title = ""
mpdicon:set_image(theme.widget_music)
end
widget:set_markup(markup.font(theme.font, markup("#EA6F81", artist) .. title))
2017-01-27 21:33:11 +01:00
end
})
-- MEM
local memicon = wibox.widget.imagebox(theme.widget_mem)
2017-02-08 14:16:12 +01:00
local mem = lain.widget.mem({
2017-01-27 21:33:11 +01:00
settings = function()
widget:set_markup(markup.font(theme.font, " " .. mem_now.used .. "MB "))
2017-01-27 21:33:11 +01:00
end
})
-- CPU
local cpuicon = wibox.widget.imagebox(theme.widget_cpu)
2017-02-08 14:16:12 +01:00
local cpu = lain.widget.cpu({
2017-01-27 21:33:11 +01:00
settings = function()
widget:set_markup(markup.font(theme.font, " " .. cpu_now.usage .. "% "))
2017-01-27 21:33:11 +01:00
end
})
-- Coretemp
local tempicon = wibox.widget.imagebox(theme.widget_temp)
2017-02-08 14:16:12 +01:00
local temp = lain.widget.temp({
2017-01-27 21:33:11 +01:00
settings = function()
widget:set_markup(markup.font(theme.font, " " .. coretemp_now .. "°C "))
2017-01-27 21:33:11 +01:00
end
})
-- / fs
local fsicon = wibox.widget.imagebox(theme.widget_hdd)
2018-09-17 21:35:27 +02:00
--[[ commented because it needs Gio/Glib >= 2.54
2017-02-08 14:16:12 +01:00
theme.fs = lain.widget.fs({
2019-08-20 15:54:41 +02:00
notification_preset = { fg = theme.fg_normal, bg = theme.bg_normal, font = "Terminus 10" },
2017-01-27 21:33:11 +01:00
settings = function()
2018-02-16 17:56:03 +01:00
widget:set_markup(markup.font(theme.font, " " .. fs_now["/"].percentage .. "% "))
2017-01-27 21:33:11 +01:00
end
})
2018-09-17 21:35:27 +02:00
--]]
2017-01-27 21:33:11 +01:00
-- Battery
local baticon = wibox.widget.imagebox(theme.widget_battery)
2017-02-08 14:16:12 +01:00
local bat = lain.widget.bat({
2017-01-27 21:33:11 +01:00
settings = function()
2018-07-25 12:45:34 +02:00
if bat_now.status and bat_now.status ~= "N/A" then
2017-01-27 21:33:11 +01:00
if bat_now.ac_status == 1 then
baticon:set_image(theme.widget_ac)
elseif not bat_now.perc and tonumber(bat_now.perc) <= 5 then
baticon:set_image(theme.widget_battery_empty)
elseif not bat_now.perc and tonumber(bat_now.perc) <= 15 then
baticon:set_image(theme.widget_battery_low)
else
baticon:set_image(theme.widget_battery)
end
widget:set_markup(markup.font(theme.font, " " .. bat_now.perc .. "% "))
2017-01-27 21:33:11 +01:00
else
widget:set_markup(markup.font(theme.font, " AC "))
2017-01-27 21:33:11 +01:00
baticon:set_image(theme.widget_ac)
end
end
})
-- ALSA volume
local volicon = wibox.widget.imagebox(theme.widget_vol)
2017-02-08 14:16:12 +01:00
theme.volume = lain.widget.alsa({
2017-01-27 21:33:11 +01:00
settings = function()
if volume_now.status == "off" then
volicon:set_image(theme.widget_vol_mute)
elseif tonumber(volume_now.level) == 0 then
volicon:set_image(theme.widget_vol_no)
elseif tonumber(volume_now.level) <= 50 then
volicon:set_image(theme.widget_vol_low)
else
volicon:set_image(theme.widget_vol)
end
widget:set_markup(markup.font(theme.font, " " .. volume_now.level .. "% "))
2017-01-27 21:33:11 +01:00
end
})
theme.volume.widget:buttons(awful.util.table.join(
awful.button({}, 4, function ()
awful.util.spawn("amixer set Master 1%+")
theme.volume.update()
end),
awful.button({}, 5, function ()
awful.util.spawn("amixer set Master 1%-")
theme.volume.update()
end)
))
2017-01-27 21:33:11 +01:00
-- Net
local neticon = wibox.widget.imagebox(theme.widget_net)
2017-02-08 14:16:12 +01:00
local net = lain.widget.net({
2017-01-27 21:33:11 +01:00
settings = function()
widget:set_markup(markup.font(theme.font,
markup("#7AC82E", " " .. string.format("%06.1f", net_now.received))
2017-01-27 21:33:11 +01:00
.. " " ..
markup("#46A8C3", " " .. string.format("%06.1f", net_now.sent) .. " ")))
2017-01-27 21:33:11 +01:00
end
})
-- Separators
local spr = wibox.widget.textbox(' ')
local arrl_dl = separators.arrow_left(theme.bg_focus, "alpha")
local arrl_ld = separators.arrow_left("alpha", theme.bg_focus)
function theme.at_screen_connect(s)
2017-01-27 21:33:11 +01:00
-- Quake application
2017-01-28 14:45:44 +01:00
s.quake = lain.util.quake({ app = awful.util.terminal })
2017-01-27 21:33:11 +01:00
2017-01-28 14:45:44 +01:00
-- If wallpaper is a function, call it with the screen
local wallpaper = theme.wallpaper
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
2017-01-28 14:45:44 +01:00
end
gears.wallpaper.maximized(wallpaper, s, true)
2017-01-27 21:33:11 +01:00
-- Tags
2017-01-28 14:45:44 +01:00
awful.tag(awful.util.tagnames, s, awful.layout.layouts)
2017-01-27 21:33:11 +01:00
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(my_table.join(
awful.button({}, 1, function () awful.layout.inc( 1) end),
awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
awful.button({}, 3, function () awful.layout.inc(-1) end),
awful.button({}, 4, function () awful.layout.inc( 1) end),
awful.button({}, 5, function () awful.layout.inc(-1) end)))
2017-01-27 21:33:11 +01:00
-- Create a taglist widget
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons)
2017-01-27 21:33:11 +01:00
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons)
2017-01-27 21:33:11 +01:00
-- Create the wibox
2019-03-02 19:05:33 +01:00
s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal })
2017-01-27 21:33:11 +01:00
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
2017-02-09 18:27:41 +01:00
--spr,
2017-01-27 21:33:11 +01:00
s.mytaglist,
s.mypromptbox,
spr,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
wibox.widget.systray(),
keyboardlayout,
2017-01-27 21:33:11 +01:00
spr,
arrl_ld,
wibox.container.background(mpdicon, theme.bg_focus),
wibox.container.background(theme.mpd.widget, theme.bg_focus),
2017-01-27 21:33:11 +01:00
arrl_dl,
volicon,
theme.volume.widget,
2017-01-27 21:33:11 +01:00
arrl_ld,
wibox.container.background(mailicon, theme.bg_focus),
2018-09-17 21:35:27 +02:00
--wibox.container.background(theme.mail.widget, theme.bg_focus),
2017-01-27 21:33:11 +01:00
arrl_dl,
memicon,
mem.widget,
arrl_ld,
wibox.container.background(cpuicon, theme.bg_focus),
wibox.container.background(cpu.widget, theme.bg_focus),
arrl_dl,
tempicon,
temp.widget,
arrl_ld,
wibox.container.background(fsicon, theme.bg_focus),
2018-09-17 21:35:27 +02:00
--wibox.container.background(theme.fs.widget, theme.bg_focus),
2017-01-27 21:33:11 +01:00
arrl_dl,
baticon,
bat.widget,
arrl_ld,
wibox.container.background(neticon, theme.bg_focus),
wibox.container.background(net.widget, theme.bg_focus),
arrl_dl,
clock,
2017-01-27 21:33:11 +01:00
spr,
arrl_ld,
wibox.container.background(s.mylayoutbox, theme.bg_focus),
},
}
end
2017-01-27 21:33:11 +01:00
2013-03-15 14:11:21 +01:00
return theme