My configuration files for Debian/Ubuntu applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

280 lines
12 KiB

  1. --[[
  2. Rainbow 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 os = os
  11. local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility
  12. local theme = {}
  13. theme.default_dir = require("awful.util").get_themes_dir() .. "default"
  14. theme.dir = os.getenv("HOME") .. "/.config/awesome/themes/rainbow"
  15. theme.wallpaper = theme.dir .. "/wall.png"
  16. theme.font = "Terminus 10.5"
  17. theme.fg_normal = "#9E9E9E"
  18. theme.fg_focus = "#EBEBFF"
  19. theme.bg_normal = "#242424"
  20. theme.bg_focus = "#242424"
  21. theme.fg_urgent = "#000000"
  22. theme.bg_urgent = "#FFFFFF"
  23. theme.border_width = dpi(1)
  24. theme.border_normal = "#242424"
  25. theme.border_focus = "#EBEBFF"
  26. theme.taglist_fg_focus = "#EDEFFF"
  27. theme.taglist_bg_focus = "#242424"
  28. theme.menu_height = dpi(16)
  29. theme.menu_width = dpi(140)
  30. theme.ocol = "<span color='" .. theme.fg_normal .. "'>"
  31. theme.tasklist_sticky = theme.ocol .. "[S]</span>"
  32. theme.tasklist_ontop = theme.ocol .. "[T]</span>"
  33. theme.tasklist_floating = theme.ocol .. "[F]</span>"
  34. theme.tasklist_maximized_horizontal = theme.ocol .. "[M] </span>"
  35. theme.tasklist_maximized_vertical = ""
  36. theme.tasklist_disable_icon = true
  37. theme.awesome_icon = theme.dir .."/icons/awesome.png"
  38. theme.menu_submenu_icon = theme.dir .."/icons/submenu.png"
  39. theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png"
  40. theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png"
  41. theme.useless_gap = dpi(8)
  42. theme.layout_txt_tile = "[t]"
  43. theme.layout_txt_tileleft = "[l]"
  44. theme.layout_txt_tilebottom = "[b]"
  45. theme.layout_txt_tiletop = "[tt]"
  46. theme.layout_txt_fairv = "[fv]"
  47. theme.layout_txt_fairh = "[fh]"
  48. theme.layout_txt_spiral = "[s]"
  49. theme.layout_txt_dwindle = "[d]"
  50. theme.layout_txt_max = "[m]"
  51. theme.layout_txt_fullscreen = "[F]"
  52. theme.layout_txt_magnifier = "[M]"
  53. theme.layout_txt_floating = "[*]"
  54. theme.titlebar_close_button_normal = theme.default_dir.."/titlebar/close_normal.png"
  55. theme.titlebar_close_button_focus = theme.default_dir.."/titlebar/close_focus.png"
  56. theme.titlebar_minimize_button_normal = theme.default_dir.."/titlebar/minimize_normal.png"
  57. theme.titlebar_minimize_button_focus = theme.default_dir.."/titlebar/minimize_focus.png"
  58. theme.titlebar_ontop_button_normal_inactive = theme.default_dir.."/titlebar/ontop_normal_inactive.png"
  59. theme.titlebar_ontop_button_focus_inactive = theme.default_dir.."/titlebar/ontop_focus_inactive.png"
  60. theme.titlebar_ontop_button_normal_active = theme.default_dir.."/titlebar/ontop_normal_active.png"
  61. theme.titlebar_ontop_button_focus_active = theme.default_dir.."/titlebar/ontop_focus_active.png"
  62. theme.titlebar_sticky_button_normal_inactive = theme.default_dir.."/titlebar/sticky_normal_inactive.png"
  63. theme.titlebar_sticky_button_focus_inactive = theme.default_dir.."/titlebar/sticky_focus_inactive.png"
  64. theme.titlebar_sticky_button_normal_active = theme.default_dir.."/titlebar/sticky_normal_active.png"
  65. theme.titlebar_sticky_button_focus_active = theme.default_dir.."/titlebar/sticky_focus_active.png"
  66. theme.titlebar_floating_button_normal_inactive = theme.default_dir.."/titlebar/floating_normal_inactive.png"
  67. theme.titlebar_floating_button_focus_inactive = theme.default_dir.."/titlebar/floating_focus_inactive.png"
  68. theme.titlebar_floating_button_normal_active = theme.default_dir.."/titlebar/floating_normal_active.png"
  69. theme.titlebar_floating_button_focus_active = theme.default_dir.."/titlebar/floating_focus_active.png"
  70. theme.titlebar_maximized_button_normal_inactive = theme.default_dir.."/titlebar/maximized_normal_inactive.png"
  71. theme.titlebar_maximized_button_focus_inactive = theme.default_dir.."/titlebar/maximized_focus_inactive.png"
  72. theme.titlebar_maximized_button_normal_active = theme.default_dir.."/titlebar/maximized_normal_active.png"
  73. theme.titlebar_maximized_button_focus_active = theme.default_dir.."/titlebar/maximized_focus_active.png"
  74. -- lain related
  75. theme.layout_txt_cascade = "[cascade]"
  76. theme.layout_txt_cascadetile = "[cascadetile]"
  77. theme.layout_txt_centerwork = "[centerwork]"
  78. theme.layout_txt_termfair = "[termfair]"
  79. theme.layout_txt_centerfair = "[centerfair]"
  80. local markup = lain.util.markup
  81. local white = theme.fg_focus
  82. local gray = theme.fg_normal
  83. -- Textclock
  84. local mytextclock = wibox.widget.textclock(markup(white, " %H:%M "))
  85. mytextclock.font = theme.font
  86. -- Calendar
  87. theme.cal = lain.widget.cal({
  88. attach_to = { mytextclock },
  89. notification_preset = {
  90. font = "Terminus 11",
  91. fg = white,
  92. bg = theme.bg_normal
  93. }
  94. })
  95. -- Mail IMAP check
  96. --[[ commented because it needs to be set before use
  97. theme.mail = lain.widget.imap({
  98. timeout = 180,
  99. server = "server",
  100. mail = "mail",
  101. password = "keyring get mail",
  102. settings = function()
  103. mail_notification_preset.fg = white
  104. mail = ""
  105. count = ""
  106. if mailcount > 0 then
  107. mail = "Mail "
  108. count = mailcount .. " "
  109. end
  110. widget:set_markup(markup.font(theme.font, markup(gray, mail) .. markup(white, count)))
  111. end
  112. })
  113. --]]
  114. -- MPD
  115. theme.mpd = lain.widget.mpd({
  116. settings = function()
  117. mpd_notification_preset.fg = white
  118. artist = mpd_now.artist .. " "
  119. title = mpd_now.title .. " "
  120. if mpd_now.state == "pause" then
  121. artist = "mpd "
  122. title = "paused "
  123. elseif mpd_now.state == "stop" then
  124. artist = ""
  125. title = ""
  126. end
  127. widget:set_markup(markup.font(theme.font, markup(gray, artist) .. markup(white, title)))
  128. end
  129. })
  130. -- /home fs
  131. --[[ commented because it needs Gio/Glib >= 2.54
  132. theme.fs = lain.widget.fs({
  133. notification_preset = { fg = white, bg = theme.bg_normal, font = "Terminus 10.5" },
  134. settings = function()
  135. local fs_header, fs_p = "", ""
  136. if fs_now["/home"].percentage >= 90 then
  137. fs_header = " Hdd "
  138. fs_p = fs_now["/home"].percentage
  139. end
  140. widget:set_markup(markup.font(theme.font, markup(gray, fs_header) .. markup(white, fs_p)))
  141. end
  142. })
  143. --]]
  144. -- ALSA volume bar
  145. theme.volume = lain.widget.alsabar({
  146. ticks = true, width = dpi(67),
  147. notification_preset = { font = theme.font }
  148. })
  149. theme.volume.tooltip.wibox.fg = theme.fg_focus
  150. theme.volume.tooltip.wibox.font = theme.font
  151. theme.volume.bar:buttons(my_table.join (
  152. awful.button({}, 1, function()
  153. awful.spawn(string.format("%s -e alsamixer", terminal))
  154. end),
  155. awful.button({}, 2, function()
  156. os.execute(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
  157. theme.volume.update()
  158. end),
  159. awful.button({}, 3, function()
  160. os.execute(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
  161. theme.volume.update()
  162. end),
  163. awful.button({}, 4, function()
  164. os.execute(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
  165. theme.volume.update()
  166. end),
  167. awful.button({}, 5, function()
  168. os.execute(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
  169. theme.volume.update()
  170. end)
  171. ))
  172. local volumebg = wibox.container.background(theme.volume.bar, "#585858", gears.shape.rectangle)
  173. local volumewidget = wibox.container.margin(volumebg, dpi(7), dpi(7), dpi(5), dpi(5))
  174. -- Weather
  175. --[[ to be set before use
  176. theme.weather = lain.widget.weather({
  177. --APPID =
  178. city_id = 2643743, -- placeholder (London)
  179. notification_preset = { font = theme.font, fg = white }
  180. })
  181. --]]
  182. -- Separators
  183. local first = wibox.widget.textbox(markup.font("Terminus 4", " "))
  184. local spr = wibox.widget.textbox(' ')
  185. local function update_txt_layoutbox(s)
  186. -- Writes a string representation of the current layout in a textbox widget
  187. local txt_l = theme["layout_txt_" .. awful.layout.getname(awful.layout.get(s))] or ""
  188. s.mytxtlayoutbox:set_text(txt_l)
  189. end
  190. function theme.at_screen_connect(s)
  191. -- Quake application
  192. s.quake = lain.util.quake({ app = awful.util.terminal })
  193. -- If wallpaper is a function, call it with the screen
  194. local wallpaper = theme.wallpaper
  195. if type(wallpaper) == "function" then
  196. wallpaper = wallpaper(s)
  197. end
  198. gears.wallpaper.maximized(wallpaper, s, true)
  199. -- Tags
  200. awful.tag(awful.util.tagnames, s, awful.layout.layouts)
  201. -- Create a promptbox for each screen
  202. s.mypromptbox = awful.widget.prompt()
  203. -- Textual layoutbox
  204. s.mytxtlayoutbox = wibox.widget.textbox(theme["layout_txt_" .. awful.layout.getname(awful.layout.get(s))])
  205. awful.tag.attached_connect_signal(s, "property::selected", function () update_txt_layoutbox(s) end)
  206. awful.tag.attached_connect_signal(s, "property::layout", function () update_txt_layoutbox(s) end)
  207. s.mytxtlayoutbox:buttons(my_table.join(
  208. awful.button({}, 1, function() awful.layout.inc(1) end),
  209. awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
  210. awful.button({}, 3, function() awful.layout.inc(-1) end),
  211. awful.button({}, 4, function() awful.layout.inc(1) end),
  212. awful.button({}, 5, function() awful.layout.inc(-1) end)))
  213. -- Create a taglist widget
  214. s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons)
  215. -- Create a tasklist widget
  216. s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons)
  217. -- Create the wibox
  218. s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal })
  219. -- Add widgets to the wibox
  220. s.mywibox:setup {
  221. layout = wibox.layout.align.horizontal,
  222. { -- Left widgets
  223. layout = wibox.layout.fixed.horizontal,
  224. first,
  225. s.mytaglist,
  226. spr,
  227. s.mytxtlayoutbox,
  228. --spr,
  229. s.mypromptbox,
  230. spr,
  231. },
  232. s.mytasklist, -- Middle widget
  233. { -- Right widgets
  234. layout = wibox.layout.fixed.horizontal,
  235. wibox.widget.systray(),
  236. spr,
  237. theme.mpd.widget,
  238. --theme.mail.widget,
  239. --theme.fs.widget,
  240. volumewidget,
  241. mytextclock,
  242. },
  243. }
  244. end
  245. return theme