My configuration files for Debian/Ubuntu applications
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

407 lines
19 KiB

  1. --[[
  2. Powerarrow 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, os = math, string, 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/powerarrow"
  14. theme.wallpaper = theme.dir .. "/wall.png"
  15. theme.font = "Liberation Mono 9"
  16. theme.fg_normal = "#FEFEFE"
  17. theme.fg_focus = "#32D6FF"
  18. theme.fg_urgent = "#C83F11"
  19. theme.bg_normal = "#222222"
  20. theme.bg_focus = "#1E2320"
  21. theme.bg_urgent = "#3F3F3F"
  22. theme.taglist_fg_focus = "#00CCFF"
  23. theme.tasklist_bg_focus = "#222222"
  24. theme.tasklist_fg_focus = "#00CCFF"
  25. theme.border_width = dpi(2)
  26. theme.border_normal = "#3F3F3F"
  27. theme.border_focus = "#6F6F6F"
  28. theme.border_marked = "#CC9393"
  29. theme.titlebar_bg_focus = "#3F3F3F"
  30. theme.titlebar_bg_normal = "#3F3F3F"
  31. theme.titlebar_bg_focus = theme.bg_focus
  32. theme.titlebar_bg_normal = theme.bg_normal
  33. theme.titlebar_fg_focus = theme.fg_focus
  34. theme.menu_height = dpi(16)
  35. theme.menu_width = dpi(140)
  36. theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png"
  37. theme.awesome_icon = theme.dir .. "/icons/awesome.png"
  38. theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png"
  39. theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png"
  40. theme.layout_tile = theme.dir .. "/icons/tile.png"
  41. theme.layout_tileleft = theme.dir .. "/icons/tileleft.png"
  42. theme.layout_tilebottom = theme.dir .. "/icons/tilebottom.png"
  43. theme.layout_tiletop = theme.dir .. "/icons/tiletop.png"
  44. theme.layout_fairv = theme.dir .. "/icons/fairv.png"
  45. theme.layout_fairh = theme.dir .. "/icons/fairh.png"
  46. theme.layout_spiral = theme.dir .. "/icons/spiral.png"
  47. theme.layout_dwindle = theme.dir .. "/icons/dwindle.png"
  48. theme.layout_max = theme.dir .. "/icons/max.png"
  49. theme.layout_fullscreen = theme.dir .. "/icons/fullscreen.png"
  50. theme.layout_magnifier = theme.dir .. "/icons/magnifier.png"
  51. theme.layout_floating = theme.dir .. "/icons/floating.png"
  52. theme.widget_ac = theme.dir .. "/icons/ac.png"
  53. theme.widget_battery = theme.dir .. "/icons/battery.png"
  54. theme.widget_battery_low = theme.dir .. "/icons/battery_low.png"
  55. theme.widget_battery_empty = theme.dir .. "/icons/battery_empty.png"
  56. theme.widget_brightness = theme.dir .. "/icons/brightness.png"
  57. theme.widget_mem = theme.dir .. "/icons/mem.png"
  58. theme.widget_cpu = theme.dir .. "/icons/cpu.png"
  59. theme.widget_temp = theme.dir .. "/icons/temp.png"
  60. theme.widget_net = theme.dir .. "/icons/net.png"
  61. theme.widget_hdd = theme.dir .. "/icons/hdd.png"
  62. theme.widget_music = theme.dir .. "/icons/note.png"
  63. theme.widget_music_on = theme.dir .. "/icons/note_on.png"
  64. theme.widget_music_pause = theme.dir .. "/icons/pause.png"
  65. theme.widget_music_stop = theme.dir .. "/icons/stop.png"
  66. theme.widget_vol = theme.dir .. "/icons/vol.png"
  67. theme.widget_vol_low = theme.dir .. "/icons/vol_low.png"
  68. theme.widget_vol_no = theme.dir .. "/icons/vol_no.png"
  69. theme.widget_vol_mute = theme.dir .. "/icons/vol_mute.png"
  70. theme.widget_mail = theme.dir .. "/icons/mail.png"
  71. theme.widget_mail_on = theme.dir .. "/icons/mail_on.png"
  72. theme.widget_task = theme.dir .. "/icons/task.png"
  73. theme.widget_scissors = theme.dir .. "/icons/scissors.png"
  74. theme.tasklist_plain_task_name = true
  75. theme.tasklist_disable_icon = true
  76. theme.useless_gap = 20
  77. theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close_focus.png"
  78. theme.titlebar_close_button_normal = theme.dir .. "/icons/titlebar/close_normal.png"
  79. theme.titlebar_ontop_button_focus_active = theme.dir .. "/icons/titlebar/ontop_focus_active.png"
  80. theme.titlebar_ontop_button_normal_active = theme.dir .. "/icons/titlebar/ontop_normal_active.png"
  81. theme.titlebar_ontop_button_focus_inactive = theme.dir .. "/icons/titlebar/ontop_focus_inactive.png"
  82. theme.titlebar_ontop_button_normal_inactive = theme.dir .. "/icons/titlebar/ontop_normal_inactive.png"
  83. theme.titlebar_sticky_button_focus_active = theme.dir .. "/icons/titlebar/sticky_focus_active.png"
  84. theme.titlebar_sticky_button_normal_active = theme.dir .. "/icons/titlebar/sticky_normal_active.png"
  85. theme.titlebar_sticky_button_focus_inactive = theme.dir .. "/icons/titlebar/sticky_focus_inactive.png"
  86. theme.titlebar_sticky_button_normal_inactive = theme.dir .. "/icons/titlebar/sticky_normal_inactive.png"
  87. theme.titlebar_floating_button_focus_active = theme.dir .. "/icons/titlebar/floating_focus_active.png"
  88. theme.titlebar_floating_button_normal_active = theme.dir .. "/icons/titlebar/floating_normal_active.png"
  89. theme.titlebar_floating_button_focus_inactive = theme.dir .. "/icons/titlebar/floating_focus_inactive.png"
  90. theme.titlebar_floating_button_normal_inactive = theme.dir .. "/icons/titlebar/floating_normal_inactive.png"
  91. theme.titlebar_maximized_button_focus_active = theme.dir .. "/icons/titlebar/maximized_focus_active.png"
  92. theme.titlebar_maximized_button_normal_active = theme.dir .. "/icons/titlebar/maximized_normal_active.png"
  93. theme.titlebar_maximized_button_focus_inactive = theme.dir .. "/icons/titlebar/maximized_focus_inactive.png"
  94. theme.titlebar_maximized_button_normal_inactive = theme.dir .. "/icons/titlebar/maximized_normal_inactive.png"
  95. local markup = lain.util.markup
  96. local separators = lain.util.separators
  97. local clockicon = wibox.widget.imagebox(theme.widget_clock)
  98. local clock = awful.widget.watch(
  99. "date +'%a %d %b %R'", 60,
  100. function(widget, stdout)
  101. widget:set_markup(" " .. markup.font(theme.font, stdout))
  102. end
  103. )
  104. -- Binary clock
  105. -- local binclock = require("themes.powerarrow.binclock"){
  106. -- height = dpi(32),
  107. -- show_seconds = true,
  108. -- color_active = theme.fg_normal,
  109. -- color_inactive = theme.bg_focus
  110. -- }
  111. -- Calendar
  112. theme.cal = lain.widget.cal({
  113. --cal = "cal --color=always",
  114. attach_to = { clock },
  115. notification_preset = {
  116. font = "Liberation Mono 10",
  117. fg = theme.fg_normal,
  118. bg = theme.bg_normal
  119. }
  120. })
  121. -- Taskwarrior
  122. local task = wibox.widget.imagebox(theme.widget_task)
  123. lain.widget.contrib.task.attach(task, {
  124. -- do not colorize output
  125. show_cmd = "task | sed -r 's/\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g'"
  126. })
  127. task:buttons(my_table.join(awful.button({}, 1, lain.widget.contrib.task.prompt)))
  128. -- Scissors (xsel copy and paste)
  129. local scissors = wibox.widget.imagebox(theme.widget_scissors)
  130. scissors:buttons(my_table.join(awful.button({}, 1, function() awful.spawn.with_shell("xsel | xsel -i -b") end)))
  131. -- Mail IMAP check
  132. --[[ commented because it needs to be set before use
  133. local mailicon = wibox.widget.imagebox(theme.widget_mail)
  134. mailicon:buttons(my_table.join(awful.button({ }, 1, function () awful.spawn(mail) end)))
  135. theme.mail = lain.widget.imap({
  136. timeout = 180,
  137. server = "server",
  138. mail = "mail",
  139. password = "keyring get mail",
  140. settings = function()
  141. if mailcount > 0 then
  142. widget:set_text(" " .. mailcount .. " ")
  143. mailicon:set_image(theme.widget_mail_on)
  144. else
  145. widget:set_text("")
  146. mailicon:set_image(theme.widget_mail)
  147. end
  148. end
  149. })
  150. --]]
  151. -- ALSA volume
  152. theme.volume = lain.widget.alsabar({
  153. --togglechannel = "IEC958,3",
  154. notification_preset = { font = "Terminus 10", fg = theme.fg_normal },
  155. })
  156. -- MPD
  157. local musicplr = awful.util.terminal .. " -title Music -g 130x34-320+16 -e ncmpcpp"
  158. local mpdicon = wibox.widget.imagebox(theme.widget_music)
  159. mpdicon:buttons(my_table.join(
  160. awful.button({ modkey }, 1, function () awful.spawn.with_shell(musicplr) end),
  161. awful.button({ }, 1, function ()
  162. os.execute("mpc prev")
  163. theme.mpd.update()
  164. end),
  165. awful.button({ }, 2, function ()
  166. os.execute("mpc toggle")
  167. theme.mpd.update()
  168. end),
  169. awful.button({ }, 3, function ()
  170. os.execute("mpc next")
  171. theme.mpd.update()
  172. end)))
  173. theme.mpd = lain.widget.mpd({
  174. settings = function()
  175. if mpd_now.state == "play" then
  176. artist = " " .. mpd_now.artist .. " "
  177. title = mpd_now.title .. " "
  178. mpdicon:set_image(theme.widget_music_on)
  179. widget:set_markup(markup.font(theme.font, markup("#FF8466", artist) .. " " .. title))
  180. elseif mpd_now.state == "pause" then
  181. widget:set_markup(markup.font(theme.font, " mpd paused "))
  182. mpdicon:set_image(theme.widget_music_pause)
  183. else
  184. widget:set_text("")
  185. mpdicon:set_image(theme.widget_music)
  186. end
  187. end
  188. })
  189. -- MEM
  190. local memicon = wibox.widget.imagebox(theme.widget_mem)
  191. local mem = lain.widget.mem({
  192. settings = function()
  193. widget:set_markup(markup.font(theme.font, " " .. mem_now.used .. "MB "))
  194. end
  195. })
  196. -- CPU
  197. local cpuicon = wibox.widget.imagebox(theme.widget_cpu)
  198. local cpu = lain.widget.cpu({
  199. settings = function()
  200. widget:set_markup(markup.font(theme.font, " " .. cpu_now.usage .. "% "))
  201. end
  202. })
  203. --[[ Coretemp (lm_sensors, per core)
  204. local tempwidget = awful.widget.watch({awful.util.shell, '-c', 'sensors | grep Core'}, 30,
  205. function(widget, stdout)
  206. local temps = ""
  207. for line in stdout:gmatch("[^\r\n]+") do
  208. temps = temps .. line:match("+(%d+).*°C") .. "° " -- in Celsius
  209. end
  210. widget:set_markup(markup.font(theme.font, " " .. temps))
  211. end)
  212. --]]
  213. -- Coretemp (lain, average)
  214. local temp = lain.widget.temp({
  215. settings = function()
  216. widget:set_markup(markup.font(theme.font, " " .. coretemp_now .. "°C "))
  217. end
  218. })
  219. --]]
  220. local tempicon = wibox.widget.imagebox(theme.widget_temp)
  221. -- / fs
  222. local fsicon = wibox.widget.imagebox(theme.widget_hdd)
  223. -- commented because it needs Gio/Glib >= 2.54
  224. theme.fs = lain.widget.fs({
  225. notification_preset = { fg = theme.fg_normal, bg = theme.bg_normal, font = "Terminus 10" },
  226. settings = function()
  227. local fsp = string.format(" %3.2f %s ", fs_now["/"].free, fs_now["/"].units)
  228. widget:set_markup(markup.font(theme.font, fsp))
  229. end
  230. })
  231. -- Battery
  232. local baticon = wibox.widget.imagebox(theme.widget_battery)
  233. local bat = lain.widget.bat({
  234. settings = function()
  235. if bat_now.status and bat_now.status ~= "N/A" then
  236. if bat_now.ac_status == 1 then
  237. widget:set_markup(markup.font(theme.font, " AC "))
  238. baticon:set_image(theme.widget_ac)
  239. return
  240. elseif not bat_now.perc and tonumber(bat_now.perc) <= 5 then
  241. baticon:set_image(theme.widget_battery_empty)
  242. elseif not bat_now.perc and tonumber(bat_now.perc) <= 15 then
  243. baticon:set_image(theme.widget_battery_low)
  244. else
  245. baticon:set_image(theme.widget_battery)
  246. end
  247. widget:set_markup(markup.font(theme.font, " " .. bat_now.perc .. "% "))
  248. else
  249. widget:set_markup()
  250. baticon:set_image(theme.widget_ac)
  251. end
  252. end
  253. })
  254. -- Net
  255. local neticon = wibox.widget.imagebox(theme.widget_net)
  256. local net = lain.widget.net({
  257. settings = function()
  258. widget:set_markup(markup.fontfg(theme.font, "#FEFEFE", " " .. net_now.received .. " ↓↑ " .. net_now.sent .. " "))
  259. end
  260. })
  261. -- Brigtness
  262. local brighticon = wibox.widget.imagebox(theme.widget_brightness)
  263. -- If you use xbacklight, comment the line with "light -G" and uncomment the line bellow
  264. -- local brightwidget = awful.widget.watch('xbacklight -get', 0.1,
  265. local brightwidget = awful.widget.watch('light -G', 0.1,
  266. function(widget, stdout, stderr, exitreason, exitcode)
  267. local brightness_level = tonumber(string.format("%.0f", stdout))
  268. widget:set_markup(markup.font(theme.font, " " .. brightness_level .. "%"))
  269. end)
  270. -- Separators
  271. local arrow = separators.arrow_left
  272. function theme.powerline_rl(cr, width, height)
  273. local arrow_depth, offset = height/2, 0
  274. -- Avoid going out of the (potential) clip area
  275. if arrow_depth < 0 then
  276. width = width + 2*arrow_depth
  277. offset = -arrow_depth
  278. end
  279. cr:move_to(offset + arrow_depth , 0 )
  280. cr:line_to(offset + width , 0 )
  281. cr:line_to(offset + width - arrow_depth , height/2 )
  282. cr:line_to(offset + width , height )
  283. cr:line_to(offset + arrow_depth , height )
  284. cr:line_to(offset , height/2 )
  285. cr:close_path()
  286. end
  287. local function pl(widget, bgcolor, padding)
  288. return wibox.container.background(wibox.container.margin(widget, dpi(16), dpi(16)), bgcolor, theme.powerline_rl)
  289. end
  290. function theme.at_screen_connect(s)
  291. -- Quake application
  292. s.quake = lain.util.quake({ app = awful.util.terminal })
  293. -- If wallpaper is a function, call it with the screen
  294. local wallpaper = theme.wallpaper
  295. if type(wallpaper) == "function" then
  296. wallpaper = wallpaper(s)
  297. end
  298. gears.wallpaper.maximized(wallpaper, s, true)
  299. -- Tags
  300. awful.tag(awful.util.tagnames, s, awful.layout.layouts)
  301. -- Create a promptbox for each screen
  302. s.mypromptbox = awful.widget.prompt()
  303. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  304. -- We need one layoutbox per screen.
  305. s.mylayoutbox = awful.widget.layoutbox(s)
  306. s.mylayoutbox:buttons(my_table.join(
  307. awful.button({}, 1, function () awful.layout.inc( 1) end),
  308. awful.button({}, 2, function () awful.layout.set( awful.layout.layouts[1] ) end),
  309. awful.button({}, 3, function () awful.layout.inc(-1) end),
  310. awful.button({}, 4, function () awful.layout.inc( 1) end),
  311. awful.button({}, 5, function () awful.layout.inc(-1) end)))
  312. -- Create a taglist widget
  313. s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons)
  314. -- Create a tasklist widget
  315. s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons)
  316. -- Create the wibox
  317. s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(16), bg = theme.bg_normal, fg = theme.fg_normal })
  318. -- Add widgets to the wibox
  319. s.mywibox:setup {
  320. layout = wibox.layout.align.horizontal,
  321. { -- Left widgets
  322. layout = wibox.layout.fixed.horizontal,
  323. --spr,
  324. s.mytaglist,
  325. s.mypromptbox,
  326. spr,
  327. },
  328. s.mytasklist, -- Middle widget
  329. { -- Right widgets
  330. layout = wibox.layout.fixed.horizontal,
  331. wibox.widget.systray(),
  332. wibox.container.margin(scissors, dpi(4), dpi(8)),
  333. --[[ using shapes
  334. pl(wibox.widget { mpdicon, theme.mpd.widget, layout = wibox.layout.align.horizontal }, "#343434"),
  335. pl(task, "#343434"),
  336. --pl(wibox.widget { mailicon, mail and theme.mail.widget, layout = wibox.layout.align.horizontal }, "#343434"),
  337. pl(wibox.widget { memicon, mem.widget, layout = wibox.layout.align.horizontal }, "#777E76"),
  338. pl(wibox.widget { cpuicon, cpu.widget, layout = wibox.layout.align.horizontal }, "#4B696D"),
  339. pl(wibox.widget { tempicon, temp.widget, layout = wibox.layout.align.horizontal }, "#4B3B51"),
  340. --pl(wibox.widget { fsicon, theme.fs and theme.fs.widget, layout = wibox.layout.align.horizontal }, "#CB755B"),
  341. pl(wibox.widget { baticon, bat.widget, layout = wibox.layout.align.horizontal }, "#8DAA9A"),
  342. pl(wibox.widget { neticon, net.widget, layout = wibox.layout.align.horizontal }, "#C0C0A2"),
  343. pl(binclock.widget, "#777E76"),
  344. --]]
  345. -- using separators
  346. arrow(theme.bg_normal, "#343434"),
  347. wibox.container.background(wibox.container.margin(wibox.widget { mailicon, theme.mail and theme.mail.widget, layout = wibox.layout.align.horizontal }, dpi(4), dpi(7)), "#343434"),
  348. arrow("#343434", theme.bg_normal),
  349. wibox.container.background(wibox.container.margin(wibox.widget { mpdicon, theme.mpd.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(6)), theme.bg_focus),
  350. arrow(theme.bg_normal, "#343434"),
  351. wibox.container.background(wibox.container.margin(task, dpi(3), dpi(7)), "#343434"),
  352. arrow("#343434", "#777E76"),
  353. wibox.container.background(wibox.container.margin(wibox.widget { memicon, mem.widget, layout = wibox.layout.align.horizontal }, dpi(2), dpi(3)), "#777E76"),
  354. arrow("#777E76", "#4B696D"),
  355. wibox.container.background(wibox.container.margin(wibox.widget { cpuicon, cpu.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(4)), "#4B696D"),
  356. arrow("#4B696D", "#4B3B51"),
  357. wibox.container.background(wibox.container.margin(wibox.widget { tempicon, temp.widget, layout = wibox.layout.align.horizontal }, dpi(4), dpi(4)), "#4B3B51"),
  358. arrow("#4B3B51", "#CB755B"),
  359. wibox.container.background(wibox.container.margin(wibox.widget { fsicon, theme.fs and theme.fs.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(3)), "#CB755B"),
  360. arrow("#CB755B", "#8DAA9A"),
  361. wibox.container.background(wibox.container.margin(wibox.widget { baticon, bat.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(3)), "#8DAA9A"),
  362. arrow("#8DAA9A", "#C0C0A2"),
  363. wibox.container.background(wibox.container.margin(wibox.widget { nil, neticon, net.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(3)), "#C0C0A2"),
  364. arrow("#C0C0A2", "#777E76"),
  365. wibox.container.background(wibox.container.margin(clock, dpi(4), dpi(8)), "#777E76"),
  366. arrow("#777E76", "alpha"),
  367. --]]
  368. s.mylayoutbox,
  369. },
  370. }
  371. end
  372. return theme