Compare commits
	
		
			10 Commits
		
	
	
		
			3a51bab1c8
			...
			c02b6ef68d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c02b6ef68d | |||
| ba2284cb65 | |||
| 3ee9ce2897 | |||
| fdcffa9650 | |||
| 4ac05d48a6 | |||
| 3017ac7e16 | |||
| 0bbff9ba62 | |||
| ef457f30af | |||
| 07e372b31c | |||
| dea630bf1e | 
| @@ -19,14 +19,16 @@ | ||||
|                 :focus true | ||||
|                 :keys (. keys :client) | ||||
|                 :buttons buttons | ||||
|                 :placement (+ awful.placement.no_overlap | ||||
|                               awful.placement.no_offscreen)}} | ||||
|                 :size_hints_honor false ;; fuck you terminals I know what I want | ||||
|                 :placement awful.placement.no_offscreen}} | ||||
|  | ||||
|   {:rule {:floating true} | ||||
|    :properties {:keys (. keys :floating)}} | ||||
|  | ||||
|   ;; Floating clients. | ||||
|   {:rule_any {:class ["Gpick"] | ||||
|   {:rule_any {:class ["Gpick" | ||||
|                       "Orage" | ||||
|                       "Pavucontrol"] | ||||
|               :name ["Event Tester"] ;; xev | ||||
|               :role ["pop-up" | ||||
|                      "xfce4-terminal-dropdown"]} | ||||
|   | ||||
| @@ -8,13 +8,12 @@ | ||||
| ;;; | ||||
| ;; Configuration | ||||
|  | ||||
| (local layouts [awful.layout.suit.tile | ||||
|                 awful.layout.suit.floating]) | ||||
| (local layouts [awful.layout.suit.tile]) | ||||
|  | ||||
| (set awful.layout.layouts layouts) | ||||
|  | ||||
| ;; TODO Rasterize? | ||||
| (local tags [:firefox.png :code.png :code.svg]) | ||||
| (local tags [:firefox.png :code.png :code.png :code.png :code.png :code.png]) | ||||
|  | ||||
| (let [icon-path (.. (os.getenv "HOME") "/.config/awesome/theme/icons/tag/")] | ||||
|  (awful.screen.connect_for_each_screen | ||||
| @@ -22,7 +21,6 @@ | ||||
|     (each [n tag (ipairs tags)] | ||||
|       (awful.tag.add | ||||
|        n {:icon (.. icon-path tag) | ||||
|           :icon_only true | ||||
|           :layout (. layouts 1) | ||||
|           :gap_single_client false | ||||
|           :gap beautiful.useless_gap | ||||
|   | ||||
| @@ -36,6 +36,7 @@ | ||||
| (async "tpset \"Natural Scrolling\" 1" (cb "tpset")) | ||||
| (async "tpset \"Tapping\" 1" (cb "tpset")) | ||||
| (spawn "setxkbmap -option caps:ctrl_modifier") | ||||
| (spawn "numlockx on") | ||||
|  | ||||
| (async (.. "feh --bg-fill " beautiful.wallpaper) (cb "feh")) | ||||
|  | ||||
|   | ||||
| @@ -10,25 +10,9 @@ | ||||
| (local gears (require :gears)) | ||||
| (local wibox (require :wibox)) | ||||
|  | ||||
| (local std (require :lib.std)) | ||||
|  | ||||
| ;; TODO Properly abstract these into a library | ||||
|  | ||||
| (local fun (require :lib.fun)) | ||||
| (local modifiers | ||||
|        {:mod "Mod4" | ||||
|         :alt "Mod1" | ||||
|         :super "Mod4" | ||||
|         :shift "Shift" | ||||
|         :ctrl "Control"}) | ||||
|  | ||||
| (fn map-mods [mods] | ||||
|   (->> mods | ||||
|      (fun.map (partial . modifiers)) | ||||
|      (fun.totable))) | ||||
|  | ||||
| (fn button [mods bc fun] | ||||
|   (awful.button (map-mods mods) bc fun)) | ||||
| (local std (require :lib.std)) | ||||
| (local button (. (require :lib.keys) :button)) | ||||
|  | ||||
| ;;; | ||||
| ;; Functions | ||||
|   | ||||
| @@ -4,12 +4,16 @@ | ||||
|  | ||||
| (local awful (require :awful)) | ||||
| (local beautiful (require :beautiful)) | ||||
| (local gears (require :gears)) | ||||
| (local dpi beautiful.xresources.apply_dpi) | ||||
| (local lain (require :lain)) | ||||
| (local wibox (require :wibox)) | ||||
|  | ||||
| (local std (require :lib.std)) | ||||
| (local button (. (require :lib.keys) :button)) | ||||
|  | ||||
| (local tag-list (require :widget.tag-list)) | ||||
| (local tag-number (require :widget.tag-number)) | ||||
| (local task-list (require :widget.task-list)) | ||||
| (local textclock (require :widget.textclock)) | ||||
|  | ||||
| @@ -33,6 +37,14 @@ | ||||
|    :align "center" | ||||
|    :widget wibox.container.place}) | ||||
|  | ||||
| (fn deftooltip [obj callback] | ||||
|   (awful.tooltip | ||||
|    {:objects [obj] | ||||
|     :timer_function callback | ||||
|     :delay_show 0.5 | ||||
|     :margin_leftright (dpi 10) | ||||
|     :margin_topbottom (dpi 8)})) | ||||
|  | ||||
| (local clock (textclock "%H\n%M")) | ||||
| (local systray (doto (wibox.widget.systray) | ||||
|                  (: :set_base_size 24) | ||||
| @@ -41,6 +53,26 @@ | ||||
| (local battery (require :widget.bat)) | ||||
| (local pulse (require :widget.pulse)) | ||||
|  | ||||
| (local clock-buttons | ||||
|        (gears.table.join | ||||
|         (button [] 1 (lambda [] (awful.spawn "orage"))))) | ||||
|  | ||||
| (fn bat-detail [] | ||||
|   (let [status _G.bat_now.status | ||||
|         statustxt (if (= status "Full") "charged" | ||||
|                       (= status "Charging") "charging" | ||||
|                       (= status "Discharging") "discharging" | ||||
|                       "N/A")] | ||||
|     (.. | ||||
|      "Level: " _G.bat_now.perc "%\n" | ||||
|      "Status: " statustxt "\n" | ||||
|      (if (or (= status "Charging") | ||||
|              (= status "Discharging")) | ||||
|          (.. "Time left: " _G.bat_now.time " hours") "")))) | ||||
|  | ||||
| (deftooltip clock (lambda [] (os.date "%A %d %B %Y"))) | ||||
| (deftooltip battery.widget bat-detail) | ||||
|  | ||||
| (fn draw-sidebar [s] | ||||
|   (set s.sb (awful.wibar {:position beautiful.sidebar_position | ||||
|                           :width beautiful.sidebar_width | ||||
| @@ -48,20 +80,27 @@ | ||||
|  | ||||
|   (: s.sb :setup | ||||
|      {:layout wibox.layout.align.vertical | ||||
|       1 {1 (border (tag-list s)) | ||||
|       1 {1 (border | ||||
|             {1 {1 (tag-number s) | ||||
|                 :forced_height 32 | ||||
|                 :align :center | ||||
|                 :widget wibox.container.place} | ||||
|              :bg beautiful.sidebar_bg_info | ||||
|              :widget wibox.container.background}) | ||||
|          2 (border (tag-list s)) | ||||
|          :layout wibox.layout.fixed.vertical} | ||||
|       2 {1 (border (center (task-list s)) 4) | ||||
|          :layout wibox.layout.flex.vertical} | ||||
|       3 {1 (center systray) | ||||
|          2 (center battery.widget) | ||||
|          3 {1 (border | ||||
|                {1 {1 (center clock) | ||||
|                    :top 2 | ||||
|                    :bottom 2 | ||||
|                    :widget wibox.container.margin} | ||||
|                 :widget wibox.container.background | ||||
|                 :bg beautiful.sidebar_bg_info}) | ||||
|             :layout wibox.layout.fixed.vertical} | ||||
|          3 (border | ||||
|             {1 {1 (center clock) | ||||
|                 :top 3 | ||||
|                 :bottom 3 | ||||
|                 :widget wibox.container.margin} | ||||
|              :buttons clock-buttons | ||||
|              :bg beautiful.sidebar_bg_info | ||||
|              :widget wibox.container.background}) | ||||
|          :layout wibox.layout.fixed.vertical}})) | ||||
|  | ||||
| ;;; | ||||
|   | ||||
| @@ -3,9 +3,10 @@ | ||||
| (let [theme-dir (.. (os.getenv "HOME") "/.config/awesome/theme") | ||||
|       icon-dir (.. theme-dir "/icons/")] | ||||
|   { | ||||
|    :font "Sarasa Mono J" | ||||
|    :variable_font "Sarasa UI J" | ||||
|    :textclock_font "Sarasa UI J" | ||||
|    :font "Sarasa UI J 10" | ||||
|    :font_mono "Sarasa Mono J Bold 10" | ||||
|  | ||||
|    :wallpaper (.. (os.getenv "HOME") "/pics/wp/sgIcOup.jpg") | ||||
|  | ||||
|    :sidebar_position :left     ;; * | ||||
|    :sidebar_width    36        ;; * | ||||
| @@ -16,7 +17,7 @@ | ||||
|    :fg_focus  "#cfcfcf" | ||||
|    :fg_normal "#cfcfcf" | ||||
|  | ||||
|    :useless_gap   0 | ||||
|    :useless_gap   2 | ||||
|    :border_width  0 | ||||
|    :border_focus  "#5bb3b4" | ||||
|    :border_normal "#1a1e24" | ||||
| @@ -25,7 +26,7 @@ | ||||
|  | ||||
|    :titlebar_position  :left ;; * | ||||
|    :titlebar_size      15    ;; * | ||||
|    :titlebar_bg_focus  "#926b3e" | ||||
|    :titlebar_bg_focus  "#5bb3b4" | ||||
|    :titlebar_bg_normal "#252b33" | ||||
|    :titlebar_fg_focus  "#1a1e24" | ||||
|    :titlebar_fg_normal "#cfcfcf" | ||||
| @@ -37,6 +38,6 @@ | ||||
|  | ||||
|    :taglist_bg_empty (.. "png:" icon-dir "tag-list/unselected.png") | ||||
|    :taglist_bg_focus (.. "png:" icon-dir "tag-list/selected.png") | ||||
|    :taglist_bg_occupied (.. "png:" icon-dir "tag-list/occupied.png") | ||||
|    :taglist_bg_occupied (.. "png:" icon-dir "tag-list/occupied-border.png") | ||||
|    :taglist_bg_urgent (.. "png:" icon-dir "tag-list/urgent.png") | ||||
|    }) | ||||
|   | ||||
| @@ -3,77 +3,107 @@ local dpi = require("beautiful").xresources.apply_dpi | ||||
| local wibox = require("wibox") | ||||
| local clickable_container = require("widget.clickable-container") | ||||
|  | ||||
| function list_update(w, buttons, label, data, objects) | ||||
|     -- update the widgets, creating them if needed | ||||
|     w:reset() | ||||
|     for i, o in ipairs(objects) do | ||||
|         local cache = data[o] | ||||
|         local ib, tb, bgb, tbm, ibm, l | ||||
|         if cache then | ||||
|             ib = cache.ib | ||||
|             tb = cache.tb | ||||
|             bgb = cache.bgb | ||||
|             tbm = cache.tbm | ||||
|             ibm = cache.ibm | ||||
|         else | ||||
|             ib = wibox.widget.imagebox() | ||||
|             tb = wibox.widget.textbox() | ||||
|             bgb = wibox.container.background() | ||||
|             tbm = wibox.container.margin(tb, dpi(4), dpi(4)) | ||||
|             ibm = wibox.container.margin(ib, dpi(10), dpi(8), dpi(8), dpi(8)) | ||||
|             -- ibm = wibox.container.margin(ib, dpi(4)) | ||||
|             l = wibox.layout.fixed.horizontal() | ||||
|             bg_clickable = clickable_container() | ||||
| local capi = {button = _G.button} | ||||
|  | ||||
|             -- All of this is added in a fixed widget | ||||
|             l:fill_space(true) | ||||
|             l:add(ibm) | ||||
|             -- l:add(tbm) | ||||
|             bg_clickable:set_widget(l) | ||||
|  | ||||
|             -- And all of this gets a background | ||||
|             -- bgb:set_widget(l) | ||||
|             bgb:set_widget(bg_clickable) | ||||
|  | ||||
|             bgb:buttons(common.create_buttons(buttons, o)) | ||||
|  | ||||
|             data[o] = { | ||||
|                 ib  = ib, | ||||
|                 tb  = tb, | ||||
|                 bgb = bgb, | ||||
|                 tbm = tbm, | ||||
|                 ibm = ibm, | ||||
|             } | ||||
|         end | ||||
|  | ||||
|         local text, bg, bg_image, icon, args = label(o, tb) | ||||
|         args = args or {} | ||||
|  | ||||
|         -- The text might be invalid, so use pcall. | ||||
|         if text == nil or text == "" then | ||||
|             tbm:set_margins(0) | ||||
|         else | ||||
|             if not tb:set_markup_silently(text) then | ||||
|                 tb:set_markup("<i><Invalid text></i>") | ||||
| function create_buttons(buttons, object) | ||||
|    if buttons then | ||||
|       local btns = {} | ||||
|       for _, b in ipairs(buttons) do | ||||
|          -- Create a proxy button object: it will receive the real | ||||
|          -- press and release events, and will propagate them to the | ||||
|          -- button object the user provided, but with the object as | ||||
|          -- argument. | ||||
|          local btn = capi.button {modifiers = b.modifiers, button = b.button} | ||||
|          btn:connect_signal( | ||||
|             'press', | ||||
|             function() | ||||
|                b:emit_signal('press', object) | ||||
|             end | ||||
|         end | ||||
|         bgb:set_bg(bg) | ||||
|         if type(bg_image) == "function" then | ||||
|             -- TODO: Why does this pass nil as an argument? | ||||
|             bg_image = bg_image(tb,o,nil,objects,i) | ||||
|         end | ||||
|         bgb:set_bgimage(bg_image) | ||||
|         if icon then | ||||
|             ib:set_image(icon) | ||||
|         else | ||||
|             ibm:set_margins(0) | ||||
|         end | ||||
|          ) | ||||
|          btn:connect_signal( | ||||
|             'release', | ||||
|             function() | ||||
|                b:emit_signal('release', object) | ||||
|             end | ||||
|          ) | ||||
|          btns[#btns + 1] = btn | ||||
|       end | ||||
|  | ||||
|         bgb.shape              = args.shape | ||||
|         bgb.shape_border_width = args.shape_border_width | ||||
|         bgb.shape_border_color = args.shape_border_color | ||||
|       return btns | ||||
|    end | ||||
| end | ||||
|  | ||||
|         w:add(bgb) | ||||
| function list_update(w, buttons, label, data, objects) | ||||
|    -- update the widgets, creating them if needed | ||||
|    w:reset() | ||||
|    for i, o in ipairs(objects) do | ||||
|       local cache = data[o] | ||||
|       local ib, tb, bgb, tbm, ibm, l | ||||
|       if cache then | ||||
|          ib = cache.ib | ||||
|          tb = cache.tb | ||||
|          bgb = cache.bgb | ||||
|          tbm = cache.tbm | ||||
|          ibm = cache.ibm | ||||
|       else | ||||
|          ib = wibox.widget.imagebox() | ||||
|          tb = wibox.widget.textbox() | ||||
|          bgb = wibox.container.background() | ||||
|          tbm = wibox.container.margin(tb, dpi(4), dpi(4)) | ||||
|          ibm = wibox.container.margin(ib, dpi(10), dpi(8), dpi(8), dpi(8)) | ||||
|          -- ibm = wibox.container.margin(ib, dpi(4)) | ||||
|          l = wibox.layout.fixed.horizontal() | ||||
|          bg_clickable = clickable_container() | ||||
|  | ||||
|          -- All of this is added in a fixed widget | ||||
|          l:fill_space(true) | ||||
|          l:add(ibm) | ||||
|          -- l:add(tbm) | ||||
|          bg_clickable:set_widget(l) | ||||
|  | ||||
|          -- And all of this gets a background | ||||
|          -- bgb:set_widget(l) | ||||
|          bgb:set_widget(bg_clickable) | ||||
|  | ||||
|          bgb:buttons(create_buttons(buttons, o)) | ||||
|  | ||||
|          data[o] = { | ||||
|             ib  = ib, | ||||
|             tb  = tb, | ||||
|             bgb = bgb, | ||||
|             tbm = tbm, | ||||
|             ibm = ibm, | ||||
|          } | ||||
|       end | ||||
|  | ||||
|       local text, bg, bg_image, icon, args = label(o, tb) | ||||
|       args = args or {} | ||||
|  | ||||
|       -- The text might be invalid, so use pcall. | ||||
|       if text == nil or text == "" then | ||||
|          tbm:set_margins(0) | ||||
|       else | ||||
|          if not tb:set_markup_silently(text) then | ||||
|             tb:set_markup("<i><Invalid text></i>") | ||||
|          end | ||||
|       end | ||||
|       bgb:set_bg(bg) | ||||
|       if type(bg_image) == "function" then | ||||
|          -- TODO: Why does this pass nil as an argument? | ||||
|          bg_image = bg_image(tb,o,nil,objects,i) | ||||
|       end | ||||
|       bgb:set_bgimage(bg_image) | ||||
|       if icon then | ||||
|          ib:set_image(icon) | ||||
|       else | ||||
|          ibm:set_margins(0) | ||||
|       end | ||||
|  | ||||
|       bgb.shape              = args.shape | ||||
|       bgb.shape_border_width = args.shape_border_width | ||||
|       bgb.shape_border_color = args.shape_border_color | ||||
|  | ||||
|       w:add(bgb) | ||||
|    end | ||||
| end | ||||
|  | ||||
|   | ||||
| @@ -4,10 +4,12 @@ | ||||
|  | ||||
| (local awful (require :awful)) | ||||
| (local beautiful (require :beautiful)) | ||||
| (local gears (require :gears)) | ||||
| (local wibox (require :wibox)) | ||||
| (local common (require :awful.widget.common)) | ||||
| (local dpi (. (require :beautiful) :xresources :apply_dpi)) | ||||
|  | ||||
| (local button (. (require :lib.keys) :button)) | ||||
| (local std (require :lib.std)) | ||||
|  | ||||
| ;;; | ||||
| @@ -93,7 +95,11 @@ | ||||
|   (awful.widget.taglist | ||||
|    s | ||||
|    awful.widget.taglist.filter.all | ||||
|    {} | ||||
|    (gears.table.join | ||||
|     (button [] 1 (lambda [t] (: t :view_only))) | ||||
|     (button [] 3 (lambda [t] (when _G.client.focus (: _G.client.focus :move_to_tag t)))) | ||||
|     (button [] 4 (lambda [t] (awful.tag.viewnext t.screen))) | ||||
|     (button [] 5 (lambda [t] (awful.tag.viewprev t.screen)))) | ||||
|    {:font (.. beautiful.font " Bold 10") | ||||
|     :spacing 2} | ||||
|    ;; update-tag-list | ||||
|   | ||||
							
								
								
									
										20
									
								
								widget/tag-number.fnl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								widget/tag-number.fnl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| (local awful (require :awful)) | ||||
| (local beautiful (require :beautiful)) | ||||
| (local wibox (require :wibox)) | ||||
|  | ||||
| (fn tag-number [s] | ||||
|   (awful.widget.taglist | ||||
|    s | ||||
|    awful.widget.taglist.filter.selected | ||||
|    {} | ||||
|    {:taglist_disable_icon true | ||||
|     :bg_empty beautiful.bg_normal | ||||
|     :bg_focus beautiful.bg_focus | ||||
|     :bg_occupied beautiful.bg_normal | ||||
|     :bg_urgent beautiful.bg_normal | ||||
|     :font beautiful.font_mono} | ||||
|    awful.widget.common.list_update | ||||
|    ;; (require :widget.list_update) | ||||
|    (wibox.layout.fixed.vertical))) | ||||
|  | ||||
| tag-number | ||||
		Reference in New Issue
	
	Block a user