Compare commits

..

10 Commits

9 changed files with 189 additions and 108 deletions

View File

@ -19,14 +19,16 @@
:focus true :focus true
:keys (. keys :client) :keys (. keys :client)
:buttons buttons :buttons buttons
:placement (+ awful.placement.no_overlap :size_hints_honor false ;; fuck you terminals I know what I want
awful.placement.no_offscreen)}} :placement awful.placement.no_offscreen}}
{:rule {:floating true} {:rule {:floating true}
:properties {:keys (. keys :floating)}} :properties {:keys (. keys :floating)}}
;; Floating clients. ;; Floating clients.
{:rule_any {:class ["Gpick"] {:rule_any {:class ["Gpick"
"Orage"
"Pavucontrol"]
:name ["Event Tester"] ;; xev :name ["Event Tester"] ;; xev
:role ["pop-up" :role ["pop-up"
"xfce4-terminal-dropdown"]} "xfce4-terminal-dropdown"]}

View File

@ -8,13 +8,12 @@
;;; ;;;
;; Configuration ;; Configuration
(local layouts [awful.layout.suit.tile (local layouts [awful.layout.suit.tile])
awful.layout.suit.floating])
(set awful.layout.layouts layouts) (set awful.layout.layouts layouts)
;; TODO Rasterize? ;; 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/")] (let [icon-path (.. (os.getenv "HOME") "/.config/awesome/theme/icons/tag/")]
(awful.screen.connect_for_each_screen (awful.screen.connect_for_each_screen
@ -22,7 +21,6 @@
(each [n tag (ipairs tags)] (each [n tag (ipairs tags)]
(awful.tag.add (awful.tag.add
n {:icon (.. icon-path tag) n {:icon (.. icon-path tag)
:icon_only true
:layout (. layouts 1) :layout (. layouts 1)
:gap_single_client false :gap_single_client false
:gap beautiful.useless_gap :gap beautiful.useless_gap

View File

@ -36,6 +36,7 @@
(async "tpset \"Natural Scrolling\" 1" (cb "tpset")) (async "tpset \"Natural Scrolling\" 1" (cb "tpset"))
(async "tpset \"Tapping\" 1" (cb "tpset")) (async "tpset \"Tapping\" 1" (cb "tpset"))
(spawn "setxkbmap -option caps:ctrl_modifier") (spawn "setxkbmap -option caps:ctrl_modifier")
(spawn "numlockx on")
(async (.. "feh --bg-fill " beautiful.wallpaper) (cb "feh")) (async (.. "feh --bg-fill " beautiful.wallpaper) (cb "feh"))

View File

@ -10,25 +10,9 @@
(local gears (require :gears)) (local gears (require :gears))
(local wibox (require :wibox)) (local wibox (require :wibox))
(local std (require :lib.std))
;; TODO Properly abstract these into a library
(local fun (require :lib.fun)) (local fun (require :lib.fun))
(local modifiers (local std (require :lib.std))
{:mod "Mod4" (local button (. (require :lib.keys) :button))
: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))
;;; ;;;
;; Functions ;; Functions

View File

@ -4,12 +4,16 @@
(local awful (require :awful)) (local awful (require :awful))
(local beautiful (require :beautiful)) (local beautiful (require :beautiful))
(local gears (require :gears))
(local dpi beautiful.xresources.apply_dpi)
(local lain (require :lain)) (local lain (require :lain))
(local wibox (require :wibox)) (local wibox (require :wibox))
(local std (require :lib.std)) (local std (require :lib.std))
(local button (. (require :lib.keys) :button))
(local tag-list (require :widget.tag-list)) (local tag-list (require :widget.tag-list))
(local tag-number (require :widget.tag-number))
(local task-list (require :widget.task-list)) (local task-list (require :widget.task-list))
(local textclock (require :widget.textclock)) (local textclock (require :widget.textclock))
@ -33,6 +37,14 @@
:align "center" :align "center"
:widget wibox.container.place}) :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 clock (textclock "%H\n%M"))
(local systray (doto (wibox.widget.systray) (local systray (doto (wibox.widget.systray)
(: :set_base_size 24) (: :set_base_size 24)
@ -41,6 +53,26 @@
(local battery (require :widget.bat)) (local battery (require :widget.bat))
(local pulse (require :widget.pulse)) (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] (fn draw-sidebar [s]
(set s.sb (awful.wibar {:position beautiful.sidebar_position (set s.sb (awful.wibar {:position beautiful.sidebar_position
:width beautiful.sidebar_width :width beautiful.sidebar_width
@ -48,20 +80,27 @@
(: s.sb :setup (: s.sb :setup
{:layout wibox.layout.align.vertical {: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} :layout wibox.layout.fixed.vertical}
2 {1 (border (center (task-list s)) 4) 2 {1 (border (center (task-list s)) 4)
:layout wibox.layout.flex.vertical} :layout wibox.layout.flex.vertical}
3 {1 (center systray) 3 {1 (center systray)
2 (center battery.widget) 2 (center battery.widget)
3 {1 (border 3 (border
{1 {1 (center clock) {1 {1 (center clock)
:top 2 :top 3
:bottom 2 :bottom 3
:widget wibox.container.margin} :widget wibox.container.margin}
:widget wibox.container.background :buttons clock-buttons
:bg beautiful.sidebar_bg_info}) :bg beautiful.sidebar_bg_info
:layout wibox.layout.fixed.vertical} :widget wibox.container.background})
:layout wibox.layout.fixed.vertical}})) :layout wibox.layout.fixed.vertical}}))
;;; ;;;

View File

@ -3,9 +3,10 @@
(let [theme-dir (.. (os.getenv "HOME") "/.config/awesome/theme") (let [theme-dir (.. (os.getenv "HOME") "/.config/awesome/theme")
icon-dir (.. theme-dir "/icons/")] icon-dir (.. theme-dir "/icons/")]
{ {
:font "Sarasa Mono J" :font "Sarasa UI J 10"
:variable_font "Sarasa UI J" :font_mono "Sarasa Mono J Bold 10"
:textclock_font "Sarasa UI J"
:wallpaper (.. (os.getenv "HOME") "/pics/wp/sgIcOup.jpg")
:sidebar_position :left ;; * :sidebar_position :left ;; *
:sidebar_width 36 ;; * :sidebar_width 36 ;; *
@ -16,7 +17,7 @@
:fg_focus "#cfcfcf" :fg_focus "#cfcfcf"
:fg_normal "#cfcfcf" :fg_normal "#cfcfcf"
:useless_gap 0 :useless_gap 2
:border_width 0 :border_width 0
:border_focus "#5bb3b4" :border_focus "#5bb3b4"
:border_normal "#1a1e24" :border_normal "#1a1e24"
@ -25,7 +26,7 @@
:titlebar_position :left ;; * :titlebar_position :left ;; *
:titlebar_size 15 ;; * :titlebar_size 15 ;; *
:titlebar_bg_focus "#926b3e" :titlebar_bg_focus "#5bb3b4"
:titlebar_bg_normal "#252b33" :titlebar_bg_normal "#252b33"
:titlebar_fg_focus "#1a1e24" :titlebar_fg_focus "#1a1e24"
:titlebar_fg_normal "#cfcfcf" :titlebar_fg_normal "#cfcfcf"
@ -37,6 +38,6 @@
:taglist_bg_empty (.. "png:" icon-dir "tag-list/unselected.png") :taglist_bg_empty (.. "png:" icon-dir "tag-list/unselected.png")
:taglist_bg_focus (.. "png:" icon-dir "tag-list/selected.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") :taglist_bg_urgent (.. "png:" icon-dir "tag-list/urgent.png")
}) })

View File

@ -3,77 +3,107 @@ local dpi = require("beautiful").xresources.apply_dpi
local wibox = require("wibox") local wibox = require("wibox")
local clickable_container = require("widget.clickable-container") local clickable_container = require("widget.clickable-container")
function list_update(w, buttons, label, data, objects) local capi = {button = _G.button}
-- 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 function create_buttons(buttons, object)
l:fill_space(true) if buttons then
l:add(ibm) local btns = {}
-- l:add(tbm) for _, b in ipairs(buttons) do
bg_clickable:set_widget(l) -- Create a proxy button object: it will receive the real
-- press and release events, and will propagate them to the
-- And all of this gets a background -- button object the user provided, but with the object as
-- bgb:set_widget(l) -- argument.
bgb:set_widget(bg_clickable) local btn = capi.button {modifiers = b.modifiers, button = b.button}
btn:connect_signal(
bgb:buttons(common.create_buttons(buttons, o)) 'press',
function()
data[o] = { b:emit_signal('press', object)
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>&lt;Invalid text&gt;</i>")
end end
end )
bgb:set_bg(bg) btn:connect_signal(
if type(bg_image) == "function" then 'release',
-- TODO: Why does this pass nil as an argument? function()
bg_image = bg_image(tb,o,nil,objects,i) b:emit_signal('release', object)
end end
bgb:set_bgimage(bg_image) )
if icon then btns[#btns + 1] = btn
ib:set_image(icon) end
else
ibm:set_margins(0)
end
bgb.shape = args.shape return btns
bgb.shape_border_width = args.shape_border_width end
bgb.shape_border_color = args.shape_border_color 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>&lt;Invalid text&gt;</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
end end

View File

@ -4,10 +4,12 @@
(local awful (require :awful)) (local awful (require :awful))
(local beautiful (require :beautiful)) (local beautiful (require :beautiful))
(local gears (require :gears))
(local wibox (require :wibox)) (local wibox (require :wibox))
(local common (require :awful.widget.common)) (local common (require :awful.widget.common))
(local dpi (. (require :beautiful) :xresources :apply_dpi)) (local dpi (. (require :beautiful) :xresources :apply_dpi))
(local button (. (require :lib.keys) :button))
(local std (require :lib.std)) (local std (require :lib.std))
;;; ;;;
@ -93,7 +95,11 @@
(awful.widget.taglist (awful.widget.taglist
s s
awful.widget.taglist.filter.all 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") {:font (.. beautiful.font " Bold 10")
:spacing 2} :spacing 2}
;; update-tag-list ;; update-tag-list

20
widget/tag-number.fnl Normal file
View 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