My configuration files for Debian/Ubuntu applications
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

376 行
16 KiB

  1. --[[
  2. Copland Awesome WM theme 2.0
  3. github.com/lcpz
  4. --]]
  5. local gears = require("gears")
  6. local lain = require("lain")
  7. local awful = require("awful")
  8. local wibox = require("wibox")
  9. local dpi = require("beautiful.xresources").apply_dpi
  10. local awesome, client, os = awesome, client, os
  11. local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
  12. local theme = {}
  13. theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/copland"
  14. theme.wallpaper = theme.dir .. "/wall.png"
  15. theme.font = "Terminus 10.5"
  16. theme.fg_normal = "#BBBBBB"
  17. theme.fg_focus = "#78A4FF"
  18. theme.bg_normal = "#111111"
  19. theme.bg_focus = "#111111"
  20. theme.fg_urgent = "#000000"
  21. theme.bg_urgent = "#FFFFFF"
  22. theme.border_width = dpi(1)
  23. theme.border_normal = "#141414"
  24. theme.border_focus = "#93B6FF"
  25. theme.taglist_fg_focus = "#FFFFFF"
  26. theme.taglist_bg_focus = "#111111"
  27. theme.taglist_bg_normal = "#111111"
  28. theme.titlebar_bg_normal = "#191919"
  29. theme.titlebar_bg_focus = "#262626"
  30. theme.menu_height = dpi(16)
  31. theme.menu_width = dpi(130)
  32. theme.tasklist_disable_icon = true
  33. theme.awesome_icon = theme.dir .."/icons/awesome.png"
  34. theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png"
  35. theme.taglist_squares_sel = theme.dir .. "/icons/square_unsel.png"
  36. theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png"
  37. theme.vol = theme.dir .. "/icons/vol.png"
  38. theme.vol_low = theme.dir .. "/icons/vol_low.png"
  39. theme.vol_no = theme.dir .. "/icons/vol_no.png"
  40. theme.vol_mute = theme.dir .. "/icons/vol_mute.png"
  41. theme.disk = theme.dir .. "/icons/disk.png"
  42. theme.ac = theme.dir .. "/icons/ac.png"
  43. theme.bat = theme.dir .. "/icons/bat.png"
  44. theme.bat_low = theme.dir .. "/icons/bat_low.png"
  45. theme.bat_no = theme.dir .. "/icons/bat_no.png"
  46. theme.play = theme.dir .. "/icons/play.png"
  47. theme.pause = theme.dir .. "/icons/pause.png"
  48. theme.stop = theme.dir .. "/icons/stop.png"
  49. theme.layout_tile = theme.dir .. "/icons/tile.png"
  50. theme.layout_tileleft = theme.dir .. "/icons/tileleft.png"
  51. theme.layout_tilebottom = theme.dir .. "/icons/tilebottom.png"
  52. theme.layout_tiletop = theme.dir .. "/icons/tiletop.png"
  53. theme.layout_fairv = theme.dir .. "/icons/fairv.png"
  54. theme.layout_fairh = theme.dir .. "/icons/fairh.png"
  55. theme.layout_spiral = theme.dir .. "/icons/spiral.png"
  56. theme.layout_dwindle = theme.dir .. "/icons/dwindle.png"
  57. theme.layout_max = theme.dir .. "/icons/max.png"
  58. theme.layout_fullscreen = theme.dir .. "/icons/fullscreen.png"
  59. theme.layout_magnifier = theme.dir .. "/icons/magnifier.png"
  60. theme.layout_floating = theme.dir .. "/icons/floating.png"
  61. theme.useless_gap = 0
  62. theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close_focus.png"
  63. theme.titlebar_close_button_normal = theme.dir .. "/icons/titlebar/close_normal.png"
  64. theme.titlebar_ontop_button_focus_active = theme.dir .. "/icons/titlebar/ontop_focus_active.png"
  65. theme.titlebar_ontop_button_normal_active = theme.dir .. "/icons/titlebar/ontop_normal_active.png"
  66. theme.titlebar_ontop_button_focus_inactive = theme.dir .. "/icons/titlebar/ontop_focus_inactive.png"
  67. theme.titlebar_ontop_button_normal_inactive = theme.dir .. "/icons/titlebar/ontop_normal_inactive.png"
  68. theme.titlebar_sticky_button_focus_active = theme.dir .. "/icons/titlebar/sticky_focus_active.png"
  69. theme.titlebar_sticky_button_normal_active = theme.dir .. "/icons/titlebar/sticky_normal_active.png"
  70. theme.titlebar_sticky_button_focus_inactive = theme.dir .. "/icons/titlebar/sticky_focus_inactive.png"
  71. theme.titlebar_sticky_button_normal_inactive = theme.dir .. "/icons/titlebar/sticky_normal_inactive.png"
  72. theme.titlebar_floating_button_focus_active = theme.dir .. "/icons/titlebar/floating_focus_active.png"
  73. theme.titlebar_floating_button_normal_active = theme.dir .. "/icons/titlebar/floating_normal_active.png"
  74. theme.titlebar_floating_button_focus_inactive = theme.dir .. "/icons/titlebar/floating_focus_inactive.png"
  75. theme.titlebar_floating_button_normal_inactive = theme.dir .. "/icons/titlebar/floating_normal_inactive.png"
  76. theme.titlebar_maximized_button_focus_active = theme.dir .. "/icons/titlebar/maximized_focus_active.png"
  77. theme.titlebar_maximized_button_normal_active = theme.dir .. "/icons/titlebar/maximized_normal_active.png"
  78. theme.titlebar_maximized_button_focus_inactive = theme.dir .. "/icons/titlebar/maximized_focus_inactive.png"
  79. theme.titlebar_maximized_button_normal_inactive = theme.dir .. "/icons/titlebar/maximized_normal_inactive.png"
  80. -- lain related
  81. theme.layout_centerfair = theme.dir .. "/icons/centerfair.png"
  82. theme.layout_termfair = theme.dir .. "/icons/termfair.png"
  83. theme.layout_centerwork = theme.dir .. "/icons/centerwork.png"
  84. local markup = lain.util.markup
  85. local blue = theme.fg_focus
  86. local red = "#EB8F8F"
  87. local green = "#8FEB8F"
  88. -- Textclock
  89. --os.setlocale(os.getenv("LANG")) -- to localize the clock
  90. local mytextclock = wibox.widget.textclock("<span font='Terminus 5'> </span>%H:%M ")
  91. mytextclock.font = theme.font
  92. -- Calendar
  93. theme.cal = lain.widget.cal({
  94. attach_to = { mytextclock },
  95. notification_preset = {
  96. font = "Terminus 11",
  97. fg = theme.fg_normal,
  98. bg = theme.bg_normal
  99. }
  100. })
  101. -- Mail IMAP check
  102. --[[ to be set before use
  103. theme.mail = lain.widget.imap({
  104. timeout = 180,
  105. server = "server",
  106. mail = "mail",
  107. password = "keyring get mail",
  108. settings = function()
  109. mail = ""
  110. count = ""
  111. if mailcount > 0 then
  112. mail = "<span font='Terminus 5'> </span>Mail "
  113. count = mailcount .. " "
  114. end
  115. widget:set_markup(markup(blue, mail) .. count)
  116. end
  117. })
  118. --]]
  119. -- MPD
  120. local mpdicon = wibox.widget.imagebox()
  121. theme.mpd = lain.widget.mpd({
  122. settings = function()
  123. if mpd_now.state == "play" then
  124. title = mpd_now.title
  125. artist = " " .. mpd_now.artist .. markup("#777777", " <span font='Terminus 2'> </span>|<span font='Terminus 5'> </span>")
  126. mpdicon:set_image(theme.play)
  127. elseif mpd_now.state == "pause" then
  128. title = "mpd "
  129. artist = "paused" .. markup("#777777", " |<span font='Terminus 5'> </span>")
  130. mpdicon:set_image(theme.pause)
  131. else
  132. title = ""
  133. artist = ""
  134. mpdicon._private.image = nil
  135. mpdicon:emit_signal("widget::redraw_needed")
  136. mpdicon:emit_signal("widget::layout_changed")
  137. end
  138. widget:set_markup(markup.font(theme.font, markup(blue, title) .. artist))
  139. end
  140. })
  141. -- Battery
  142. local baticon = wibox.widget.imagebox(theme.bat)
  143. local batbar = wibox.widget {
  144. forced_height = dpi(1),
  145. forced_width = dpi(59),
  146. color = theme.fg_normal,
  147. background_color = theme.bg_normal,
  148. margins = 1,
  149. paddings = 1,
  150. ticks = true,
  151. ticks_size = dpi(6),
  152. widget = wibox.widget.progressbar,
  153. }
  154. local batupd = lain.widget.bat({
  155. settings = function()
  156. if (not bat_now.status) or bat_now.status == "N/A" or type(bat_now.perc) ~= "number" then return end
  157. if bat_now.status == "Charging" then
  158. baticon:set_image(theme.ac)
  159. if bat_now.perc >= 98 then
  160. batbar:set_color(green)
  161. elseif bat_now.perc > 50 then
  162. batbar:set_color(theme.fg_normal)
  163. elseif bat_now.perc > 15 then
  164. batbar:set_color(theme.fg_normal)
  165. else
  166. batbar:set_color(red)
  167. end
  168. else
  169. if bat_now.perc >= 98 then
  170. batbar:set_color(green)
  171. elseif bat_now.perc > 50 then
  172. batbar:set_color(theme.fg_normal)
  173. baticon:set_image(theme.bat)
  174. elseif bat_now.perc > 15 then
  175. batbar:set_color(theme.fg_normal)
  176. baticon:set_image(theme.bat_low)
  177. else
  178. batbar:set_color(red)
  179. baticon:set_image(theme.bat_no)
  180. end
  181. end
  182. batbar:set_value(bat_now.perc / 100)
  183. end
  184. })
  185. local batbg = wibox.container.background(batbar, "#474747", gears.shape.rectangle)
  186. local batwidget = wibox.container.margin(batbg, dpi(2), dpi(7), dpi(4), dpi(4))
  187. -- /home fs
  188. --[[ commented because it needs Gio/Glib >= 2.54
  189. local fsicon = wibox.widget.imagebox(theme.disk)
  190. local fsbar = wibox.widget {
  191. forced_height = dpi(1),
  192. forced_width = dpi(59),
  193. color = theme.fg_normal,
  194. background_color = theme.bg_normal,
  195. margins = 1,
  196. paddings = 1,
  197. ticks = true,
  198. ticks_size = dpi(6),
  199. widget = wibox.widget.progressbar,
  200. }
  201. theme.fs = lain.widget.fs {
  202. notification_preset = { fg = theme.fg_normal, bg = theme.bg_normal, font = "Terminus 10.5" },
  203. settings = function()
  204. if fs_now["/home"].percentage < 90 then
  205. fsbar:set_color(theme.fg_normal)
  206. else
  207. fsbar:set_color("#EB8F8F")
  208. end
  209. fsbar:set_value(fs_now["/home"].percentage / 100)
  210. end
  211. }
  212. local fsbg = wibox.container.background(fsbar, "#474747", gears.shape.rectangle)
  213. local fswidget = wibox.container.margin(fsbg, dpi(2), dpi(7), dpi(4), dpi(4))
  214. --]]
  215. -- ALSA volume bar
  216. local volicon = wibox.widget.imagebox(theme.vol)
  217. theme.volume = lain.widget.alsabar {
  218. width = dpi(59), border_width = 0, ticks = true, ticks_size = dpi(6),
  219. notification_preset = { font = theme.font },
  220. --togglechannel = "IEC958,3",
  221. settings = function()
  222. if volume_now.status == "off" then
  223. volicon:set_image(theme.vol_mute)
  224. elseif volume_now.level == 0 then
  225. volicon:set_image(theme.vol_no)
  226. elseif volume_now.level <= 50 then
  227. volicon:set_image(theme.vol_low)
  228. else
  229. volicon:set_image(theme.vol)
  230. end
  231. end,
  232. colors = {
  233. background = theme.bg_normal,
  234. mute = red,
  235. unmute = theme.fg_normal
  236. }
  237. }
  238. theme.volume.tooltip.wibox.fg = theme.fg_focus
  239. theme.volume.bar:buttons(my_table.join (
  240. awful.button({}, 1, function()
  241. awful.spawn(string.format("%s -e alsamixer", awful.util.terminal))
  242. end),
  243. awful.button({}, 2, function()
  244. os.execute(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
  245. theme.volume.update()
  246. end),
  247. awful.button({}, 3, function()
  248. os.execute(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
  249. theme.volume.update()
  250. end),
  251. awful.button({}, 4, function()
  252. os.execute(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
  253. theme.volume.update()
  254. end),
  255. awful.button({}, 5, function()
  256. os.execute(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
  257. theme.volume.update()
  258. end)
  259. ))
  260. local volumebg = wibox.container.background(theme.volume.bar, "#474747", gears.shape.rectangle)
  261. local volumewidget = wibox.container.margin(volumebg, dpi(2), dpi(7), dpi(4), dpi(4))
  262. -- Weather
  263. --[[ to be set before use
  264. theme.weather = lain.widget.weather({
  265. --APPID =
  266. city_id = 2643743, -- placeholder (London)
  267. })
  268. --]]
  269. -- Separators
  270. local first = wibox.widget.textbox(markup.font("Terminus 3", " "))
  271. local spr = wibox.widget.textbox(' ')
  272. local small_spr = wibox.widget.textbox(markup.font("Terminus 4", " "))
  273. local bar_spr = wibox.widget.textbox(markup.font("Terminus 3", " ") .. markup.fontfg(theme.font, "#777777", "|") .. markup.font("Terminus 5", " "))
  274. -- Eminent-like task filtering
  275. local orig_filter = awful.widget.taglist.filter.all
  276. -- Taglist label functions
  277. awful.widget.taglist.filter.all = function (t, args)
  278. if t.selected or #t:clients() > 0 then
  279. return orig_filter(t, args)
  280. end
  281. end
  282. function theme.at_screen_connect(s)
  283. -- Quake application
  284. s.quake = lain.util.quake({ app = awful.util.terminal })
  285. -- If wallpaper is a function, call it with the screen
  286. local wallpaper = theme.wallpaper
  287. if type(wallpaper) == "function" then
  288. wallpaper = wallpaper(s)
  289. end
  290. gears.wallpaper.maximized(wallpaper, s, true)
  291. -- Tags
  292. awful.tag(awful.util.tagnames, s, awful.layout.layouts)
  293. -- Create a promptbox for each screen
  294. s.mypromptbox = awful.widget.prompt()
  295. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  296. -- We need one layoutbox per screen.
  297. s.mylayoutbox = awful.widget.layoutbox(s)
  298. s.mylayoutbox:buttons(my_table.join(
  299. awful.button({}, 1, function () awful.layout.inc( 1) end),
  300. awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
  301. awful.button({}, 3, function () awful.layout.inc(-1) end),
  302. awful.button({}, 4, function () awful.layout.inc( 1) end),
  303. awful.button({}, 5, function () awful.layout.inc(-1) end)))
  304. -- Create a taglist widget
  305. s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons)
  306. -- Create a tasklist widget
  307. s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons)
  308. -- Create the wibox
  309. s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal })
  310. -- Add widgets to the wibox
  311. s.mywibox:setup {
  312. layout = wibox.layout.align.horizontal,
  313. { -- Left widgets
  314. layout = wibox.layout.fixed.horizontal,
  315. small_spr,
  316. s.mylayoutbox,
  317. first,
  318. bar_spr,
  319. s.mytaglist,
  320. first,
  321. s.mypromptbox,
  322. },
  323. s.mytasklist, -- Middle widget
  324. { -- Right widgets
  325. layout = wibox.layout.fixed.horizontal,
  326. wibox.widget.systray(),
  327. small_spr,
  328. --theme.mail.widget,
  329. mpdicon,
  330. theme.mpd.widget,
  331. baticon,
  332. batwidget,
  333. bar_spr,
  334. --fsicon,
  335. --fswidget,
  336. bar_spr,
  337. volicon,
  338. volumewidget,
  339. bar_spr,
  340. mytextclock,
  341. },
  342. }
  343. end
  344. return theme