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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. --[[
  2. Vertex Awesome WM theme
  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 math, string, tag, tonumber, type, os = math, string, tag, tonumber, type, 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.icon_dir = os.getenv("HOME") .. "/.config/awesome/themes/vertex/icons"
  15. theme.wallpaper = os.getenv("HOME") .. "/.config/awesome/themes/vertex/wall.png"
  16. theme.font = "Roboto Bold 10"
  17. theme.taglist_font = "FontAwesome 17"
  18. theme.fg_normal = "#FFFFFF"
  19. theme.fg_focus = "#6A95EB"
  20. theme.bg_focus = "#303030"
  21. theme.bg_focus2 = "#3762B8"
  22. theme.bg_normal = "#242424"
  23. theme.fg_urgent = "#CC9393"
  24. theme.bg_urgent = "#006B8E"
  25. theme.border_width = dpi(4)
  26. theme.border_normal = "#252525"
  27. theme.border_focus = "#7CA2EE"
  28. theme.tooltip_border_color = theme.fg_focus
  29. theme.tooltip_border_width = theme.border_width
  30. theme.menu_height = dpi(24)
  31. theme.menu_width = dpi(140)
  32. theme.awesome_icon = theme.icon_dir .. "/awesome.png"
  33. theme.taglist_squares_sel = gears.surface.load_from_shape(dpi(3), dpi(30), gears.shape.rectangle, theme.fg_focus)
  34. theme.taglist_squares_unsel = gears.surface.load_from_shape(dpi(3), dpi(30), gears.shape.rectangle, theme.bg_focus2)
  35. theme.panelbg = theme.icon_dir .. "/panel.png"
  36. theme.bat000charging = theme.icon_dir .. "/bat-000-charging.png"
  37. theme.bat000 = theme.icon_dir .. "/bat-000.png"
  38. theme.bat020charging = theme.icon_dir .. "/bat-020-charging.png"
  39. theme.bat020 = theme.icon_dir .. "/bat-020.png"
  40. theme.bat040charging = theme.icon_dir .. "/bat-040-charging.png"
  41. theme.bat040 = theme.icon_dir .. "/bat-040.png"
  42. theme.bat060charging = theme.icon_dir .. "/bat-060-charging.png"
  43. theme.bat060 = theme.icon_dir .. "/bat-060.png"
  44. theme.bat080charging = theme.icon_dir .. "/bat-080-charging.png"
  45. theme.bat080 = theme.icon_dir .. "/bat-080.png"
  46. theme.bat100charging = theme.icon_dir .. "/bat-100-charging.png"
  47. theme.bat100 = theme.icon_dir .. "/bat-100.png"
  48. theme.batcharged = theme.icon_dir .. "/bat-charged.png"
  49. theme.ethon = theme.icon_dir .. "/ethernet-connected.png"
  50. theme.ethoff = theme.icon_dir .. "/ethernet-disconnected.png"
  51. theme.volhigh = theme.icon_dir .. "/volume-high.png"
  52. theme.vollow = theme.icon_dir .. "/volume-low.png"
  53. theme.volmed = theme.icon_dir .. "/volume-medium.png"
  54. theme.volmutedblocked = theme.icon_dir .. "/volume-muted-blocked.png"
  55. theme.volmuted = theme.icon_dir .. "/volume-muted.png"
  56. theme.voloff = theme.icon_dir .. "/volume-off.png"
  57. theme.wifidisc = theme.icon_dir .. "/wireless-disconnected.png"
  58. theme.wififull = theme.icon_dir .. "/wireless-full.png"
  59. theme.wifihigh = theme.icon_dir .. "/wireless-high.png"
  60. theme.wifilow = theme.icon_dir .. "/wireless-low.png"
  61. theme.wifimed = theme.icon_dir .. "/wireless-medium.png"
  62. theme.wifinone = theme.icon_dir .. "/wireless-none.png"
  63. theme.layout_fairh = theme.default_dir.."/layouts/fairhw.png"
  64. theme.layout_fairv = theme.default_dir.."/layouts/fairvw.png"
  65. theme.layout_floating = theme.default_dir.."/layouts/floatingw.png"
  66. theme.layout_magnifier = theme.default_dir.."/layouts/magnifierw.png"
  67. theme.layout_max = theme.default_dir.."/layouts/maxw.png"
  68. theme.layout_fullscreen = theme.default_dir.."/layouts/fullscreenw.png"
  69. theme.layout_tilebottom = theme.default_dir.."/layouts/tilebottomw.png"
  70. theme.layout_tileleft = theme.default_dir.."/layouts/tileleftw.png"
  71. theme.layout_tile = theme.default_dir.."/layouts/tilew.png"
  72. theme.layout_tiletop = theme.default_dir.."/layouts/tiletopw.png"
  73. theme.layout_spiral = theme.default_dir.."/layouts/spiralw.png"
  74. theme.layout_dwindle = theme.default_dir.."/layouts/dwindlew.png"
  75. theme.layout_cornernw = theme.default_dir.."/layouts/cornernww.png"
  76. theme.layout_cornerne = theme.default_dir.."/layouts/cornernew.png"
  77. theme.layout_cornersw = theme.default_dir.."/layouts/cornersww.png"
  78. theme.layout_cornerse = theme.default_dir.."/layouts/cornersew.png"
  79. theme.tasklist_plain_task_name = true
  80. theme.tasklist_disable_icon = true
  81. theme.useless_gap = dpi(10)
  82. theme.titlebar_close_button_normal = theme.default_dir.."/titlebar/close_normal.png"
  83. theme.titlebar_close_button_focus = theme.default_dir.."/titlebar/close_focus.png"
  84. theme.titlebar_minimize_button_normal = theme.default_dir.."/titlebar/minimize_normal.png"
  85. theme.titlebar_minimize_button_focus = theme.default_dir.."/titlebar/minimize_focus.png"
  86. theme.titlebar_ontop_button_normal_inactive = theme.default_dir.."/titlebar/ontop_normal_inactive.png"
  87. theme.titlebar_ontop_button_focus_inactive = theme.default_dir.."/titlebar/ontop_focus_inactive.png"
  88. theme.titlebar_ontop_button_normal_active = theme.default_dir.."/titlebar/ontop_normal_active.png"
  89. theme.titlebar_ontop_button_focus_active = theme.default_dir.."/titlebar/ontop_focus_active.png"
  90. theme.titlebar_sticky_button_normal_inactive = theme.default_dir.."/titlebar/sticky_normal_inactive.png"
  91. theme.titlebar_sticky_button_focus_inactive = theme.default_dir.."/titlebar/sticky_focus_inactive.png"
  92. theme.titlebar_sticky_button_normal_active = theme.default_dir.."/titlebar/sticky_normal_active.png"
  93. theme.titlebar_sticky_button_focus_active = theme.default_dir.."/titlebar/sticky_focus_active.png"
  94. theme.titlebar_floating_button_normal_inactive = theme.default_dir.."/titlebar/floating_normal_inactive.png"
  95. theme.titlebar_floating_button_focus_inactive = theme.default_dir.."/titlebar/floating_focus_inactive.png"
  96. theme.titlebar_floating_button_normal_active = theme.default_dir.."/titlebar/floating_normal_active.png"
  97. theme.titlebar_floating_button_focus_active = theme.default_dir.."/titlebar/floating_focus_active.png"
  98. theme.titlebar_maximized_button_normal_inactive = theme.default_dir.."/titlebar/maximized_normal_inactive.png"
  99. theme.titlebar_maximized_button_focus_inactive = theme.default_dir.."/titlebar/maximized_focus_inactive.png"
  100. theme.titlebar_maximized_button_normal_active = theme.default_dir.."/titlebar/maximized_normal_active.png"
  101. theme.titlebar_maximized_button_focus_active = theme.default_dir.."/titlebar/maximized_focus_active.png"
  102. -- http://fontawesome.io/cheatsheet
  103. awful.util.tagnames = { "", "", "", "", "", "", "", "" }
  104. local markup = lain.util.markup
  105. -- Clock
  106. --os.setlocale(os.getenv("LANG")) -- to localize the clock
  107. local mytextclock = wibox.widget.textclock(markup("#FFFFFF", "%a %d %b, %H:%M"))
  108. mytextclock.font = theme.font
  109. theme.cal = lain.widget.cal({
  110. attach_to = { mytextclock },
  111. notification_preset = {
  112. fg = "#FFFFFF",
  113. bg = theme.bg_normal,
  114. position = "top_middle",
  115. font = "Monospace 10"
  116. }
  117. })
  118. -- Battery
  119. local baticon = wibox.widget.imagebox(theme.bat000)
  120. local battooltip = awful.tooltip({
  121. objects = { baticon },
  122. margin_leftright = dpi(15),
  123. margin_topbottom = dpi(12)
  124. })
  125. battooltip.wibox.fg = theme.fg_normal
  126. battooltip.textbox.font = theme.font
  127. battooltip.timeout = 0
  128. battooltip:set_shape(function(cr, width, height)
  129. gears.shape.infobubble(cr, width, height, corner_radius, arrow_size, width - dpi(35))
  130. end)
  131. local bat = lain.widget.bat({
  132. settings = function()
  133. local index, perc = "bat", tonumber(bat_now.perc) or 0
  134. if perc <= 7 then
  135. index = index .. "000"
  136. elseif perc <= 20 then
  137. index = index .. "020"
  138. elseif perc <= 40 then
  139. index = index .. "040"
  140. elseif perc <= 60 then
  141. index = index .. "060"
  142. elseif perc <= 80 then
  143. index = index .. "080"
  144. elseif perc <= 100 then
  145. index = index .. "100"
  146. end
  147. if bat_now.ac_status == 1 then
  148. index = index .. "charging"
  149. end
  150. baticon:set_image(theme[index])
  151. battooltip:set_markup(string.format("\n%s%%, %s", perc, bat_now.time))
  152. end
  153. })
  154. -- MPD
  155. theme.mpd = lain.widget.mpd({
  156. music_dir = "/mnt/storage/Downloads/Music",
  157. settings = function()
  158. if mpd_now.state == "play" then
  159. title = mpd_now.title
  160. artist = " " .. mpd_now.artist .. " "
  161. elseif mpd_now.state == "pause" then
  162. title = "mpd "
  163. artist = "paused "
  164. else
  165. title = ""
  166. artist = ""
  167. end
  168. widget:set_markup(markup.font(theme.font, title .. markup(theme.fg_focus, artist)))
  169. end
  170. })
  171. -- ALSA volume
  172. local volicon = wibox.widget.imagebox()
  173. theme.volume = lain.widget.alsabar({
  174. --togglechannel = "IEC958,3",
  175. notification_preset = { font = "Monospace 12", fg = theme.fg_normal },
  176. settings = function()
  177. local index, perc = "", tonumber(volume_now.level) or 0
  178. if volume_now.status == "off" then
  179. index = "volmutedblocked"
  180. else
  181. if perc <= 5 then
  182. index = "volmuted"
  183. elseif perc <= 25 then
  184. index = "vollow"
  185. elseif perc <= 75 then
  186. index = "volmed"
  187. else
  188. index = "volhigh"
  189. end
  190. end
  191. volicon:set_image(theme[index])
  192. end
  193. })
  194. volicon:buttons(my_table.join (
  195. awful.button({}, 1, function()
  196. awful.spawn(string.format("%s -e alsamixer", awful.util.terminal))
  197. end),
  198. awful.button({}, 2, function()
  199. os.execute(string.format("%s set %s 100%%", theme.volume.cmd, theme.volume.channel))
  200. theme.volume.notify()
  201. end),
  202. awful.button({}, 3, function()
  203. os.execute(string.format("%s set %s toggle", theme.volume.cmd, theme.volume.togglechannel or theme.volume.channel))
  204. theme.volume.notify()
  205. end),
  206. awful.button({}, 4, function()
  207. os.execute(string.format("%s set %s 1%%+", theme.volume.cmd, theme.volume.channel))
  208. theme.volume.notify()
  209. end),
  210. awful.button({}, 5, function()
  211. os.execute(string.format("%s set %s 1%%-", theme.volume.cmd, theme.volume.channel))
  212. theme.volume.notify()
  213. end)
  214. ))
  215. -- Wifi carrier and signal strength
  216. local wificon = wibox.widget.imagebox(theme.wifidisc)
  217. local wifitooltip = awful.tooltip({
  218. objects = { wificon },
  219. margin_leftright = dpi(15),
  220. margin_topbottom = dpi(15)
  221. })
  222. wifitooltip.wibox.fg = theme.fg_normal
  223. wifitooltip.textbox.font = theme.font
  224. wifitooltip.timeout = 0
  225. wifitooltip:set_shape(function(cr, width, height)
  226. gears.shape.infobubble(cr, width, height, corner_radius, arrow_size, width - dpi(120))
  227. end)
  228. local mywifisig = awful.widget.watch(
  229. { awful.util.shell, "-c", "awk 'NR==3 {printf(\"%d-%.0f\\n\",$2, $3*10/7)}' /proc/net/wireless; iw dev wlan0 link" },
  230. 2,
  231. function(widget, stdout)
  232. local carrier, perc = stdout:match("(%d)-(%d+)")
  233. local tiptext = stdout:gsub("(%d)-(%d+)", ""):gsub("%s+$", "")
  234. perc = tonumber(perc)
  235. if carrier == "1" or not perc then
  236. wificon:set_image(theme.wifidisc)
  237. wifitooltip:set_markup("No carrier")
  238. else
  239. if perc <= 5 then
  240. wificon:set_image(theme.wifinone)
  241. elseif perc <= 25 then
  242. wificon:set_image(theme.wifilow)
  243. elseif perc <= 50 then
  244. wificon:set_image(theme.wifimed)
  245. elseif perc <= 75 then
  246. wificon:set_image(theme.wifihigh)
  247. else
  248. wificon:set_image(theme.wififull)
  249. end
  250. wifitooltip:set_markup(tiptext)
  251. end
  252. end
  253. )
  254. wificon:connect_signal("button::press", function() awful.spawn(string.format("%s -e wavemon", awful.util.terminal)) end)
  255. -- Weather
  256. --[[ to be set before use
  257. theme.weather = lain.widget.weather({
  258. city_id = 2643743, -- placeholder (London)
  259. notification_preset = { font = "Monospace 10" },
  260. settings = function()
  261. units = math.floor(weather_now["main"]["temp"])
  262. widget:set_markup(" " .. markup.font(theme.font, units .. "°C") .. " ")
  263. end
  264. })
  265. --]]
  266. -- Launcher
  267. local mylauncher = awful.widget.button({image = theme.awesome_icon})
  268. mylauncher:connect_signal("button::press", function() awful.util.mymainmenu:toggle() end)
  269. -- Separators
  270. local space = wibox.widget.textbox(" ")
  271. local rspace1 = wibox.widget.textbox()
  272. local rspace0 = wibox.widget.textbox()
  273. local rspace2 = wibox.widget.textbox()
  274. local rspace3 = wibox.widget.textbox()
  275. local tspace1 = wibox.widget.textbox()
  276. tspace1.forced_width = dpi(18)
  277. rspace1.forced_width = dpi(16)
  278. rspace0.forced_width = dpi(18)
  279. rspace2.forced_width = dpi(19)
  280. rspace3.forced_width = dpi(21)
  281. local lspace1 = wibox.widget.textbox()
  282. local lspace2 = wibox.widget.textbox()
  283. local lspace3 = wibox.widget.textbox()
  284. lspace1.forced_height = dpi(18)
  285. lspace2.forced_height = dpi(10)
  286. lspace3.forced_height = dpi(16)
  287. local barcolor = gears.color({
  288. type = "linear",
  289. from = { 0, dpi(46) },
  290. to = { dpi(46), dpi(46) },
  291. stops = { {0, theme.bg_focus}, {0.9, theme.bg_focus2} }
  292. })
  293. local barcolor2 = gears.color({
  294. type = "linear",
  295. from = { 0, dpi(46) },
  296. to = { dpi(46), dpi(46) },
  297. stops = { {0, "#323232"}, {1, theme.bg_normal} }
  298. })
  299. local dockshape = function(cr, width, height)
  300. gears.shape.partially_rounded_rect(cr, width, height, false, true, true, false, 6)
  301. end
  302. function theme.vertical_wibox(s)
  303. -- Create the vertical wibox
  304. s.dockheight = (35 * s.workarea.height)/100
  305. s.myleftwibox = wibox({ screen = s, x=0, y=s.workarea.height/2 - s.dockheight/2, width = dpi(6), height = s.dockheight, fg = theme.fg_normal, bg = barcolor2, ontop = true, visible = true, type = "dock" })
  306. if s.index > 1 and s.myleftwibox.y == 0 then
  307. s.myleftwibox.y = screen[1].myleftwibox.y
  308. end
  309. -- Add widgets to the vertical wibox
  310. s.myleftwibox:setup {
  311. layout = wibox.layout.align.vertical,
  312. {
  313. layout = wibox.layout.fixed.vertical,
  314. lspace1,
  315. s.mytaglist,
  316. lspace2,
  317. s.layoutb,
  318. wibox.container.margin(mylauncher, dpi(5), dpi(8), dpi(13), dpi(0)),
  319. },
  320. }
  321. -- Add toggling functionalities
  322. s.docktimer = gears.timer{ timeout = 2 }
  323. s.docktimer:connect_signal("timeout", function()
  324. local s = awful.screen.focused()
  325. s.myleftwibox.width = dpi(9)
  326. s.layoutb.visible = false
  327. mylauncher.visible = false
  328. if s.docktimer.started then
  329. s.docktimer:stop()
  330. end
  331. end)
  332. tag.connect_signal("property::selected", function(t)
  333. local s = t.screen or awful.screen.focused()
  334. s.myleftwibox.width = dpi(38)
  335. s.layoutb.visible = true
  336. mylauncher.visible = true
  337. gears.surface.apply_shape_bounding(s.myleftwibox, dockshape)
  338. if not s.docktimer.started then
  339. s.docktimer:start()
  340. end
  341. end)
  342. s.myleftwibox:connect_signal("mouse::leave", function()
  343. local s = awful.screen.focused()
  344. s.myleftwibox.width = dpi(9)
  345. s.layoutb.visible = false
  346. mylauncher.visible = false
  347. end)
  348. s.myleftwibox:connect_signal("mouse::enter", function()
  349. local s = awful.screen.focused()
  350. s.myleftwibox.width = dpi(38)
  351. s.layoutb.visible = true
  352. mylauncher.visible = true
  353. gears.surface.apply_shape_bounding(s.myleftwibox, dockshape)
  354. end)
  355. end
  356. function theme.at_screen_connect(s)
  357. -- Quake application
  358. s.quake = lain.util.quake({ app = awful.util.terminal, border = theme.border_width })
  359. -- If wallpaper is a function, call it with the screen
  360. local wallpaper = theme.wallpaper
  361. if type(wallpaper) == "function" then
  362. wallpaper = wallpaper(s)
  363. end
  364. gears.wallpaper.maximized(wallpaper, s, true)
  365. -- Tags
  366. awful.tag(awful.util.tagnames, s, awful.layout.layouts)
  367. -- Create a promptbox for each screen
  368. s.mypromptbox = awful.widget.prompt()
  369. s.mypromptbox.bg = "#00000000"
  370. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  371. -- We need one layoutbox per screen.
  372. s.mylayoutbox = awful.widget.layoutbox(s)
  373. s.mylayoutbox:buttons(my_table.join(
  374. awful.button({}, 1, function () awful.layout.inc( 1) end),
  375. awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
  376. awful.button({}, 3, function () awful.layout.inc(-1) end),
  377. awful.button({}, 4, function () awful.layout.inc( 1) end),
  378. awful.button({}, 5, function () awful.layout.inc(-1) end)))
  379. s.layoutb = wibox.container.margin(s.mylayoutbox, dpi(8), dpi(11), dpi(3), dpi(3))
  380. -- Create a taglist widget
  381. s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons, {
  382. font = theme.taglist_font,
  383. shape = gears.shape.rectangle,
  384. spacing = dpi(10),
  385. square_unsel = theme.square_unsel,
  386. bg_focus = barcolor
  387. }, nil, wibox.layout.fixed.vertical())
  388. -- Create a tasklist widget
  389. s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.focused, awful.util.tasklist_buttons, { bg_focus = "#00000000" })
  390. -- Create the wibox
  391. s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(25), bg = gears.color.create_png_pattern(theme.panelbg) })
  392. -- Add widgets to the wibox
  393. s.mywibox:setup {
  394. layout = wibox.layout.align.horizontal,
  395. expand = "none",
  396. { -- Left widgets
  397. layout = wibox.layout.fixed.horizontal,
  398. s.mypromptbox,
  399. tspace1,
  400. s.mytasklist,
  401. },
  402. { -- Middle widgets
  403. layout = wibox.layout.flex.horizontal,
  404. max_widget_size = 1500,
  405. mytextclock
  406. },
  407. { -- Right widgets
  408. layout = wibox.layout.fixed.horizontal,
  409. wibox.widget { nil, nil, theme.mpd.widget, layout = wibox.layout.align.horizontal },
  410. rspace0,
  411. --theme.weather.icon,
  412. --theme.weather.widget,
  413. rspace1,
  414. wificon,
  415. rspace0,
  416. volicon,
  417. rspace2,
  418. baticon,
  419. rspace3,
  420. wibox.widget.systray(),
  421. },
  422. }
  423. gears.timer.delayed_call(theme.vertical_wibox, s)
  424. end
  425. return theme