#217: make themes retrocompatible as well

This commit is contained in:
Luca CPZ 2018-02-02 12:17:33 +01:00
parent 2f0ffb34d6
commit 29b8ad484f
10 changed files with 69 additions and 51 deletions

View File

@ -5,11 +5,13 @@
--]]
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv }
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv }
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/blackburn"
@ -222,7 +224,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),

View File

@ -5,12 +5,14 @@
--]]
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv, setlocale = os.setlocale }
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv, setlocale = os.setlocale }
local awesome, client = awesome, client
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/copland"
@ -252,7 +254,7 @@ theme.volume = lain.widget.alsabar({
}
})
theme.volume.tooltip.wibox.fg = theme.fg_focus
theme.volume.bar:buttons(gears.table.join (
theme.volume.bar:buttons(my_table.join (
awful.button({}, 1, function()
awful.spawn.with_shell(string.format("%s -e alsamixer", awful.util.terminal))
end),
@ -316,7 +318,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),

View File

@ -5,11 +5,13 @@
--]]
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv }
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv }
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/dremora"
@ -204,7 +206,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),

View File

@ -5,12 +5,14 @@
--]]
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local string = string
local os = { getenv = os.getenv }
local os = { getenv = os.getenv }
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.default_dir = require("awful.util").get_themes_dir() .. "default"
@ -174,25 +176,25 @@ theme.mpd = lain.widget.mpd({
local musicbg = wibox.container.background(theme.mpd.widget, theme.bg_focus, gears.shape.rectangle)
local musicwidget = wibox.container.margin(musicbg, 0, 0, 5, 5)
musicwidget:buttons(gears.table.join(awful.button({ }, 1,
musicwidget:buttons(my_table.join(awful.button({ }, 1,
function () awful.spawn(theme.musicplr) end)))
prev_icon:buttons(gears.table.join(awful.button({}, 1,
prev_icon:buttons(my_table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc prev")
theme.mpd.update()
end)))
next_icon:buttons(gears.table.join(awful.button({}, 1,
next_icon:buttons(my_table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc next")
theme.mpd.update()
end)))
stop_icon:buttons(gears.table.join(awful.button({}, 1,
stop_icon:buttons(my_table.join(awful.button({}, 1,
function ()
play_pause_icon:set_image(theme.play)
awful.spawn.with_shell("mpc stop")
theme.mpd.update()
end)))
play_pause_icon:buttons(gears.table.join(awful.button({}, 1,
play_pause_icon:buttons(my_table.join(awful.button({}, 1,
function ()
awful.spawn.with_shell("mpc toggle")
theme.mpd.update()
@ -303,7 +305,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),

View File

@ -5,12 +5,13 @@
--]]
local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv, setlocale = os.setlocale }
local os = { getenv = os.getenv, setlocale = os.setlocale }
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.confdir = os.getenv("HOME") .. "/.config/awesome/themes/multicolor"
@ -268,7 +269,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),

View File

@ -9,7 +9,9 @@ local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv }
local os = { getenv = os.getenv }
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/powerarrow-dark"
@ -110,7 +112,7 @@ theme.cal = lain.widget.calendar({
-- Mail IMAP check
local mailicon = wibox.widget.imagebox(theme.widget_mail)
--[[ commented because it needs to be set before use
mailicon:buttons(gears.table.join(awful.button({ }, 1, function () awful.spawn(mail) end)))
mailicon:buttons(my_table.join(awful.button({ }, 1, function () awful.spawn(mail) end)))
local mail = lain.widget.imap({
timeout = 180,
server = "server",
@ -131,7 +133,7 @@ local mail = lain.widget.imap({
-- MPD
local musicplr = awful.util.terminal .. " -title Music -g 130x34-320+16 -e ncmpcpp"
local mpdicon = wibox.widget.imagebox(theme.widget_music)
mpdicon:buttons(gears.table.join(
mpdicon:buttons(my_table.join(
awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end),
awful.button({ }, 1, function ()
awful.spawn.with_shell("mpc prev")
@ -275,7 +277,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),

View File

@ -9,7 +9,9 @@ local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os, math, string = os, math, string
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/powerarrow"
@ -122,16 +124,16 @@ lain.widget.contrib.task.attach(task, {
-- do not colorize output
show_cmd = "task | sed -r 's/\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g'"
})
task:buttons(gears.table.join(awful.button({}, 1, lain.widget.contrib.task.prompt)))
task:buttons(my_table.join(awful.button({}, 1, lain.widget.contrib.task.prompt)))
-- Scissors (xsel copy and paste)
local scissors = wibox.widget.imagebox(theme.widget_scissors)
scissors:buttons(gears.table.join(awful.button({}, 1, function() awful.spawn("xsel | xsel -i -b") end)))
scissors:buttons(my_table.join(awful.button({}, 1, function() awful.spawn("xsel | xsel -i -b") end)))
-- Mail IMAP check
local mailicon = wibox.widget.imagebox(theme.widget_mail)
--[[ commented because it needs to be set before use
mailicon:buttons(gears.table.join(awful.button({ }, 1, function () awful.spawn(mail) end)))
mailicon:buttons(my_table.join(awful.button({ }, 1, function () awful.spawn(mail) end)))
local mail = lain.widget.imap({
timeout = 180,
server = "server",
@ -158,7 +160,7 @@ theme.volume = lain.widget.alsabar({
-- MPD
local musicplr = awful.util.terminal .. " -title Music -g 130x34-320+16 -e ncmpcpp"
local mpdicon = wibox.widget.imagebox(theme.widget_music)
mpdicon:buttons(gears.table.join(
mpdicon:buttons(my_table.join(
awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end),
awful.button({ }, 1, function ()
awful.spawn.with_shell("mpc prev")
@ -311,7 +313,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),

View File

@ -9,7 +9,9 @@ local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv }
local os = { getenv = os.getenv }
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.default_dir = require("awful.util").get_themes_dir() .. "default"
@ -167,7 +169,7 @@ theme.volume = lain.widget.alsabar({
})
theme.volume.tooltip.wibox.fg = theme.fg_focus
theme.volume.tooltip.wibox.font = theme.font
theme.volume.bar:buttons(gears.table.join (
theme.volume.bar:buttons(my_table.join (
awful.button({}, 1, function()
awful.spawn.with_shell(string.format("%s -e alsamixer", terminal))
end),
@ -228,7 +230,7 @@ function theme.at_screen_connect(s)
s.mytxtlayoutbox = wibox.widget.textbox(theme["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
awful.tag.attached_connect_signal(s, "property::selected", function () update_txt_layoutbox(s) end)
awful.tag.attached_connect_signal(s, "property::layout", function () update_txt_layoutbox(s) end)
s.mytxtlayoutbox:buttons(gears.table.join(
s.mytxtlayoutbox:buttons(my_table.join(
awful.button({}, 1, function() awful.layout.inc(1) end),
awful.button({}, 3, function() awful.layout.inc(-1) end),
awful.button({}, 4, function() awful.layout.inc(1) end),

View File

@ -9,7 +9,9 @@ local gears = require("gears")
local lain = require("lain")
local awful = require("awful")
local wibox = require("wibox")
local os = { getenv = os.getenv }
local os = { getenv = os.getenv }
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.zenburn_dir = require("awful.util").get_themes_dir() .. "zenburn"
@ -222,7 +224,7 @@ function theme.at_screen_connect(s)
s.mytxtlayoutbox = wibox.widget.textbox(theme["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
awful.tag.attached_connect_signal(s, "property::selected", function () update_txt_layoutbox(s) end)
awful.tag.attached_connect_signal(s, "property::layout", function () update_txt_layoutbox(s) end)
s.mytxtlayoutbox:buttons(gears.table.join(
s.mytxtlayoutbox:buttons(my_table.join(
awful.button({}, 1, function() awful.layout.inc(1) end),
awful.button({}, 3, function() awful.layout.inc(-1) end),
awful.button({}, 4, function() awful.layout.inc(1) end),

View File

@ -1,7 +1,7 @@
--[[
Vertex Awesome WM theme
github.com/lcpz
Vertex Awesome WM theme
github.com/lcpz
--]]
@ -11,6 +11,7 @@ local awful = require("awful")
local wibox = require("wibox")
local math, string, tag, tonumber, type, os = math, string, tag, tonumber, type, os
local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
local theme = {}
theme.default_dir = require("awful.util").get_themes_dir() .. "default"
@ -205,7 +206,7 @@ theme.volume = lain.widget.alsabar({
volicon:set_image(theme[index])
end
})
volicon:buttons(gears.table.join (
volicon:buttons(my_table.join (
awful.button({}, 1, function()
awful.spawn.with_shell(string.format("%s -e alsamixer", awful.util.terminal))
end),
@ -404,7 +405,7 @@ function theme.at_screen_connect(s)
-- 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(gears.table.join(
s.mylayoutbox:buttons(my_table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),