-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.lua
141 lines (131 loc) · 4.34 KB
/
theme.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
local gears = require("gears")
local awful = require('awful')
local naughty = require('naughty')
local wibox = require('wibox')
local lain = require('lain')
local helpers = require('lain.helpers')
local markup = lain.util.markup
local dofile = dofile
local format = string.format
local theme = gears.protected_call(dofile, awful.util.get_themes_dir() .. 'zenburn/theme.lua')
-- master windows and columns
theme.master_count = 3
-- desktop background color
theme.desktop_color = '#000'
-- fonts
theme.font = 'roboto sans 8'
theme.monofont = 'roboto mono 8'
-- icons
theme.notification_icon_size = 64
theme.lain_icons = os.getenv('HOME') .. '/.config/awesome/lain/icons/layout/zenburn/'
theme.layout_termfair = theme.lain_icons .. 'termfair.png'
theme.layout_centerfair = theme.lain_icons .. 'centerfair.png' -- termfair.center
theme.layout_cascade = theme.lain_icons .. 'cascade.png'
theme.layout_cascadetile = theme.lain_icons .. 'cascadetile.png' -- cascade.tile
theme.layout_centerwork = theme.lain_icons .. 'centerwork.png'
theme.layout_centerworkh = theme.lain_icons .. 'centerworkh.png' -- centerwork.horizontal
theme.separator = ' ◦ '
-- clock & calendar
theme.clock = wibox.widget.textclock(' %H:%M ')
lain.widget.cal({
attach_to = { theme.clock },
week_start = 1,
three = true,
notification_preset = {
font = theme.monofont,
fg = theme.fg_normal,
bg = theme.bg_systray,
}
})
-- volume
local volume = lain.widget.pulsebar({
ticks = true, ticks_size = 3,
colors = {
background = theme.bg_focus,
unmute = theme.fg_normal,
mute = theme.fg_urgent,
},
})
--volume.tooltip.font = theme.font
--volume.tooltip.fg = theme.fg_normal
--volume.tooltip.bg = theme.bg_systray
volume.widget = wibox.container.rotate(volume.bar, 'east')
volume.widget.forced_width = 10
local vol_set_cmd = function(action, value)
return format('pactl %s %s %s', action, volume.device, value)
end
volume.fx = {
mixer = function() awful.spawn('pavucontrol') end,
mute = function()
awful.spawn(vol_set_cmd('set-sink-mute', 'toggle'), false)
volume.update()
end,
up = function()
awful.spawn(vol_set_cmd('set-sink-volume', '+1%'), false)
volume.update()
end,
down = function()
awful.spawn(vol_set_cmd('set-sink-volume', '-1%'), false)
volume.update()
end,
}
volume.widget:buttons(gears.table.join(
awful.button({}, 1, volume.fx.mixer),
awful.button({}, 3, volume.fx.mute),
awful.button({}, 4, volume.fx.up),
awful.button({}, 5, volume.fx.down)
))
theme.volume = volume
-- mpd
local mode_icon = {
repeat_mode = '↻',
random_mode = '?',
single_mode = '1',
consume_mode = '🍽',
}
local mpd = lain.widget.mpd({
music_dir = '/zmedia/music',
settings = function()
if mpd_now.state == 'stop' then
widget:set_markup('')
else
widget:set_markup(markup.font(theme.font, theme.separator .. mpd_now.artist))
if widget.tooltip == nil then
widget.tooltip = awful.tooltip({ objects = { widget } })
end
local modes = {mpd_now.state}
for k,v in pairs(mpd_now) do
if mode_icon[k] ~= nil and v then
table.insert(modes, mode_icon[k])
end
end
widget.tooltip:set_text(format('%s\n--\n%s\n%s',
mpd_notification_preset.text, mpd_now.file, table.concat(modes, ' ')))
end
end
})
theme.mpd = mpd
-- randomized wallpaper
local wp_file = nil
local wp_files = {}
theme.wallpaper = function(s)
if next(wp_files) == nil then
local fh = io.popen([[ find /home/jin/images/bkg -type f | grep -Ei "\\.(jpg|jpeg|gif|bmp|png)$" | grep -Ev "vertical" | grep -Ev "16x9" | shuf ]])
for file in fh:lines() do
table.insert(wp_files, file)
end
end
if wp_file == nil or s == nil then wp_file = table.remove(wp_files) end
if wp_file ~= nil then
naughty.notify({title = 'wallpaper', text = wp_file, position = 'bottom_right'})
if string.match(wp_file, '/center/') then
gears.wallpaper.centered(wp_file, s, theme.desktop_color)
elseif string.match(wp_file, '/fit/') then
gears.wallpaper.fit(wp_file, s, theme.desktop_color)
else
gears.wallpaper.maximized(wp_file, s, true)
end
end
end
helpers.newtimer('wallpaper', 30 * 60, function() theme.wallpaper(nil) end, true, true)
return theme