Advertisement
Guest User

Untitled

a guest
Oct 5th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.84 KB | None | 0 0
  1. local awful = require("awful")
  2. local gears = require("gears")
  3. local wibox = require("wibox")
  4. local beautiful = require("beautiful")
  5. --local xresources = require("beautiful.xresources")
  6. --local xrdb = xresources.get_current_theme()
  7.  
  8. local helpers = require("helpers")
  9. local keys = require("keys")
  10.  
  11. -- {{{ Widgets
  12. local desktop_mode_widget = require("noodle.desktop_mode_widget")
  13. local minimal_tasklist = require("noodle.minimal_tasklist")
  14.  
  15. -- Volume widget prefix
  16. volumebar_prefix = wibox.widget.textbox(" ")
  17. volumebar_prefix.markup = helpers.colorize_text(volumebar_prefix.text, beautiful.prefix_fg)
  18.  
  19. -- Keyboard map indicator and switcher
  20. keyboardlayout_prefix = wibox.widget.textbox(" ")
  21. keyboardlayout_prefix.markup = helpers.colorize_text(keyboardlayout_prefix.text, beautiful.prefix_fg)
  22. mykeyboardlayout = awful.widget.keyboardlayout()
  23.  
  24. -- Create a textclock widget that shows date
  25. date_prefix = wibox.widget.textbox(" ")
  26. date_prefix.markup = helpers.colorize_text(date_prefix.text, beautiful.prefix_fg)
  27. --mytextdate = wibox.widget.textclock("%a %d %B")
  28. mytextdate = wibox.widget.textclock("%j days around the sun") --HAHA very useful
  29. -- Create a textclock widget
  30. clock_prefix = wibox.widget.textbox(" ")
  31. clock_prefix.markup = helpers.colorize_text(clock_prefix.text, beautiful.prefix_fg)
  32. mytextclock = wibox.widget.textclock("%H:%M")
  33.  
  34. -- Create item separator
  35. textseparator = wibox.widget.textbox()
  36. textseparator.text = beautiful.separator_text
  37. textseparator.markup = helpers.colorize_text(textseparator.text, beautiful.separator_fg)
  38.  
  39. -- Create padding
  40. pad = wibox.widget.textbox(" ")
  41.  
  42. -- Create a wibox for each screen and add it
  43. local taglist_buttons = gears.table.join(
  44. awful.button({ }, 1, function(t) t:view_only() end),
  45. awful.button({ modkey }, 1, function(t)
  46. if client.focus then
  47. client.focus:move_to_tag(t)
  48. end
  49. end),
  50. awful.button({ }, 3, awful.tag.viewtoggle),
  51. awful.button({ modkey }, 3, function(t)
  52. if client.focus then
  53. client.focus:toggle_tag(t)
  54. end
  55. end),
  56. awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end),
  57. awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end)
  58. )
  59.  
  60. local tasklist_buttons = gears.table.join(
  61. awful.button({ }, 1,
  62. function (c)
  63. if c == client.focus then
  64. c.minimized = true
  65. else
  66. -- Without this, the following
  67. -- :isvisible() makes no sense
  68. c.minimized = false
  69. if not c:isvisible() and c.first_tag then
  70. c.first_tag:view_only()
  71. end
  72. -- This will also un-minimize
  73. -- the client, if needed
  74. client.focus = c
  75. c:raise()
  76. end
  77. end),
  78. -- Middle mouse button closes the window
  79. awful.button({ }, 2, function (c) c:kill() end),
  80. awful.button({ }, 3, helpers.client_menu_toggle()),
  81. awful.button({ }, 4, function ()
  82. awful.client.focus.byidx(-1)
  83. end),
  84. awful.button({ }, 5, function ()
  85. awful.client.focus.byidx(1)
  86. end)
  87. )
  88. -- }}}
  89.  
  90. awful.screen.connect_for_each_screen(function(s)
  91. -- Create a promptbox for each screen
  92. s.mypromptbox = awful.widget.prompt({prompt = " Run: ", fg = beautiful.prompt_fg})
  93. -- Create an imagebox widget which will contain an icon indicating which layout we're using.
  94. -- We need one layoutbox per screen.
  95. s.mylayoutbox = awful.widget.layoutbox(s)
  96. s.mylayoutbox:buttons(gears.table.join(
  97. awful.button({ }, 1, function () awful.layout.inc( 1) end),
  98. awful.button({ }, 3, function () awful.layout.inc(-1) end),
  99. awful.button({ }, 4, function () awful.layout.inc( 1) end),
  100. awful.button({ }, 5, function () awful.layout.inc(-1) end)))
  101. -- Create a taglist widget
  102. s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
  103. s.mytaglist.font = beautiful.font
  104.  
  105. -- Create a tasklist widget
  106. -- Show all clients
  107. --s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
  108. -- Show only focused client
  109. --s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.focused, tasklist_buttons)
  110. -- Show only minimized clients
  111. --s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.minimizedcurrenttags, tasklist_buttons)
  112.  
  113. -- Outer gaps
  114. --awful.screen.padding(awful.screen.focused(),{left = 28, right = 28, top = 28, bottom = 28})
  115.  
  116. -- Create a system tray widget
  117. s.systray = wibox.widget.systray()
  118. s.systray.visible = false -- can be toggled by a keybind
  119.  
  120. -- Wibar detached - Method: Transparent useless bar
  121. -- Requires compositor
  122. if beautiful.wibar_detached then
  123. s.useless_wibar = awful.wibar({ position = beautiful.wibar_position, screen = s, height = beautiful.screen_margin * 2, opacity = 0 })
  124. --TODO
  125. --s.useless_wibar:buttons(keys.desktopbuttons)
  126. end
  127. -- Create the wibox
  128. s.mywibox = awful.wibar({ position = beautiful.wibar_position, screen = s, width = beautiful.wibar_width, height = beautiful.wibar_height, shape = helpers.rrect(beautiful.wibar_border_radius)})
  129. -- Wibar items
  130. -- Add or remove widgets here
  131. s.mywibox:setup {
  132. layout = wibox.layout.align.horizontal,
  133. { -- Left widgets
  134. layout = wibox.layout.fixed.horizontal,
  135. --s.mylayoutbox,
  136. --mylauncher,
  137. s.mytaglist,
  138. textseparator,
  139. minimal_tasklist
  140. },
  141. { -- Middle widgets
  142. layout = wibox.layout.fixed.horizontal,
  143. --s.mypromptbox,
  144. --textseparator,
  145. --s.mytasklist,
  146. --minimal_tasklist
  147. },
  148. { -- Right widgets
  149. layout = wibox.layout.fixed.horizontal,
  150. --mpdarc_widget,
  151. --textseparator,
  152. --volumebar_prefix,
  153. --volumebar_widget,
  154. --textseparator,
  155. --keyboardlayout_prefix,
  156. --mykeyboardlayout,
  157. --textseparator,
  158. s.systray,
  159. --minimal_tasklist,
  160. textseparator,
  161. --date_prefix,
  162. mytextdate,
  163. textseparator,
  164. --clock_prefix,
  165. mytextclock,
  166. textseparator,
  167. desktop_mode_widget,
  168. pad,
  169. pad
  170. },
  171. }
  172.  
  173. -- Second (alternate panel)
  174. if beautiful.wibar_alt_enabled then
  175. if beautiful.wibar_alt_detached then
  176. s.useless_wibar_alt = awful.wibar({ position = beautiful.wibar_alt_position, screen = s, height = beautiful.screen_margin * 2, opacity = 0 })
  177. s.useless_wibar_alt:buttons(gears.table.join(
  178. --TODO
  179. --keys.desktopbuttons
  180. ))
  181. end
  182. s.mywibox_alt = awful.wibox({ position = beautiful.wibar_alt_position, screen = s, width = beautiful.wibar_alt_width, height = beautiful.wibar_alt_height, shape = helpers.rrect(beautiful.wibar_alt_border_radius)})
  183. -- Only set them if they exist, else they overwrite the position variable
  184. if beautiful.wibar_alt_x then
  185. s.mywibox_alt.x = beautiful.wibar_alt_x
  186. end
  187. if beautiful.wibar_alt_y then
  188. s.mywibox_alt.y = beautiful.wibar_alt_y
  189. end
  190. -- Second wibar items
  191. -- Add or remove widgets here
  192. s.mywibox_alt:setup {
  193. layout = wibox.layout.align.horizontal,
  194. { -- Left widgets
  195. layout = wibox.layout.fixed.horizontal,
  196. --pad,
  197. --s.mylayoutbox,
  198. --mylauncher,
  199. },
  200. { -- Middle widgets
  201. layout = wibox.layout.fixed.horizontal,
  202. --s.mypromptbox,
  203. --s.mytasklist,
  204. --textseparator,
  205. },
  206. { -- Right widgets
  207. layout = wibox.layout.fixed.horizontal,
  208. --mpdarc_widget,
  209. --textseparator,
  210. --volumebar_prefix,
  211. --volumebar_widget,
  212. --textseparator,
  213. --keyboardlayout_prefix,
  214. --mykeyboardlayout,
  215. --textseparator,
  216. s.systray,
  217. minimal_tasklist,
  218. textseparator,
  219. date_prefix,
  220. mytextdate,
  221. textseparator,
  222. clock_prefix,
  223. mytextclock,
  224. textseparator,
  225. desktop_mode_widget,
  226. pad
  227. },
  228. }
  229. end
  230.  
  231. -- Only set them if they exist, else they overwrite the position variable
  232. if beautiful.wibar_x then
  233. s.mywibox.x = beautiful.wibar_x
  234. end
  235. if beautiful.wibar_y then
  236. s.mywibox.y = beautiful.wibar_y
  237. end
  238.  
  239. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement