diff --git a/awesome/check.sh b/awesome/check.sh new file mode 100755 index 0000000..ae0e070 --- /dev/null +++ b/awesome/check.sh @@ -0,0 +1,5 @@ +#!/bin/sh +files=(theme/*.lua theme/*/*.lua rc_parts/*.lua) +files=${files[@]} +stylua -c $files +luacheck $files diff --git a/awesome/freedesktop/LICENSE b/awesome/lib/freedesktop/LICENSE similarity index 100% rename from awesome/freedesktop/LICENSE rename to awesome/lib/freedesktop/LICENSE diff --git a/awesome/freedesktop/README.rst b/awesome/lib/freedesktop/README.rst similarity index 100% rename from awesome/freedesktop/README.rst rename to awesome/lib/freedesktop/README.rst diff --git a/awesome/freedesktop/awesome-freedesktop-scm-1.rockspec b/awesome/lib/freedesktop/awesome-freedesktop-scm-1.rockspec similarity index 100% rename from awesome/freedesktop/awesome-freedesktop-scm-1.rockspec rename to awesome/lib/freedesktop/awesome-freedesktop-scm-1.rockspec diff --git a/awesome/freedesktop/desktop.lua b/awesome/lib/freedesktop/desktop.lua similarity index 100% rename from awesome/freedesktop/desktop.lua rename to awesome/lib/freedesktop/desktop.lua diff --git a/awesome/freedesktop/init.lua b/awesome/lib/freedesktop/init.lua similarity index 100% rename from awesome/freedesktop/init.lua rename to awesome/lib/freedesktop/init.lua diff --git a/awesome/freedesktop/menu.lua b/awesome/lib/freedesktop/menu.lua similarity index 100% rename from awesome/freedesktop/menu.lua rename to awesome/lib/freedesktop/menu.lua diff --git a/awesome/freedesktop/screenshot.png b/awesome/lib/freedesktop/screenshot.png similarity index 100% rename from awesome/freedesktop/screenshot.png rename to awesome/lib/freedesktop/screenshot.png diff --git a/awesome/lain/.github/workflows/main.yml b/awesome/lib/lain/.github/workflows/main.yml similarity index 100% rename from awesome/lain/.github/workflows/main.yml rename to awesome/lib/lain/.github/workflows/main.yml diff --git a/awesome/lain/.gitmodules b/awesome/lib/lain/.gitmodules similarity index 100% rename from awesome/lain/.gitmodules rename to awesome/lib/lain/.gitmodules diff --git a/awesome/lain/.luacheckrc b/awesome/lib/lain/.luacheckrc similarity index 100% rename from awesome/lain/.luacheckrc rename to awesome/lib/lain/.luacheckrc diff --git a/awesome/lain/ISSUE_TEMPLATE.md b/awesome/lib/lain/ISSUE_TEMPLATE.md similarity index 100% rename from awesome/lain/ISSUE_TEMPLATE.md rename to awesome/lib/lain/ISSUE_TEMPLATE.md diff --git a/awesome/lain/LICENSE b/awesome/lib/lain/LICENSE similarity index 100% rename from awesome/lain/LICENSE rename to awesome/lib/lain/LICENSE diff --git a/awesome/lain/README.rst b/awesome/lib/lain/README.rst similarity index 100% rename from awesome/lain/README.rst rename to awesome/lib/lain/README.rst diff --git a/awesome/lain/helpers.lua b/awesome/lib/lain/helpers.lua similarity index 100% rename from awesome/lain/helpers.lua rename to awesome/lib/lain/helpers.lua diff --git a/awesome/lain/icons/cal/black/1.png b/awesome/lib/lain/icons/cal/black/1.png similarity index 100% rename from awesome/lain/icons/cal/black/1.png rename to awesome/lib/lain/icons/cal/black/1.png diff --git a/awesome/lain/icons/cal/black/10.png b/awesome/lib/lain/icons/cal/black/10.png similarity index 100% rename from awesome/lain/icons/cal/black/10.png rename to awesome/lib/lain/icons/cal/black/10.png diff --git a/awesome/lain/icons/cal/black/11.png b/awesome/lib/lain/icons/cal/black/11.png similarity index 100% rename from awesome/lain/icons/cal/black/11.png rename to awesome/lib/lain/icons/cal/black/11.png diff --git a/awesome/lain/icons/cal/black/12.png b/awesome/lib/lain/icons/cal/black/12.png similarity index 100% rename from awesome/lain/icons/cal/black/12.png rename to awesome/lib/lain/icons/cal/black/12.png diff --git a/awesome/lain/icons/cal/black/13.png b/awesome/lib/lain/icons/cal/black/13.png similarity index 100% rename from awesome/lain/icons/cal/black/13.png rename to awesome/lib/lain/icons/cal/black/13.png diff --git a/awesome/lain/icons/cal/black/14.png b/awesome/lib/lain/icons/cal/black/14.png similarity index 100% rename from awesome/lain/icons/cal/black/14.png rename to awesome/lib/lain/icons/cal/black/14.png diff --git a/awesome/lain/icons/cal/black/15.png b/awesome/lib/lain/icons/cal/black/15.png similarity index 100% rename from awesome/lain/icons/cal/black/15.png rename to awesome/lib/lain/icons/cal/black/15.png diff --git a/awesome/lain/icons/cal/black/16.png b/awesome/lib/lain/icons/cal/black/16.png similarity index 100% rename from awesome/lain/icons/cal/black/16.png rename to awesome/lib/lain/icons/cal/black/16.png diff --git a/awesome/lain/icons/cal/black/17.png b/awesome/lib/lain/icons/cal/black/17.png similarity index 100% rename from awesome/lain/icons/cal/black/17.png rename to awesome/lib/lain/icons/cal/black/17.png diff --git a/awesome/lain/icons/cal/black/18.png b/awesome/lib/lain/icons/cal/black/18.png similarity index 100% rename from awesome/lain/icons/cal/black/18.png rename to awesome/lib/lain/icons/cal/black/18.png diff --git a/awesome/lain/icons/cal/black/19.png b/awesome/lib/lain/icons/cal/black/19.png similarity index 100% rename from awesome/lain/icons/cal/black/19.png rename to awesome/lib/lain/icons/cal/black/19.png diff --git a/awesome/lain/icons/cal/black/2.png b/awesome/lib/lain/icons/cal/black/2.png similarity index 100% rename from awesome/lain/icons/cal/black/2.png rename to awesome/lib/lain/icons/cal/black/2.png diff --git a/awesome/lain/icons/cal/black/20.png b/awesome/lib/lain/icons/cal/black/20.png similarity index 100% rename from awesome/lain/icons/cal/black/20.png rename to awesome/lib/lain/icons/cal/black/20.png diff --git a/awesome/lain/icons/cal/black/21.png b/awesome/lib/lain/icons/cal/black/21.png similarity index 100% rename from awesome/lain/icons/cal/black/21.png rename to awesome/lib/lain/icons/cal/black/21.png diff --git a/awesome/lain/icons/cal/black/22.png b/awesome/lib/lain/icons/cal/black/22.png similarity index 100% rename from awesome/lain/icons/cal/black/22.png rename to awesome/lib/lain/icons/cal/black/22.png diff --git a/awesome/lain/icons/cal/black/23.png b/awesome/lib/lain/icons/cal/black/23.png similarity index 100% rename from awesome/lain/icons/cal/black/23.png rename to awesome/lib/lain/icons/cal/black/23.png diff --git a/awesome/lain/icons/cal/black/24.png b/awesome/lib/lain/icons/cal/black/24.png similarity index 100% rename from awesome/lain/icons/cal/black/24.png rename to awesome/lib/lain/icons/cal/black/24.png diff --git a/awesome/lain/icons/cal/black/25.png b/awesome/lib/lain/icons/cal/black/25.png similarity index 100% rename from awesome/lain/icons/cal/black/25.png rename to awesome/lib/lain/icons/cal/black/25.png diff --git a/awesome/lain/icons/cal/black/26.png b/awesome/lib/lain/icons/cal/black/26.png similarity index 100% rename from awesome/lain/icons/cal/black/26.png rename to awesome/lib/lain/icons/cal/black/26.png diff --git a/awesome/lain/icons/cal/black/27.png b/awesome/lib/lain/icons/cal/black/27.png similarity index 100% rename from awesome/lain/icons/cal/black/27.png rename to awesome/lib/lain/icons/cal/black/27.png diff --git a/awesome/lain/icons/cal/black/28.png b/awesome/lib/lain/icons/cal/black/28.png similarity index 100% rename from awesome/lain/icons/cal/black/28.png rename to awesome/lib/lain/icons/cal/black/28.png diff --git a/awesome/lain/icons/cal/black/29.png b/awesome/lib/lain/icons/cal/black/29.png similarity index 100% rename from awesome/lain/icons/cal/black/29.png rename to awesome/lib/lain/icons/cal/black/29.png diff --git a/awesome/lain/icons/cal/black/3.png b/awesome/lib/lain/icons/cal/black/3.png similarity index 100% rename from awesome/lain/icons/cal/black/3.png rename to awesome/lib/lain/icons/cal/black/3.png diff --git a/awesome/lain/icons/cal/black/30.png b/awesome/lib/lain/icons/cal/black/30.png similarity index 100% rename from awesome/lain/icons/cal/black/30.png rename to awesome/lib/lain/icons/cal/black/30.png diff --git a/awesome/lain/icons/cal/black/31.png b/awesome/lib/lain/icons/cal/black/31.png similarity index 100% rename from awesome/lain/icons/cal/black/31.png rename to awesome/lib/lain/icons/cal/black/31.png diff --git a/awesome/lain/icons/cal/black/4.png b/awesome/lib/lain/icons/cal/black/4.png similarity index 100% rename from awesome/lain/icons/cal/black/4.png rename to awesome/lib/lain/icons/cal/black/4.png diff --git a/awesome/lain/icons/cal/black/5.png b/awesome/lib/lain/icons/cal/black/5.png similarity index 100% rename from awesome/lain/icons/cal/black/5.png rename to awesome/lib/lain/icons/cal/black/5.png diff --git a/awesome/lain/icons/cal/black/6.png b/awesome/lib/lain/icons/cal/black/6.png similarity index 100% rename from awesome/lain/icons/cal/black/6.png rename to awesome/lib/lain/icons/cal/black/6.png diff --git a/awesome/lain/icons/cal/black/7.png b/awesome/lib/lain/icons/cal/black/7.png similarity index 100% rename from awesome/lain/icons/cal/black/7.png rename to awesome/lib/lain/icons/cal/black/7.png diff --git a/awesome/lain/icons/cal/black/8.png b/awesome/lib/lain/icons/cal/black/8.png similarity index 100% rename from awesome/lain/icons/cal/black/8.png rename to awesome/lib/lain/icons/cal/black/8.png diff --git a/awesome/lain/icons/cal/black/9.png b/awesome/lib/lain/icons/cal/black/9.png similarity index 100% rename from awesome/lain/icons/cal/black/9.png rename to awesome/lib/lain/icons/cal/black/9.png diff --git a/awesome/lain/icons/cal/white/1.png b/awesome/lib/lain/icons/cal/white/1.png similarity index 100% rename from awesome/lain/icons/cal/white/1.png rename to awesome/lib/lain/icons/cal/white/1.png diff --git a/awesome/lain/icons/cal/white/10.png b/awesome/lib/lain/icons/cal/white/10.png similarity index 100% rename from awesome/lain/icons/cal/white/10.png rename to awesome/lib/lain/icons/cal/white/10.png diff --git a/awesome/lain/icons/cal/white/11.png b/awesome/lib/lain/icons/cal/white/11.png similarity index 100% rename from awesome/lain/icons/cal/white/11.png rename to awesome/lib/lain/icons/cal/white/11.png diff --git a/awesome/lain/icons/cal/white/12.png b/awesome/lib/lain/icons/cal/white/12.png similarity index 100% rename from awesome/lain/icons/cal/white/12.png rename to awesome/lib/lain/icons/cal/white/12.png diff --git a/awesome/lain/icons/cal/white/13.png b/awesome/lib/lain/icons/cal/white/13.png similarity index 100% rename from awesome/lain/icons/cal/white/13.png rename to awesome/lib/lain/icons/cal/white/13.png diff --git a/awesome/lain/icons/cal/white/14.png b/awesome/lib/lain/icons/cal/white/14.png similarity index 100% rename from awesome/lain/icons/cal/white/14.png rename to awesome/lib/lain/icons/cal/white/14.png diff --git a/awesome/lain/icons/cal/white/15.png b/awesome/lib/lain/icons/cal/white/15.png similarity index 100% rename from awesome/lain/icons/cal/white/15.png rename to awesome/lib/lain/icons/cal/white/15.png diff --git a/awesome/lain/icons/cal/white/16.png b/awesome/lib/lain/icons/cal/white/16.png similarity index 100% rename from awesome/lain/icons/cal/white/16.png rename to awesome/lib/lain/icons/cal/white/16.png diff --git a/awesome/lain/icons/cal/white/17.png b/awesome/lib/lain/icons/cal/white/17.png similarity index 100% rename from awesome/lain/icons/cal/white/17.png rename to awesome/lib/lain/icons/cal/white/17.png diff --git a/awesome/lain/icons/cal/white/18.png b/awesome/lib/lain/icons/cal/white/18.png similarity index 100% rename from awesome/lain/icons/cal/white/18.png rename to awesome/lib/lain/icons/cal/white/18.png diff --git a/awesome/lain/icons/cal/white/19.png b/awesome/lib/lain/icons/cal/white/19.png similarity index 100% rename from awesome/lain/icons/cal/white/19.png rename to awesome/lib/lain/icons/cal/white/19.png diff --git a/awesome/lain/icons/cal/white/2.png b/awesome/lib/lain/icons/cal/white/2.png similarity index 100% rename from awesome/lain/icons/cal/white/2.png rename to awesome/lib/lain/icons/cal/white/2.png diff --git a/awesome/lain/icons/cal/white/20.png b/awesome/lib/lain/icons/cal/white/20.png similarity index 100% rename from awesome/lain/icons/cal/white/20.png rename to awesome/lib/lain/icons/cal/white/20.png diff --git a/awesome/lain/icons/cal/white/21.png b/awesome/lib/lain/icons/cal/white/21.png similarity index 100% rename from awesome/lain/icons/cal/white/21.png rename to awesome/lib/lain/icons/cal/white/21.png diff --git a/awesome/lain/icons/cal/white/22.png b/awesome/lib/lain/icons/cal/white/22.png similarity index 100% rename from awesome/lain/icons/cal/white/22.png rename to awesome/lib/lain/icons/cal/white/22.png diff --git a/awesome/lain/icons/cal/white/23.png b/awesome/lib/lain/icons/cal/white/23.png similarity index 100% rename from awesome/lain/icons/cal/white/23.png rename to awesome/lib/lain/icons/cal/white/23.png diff --git a/awesome/lain/icons/cal/white/24.png b/awesome/lib/lain/icons/cal/white/24.png similarity index 100% rename from awesome/lain/icons/cal/white/24.png rename to awesome/lib/lain/icons/cal/white/24.png diff --git a/awesome/lain/icons/cal/white/25.png b/awesome/lib/lain/icons/cal/white/25.png similarity index 100% rename from awesome/lain/icons/cal/white/25.png rename to awesome/lib/lain/icons/cal/white/25.png diff --git a/awesome/lain/icons/cal/white/26.png b/awesome/lib/lain/icons/cal/white/26.png similarity index 100% rename from awesome/lain/icons/cal/white/26.png rename to awesome/lib/lain/icons/cal/white/26.png diff --git a/awesome/lain/icons/cal/white/27.png b/awesome/lib/lain/icons/cal/white/27.png similarity index 100% rename from awesome/lain/icons/cal/white/27.png rename to awesome/lib/lain/icons/cal/white/27.png diff --git a/awesome/lain/icons/cal/white/28.png b/awesome/lib/lain/icons/cal/white/28.png similarity index 100% rename from awesome/lain/icons/cal/white/28.png rename to awesome/lib/lain/icons/cal/white/28.png diff --git a/awesome/lain/icons/cal/white/29.png b/awesome/lib/lain/icons/cal/white/29.png similarity index 100% rename from awesome/lain/icons/cal/white/29.png rename to awesome/lib/lain/icons/cal/white/29.png diff --git a/awesome/lain/icons/cal/white/3.png b/awesome/lib/lain/icons/cal/white/3.png similarity index 100% rename from awesome/lain/icons/cal/white/3.png rename to awesome/lib/lain/icons/cal/white/3.png diff --git a/awesome/lain/icons/cal/white/30.png b/awesome/lib/lain/icons/cal/white/30.png similarity index 100% rename from awesome/lain/icons/cal/white/30.png rename to awesome/lib/lain/icons/cal/white/30.png diff --git a/awesome/lain/icons/cal/white/31.png b/awesome/lib/lain/icons/cal/white/31.png similarity index 100% rename from awesome/lain/icons/cal/white/31.png rename to awesome/lib/lain/icons/cal/white/31.png diff --git a/awesome/lain/icons/cal/white/4.png b/awesome/lib/lain/icons/cal/white/4.png similarity index 100% rename from awesome/lain/icons/cal/white/4.png rename to awesome/lib/lain/icons/cal/white/4.png diff --git a/awesome/lain/icons/cal/white/5.png b/awesome/lib/lain/icons/cal/white/5.png similarity index 100% rename from awesome/lain/icons/cal/white/5.png rename to awesome/lib/lain/icons/cal/white/5.png diff --git a/awesome/lain/icons/cal/white/6.png b/awesome/lib/lain/icons/cal/white/6.png similarity index 100% rename from awesome/lain/icons/cal/white/6.png rename to awesome/lib/lain/icons/cal/white/6.png diff --git a/awesome/lain/icons/cal/white/7.png b/awesome/lib/lain/icons/cal/white/7.png similarity index 100% rename from awesome/lain/icons/cal/white/7.png rename to awesome/lib/lain/icons/cal/white/7.png diff --git a/awesome/lain/icons/cal/white/8.png b/awesome/lib/lain/icons/cal/white/8.png similarity index 100% rename from awesome/lain/icons/cal/white/8.png rename to awesome/lib/lain/icons/cal/white/8.png diff --git a/awesome/lain/icons/cal/white/9.png b/awesome/lib/lain/icons/cal/white/9.png similarity index 100% rename from awesome/lain/icons/cal/white/9.png rename to awesome/lib/lain/icons/cal/white/9.png diff --git a/awesome/lain/icons/layout/default/cascade.png b/awesome/lib/lain/icons/layout/default/cascade.png similarity index 100% rename from awesome/lain/icons/layout/default/cascade.png rename to awesome/lib/lain/icons/layout/default/cascade.png diff --git a/awesome/lain/icons/layout/default/cascadetile.png b/awesome/lib/lain/icons/layout/default/cascadetile.png similarity index 100% rename from awesome/lain/icons/layout/default/cascadetile.png rename to awesome/lib/lain/icons/layout/default/cascadetile.png diff --git a/awesome/lain/icons/layout/default/cascadetilew.png b/awesome/lib/lain/icons/layout/default/cascadetilew.png similarity index 100% rename from awesome/lain/icons/layout/default/cascadetilew.png rename to awesome/lib/lain/icons/layout/default/cascadetilew.png diff --git a/awesome/lain/icons/layout/default/cascadew.png b/awesome/lib/lain/icons/layout/default/cascadew.png similarity index 100% rename from awesome/lain/icons/layout/default/cascadew.png rename to awesome/lib/lain/icons/layout/default/cascadew.png diff --git a/awesome/lain/icons/layout/default/centerfair.png b/awesome/lib/lain/icons/layout/default/centerfair.png similarity index 100% rename from awesome/lain/icons/layout/default/centerfair.png rename to awesome/lib/lain/icons/layout/default/centerfair.png diff --git a/awesome/lain/icons/layout/default/centerfairw.png b/awesome/lib/lain/icons/layout/default/centerfairw.png similarity index 100% rename from awesome/lain/icons/layout/default/centerfairw.png rename to awesome/lib/lain/icons/layout/default/centerfairw.png diff --git a/awesome/lain/icons/layout/default/centerwork.png b/awesome/lib/lain/icons/layout/default/centerwork.png similarity index 100% rename from awesome/lain/icons/layout/default/centerwork.png rename to awesome/lib/lain/icons/layout/default/centerwork.png diff --git a/awesome/lain/icons/layout/default/centerworkh.png b/awesome/lib/lain/icons/layout/default/centerworkh.png similarity index 100% rename from awesome/lain/icons/layout/default/centerworkh.png rename to awesome/lib/lain/icons/layout/default/centerworkh.png diff --git a/awesome/lain/icons/layout/default/centerworkhw.png b/awesome/lib/lain/icons/layout/default/centerworkhw.png similarity index 100% rename from awesome/lain/icons/layout/default/centerworkhw.png rename to awesome/lib/lain/icons/layout/default/centerworkhw.png diff --git a/awesome/lain/icons/layout/default/centerworkw.png b/awesome/lib/lain/icons/layout/default/centerworkw.png similarity index 100% rename from awesome/lain/icons/layout/default/centerworkw.png rename to awesome/lib/lain/icons/layout/default/centerworkw.png diff --git a/awesome/lain/icons/layout/default/termfair.png b/awesome/lib/lain/icons/layout/default/termfair.png similarity index 100% rename from awesome/lain/icons/layout/default/termfair.png rename to awesome/lib/lain/icons/layout/default/termfair.png diff --git a/awesome/lain/icons/layout/default/termfairw.png b/awesome/lib/lain/icons/layout/default/termfairw.png similarity index 100% rename from awesome/lain/icons/layout/default/termfairw.png rename to awesome/lib/lain/icons/layout/default/termfairw.png diff --git a/awesome/lain/icons/layout/zenburn/cascade.png b/awesome/lib/lain/icons/layout/zenburn/cascade.png similarity index 100% rename from awesome/lain/icons/layout/zenburn/cascade.png rename to awesome/lib/lain/icons/layout/zenburn/cascade.png diff --git a/awesome/lain/icons/layout/zenburn/cascadetile.png b/awesome/lib/lain/icons/layout/zenburn/cascadetile.png similarity index 100% rename from awesome/lain/icons/layout/zenburn/cascadetile.png rename to awesome/lib/lain/icons/layout/zenburn/cascadetile.png diff --git a/awesome/lain/icons/layout/zenburn/centerfair.png b/awesome/lib/lain/icons/layout/zenburn/centerfair.png similarity index 100% rename from awesome/lain/icons/layout/zenburn/centerfair.png rename to awesome/lib/lain/icons/layout/zenburn/centerfair.png diff --git a/awesome/lain/icons/layout/zenburn/centerwork.png b/awesome/lib/lain/icons/layout/zenburn/centerwork.png similarity index 100% rename from awesome/lain/icons/layout/zenburn/centerwork.png rename to awesome/lib/lain/icons/layout/zenburn/centerwork.png diff --git a/awesome/lain/icons/layout/zenburn/centerworkh.png b/awesome/lib/lain/icons/layout/zenburn/centerworkh.png similarity index 100% rename from awesome/lain/icons/layout/zenburn/centerworkh.png rename to awesome/lib/lain/icons/layout/zenburn/centerworkh.png diff --git a/awesome/lain/icons/layout/zenburn/termfair.png b/awesome/lib/lain/icons/layout/zenburn/termfair.png similarity index 100% rename from awesome/lain/icons/layout/zenburn/termfair.png rename to awesome/lib/lain/icons/layout/zenburn/termfair.png diff --git a/awesome/lain/icons/mail.png b/awesome/lib/lain/icons/mail.png similarity index 100% rename from awesome/lain/icons/mail.png rename to awesome/lib/lain/icons/mail.png diff --git a/awesome/lain/icons/no_net.png b/awesome/lib/lain/icons/no_net.png similarity index 100% rename from awesome/lain/icons/no_net.png rename to awesome/lib/lain/icons/no_net.png diff --git a/awesome/lain/icons/openweathermap/01d.png b/awesome/lib/lain/icons/openweathermap/01d.png similarity index 100% rename from awesome/lain/icons/openweathermap/01d.png rename to awesome/lib/lain/icons/openweathermap/01d.png diff --git a/awesome/lain/icons/openweathermap/01n.png b/awesome/lib/lain/icons/openweathermap/01n.png similarity index 100% rename from awesome/lain/icons/openweathermap/01n.png rename to awesome/lib/lain/icons/openweathermap/01n.png diff --git a/awesome/lain/icons/openweathermap/02d.png b/awesome/lib/lain/icons/openweathermap/02d.png similarity index 100% rename from awesome/lain/icons/openweathermap/02d.png rename to awesome/lib/lain/icons/openweathermap/02d.png diff --git a/awesome/lain/icons/openweathermap/02n.png b/awesome/lib/lain/icons/openweathermap/02n.png similarity index 100% rename from awesome/lain/icons/openweathermap/02n.png rename to awesome/lib/lain/icons/openweathermap/02n.png diff --git a/awesome/lain/icons/openweathermap/03d.png b/awesome/lib/lain/icons/openweathermap/03d.png similarity index 100% rename from awesome/lain/icons/openweathermap/03d.png rename to awesome/lib/lain/icons/openweathermap/03d.png diff --git a/awesome/lain/icons/openweathermap/03n.png b/awesome/lib/lain/icons/openweathermap/03n.png similarity index 100% rename from awesome/lain/icons/openweathermap/03n.png rename to awesome/lib/lain/icons/openweathermap/03n.png diff --git a/awesome/lain/icons/openweathermap/04d.png b/awesome/lib/lain/icons/openweathermap/04d.png similarity index 100% rename from awesome/lain/icons/openweathermap/04d.png rename to awesome/lib/lain/icons/openweathermap/04d.png diff --git a/awesome/lain/icons/openweathermap/04n.png b/awesome/lib/lain/icons/openweathermap/04n.png similarity index 100% rename from awesome/lain/icons/openweathermap/04n.png rename to awesome/lib/lain/icons/openweathermap/04n.png diff --git a/awesome/lain/icons/openweathermap/09d.png b/awesome/lib/lain/icons/openweathermap/09d.png similarity index 100% rename from awesome/lain/icons/openweathermap/09d.png rename to awesome/lib/lain/icons/openweathermap/09d.png diff --git a/awesome/lain/icons/openweathermap/09n.png b/awesome/lib/lain/icons/openweathermap/09n.png similarity index 100% rename from awesome/lain/icons/openweathermap/09n.png rename to awesome/lib/lain/icons/openweathermap/09n.png diff --git a/awesome/lain/icons/openweathermap/10d.png b/awesome/lib/lain/icons/openweathermap/10d.png similarity index 100% rename from awesome/lain/icons/openweathermap/10d.png rename to awesome/lib/lain/icons/openweathermap/10d.png diff --git a/awesome/lain/icons/openweathermap/10n.png b/awesome/lib/lain/icons/openweathermap/10n.png similarity index 100% rename from awesome/lain/icons/openweathermap/10n.png rename to awesome/lib/lain/icons/openweathermap/10n.png diff --git a/awesome/lain/icons/openweathermap/11d.png b/awesome/lib/lain/icons/openweathermap/11d.png similarity index 100% rename from awesome/lain/icons/openweathermap/11d.png rename to awesome/lib/lain/icons/openweathermap/11d.png diff --git a/awesome/lain/icons/openweathermap/11n.png b/awesome/lib/lain/icons/openweathermap/11n.png similarity index 100% rename from awesome/lain/icons/openweathermap/11n.png rename to awesome/lib/lain/icons/openweathermap/11n.png diff --git a/awesome/lain/icons/openweathermap/13d.png b/awesome/lib/lain/icons/openweathermap/13d.png similarity index 100% rename from awesome/lain/icons/openweathermap/13d.png rename to awesome/lib/lain/icons/openweathermap/13d.png diff --git a/awesome/lain/icons/openweathermap/13n.png b/awesome/lib/lain/icons/openweathermap/13n.png similarity index 100% rename from awesome/lain/icons/openweathermap/13n.png rename to awesome/lib/lain/icons/openweathermap/13n.png diff --git a/awesome/lain/icons/openweathermap/50d.png b/awesome/lib/lain/icons/openweathermap/50d.png similarity index 100% rename from awesome/lain/icons/openweathermap/50d.png rename to awesome/lib/lain/icons/openweathermap/50d.png diff --git a/awesome/lain/icons/openweathermap/50n.png b/awesome/lib/lain/icons/openweathermap/50n.png similarity index 100% rename from awesome/lain/icons/openweathermap/50n.png rename to awesome/lib/lain/icons/openweathermap/50n.png diff --git a/awesome/lain/icons/openweathermap/README.md b/awesome/lib/lain/icons/openweathermap/README.md similarity index 100% rename from awesome/lain/icons/openweathermap/README.md rename to awesome/lib/lain/icons/openweathermap/README.md diff --git a/awesome/lain/icons/openweathermap/na.png b/awesome/lib/lain/icons/openweathermap/na.png similarity index 100% rename from awesome/lain/icons/openweathermap/na.png rename to awesome/lib/lain/icons/openweathermap/na.png diff --git a/awesome/lain/icons/taskwarrior.png b/awesome/lib/lain/icons/taskwarrior.png similarity index 100% rename from awesome/lain/icons/taskwarrior.png rename to awesome/lib/lain/icons/taskwarrior.png diff --git a/awesome/lain/init.lua b/awesome/lib/lain/init.lua similarity index 100% rename from awesome/lain/init.lua rename to awesome/lib/lain/init.lua diff --git a/awesome/lain/lain-scm-1.rockspec b/awesome/lib/lain/lain-scm-1.rockspec similarity index 100% rename from awesome/lain/lain-scm-1.rockspec rename to awesome/lib/lain/lain-scm-1.rockspec diff --git a/awesome/lain/layout/cascade.lua b/awesome/lib/lain/layout/cascade.lua similarity index 100% rename from awesome/lain/layout/cascade.lua rename to awesome/lib/lain/layout/cascade.lua diff --git a/awesome/lain/layout/centerwork.lua b/awesome/lib/lain/layout/centerwork.lua similarity index 100% rename from awesome/lain/layout/centerwork.lua rename to awesome/lib/lain/layout/centerwork.lua diff --git a/awesome/lain/layout/init.lua b/awesome/lib/lain/layout/init.lua similarity index 100% rename from awesome/lain/layout/init.lua rename to awesome/lib/lain/layout/init.lua diff --git a/awesome/lain/layout/termfair.lua b/awesome/lib/lain/layout/termfair.lua similarity index 100% rename from awesome/lain/layout/termfair.lua rename to awesome/lib/lain/layout/termfair.lua diff --git a/awesome/lain/util/dkjson.lua b/awesome/lib/lain/util/dkjson.lua similarity index 100% rename from awesome/lain/util/dkjson.lua rename to awesome/lib/lain/util/dkjson.lua diff --git a/awesome/lain/util/init.lua b/awesome/lib/lain/util/init.lua similarity index 100% rename from awesome/lain/util/init.lua rename to awesome/lib/lain/util/init.lua diff --git a/awesome/lain/util/markup.lua b/awesome/lib/lain/util/markup.lua similarity index 100% rename from awesome/lain/util/markup.lua rename to awesome/lib/lain/util/markup.lua diff --git a/awesome/lain/util/menu_iterator.lua b/awesome/lib/lain/util/menu_iterator.lua similarity index 100% rename from awesome/lain/util/menu_iterator.lua rename to awesome/lib/lain/util/menu_iterator.lua diff --git a/awesome/lain/util/quake.lua b/awesome/lib/lain/util/quake.lua similarity index 100% rename from awesome/lain/util/quake.lua rename to awesome/lib/lain/util/quake.lua diff --git a/awesome/lain/util/separators.lua b/awesome/lib/lain/util/separators.lua similarity index 100% rename from awesome/lain/util/separators.lua rename to awesome/lib/lain/util/separators.lua diff --git a/awesome/lain/widget/alsa.lua b/awesome/lib/lain/widget/alsa.lua similarity index 100% rename from awesome/lain/widget/alsa.lua rename to awesome/lib/lain/widget/alsa.lua diff --git a/awesome/lain/widget/alsabar.lua b/awesome/lib/lain/widget/alsabar.lua similarity index 100% rename from awesome/lain/widget/alsabar.lua rename to awesome/lib/lain/widget/alsabar.lua diff --git a/awesome/lain/widget/bat.lua b/awesome/lib/lain/widget/bat.lua similarity index 100% rename from awesome/lain/widget/bat.lua rename to awesome/lib/lain/widget/bat.lua diff --git a/awesome/lain/widget/cal.lua b/awesome/lib/lain/widget/cal.lua similarity index 100% rename from awesome/lain/widget/cal.lua rename to awesome/lib/lain/widget/cal.lua diff --git a/awesome/lain/widget/contrib/init.lua b/awesome/lib/lain/widget/contrib/init.lua similarity index 100% rename from awesome/lain/widget/contrib/init.lua rename to awesome/lib/lain/widget/contrib/init.lua diff --git a/awesome/lain/widget/contrib/moc.lua b/awesome/lib/lain/widget/contrib/moc.lua similarity index 100% rename from awesome/lain/widget/contrib/moc.lua rename to awesome/lib/lain/widget/contrib/moc.lua diff --git a/awesome/lain/widget/contrib/redshift.lua b/awesome/lib/lain/widget/contrib/redshift.lua similarity index 100% rename from awesome/lain/widget/contrib/redshift.lua rename to awesome/lib/lain/widget/contrib/redshift.lua diff --git a/awesome/lain/widget/contrib/task.lua b/awesome/lib/lain/widget/contrib/task.lua similarity index 100% rename from awesome/lain/widget/contrib/task.lua rename to awesome/lib/lain/widget/contrib/task.lua diff --git a/awesome/lain/widget/contrib/tp_smapi.lua b/awesome/lib/lain/widget/contrib/tp_smapi.lua similarity index 100% rename from awesome/lain/widget/contrib/tp_smapi.lua rename to awesome/lib/lain/widget/contrib/tp_smapi.lua diff --git a/awesome/lain/widget/cpu.lua b/awesome/lib/lain/widget/cpu.lua similarity index 100% rename from awesome/lain/widget/cpu.lua rename to awesome/lib/lain/widget/cpu.lua diff --git a/awesome/lain/widget/fs.lua b/awesome/lib/lain/widget/fs.lua similarity index 100% rename from awesome/lain/widget/fs.lua rename to awesome/lib/lain/widget/fs.lua diff --git a/awesome/lain/widget/imap.lua b/awesome/lib/lain/widget/imap.lua similarity index 100% rename from awesome/lain/widget/imap.lua rename to awesome/lib/lain/widget/imap.lua diff --git a/awesome/lain/widget/init.lua b/awesome/lib/lain/widget/init.lua similarity index 100% rename from awesome/lain/widget/init.lua rename to awesome/lib/lain/widget/init.lua diff --git a/awesome/lain/widget/mem.lua b/awesome/lib/lain/widget/mem.lua similarity index 100% rename from awesome/lain/widget/mem.lua rename to awesome/lib/lain/widget/mem.lua diff --git a/awesome/lain/widget/mpd.lua b/awesome/lib/lain/widget/mpd.lua similarity index 100% rename from awesome/lain/widget/mpd.lua rename to awesome/lib/lain/widget/mpd.lua diff --git a/awesome/lain/widget/net.lua b/awesome/lib/lain/widget/net.lua similarity index 100% rename from awesome/lain/widget/net.lua rename to awesome/lib/lain/widget/net.lua diff --git a/awesome/lain/widget/pulse.lua b/awesome/lib/lain/widget/pulse.lua similarity index 100% rename from awesome/lain/widget/pulse.lua rename to awesome/lib/lain/widget/pulse.lua diff --git a/awesome/lain/widget/pulsebar.lua b/awesome/lib/lain/widget/pulsebar.lua similarity index 100% rename from awesome/lain/widget/pulsebar.lua rename to awesome/lib/lain/widget/pulsebar.lua diff --git a/awesome/lain/widget/sysload.lua b/awesome/lib/lain/widget/sysload.lua similarity index 100% rename from awesome/lain/widget/sysload.lua rename to awesome/lib/lain/widget/sysload.lua diff --git a/awesome/lain/widget/temp.lua b/awesome/lib/lain/widget/temp.lua similarity index 100% rename from awesome/lain/widget/temp.lua rename to awesome/lib/lain/widget/temp.lua diff --git a/awesome/lain/widget/weather.lua b/awesome/lib/lain/widget/weather.lua similarity index 100% rename from awesome/lain/widget/weather.lua rename to awesome/lib/lain/widget/weather.lua diff --git a/awesome/lain/wiki/Home.md b/awesome/lib/lain/wiki/Home.md similarity index 100% rename from awesome/lain/wiki/Home.md rename to awesome/lib/lain/wiki/Home.md diff --git a/awesome/lain/wiki/Layouts.md b/awesome/lib/lain/wiki/Layouts.md similarity index 100% rename from awesome/lain/wiki/Layouts.md rename to awesome/lib/lain/wiki/Layouts.md diff --git a/awesome/lain/wiki/Utilities.md b/awesome/lib/lain/wiki/Utilities.md similarity index 100% rename from awesome/lain/wiki/Utilities.md rename to awesome/lib/lain/wiki/Utilities.md diff --git a/awesome/lain/wiki/Widgets.md b/awesome/lib/lain/wiki/Widgets.md similarity index 100% rename from awesome/lain/wiki/Widgets.md rename to awesome/lib/lain/wiki/Widgets.md diff --git a/awesome/lain/wiki/_Footer.md b/awesome/lib/lain/wiki/_Footer.md similarity index 100% rename from awesome/lain/wiki/_Footer.md rename to awesome/lib/lain/wiki/_Footer.md diff --git a/awesome/lain/wiki/_Sidebar.md b/awesome/lib/lain/wiki/_Sidebar.md similarity index 100% rename from awesome/lain/wiki/_Sidebar.md rename to awesome/lib/lain/wiki/_Sidebar.md diff --git a/awesome/lain/wiki/alsa.md b/awesome/lib/lain/wiki/alsa.md similarity index 100% rename from awesome/lain/wiki/alsa.md rename to awesome/lib/lain/wiki/alsa.md diff --git a/awesome/lain/wiki/alsabar.md b/awesome/lib/lain/wiki/alsabar.md similarity index 100% rename from awesome/lain/wiki/alsabar.md rename to awesome/lib/lain/wiki/alsabar.md diff --git a/awesome/lain/wiki/bat.md b/awesome/lib/lain/wiki/bat.md similarity index 100% rename from awesome/lain/wiki/bat.md rename to awesome/lib/lain/wiki/bat.md diff --git a/awesome/lain/wiki/cal.md b/awesome/lib/lain/wiki/cal.md similarity index 100% rename from awesome/lain/wiki/cal.md rename to awesome/lib/lain/wiki/cal.md diff --git a/awesome/lain/wiki/cpu.md b/awesome/lib/lain/wiki/cpu.md similarity index 100% rename from awesome/lain/wiki/cpu.md rename to awesome/lib/lain/wiki/cpu.md diff --git a/awesome/lain/wiki/fs.md b/awesome/lib/lain/wiki/fs.md similarity index 100% rename from awesome/lain/wiki/fs.md rename to awesome/lib/lain/wiki/fs.md diff --git a/awesome/lain/wiki/imap.md b/awesome/lib/lain/wiki/imap.md similarity index 100% rename from awesome/lain/wiki/imap.md rename to awesome/lib/lain/wiki/imap.md diff --git a/awesome/lain/wiki/mem.md b/awesome/lib/lain/wiki/mem.md similarity index 100% rename from awesome/lain/wiki/mem.md rename to awesome/lib/lain/wiki/mem.md diff --git a/awesome/lain/wiki/moc.md b/awesome/lib/lain/wiki/moc.md similarity index 100% rename from awesome/lain/wiki/moc.md rename to awesome/lib/lain/wiki/moc.md diff --git a/awesome/lain/wiki/mpd.md b/awesome/lib/lain/wiki/mpd.md similarity index 100% rename from awesome/lain/wiki/mpd.md rename to awesome/lib/lain/wiki/mpd.md diff --git a/awesome/lain/wiki/net.md b/awesome/lib/lain/wiki/net.md similarity index 100% rename from awesome/lain/wiki/net.md rename to awesome/lib/lain/wiki/net.md diff --git a/awesome/lain/wiki/pulse.md b/awesome/lib/lain/wiki/pulse.md similarity index 100% rename from awesome/lain/wiki/pulse.md rename to awesome/lib/lain/wiki/pulse.md diff --git a/awesome/lain/wiki/pulsebar.md b/awesome/lib/lain/wiki/pulsebar.md similarity index 100% rename from awesome/lain/wiki/pulsebar.md rename to awesome/lib/lain/wiki/pulsebar.md diff --git a/awesome/lain/wiki/redshift.md b/awesome/lib/lain/wiki/redshift.md similarity index 100% rename from awesome/lain/wiki/redshift.md rename to awesome/lib/lain/wiki/redshift.md diff --git a/awesome/lain/wiki/sysload.md b/awesome/lib/lain/wiki/sysload.md similarity index 100% rename from awesome/lain/wiki/sysload.md rename to awesome/lib/lain/wiki/sysload.md diff --git a/awesome/lain/wiki/task.md b/awesome/lib/lain/wiki/task.md similarity index 100% rename from awesome/lain/wiki/task.md rename to awesome/lib/lain/wiki/task.md diff --git a/awesome/lain/wiki/temp.md b/awesome/lib/lain/wiki/temp.md similarity index 100% rename from awesome/lain/wiki/temp.md rename to awesome/lib/lain/wiki/temp.md diff --git a/awesome/lain/wiki/tp_smapi.md b/awesome/lib/lain/wiki/tp_smapi.md similarity index 100% rename from awesome/lain/wiki/tp_smapi.md rename to awesome/lib/lain/wiki/tp_smapi.md diff --git a/awesome/lain/wiki/watch.md b/awesome/lib/lain/wiki/watch.md similarity index 100% rename from awesome/lain/wiki/watch.md rename to awesome/lib/lain/wiki/watch.md diff --git a/awesome/lain/wiki/weather.md b/awesome/lib/lain/wiki/weather.md similarity index 100% rename from awesome/lain/wiki/weather.md rename to awesome/lib/lain/wiki/weather.md diff --git a/awesome/rc.lua b/awesome/rc.lua index 1fd248b..753dc87 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -1,7 +1,6 @@ --- {{{ Required libraries +local libfolder = os.getenv('HOME') .. '/.config/awesome/lib/' +package.path = (libfolder .. '?/init.lua;') .. (libfolder .. '?.lua;') .. package.path --- If LuaRocks is installed, make sure that packages installed through it are --- found (e.g. lgi). If LuaRocks is not installed, do nothing. pcall(require, 'luarocks.loader') local gears = require('gears') @@ -13,18 +12,15 @@ local wibox = require('wibox') local beautiful = require('beautiful') local naughty = require('naughty') local lain = require('lain') ---local menubar = require("menubar") local freedesktop = require('freedesktop') local hotkeys_popup = require('awful.hotkeys_popup') require('awful.hotkeys_popup.keys') -local constrain = require('constrain') +local theme = require('theme') +local constrain = require('rc_parts.constrain') +local globals = require('rc_parts.globals') local mytable = awful.util.table or gears.table -- 4.{0,1} compatibility --- }}} - --- {{{ Error handling - -- Check if awesome encountered an error during startup and fell back to -- another config (This code will only ever execute for the fallback config) if awesome.startup_errors then @@ -56,10 +52,6 @@ do end) end --- }}} - --- {{{ Autostart windowless processes - -- This function will run once every time Awesome is started --[[ local function run_once(cmd_arr) for _, cmd in ipairs(cmd_arr) do @@ -68,27 +60,9 @@ end end ]] -- --- run_once({ "urxvtd", "unclutter -root" }) -- comma-separated entries - --- This function implements the XDG autostart specification ---[[ -awful.spawn.with_shell( - 'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' .. - 'xrdb -merge <<< "awesome.started:true";' .. - -- list each of your autostart commands, followed by ; inside single quotes, followed by .. - 'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex -) ---]] - --- }}} - --- {{{ Variable definitions -local modkey = 'Mod4' -local altkey = 'Mod1' -local terminal = 'kitty' -local vi_focus = false -- vi-like client focus https://github.com/lcpz/awesome-copycats/issues/275 -local cycle_prev = true -- cycle with only the previously focused client or all https://github.com/lcpz/awesome-copycats/issues/274 -local editor = 'nvim' +local terminal = globals.terminal +local modkey = globals.modkey +local altkey = globals.altkey awful.util.terminal = terminal awful.util.tagnames = { '1', '2', '3', '4', '5' } @@ -106,21 +80,8 @@ awful.layout.layouts = { awful.layout.suit.magnifier, awful.layout.suit.corner.nw, awful.layout.suit.floating, - -- awful.layout.suit.corner.ne, - -- awful.layout.suit.corner.sw, - -- awful.layout.suit.corner.se, } -lain.layout.termfair.nmaster = 3 -lain.layout.termfair.ncol = 1 -lain.layout.termfair.center.nmaster = 3 -lain.layout.termfair.center.ncol = 1 -lain.layout.cascade.tile.offset_x = 2 -lain.layout.cascade.tile.offset_y = 32 -lain.layout.cascade.tile.extra_padding = 5 -lain.layout.cascade.tile.nmaster = 5 -lain.layout.cascade.tile.ncol = 2 - awful.util.taglist_buttons = mytable.join( awful.button({}, 1, function(t) t:view_only() @@ -163,13 +124,8 @@ awful.util.tasklist_buttons = mytable.join( end) ) -beautiful.init(os.getenv('HOME') .. '/.config/awesome/theme.lua') +beautiful.init(theme) --- }}} - --- {{{ Menu - --- Create a launcher widget and a main menu local myawesomemenu = { { 'Hotkeys', @@ -178,7 +134,7 @@ local myawesomemenu = { end, }, { 'Manual', string.format('%s -e man awesome', terminal) }, - { 'Edit config', string.format('%s -e %s %s', terminal, editor, awesome.conffile) }, + { 'Edit config', string.format('%s -e %s %s', terminal, globals.editor, awesome.conffile) }, { 'Restart', awesome.restart }, { 'Quit', @@ -199,31 +155,6 @@ awful.util.mymainmenu = freedesktop.menu.build({ }, }) --- Hide the menu when the mouse leaves it ---[[ -awful.util.mymainmenu.wibox:connect_signal("mouse::leave", function() - if not awful.util.mymainmenu.active_child or - (awful.util.mymainmenu.wibox ~= mouse.current_wibox and - awful.util.mymainmenu.active_child.wibox ~= mouse.current_wibox) then - awful.util.mymainmenu:hide() - else - awful.util.mymainmenu.active_child.wibox:connect_signal("mouse::leave", - function() - if awful.util.mymainmenu.wibox ~= mouse.current_wibox then - awful.util.mymainmenu:hide() - end - end) - end -end) ---]] - --- Set the Menubar terminal for applications that require it ---menubar.utils.terminal = terminal - --- }}} - --- {{{ Screen - -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) screen.connect_signal('property::geometry', function(s) -- Wallpaper @@ -254,344 +185,7 @@ awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end) --- }}} - --- {{{ Mouse bindings - -root.buttons(mytable.join( - awful.button({}, 3, function() - awful.util.mymainmenu:toggle() - end), - awful.button({}, 4, awful.tag.viewnext), - awful.button({}, 5, awful.tag.viewprev) -)) - --- }}} - --- {{{ Key bindings - -globalkeys = mytable.join( - -- Destroy all notifications - awful.key({ 'Control' }, 'space', function() - naughty.destroy_all_notifications() - end, { description = 'destroy all notifications', group = 'hotkeys' }), - - -- Take a screenshot - awful.key({ modkey, altkey }, 'p', function() - awful.spawn('flameshot gui') - end, { description = 'take a screenshot', group = 'hotkeys' }), - - -- X screen locker - awful.key({ modkey, altkey, 'Control' }, 'l', function() - os.execute(os.getenv('HOME') .. '/.config/awesome/scripts/lock.sh') - end, { description = 'lock screen', group = 'hotkeys' }), - - -- Show help - awful.key({ modkey }, 's', hotkeys_popup.show_help, { description = 'show help', group = 'awesome' }), - - -- Tag browsing - awful.key({ modkey }, 'Left', awful.tag.viewprev, { description = 'view previous', group = 'tag' }), - awful.key({ modkey }, 'Right', awful.tag.viewnext, { description = 'view next', group = 'tag' }), - awful.key({ modkey }, 'Escape', awful.tag.history.restore, { description = 'go back', group = 'tag' }), - - -- Non-empty tag browsing - awful.key({ altkey }, 'Left', function() - lain.util.tag_view_nonempty(-1) - end, { description = 'view previous nonempty', group = 'tag' }), - awful.key({ altkey }, 'Right', function() - lain.util.tag_view_nonempty(1) - end, { description = 'view previous nonempty', group = 'tag' }), - - -- Default client focus - awful.key({ altkey }, 'j', function() - awful.client.focus.byidx(1) - end, { description = 'focus next by index', group = 'client' }), - awful.key({ altkey }, 'k', function() - awful.client.focus.byidx(-1) - end, { description = 'focus previous by index', group = 'client' }), - - -- By-direction client focus - awful.key({ modkey }, 'j', function() - awful.client.focus.global_bydirection('down') - if client.focus then - client.focus:raise() - end - end, { description = 'focus down', group = 'client' }), - awful.key({ modkey }, 'k', function() - awful.client.focus.global_bydirection('up') - if client.focus then - client.focus:raise() - end - end, { description = 'focus up', group = 'client' }), - awful.key({ modkey }, 'h', function() - awful.client.focus.global_bydirection('left') - if client.focus then - client.focus:raise() - end - end, { description = 'focus left', group = 'client' }), - awful.key({ modkey }, 'l', function() - awful.client.focus.global_bydirection('right') - if client.focus then - client.focus:raise() - end - end, { description = 'focus right', group = 'client' }), - - -- Menu - awful.key({ modkey }, 'w', function() - awful.util.mymainmenu:show() - end, { description = 'show main menu', group = 'awesome' }), - - -- Layout manipulation - awful.key({ modkey, 'Shift' }, 'j', function() - awful.client.swap.byidx(1) - end, { description = 'swap with next client by index', group = 'client' }), - awful.key({ modkey, 'Shift' }, 'k', function() - awful.client.swap.byidx(-1) - end, { description = 'swap with previous client by index', group = 'client' }), - awful.key({ modkey, 'Control' }, 'j', function() - awful.screen.focus_relative(1) - end, { description = 'focus the next screen', group = 'screen' }), - awful.key({ modkey, 'Control' }, 'k', function() - awful.screen.focus_relative(-1) - end, { description = 'focus the previous screen', group = 'screen' }), - awful.key({ modkey }, 'u', awful.client.urgent.jumpto, { description = 'jump to urgent client', group = 'client' }), - awful.key({ modkey }, 'Tab', function() - if cycle_prev then - awful.client.focus.history.previous() - else - awful.client.focus.byidx(-1) - end - if client.focus then - client.focus:raise() - end - end, { description = 'cycle with previous/go back', group = 'client' }), - - -- Show/hide wibox - awful.key({ modkey }, 'b', function() - for s in screen do - s.mywibox.visible = not s.mywibox.visible - if s.mybottomwibox then - s.mybottomwibox.visible = not s.mybottomwibox.visible - end - end - end, { description = 'toggle wibox', group = 'awesome' }), - - -- On-the-fly useless gaps change - awful.key({ altkey, 'Control' }, '+', function() - lain.util.useless_gaps_resize(1) - end, { description = 'increment useless gaps', group = 'tag' }), - awful.key({ altkey, 'Control' }, '-', function() - lain.util.useless_gaps_resize(-1) - end, { description = 'decrement useless gaps', group = 'tag' }), - - -- Dynamic tagging - awful.key({ modkey, 'Shift' }, 'n', function() - lain.util.add_tag() - end, { description = 'add new tag', group = 'tag' }), - awful.key({ modkey, 'Shift' }, 'r', function() - lain.util.rename_tag() - end, { description = 'rename tag', group = 'tag' }), - awful.key({ modkey, 'Shift' }, 'Left', function() - lain.util.move_tag(-1) - end, { description = 'move tag to the left', group = 'tag' }), - awful.key({ modkey, 'Shift' }, 'Right', function() - lain.util.move_tag(1) - end, { description = 'move tag to the right', group = 'tag' }), - awful.key({ modkey, 'Shift' }, 'd', function() - lain.util.delete_tag() - end, { description = 'delete tag', group = 'tag' }), - - -- Standard program - awful.key({ modkey }, 'Return', function() - awful.spawn(terminal) - end, { description = 'open a terminal', group = 'launcher' }), - awful.key({ modkey, 'Control' }, 'r', awesome.restart, { description = 'reload awesome', group = 'awesome' }), - awful.key({ modkey, 'Shift' }, 'q', awesome.quit, { description = 'quit awesome', group = 'awesome' }), - - awful.key({ modkey, altkey }, 'l', function() - awful.tag.incmwfact(0.05) - end, { description = 'increase master width factor', group = 'layout' }), - awful.key({ modkey, altkey }, 'h', function() - awful.tag.incmwfact(-0.05) - end, { description = 'decrease master width factor', group = 'layout' }), - awful.key({ modkey, 'Shift' }, 'h', function() - awful.tag.incnmaster(1, nil, true) - end, { description = 'increase the number of master clients', group = 'layout' }), - awful.key({ modkey, 'Shift' }, 'l', function() - awful.tag.incnmaster(-1, nil, true) - end, { description = 'decrease the number of master clients', group = 'layout' }), - awful.key({ modkey, 'Control' }, 'h', function() - awful.tag.incncol(1, nil, true) - end, { description = 'increase the number of columns', group = 'layout' }), - awful.key({ modkey, 'Control' }, 'l', function() - awful.tag.incncol(-1, nil, true) - end, { description = 'decrease the number of columns', group = 'layout' }), - awful.key({ modkey }, 'space', function() - awful.layout.inc(1) - end, { description = 'select next', group = 'layout' }), - awful.key({ modkey, 'Shift' }, 'space', function() - awful.layout.inc(-1) - end, { description = 'select previous', group = 'layout' }), - - awful.key({ modkey, 'Control' }, 'n', function() - local c = awful.client.restore() - -- Focus restored client - if c then - c:emit_signal('request::activate', 'key.unminimize', { raise = true }) - end - end, { description = 'restore minimized', group = 'client' }), - - -- Dropdown application - awful.key({ modkey }, 'q', function() - awful.screen.focused().quake:toggle() - end, { description = 'dropdown application', group = 'launcher' }), - - -- Widgets popups - --[[ awful.key({ altkey, }, "c", function () if beautiful.cal then beautiful.cal.show(7) end end, - {description = "show calendar", group = "widgets"}), - awful.key({ altkey, }, "h", function () if beautiful.fs then beautiful.fs.show(7) end end, - {description = "show filesystem", group = "widgets"}), - awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end, - {description = "show weather", group = "widgets"}), - ]] - -- - - -- Screen brightness - --awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end, - -- {description = "+10%", group = "hotkeys"}), - --awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 10") end, - -- {description = "-10%", group = "hotkeys"}), - - -- ALSA volume control - --[[ - awful.key({ altkey }, "Up", - function () - os.execute(string.format("amixer -q set %s 1%%+", beautiful.volume.channel)) - beautiful.volume.update() - end, - {description = "volume up", group = "hotkeys"}), - awful.key({ altkey }, "Down", - function () - os.execute(string.format("amixer -q set %s 1%%-", beautiful.volume.channel)) - beautiful.volume.update() - end, - {description = "volume down", group = "hotkeys"}), - awful.key({ altkey }, "m", - function () - os.execute(string.format("amixer -q set %s toggle", beautiful.volume.togglechannel or beautiful.volume.channel)) - beautiful.volume.update() - end, - {description = "toggle mute", group = "hotkeys"}), - awful.key({ altkey, "Control" }, "m", - function () - os.execute(string.format("amixer -q set %s 100%%", beautiful.volume.channel)) - beautiful.volume.update() - end, - {description = "volume 100%", group = "hotkeys"}), - awful.key({ altkey, "Control" }, "0", - function () - os.execute(string.format("amixer -q set %s 0%%", beautiful.volume.channel)) - beautiful.volume.update() - end, - {description = "volume 0%", group = "hotkeys"}), - ]] - -- - - -- MPD control - --[[ - awful.key({ altkey, "Control" }, "Up", - function () - os.execute("mpc toggle") - beautiful.mpd.update() - end, - {description = "mpc toggle", group = "widgets"}), - awful.key({ altkey, "Control" }, "Down", - function () - os.execute("mpc stop") - beautiful.mpd.update() - end, - {description = "mpc stop", group = "widgets"}), - awful.key({ altkey, "Control" }, "Left", - function () - os.execute("mpc prev") - beautiful.mpd.update() - end, - {description = "mpc prev", group = "widgets"}), - awful.key({ altkey, "Control" }, "Right", - function () - os.execute("mpc next") - beautiful.mpd.update() - end, - {description = "mpc next", group = "widgets"}), - awful.key({ altkey }, "0", - function () - local common = { text = "MPD widget ", position = "top_middle", timeout = 2 } - if beautiful.mpd.timer.started then - beautiful.mpd.timer:stop() - common.text = common.text .. lain.util.markup.bold("OFF") - else - beautiful.mpd.timer:start() - common.text = common.text .. lain.util.markup.bold("ON") - end - naughty.notify(common) - end, - {description = "mpc on/off", group = "widgets"}), - ]] - -- - - -- Copy primary to clipboard (terminals to gtk) - --awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end, - -- {description = "copy terminal to gtk", group = "hotkeys"}), - -- Copy clipboard to primary (gtk to terminals) - --awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end, - -- {description = "copy gtk to terminal", group = "hotkeys"}), - - -- User programs - --awful.key({ modkey }, "q", function () awful.spawn(browser) end, - -- {description = "run browser", group = "launcher"}), - - -- Default - --[[ Menubar - awful.key({ modkey }, "p", function() menubar.show() end, - {description = "show the menubar", group = "launcher"}), - --]] - --[[ dmenu - awful.key({ modkey }, "x", function () - os.execute(string.format("dmenu_run -i -fn 'Monospace' -nb '%s' -nf '%s' -sb '%s' -sf '%s'", - beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) - end, - {description = "show dmenu", group = "launcher"}), - --]] - -- alternatively use rofi, a dmenu-like application with more features - -- check https://github.com/DaveDavenport/rofi for more details - -- rofi - awful.key({ modkey }, 'y', function() - os.execute('rofi -show drun -theme fancy') - end, { description = 'show rofi', group = 'launcher' }), - awful.key({ modkey, 'Shift' }, 'y', function() - os.execute('rofi -show ssh -theme fancy') - end, { description = 'show rofi', group = 'launcher' }), - awful.key({ modkey, 'Control' }, 'y', function() - os.execute('rofi -show window -theme fancy') - end, { description = 'show rofi', group = 'launcher' }), - - -- Prompt - awful.key({ modkey }, 'r', function() - awful.screen.focused().mypromptbox:run() - end, { description = 'run prompt', group = 'launcher' }), - - awful.key({ modkey }, 'x', function() - awful.prompt.run({ - prompt = 'Run Lua code: ', - textbox = awful.screen.focused().mypromptbox.widget, - exe_callback = awful.util.eval, - history_path = awful.util.get_cache_dir() .. '/history_eval', - }) - end, { description = 'lua execute prompt', group = 'awesome' }) - --]] -) - -clientkeys = mytable.join( +local clientkeys = mytable.join( awful.key({ altkey, 'Shift' }, 'm', lain.util.magnify_client, { description = 'magnify client', group = 'client' }), awful.key({ modkey }, 'f', function(c) c.fullscreen = not c.fullscreen @@ -646,50 +240,7 @@ clientkeys = mytable.join( end, { description = 'toggle mouse constrain', group = 'client' }) ) --- Bind all key numbers to tags. --- Be careful: we use keycodes to make it work on any keyboard layout. --- This should map on the top row of your keyboard, usually 1 to 9. -for i = 1, 9 do - globalkeys = mytable.join( - globalkeys, - -- View tag only. - awful.key({ modkey }, '#' .. i + 9, function() - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - tag:view_only() - end - end, { description = 'view tag #' .. i, group = 'tag' }), - -- Toggle tag display. - awful.key({ modkey, 'Control' }, '#' .. i + 9, function() - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - awful.tag.viewtoggle(tag) - end - end, { description = 'toggle tag #' .. i, group = 'tag' }), - -- Move client to tag. - awful.key({ modkey, 'Shift' }, '#' .. i + 9, function() - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:move_to_tag(tag) - end - end - end, { description = 'move focused client to tag #' .. i, group = 'tag' }), - -- Toggle tag on focused client. - awful.key({ modkey, 'Control', 'Shift' }, '#' .. i + 9, function() - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:toggle_tag(tag) - end - end - end, { description = 'toggle focused client on tag #' .. i, group = 'tag' }) - ) -end - -clientbuttons = mytable.join( +local clientbuttons = mytable.join( awful.button({}, 1, function(c) c:emit_signal('request::activate', 'mouse_click', { raise = true }) end), @@ -704,7 +255,7 @@ clientbuttons = mytable.join( ) -- Set keys -root.keys(globalkeys) +root.keys(require('rc_parts.global_keys')) -- }}} @@ -781,10 +332,6 @@ awful.rules.rules = { -- properties = { screen = 1, tag = "2" } }, } --- }}} - --- {{{ Signals - -- Signal function to execute when a new client appears. client.connect_signal('manage', function(c) -- Set the windows at the slave, @@ -850,7 +397,7 @@ end) -- Enable sloppy focus, so that focus follows mouse. client.connect_signal('mouse::enter', function(c) - c:emit_signal('request::activate', 'mouse_enter', { raise = vi_focus }) + c:emit_signal('request::activate', 'mouse_enter', { raise = globals.vi_focus }) end) client.connect_signal('focus', function(c) @@ -859,5 +406,3 @@ end) client.connect_signal('unfocus', function(c) c.border_color = beautiful.border_normal end) - --- }}} diff --git a/awesome/constrain.lua b/awesome/rc_parts/constrain.lua similarity index 100% rename from awesome/constrain.lua rename to awesome/rc_parts/constrain.lua diff --git a/awesome/rc_parts/global_keys.lua b/awesome/rc_parts/global_keys.lua new file mode 100644 index 0000000..f29e33c --- /dev/null +++ b/awesome/rc_parts/global_keys.lua @@ -0,0 +1,384 @@ +local gears = require('gears') +local awful = require('awful') + +require('awful.autofocus') + +local naughty = require('naughty') +local lain = require('lain') +local hotkeys_popup = require('awful.hotkeys_popup') +require('awful.hotkeys_popup.keys') +local globals = require('rc_parts.globals') + +local mytable = awful.util.table or gears.table -- 4.{0,1} compatibility + +local modkey = globals.modkey +local altkey = globals.altkey + +local globalkeys = mytable.join( + -- Destroy all notifications + awful.key({ 'Control' }, 'space', function() + naughty.destroy_all_notifications() + end, { description = 'destroy all notifications', group = 'hotkeys' }), + + -- Take a screenshot + awful.key({ modkey, altkey }, 'p', function() + awful.spawn('flameshot gui') + end, { description = 'take a screenshot', group = 'hotkeys' }), + + -- X screen locker + awful.key({ modkey, altkey, 'Control' }, 'l', function() + os.execute(os.getenv('HOME') .. '/.config/awesome/scripts/lock.sh') + end, { description = 'lock screen', group = 'hotkeys' }), + + -- Show help + awful.key({ modkey }, 's', hotkeys_popup.show_help, { description = 'show help', group = 'awesome' }), + + -- Tag browsing + awful.key({ modkey }, 'Left', awful.tag.viewprev, { description = 'view previous', group = 'tag' }), + awful.key({ modkey }, 'Right', awful.tag.viewnext, { description = 'view next', group = 'tag' }), + awful.key({ modkey }, 'Escape', awful.tag.history.restore, { description = 'go back', group = 'tag' }), + + -- Non-empty tag browsing + awful.key({ altkey }, 'Left', function() + lain.util.tag_view_nonempty(-1) + end, { description = 'view previous nonempty', group = 'tag' }), + awful.key({ altkey }, 'Right', function() + lain.util.tag_view_nonempty(1) + end, { description = 'view previous nonempty', group = 'tag' }), + + -- Default client focus + awful.key({ altkey }, 'j', function() + awful.client.focus.byidx(1) + end, { description = 'focus next by index', group = 'client' }), + awful.key({ altkey }, 'k', function() + awful.client.focus.byidx(-1) + end, { description = 'focus previous by index', group = 'client' }), + + -- By-direction client focus + awful.key({ modkey }, 'j', function() + awful.client.focus.global_bydirection('down') + if client.focus then + client.focus:raise() + end + end, { description = 'focus down', group = 'client' }), + awful.key({ modkey }, 'k', function() + awful.client.focus.global_bydirection('up') + if client.focus then + client.focus:raise() + end + end, { description = 'focus up', group = 'client' }), + awful.key({ modkey }, 'h', function() + awful.client.focus.global_bydirection('left') + if client.focus then + client.focus:raise() + end + end, { description = 'focus left', group = 'client' }), + awful.key({ modkey }, 'l', function() + awful.client.focus.global_bydirection('right') + if client.focus then + client.focus:raise() + end + end, { description = 'focus right', group = 'client' }), + + -- Menu + awful.key({ modkey }, 'w', function() + awful.util.mymainmenu:show() + end, { description = 'show main menu', group = 'awesome' }), + + -- Layout manipulation + awful.key({ modkey, 'Shift' }, 'j', function() + awful.client.swap.byidx(1) + end, { description = 'swap with next client by index', group = 'client' }), + awful.key({ modkey, 'Shift' }, 'k', function() + awful.client.swap.byidx(-1) + end, { description = 'swap with previous client by index', group = 'client' }), + awful.key({ modkey, 'Control' }, 'j', function() + awful.screen.focus_relative(1) + end, { description = 'focus the next screen', group = 'screen' }), + awful.key({ modkey, 'Control' }, 'k', function() + awful.screen.focus_relative(-1) + end, { description = 'focus the previous screen', group = 'screen' }), + awful.key({ modkey }, 'u', awful.client.urgent.jumpto, { description = 'jump to urgent client', group = 'client' }), + awful.key({ modkey }, 'Tab', function() + if globals.cycle_prev then + awful.client.focus.history.previous() + else + awful.client.focus.byidx(-1) + end + if client.focus then + client.focus:raise() + end + end, { description = 'cycle with previous/go back', group = 'client' }), + + -- Show/hide wibox + awful.key({ modkey }, 'b', function() + for s in screen do + s.mywibox.visible = not s.mywibox.visible + if s.mybottomwibox then + s.mybottomwibox.visible = not s.mybottomwibox.visible + end + end + end, { description = 'toggle wibox', group = 'awesome' }), + + -- On-the-fly useless gaps change + awful.key({ altkey, 'Control' }, '+', function() + lain.util.useless_gaps_resize(1) + end, { description = 'increment useless gaps', group = 'tag' }), + awful.key({ altkey, 'Control' }, '-', function() + lain.util.useless_gaps_resize(-1) + end, { description = 'decrement useless gaps', group = 'tag' }), + + -- Dynamic tagging + awful.key({ modkey, 'Shift' }, 'n', function() + lain.util.add_tag() + end, { description = 'add new tag', group = 'tag' }), + awful.key({ modkey, 'Shift' }, 'r', function() + lain.util.rename_tag() + end, { description = 'rename tag', group = 'tag' }), + awful.key({ modkey, 'Shift' }, 'Left', function() + lain.util.move_tag(-1) + end, { description = 'move tag to the left', group = 'tag' }), + awful.key({ modkey, 'Shift' }, 'Right', function() + lain.util.move_tag(1) + end, { description = 'move tag to the right', group = 'tag' }), + awful.key({ modkey, 'Shift' }, 'd', function() + lain.util.delete_tag() + end, { description = 'delete tag', group = 'tag' }), + + -- Standard program + awful.key({ modkey }, 'Return', function() + awful.spawn(globals.terminal) + end, { description = 'open a terminal', group = 'launcher' }), + awful.key({ modkey, 'Control' }, 'r', awesome.restart, { description = 'reload awesome', group = 'awesome' }), + awful.key({ modkey, 'Shift' }, 'q', awesome.quit, { description = 'quit awesome', group = 'awesome' }), + + awful.key({ modkey, altkey }, 'l', function() + awful.tag.incmwfact(0.05) + end, { description = 'increase master width factor', group = 'layout' }), + awful.key({ modkey, altkey }, 'h', function() + awful.tag.incmwfact(-0.05) + end, { description = 'decrease master width factor', group = 'layout' }), + awful.key({ modkey, 'Shift' }, 'h', function() + awful.tag.incnmaster(1, nil, true) + end, { description = 'increase the number of master clients', group = 'layout' }), + awful.key({ modkey, 'Shift' }, 'l', function() + awful.tag.incnmaster(-1, nil, true) + end, { description = 'decrease the number of master clients', group = 'layout' }), + awful.key({ modkey, 'Control' }, 'h', function() + awful.tag.incncol(1, nil, true) + end, { description = 'increase the number of columns', group = 'layout' }), + awful.key({ modkey, 'Control' }, 'l', function() + awful.tag.incncol(-1, nil, true) + end, { description = 'decrease the number of columns', group = 'layout' }), + awful.key({ modkey }, 'space', function() + awful.layout.inc(1) + end, { description = 'select next', group = 'layout' }), + awful.key({ modkey, 'Shift' }, 'space', function() + awful.layout.inc(-1) + end, { description = 'select previous', group = 'layout' }), + + awful.key({ modkey, 'Control' }, 'n', function() + local c = awful.client.restore() + -- Focus restored client + if c then + c:emit_signal('request::activate', 'key.unminimize', { raise = true }) + end + end, { description = 'restore minimized', group = 'client' }), + + -- Dropdown application + awful.key({ modkey }, 'q', function() + awful.screen.focused().quake:toggle() + end, { description = 'dropdown application', group = 'launcher' }), + + -- Widgets popups + --[[ awful.key({ altkey, }, "c", function () if beautiful.cal then beautiful.cal.show(7) end end, + {description = "show calendar", group = "widgets"}), + awful.key({ altkey, }, "h", function () if beautiful.fs then beautiful.fs.show(7) end end, + {description = "show filesystem", group = "widgets"}), + awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end, + {description = "show weather", group = "widgets"}), + ]] + -- + + -- Screen brightness + --awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end, + -- {description = "+10%", group = "hotkeys"}), + --awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 10") end, + -- {description = "-10%", group = "hotkeys"}), + + -- ALSA volume control + --[[ + awful.key({ altkey }, "Up", + function () + os.execute(string.format("amixer -q set %s 1%%+", beautiful.volume.channel)) + beautiful.volume.update() + end, + {description = "volume up", group = "hotkeys"}), + awful.key({ altkey }, "Down", + function () + os.execute(string.format("amixer -q set %s 1%%-", beautiful.volume.channel)) + beautiful.volume.update() + end, + {description = "volume down", group = "hotkeys"}), + awful.key({ altkey }, "m", + function () + os.execute(string.format( + "amixer -q set %s toggle", + beautiful.volume.togglechannel or beautiful.volume.channel + )) + beautiful.volume.update() + end, + {description = "toggle mute", group = "hotkeys"}), + awful.key({ altkey, "Control" }, "m", + function () + os.execute(string.format("amixer -q set %s 100%%", beautiful.volume.channel)) + beautiful.volume.update() + end, + {description = "volume 100%", group = "hotkeys"}), + awful.key({ altkey, "Control" }, "0", + function () + os.execute(string.format("amixer -q set %s 0%%", beautiful.volume.channel)) + beautiful.volume.update() + end, + {description = "volume 0%", group = "hotkeys"}), + ]] + -- + + -- MPD control + --[[ + awful.key({ altkey, "Control" }, "Up", + function () + os.execute("mpc toggle") + beautiful.mpd.update() + end, + {description = "mpc toggle", group = "widgets"}), + awful.key({ altkey, "Control" }, "Down", + function () + os.execute("mpc stop") + beautiful.mpd.update() + end, + {description = "mpc stop", group = "widgets"}), + awful.key({ altkey, "Control" }, "Left", + function () + os.execute("mpc prev") + beautiful.mpd.update() + end, + {description = "mpc prev", group = "widgets"}), + awful.key({ altkey, "Control" }, "Right", + function () + os.execute("mpc next") + beautiful.mpd.update() + end, + {description = "mpc next", group = "widgets"}), + awful.key({ altkey }, "0", + function () + local common = { text = "MPD widget ", position = "top_middle", timeout = 2 } + if beautiful.mpd.timer.started then + beautiful.mpd.timer:stop() + common.text = common.text .. lain.util.markup.bold("OFF") + else + beautiful.mpd.timer:start() + common.text = common.text .. lain.util.markup.bold("ON") + end + naughty.notify(common) + end, + {description = "mpc on/off", group = "widgets"}), + ]] + -- + + -- Copy primary to clipboard (terminals to gtk) + --awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end, + -- {description = "copy terminal to gtk", group = "hotkeys"}), + -- Copy clipboard to primary (gtk to terminals) + --awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end, + -- {description = "copy gtk to terminal", group = "hotkeys"}), + + -- User programs + --awful.key({ modkey }, "q", function () awful.spawn(browser) end, + -- {description = "run browser", group = "launcher"}), + + -- Default + --[[ Menubar + awful.key({ modkey }, "p", function() menubar.show() end, + {description = "show the menubar", group = "launcher"}), + --]] + --[[ dmenu + awful.key({ modkey }, "x", function () + os.execute(string.format("dmenu_run -i -fn 'Monospace' -nb '%s' -nf '%s' -sb '%s' -sf '%s'", + beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) + end, + {description = "show dmenu", group = "launcher"}), + --]] + -- alternatively use rofi, a dmenu-like application with more features + -- check https://github.com/DaveDavenport/rofi for more details + -- rofi + awful.key({ modkey }, 'y', function() + os.execute('rofi -show drun -theme fancy') + end, { description = 'show rofi', group = 'launcher' }), + awful.key({ modkey, 'Shift' }, 'y', function() + os.execute('rofi -show ssh -theme fancy') + end, { description = 'show rofi', group = 'launcher' }), + awful.key({ modkey, 'Control' }, 'y', function() + os.execute('rofi -show window -theme fancy') + end, { description = 'show rofi', group = 'launcher' }), + + -- Prompt + awful.key({ modkey }, 'r', function() + awful.screen.focused().mypromptbox:run() + end, { description = 'run prompt', group = 'launcher' }), + + awful.key({ modkey }, 'x', function() + awful.prompt.run({ + prompt = 'Run Lua code: ', + textbox = awful.screen.focused().mypromptbox.widget, + exe_callback = awful.util.eval, + history_path = awful.util.get_cache_dir() .. '/history_eval', + }) + end, { description = 'lua execute prompt', group = 'awesome' }) + --]] +) + +-- Bind all key numbers to tags. +-- Be careful: we use keycodes to make it work on any keyboard layout. +-- This should map on the top row of your keyboard, usually 1 to 9. +for i = 1, 9 do + globalkeys = mytable.join( + globalkeys, + -- View tag only. + awful.key({ modkey }, '#' .. i + 9, function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end, { description = 'view tag #' .. i, group = 'tag' }), + -- Toggle tag display. + awful.key({ modkey, 'Control' }, '#' .. i + 9, function() + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end, { description = 'toggle tag #' .. i, group = 'tag' }), + -- Move client to tag. + awful.key({ modkey, 'Shift' }, '#' .. i + 9, function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end, { description = 'move focused client to tag #' .. i, group = 'tag' }), + -- Toggle tag on focused client. + awful.key({ modkey, 'Control', 'Shift' }, '#' .. i + 9, function() + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end, { description = 'toggle focused client on tag #' .. i, group = 'tag' }) + ) +end + +return globalkeys diff --git a/awesome/rc_parts/globals.lua b/awesome/rc_parts/globals.lua new file mode 100644 index 0000000..6d88aa2 --- /dev/null +++ b/awesome/rc_parts/globals.lua @@ -0,0 +1,8 @@ +return { + modkey = 'Mod4', + altkey = 'Mod1', + terminal = 'kitty', + vi_focus = false, + cycle_prev = true, + editor = 'nvim', +} diff --git a/awesome/theme.lua b/awesome/theme.lua deleted file mode 100644 index f96639e..0000000 --- a/awesome/theme.lua +++ /dev/null @@ -1,429 +0,0 @@ ---[[ - - Multicolor Awesome WM theme 2.0 - github.com/lcpz - ---]] - -local gears = require('gears') -local lain = require('lain') -local awful = require('awful') -local wibox = require('wibox') -local dpi = require('beautiful.xresources').apply_dpi -local naughty = require('naughty') -local settings = (function() - local status, settings = pcall(function() - return dofile(os.getenv('HOME') .. '/.config/awesome/settings.lua') - end) - if status then - return settings - else - naughty.notify({ - preset = naughty.config.presets.critical, - title = 'Error while parsing settings!', - text = settings, - }) - return {} - end -end)() - -local os = os -local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility - -local theme = {} -theme.confdir = os.getenv('HOME') .. '/.config/awesome/' -theme.wallpaper = os.getenv('HOME') .. '/.config/awesome/' .. (settings['wallpaper'] or 'wall.png') -theme.font = 'Terminus 8' -theme.menu_bg_normal = '#000000' -theme.menu_bg_focus = '#000000' -theme.bg_normal = '#000000' -theme.bg_focus = '#000000' -theme.bg_urgent = '#000000' -theme.fg_normal = '#aaaaaa' -theme.fg_focus = '#ff8c00' -theme.fg_urgent = '#af1d18' -theme.fg_minimize = '#ffffff' -theme.border_width = dpi(1) -theme.border_normal = '#1c2022' -theme.border_focus = '#606060' -theme.border_marked = '#3ca4d8' -theme.menu_border_width = 0 -theme.menu_width = dpi(130) -theme.menu_submenu_icon = theme.confdir .. '/icons/submenu.png' -theme.menu_fg_normal = '#aaaaaa' -theme.menu_fg_focus = '#ff8c00' -theme.menu_bg_normal = '#050505dd' -theme.menu_bg_focus = '#050505dd' -theme.widget_cpu = theme.confdir .. '/icons/info/cpu.png' -theme.widget_mem = theme.confdir .. '/icons/info/mem.png' -theme.widget_netdown = theme.confdir .. '/icons/info/download.png' -theme.widget_netup = theme.confdir .. '/icons/info/upload.png' -theme.widget_bat_charge = theme.confdir .. '/icons/info/batcharge.png' -theme.widget_bat_empty = theme.confdir .. '/icons/info/batempty.png' -theme.widget_bat_low = theme.confdir .. '/icons/info/batlow.png' -theme.widget_bat_mid = theme.confdir .. '/icons/info/batmid.png' -theme.widget_bat_high = theme.confdir .. '/icons/info/bathigh.png' -theme.widget_bat_full = theme.confdir .. '/icons/info/batfull.png' -theme.widget_vol_mute = theme.confdir .. '/icons/info/volmute.png' -theme.widget_vol_low = theme.confdir .. '/icons/info/vollow.png' -theme.widget_vol_high = theme.confdir .. '/icons/info/volhigh.png' -theme.taglist_fg_focus = '#000000' -theme.taglist_bg_focus = '#b3b3b3' -theme.taglist_squares_unsel = theme.confdir .. '/icons/usedtag.png' -theme.taglist_squares_resize = true -theme.tasklist_plain_task_name = true -theme.tasklist_disable_icon = true -theme.useless_gap = 0 -theme.layout_tile = theme.confdir .. '/icons/tile.png' -theme.layout_tilegaps = theme.confdir .. '/icons/tilegaps.png' -theme.layout_tileleft = theme.confdir .. '/icons/tileleft.png' -theme.layout_tilebottom = theme.confdir .. '/icons/tilebottom.png' -theme.layout_tiletop = theme.confdir .. '/icons/tiletop.png' -theme.layout_fairv = theme.confdir .. '/icons/fairv.png' -theme.layout_fairh = theme.confdir .. '/icons/fairh.png' -theme.layout_spiral = theme.confdir .. '/icons/spiral.png' -theme.layout_dwindle = theme.confdir .. '/icons/dwindle.png' -theme.layout_max = theme.confdir .. '/icons/max.png' -theme.layout_fullscreen = theme.confdir .. '/icons/fullscreen.png' -theme.layout_magnifier = theme.confdir .. '/icons/magnifier.png' -theme.layout_floating = theme.confdir .. '/icons/floating.png' -theme.titlebar_close_button_normal = theme.confdir .. '/icons/titlebar/close_normal.png' -theme.titlebar_close_button_focus = theme.confdir .. '/icons/titlebar/close_focus.png' -theme.titlebar_minimize_button_normal = theme.confdir .. '/icons/titlebar/minimize_normal.png' -theme.titlebar_minimize_button_focus = theme.confdir .. '/icons/titlebar/minimize_focus.png' -theme.titlebar_ontop_button_normal_inactive = theme.confdir .. '/icons/titlebar/ontop_normal_inactive.png' -theme.titlebar_ontop_button_focus_inactive = theme.confdir .. '/icons/titlebar/ontop_focus_inactive.png' -theme.titlebar_ontop_button_normal_active = theme.confdir .. '/icons/titlebar/ontop_normal_active.png' -theme.titlebar_ontop_button_focus_active = theme.confdir .. '/icons/titlebar/ontop_focus_active.png' -theme.titlebar_sticky_button_normal_inactive = theme.confdir .. '/icons/titlebar/sticky_normal_inactive.png' -theme.titlebar_sticky_button_focus_inactive = theme.confdir .. '/icons/titlebar/sticky_focus_inactive.png' -theme.titlebar_sticky_button_normal_active = theme.confdir .. '/icons/titlebar/sticky_normal_active.png' -theme.titlebar_sticky_button_focus_active = theme.confdir .. '/icons/titlebar/sticky_focus_active.png' -theme.titlebar_floating_button_normal_inactive = theme.confdir .. '/icons/titlebar/floating_normal_inactive.png' -theme.titlebar_floating_button_focus_inactive = theme.confdir .. '/icons/titlebar/floating_focus_inactive.png' -theme.titlebar_floating_button_normal_active = theme.confdir .. '/icons/titlebar/floating_normal_active.png' -theme.titlebar_floating_button_focus_active = theme.confdir .. '/icons/titlebar/floating_focus_active.png' -theme.titlebar_maximized_button_normal_inactive = theme.confdir .. '/icons/titlebar/maximized_normal_inactive.png' -theme.titlebar_maximized_button_focus_inactive = theme.confdir .. '/icons/titlebar/maximized_focus_inactive.png' -theme.titlebar_maximized_button_normal_active = theme.confdir .. '/icons/titlebar/maximized_normal_active.png' -theme.titlebar_maximized_button_focus_active = theme.confdir .. '/icons/titlebar/maximized_focus_active.png' - -theme.tasklist_fg_minimize = '#b3b3b3' -theme.tasklist_bg_minimize = '#4d4d4d' - -local function build_widget_list(widgets) - local out = {} - local last_bg = 'alpha' - - for _, widget in pairs(widgets) do - table.insert(out, lain.util.separators.arrow_left(last_bg, widget.bg)) - - local bg_widget = wibox.widget.background(wibox.container.margin(widget.widget, 5, 5), widget.bg) - bg_widget.fg = '#000000' - table.insert(out, bg_widget) - - last_bg = widget.bg - end - - return out -end - -local info_widgets = {} - --- > Net -local netdowninfo = wibox.widget.textbox() -local netupinfo = lain.widget.net({ - settings = function() - -- luacheck: globals widget net_now - widget:set_text(net_now.sent) - netdowninfo:set_text(net_now.received) - end, -}) - -table.insert(info_widgets, { - widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netdown), netdowninfo), - bg = '#87af5f', -}) -table.insert(info_widgets, { - widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netup), netupinfo.widget), - bg = '#e54c62', -}) --- < Net - --- > Battery -if settings['show_battery'] == true then - local baticon = wibox.widget.imagebox(nil) - local bat = lain.widget.bat({ - settings = function() - -- luacheck: globals widget bat_now - if bat_now.ac_status == 1 or bat_now.perc == 'N/A' then - baticon:set_image(theme.widget_bat_charge) - elseif bat_now.perc < 5 then - baticon:set_image(theme.widget_bat_empty) - elseif bat_now.perc < 15 then - baticon:set_image(theme.widget_bat_low) - elseif bat_now.perc < 50 then - baticon:set_image(theme.widget_bat_mid) - elseif bat_now.perc < 95 then - baticon:set_image(theme.widget_bat_high) - else - baticon:set_image(theme.widget_bat_full) - end - - local perc = bat_now.perc ~= 'N/A' and bat_now.perc .. '%' or bat_now.perc - - if bat_now.ac_status == 1 then - perc = perc .. ' plug' - end - - widget:set_text(perc) - end, - }) - table.insert(info_widgets, { - widget = wibox.layout.fixed.horizontal(baticon, bat.widget), - bg = '#e54c62', - }) -end --- < Battery - --- > ALSA volume -local volumeicon = wibox.widget.imagebox(nil) -local volume = lain.widget.alsa({ - settings = function() - -- luacheck: globals widget volume_now - if volume_now.status == 'off' then - volumeicon:set_image(theme.widget_vol_mute) - volume_now.level = 'M ' .. volume_now.level - elseif volume_now.level == 0 then - volumeicon:set_image(theme.widget_vol_mute) - elseif volume_now.level <= 50 then - volumeicon:set_image(theme.widget_vol_low) - else - volumeicon:set_image(theme.widget_vol_high) - end - - widget:set_text(' ' .. volume_now.level .. '%') - end, -}) - -local volumebuttons = awful.util.table.join( - awful.button({}, 1, function() -- left click - os.execute(string.format('%s set %s toggle', volume.cmd, volume.togglechannel or volume.channel)) - volume.update() - end), - awful.button({}, 4, function() - os.execute(string.format('%s set %s 1%%+', volume.cmd, volume.channel)) - volume.update() - end), - awful.button({}, 5, function() - os.execute(string.format('%s set %s 1%%-', volume.cmd, volume.channel)) - volume.update() - end) -) - -volume.widget:buttons(volumebuttons) -volumeicon:buttons(volumebuttons) - -table.insert(info_widgets, { - widget = wibox.layout.fixed.horizontal(volumeicon, volume.widget), - bg = '#7493d2', -}) --- < ALSA volume - --- > MEM -local memory = lain.widget.mem({ - settings = function() - -- luacheck: globals widget mem_now - widget:set_text(mem_now.used .. 'M') - end, -}) -table.insert(info_widgets, { - widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_mem), memory.widget), - bg = '#e0da37', -}) --- < MEM - --- > CPU -local cpu = lain.widget.cpu({ - settings = function() - -- luacheck: globals widget cpu_now - widget:set_text(cpu_now.usage .. '%') - end, -}) -table.insert(info_widgets, { - widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_cpu), cpu.widget), - bg = '#e33a6e', -}) --- < CPU - --- > fs -local fs = lain.widget.fs({ - notification_preset = { font = 'Monospace 10', fg = theme.fg_normal }, - settings = function() - -- luacheck: max line length 150, globals widget fs_now - widget:set_text( - fs_now['/'].percentage - .. '% (' - .. string.format('%.3f', fs_now['/'].free) - .. ' ' - .. fs_now['/'].units - .. ' left)' - ) - end, -}) -fs.widget:buttons(gears.table.join(awful.button({}, 1, function() - awful.spawn('Thunar') -end))) -table.insert(info_widgets, { - widget = fs.widget, - bg = '#80d9d8', -}) --- < fs - --- > Textclock -os.setlocale(os.getenv('LANG')) -- to localize the clock ---local clockicon = wibox.widget.imagebox(theme.widget_clock) -local mytextclock = wibox.widget.textclock('%I:%M %a %d.%m') -mytextclock.font = theme.font - -lain.widget.cal({ - attach_to = { mytextclock }, - notification_preset = { - font = 'Monospace 10', - fg = theme.fg_normal, - bg = theme.bg_normal, - }, -}) -table.insert(info_widgets, { - widget = mytextclock, - bg = '#7788af', -}) --- < Textclock - --- MPD ---[[ -local mpdicon = wibox.widget.imagebox() -theme.mpd = lain.widget.mpd({ - settings = function() - mpd_notification_preset = { - text = string.format("%s [%s] - %s\n%s", mpd_now.artist, - mpd_now.album, mpd_now.date, mpd_now.title) - } - - if mpd_now.state == "play" then - artist = mpd_now.artist .. " > " - title = mpd_now.title .. " " - mpdicon:set_image(theme.widget_note_on) - elseif mpd_now.state == "pause" then - artist = "mpd " - title = "paused " - else - artist = "" - title = "" - --mpdicon:set_image() -- not working in 4.0 - mpdicon._private.image = nil - mpdicon:emit_signal("widget::redraw_needed") - mpdicon:emit_signal("widget::layout_changed") - end - widget:set_markup(markup.fontfg(theme.font, "#e54c62", artist) .. markup.fontfg(theme.font, "#b2b2b2", title)) - end -}) -]] --- - -local final_info_widgets = build_widget_list(info_widgets) - -function theme.at_screen_connect(s) - -- Quake application - s.quake = lain.util.quake({ app = awful.util.terminal }) - - -- If wallpaper is a function, call it with the screen - local wallpaper = theme.wallpaper - if type(wallpaper) == 'function' then - wallpaper = wallpaper(s) - end - gears.wallpaper.maximized(wallpaper, s, true) - - -- Tags - awful.tag(awful.util.tagnames, s, awful.layout.layouts[1]) - - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt() - -- Create an imagebox widget which will contains an icon indicating which layout we're using. - -- We need one layoutbox per screen. - s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(my_table.join( - awful.button({}, 1, function() - awful.layout.inc(1) - end), - awful.button({}, 2, function() - awful.layout.set(awful.layout.layouts[1]) - end), - awful.button({}, 3, function() - awful.layout.inc(-1) - end), - awful.button({}, 4, function() - awful.layout.inc(1) - end), - awful.button({}, 5, function() - awful.layout.inc(-1) - end) - )) - -- Create a taglist widget - s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons) - - -- Create a tasklist widget - s.mytasklist = awful.widget.tasklist({ - screen = s, - filter = awful.widget.tasklist.filter.minimizedcurrenttags, - buttons = awful.util.tasklist_buttons, - style = { - shape = function(cr, w, h) - gears.shape.partially_rounded_rect(cr, w, h, false, false, true, true, 10) - end, - }, - layout = { - spacing = 5, - layout = wibox.layout.flex.horizontal, - }, - widget_template = { - { - { - id = 'text_role', - widget = wibox.widget.textbox, - }, - left = 10, - right = 10, - widget = wibox.container.margin, - }, - id = 'background_role', - widget = wibox.container.background, - }, - }) - s.mytasklist = wibox.container.margin(s.mytasklist, 10, 10, 0, 0) - - -- Create the wibox - s.mywibox = - awful.wibar({ position = 'top', screen = s, height = dpi(19), bg = theme.bg_normal, fg = theme.fg_normal }) - - -- Add widgets to the wibox - s.mywibox:setup({ - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - s.mylayoutbox, - s.mytaglist, - s.mypromptbox, - --mpdicon, - --theme.mpd.widget, - }, - s.mytasklist, -- Middle widget - --nil, - gears.table.join({ -- Right widgets - layout = wibox.layout.fixed.horizontal, - wibox.container.margin(wibox.widget.systray(), 0, 5), - }, final_info_widgets), - }) -end - -return theme diff --git a/awesome/theme/base_theme.lua b/awesome/theme/base_theme.lua new file mode 100644 index 0000000..c6f2611 --- /dev/null +++ b/awesome/theme/base_theme.lua @@ -0,0 +1,92 @@ +local dpi = require('beautiful.xresources').apply_dpi +local settings = require('settings') + +local theme = {} + +theme.confdir = os.getenv('HOME') .. '/.config/awesome/' +theme.wallpaper = os.getenv('HOME') .. '/.config/awesome/' .. (settings['wallpaper'] or 'wall.png') +theme.font = 'Terminus 8' + +theme.bg_normal = '#000000' +theme.bg_focus = '#000000' +theme.bg_urgent = '#000000' +theme.fg_normal = '#aaaaaa' +theme.fg_focus = '#ff8c00' +theme.fg_urgent = '#af1d18' +theme.fg_minimize = '#ffffff' + +theme.border_width = dpi(1) +theme.border_normal = '#1c2022' +theme.border_focus = '#606060' +theme.border_marked = '#3ca4d8' + +theme.menu_border_width = 0 +theme.menu_width = dpi(130) +theme.menu_submenu_icon = theme.confdir .. '/icons/submenu.png' +theme.menu_fg_normal = '#aaaaaa' +theme.menu_fg_focus = '#ff8c00' +theme.menu_bg_normal = '#050505dd' +theme.menu_bg_focus = '#050505dd' + +theme.widget_cpu = theme.confdir .. '/icons/info/cpu.png' +theme.widget_mem = theme.confdir .. '/icons/info/mem.png' +theme.widget_netdown = theme.confdir .. '/icons/info/download.png' +theme.widget_netup = theme.confdir .. '/icons/info/upload.png' +theme.widget_bat_charge = theme.confdir .. '/icons/info/batcharge.png' +theme.widget_bat_empty = theme.confdir .. '/icons/info/batempty.png' +theme.widget_bat_low = theme.confdir .. '/icons/info/batlow.png' +theme.widget_bat_mid = theme.confdir .. '/icons/info/batmid.png' +theme.widget_bat_high = theme.confdir .. '/icons/info/bathigh.png' +theme.widget_bat_full = theme.confdir .. '/icons/info/batfull.png' +theme.widget_vol_mute = theme.confdir .. '/icons/info/volmute.png' +theme.widget_vol_low = theme.confdir .. '/icons/info/vollow.png' +theme.widget_vol_high = theme.confdir .. '/icons/info/volhigh.png' + +theme.taglist_fg_focus = '#000000' +theme.taglist_bg_focus = '#b3b3b3' +theme.taglist_squares_unsel = theme.confdir .. '/icons/usedtag.png' +theme.taglist_squares_resize = true + +theme.useless_gap = 0 + +theme.layout_tile = theme.confdir .. '/icons/tile.png' +theme.layout_tilegaps = theme.confdir .. '/icons/tilegaps.png' +theme.layout_tileleft = theme.confdir .. '/icons/tileleft.png' +theme.layout_tilebottom = theme.confdir .. '/icons/tilebottom.png' +theme.layout_tiletop = theme.confdir .. '/icons/tiletop.png' +theme.layout_fairv = theme.confdir .. '/icons/fairv.png' +theme.layout_fairh = theme.confdir .. '/icons/fairh.png' +theme.layout_spiral = theme.confdir .. '/icons/spiral.png' +theme.layout_dwindle = theme.confdir .. '/icons/dwindle.png' +theme.layout_max = theme.confdir .. '/icons/max.png' +theme.layout_fullscreen = theme.confdir .. '/icons/fullscreen.png' +theme.layout_magnifier = theme.confdir .. '/icons/magnifier.png' +theme.layout_floating = theme.confdir .. '/icons/floating.png' + +theme.titlebar_close_button_normal = theme.confdir .. '/icons/titlebar/close_normal.png' +theme.titlebar_close_button_focus = theme.confdir .. '/icons/titlebar/close_focus.png' +theme.titlebar_minimize_button_normal = theme.confdir .. '/icons/titlebar/minimize_normal.png' +theme.titlebar_minimize_button_focus = theme.confdir .. '/icons/titlebar/minimize_focus.png' +theme.titlebar_ontop_button_normal_inactive = theme.confdir .. '/icons/titlebar/ontop_normal_inactive.png' +theme.titlebar_ontop_button_focus_inactive = theme.confdir .. '/icons/titlebar/ontop_focus_inactive.png' +theme.titlebar_ontop_button_normal_active = theme.confdir .. '/icons/titlebar/ontop_normal_active.png' +theme.titlebar_ontop_button_focus_active = theme.confdir .. '/icons/titlebar/ontop_focus_active.png' +theme.titlebar_sticky_button_normal_inactive = theme.confdir .. '/icons/titlebar/sticky_normal_inactive.png' +theme.titlebar_sticky_button_focus_inactive = theme.confdir .. '/icons/titlebar/sticky_focus_inactive.png' +theme.titlebar_sticky_button_normal_active = theme.confdir .. '/icons/titlebar/sticky_normal_active.png' +theme.titlebar_sticky_button_focus_active = theme.confdir .. '/icons/titlebar/sticky_focus_active.png' +theme.titlebar_floating_button_normal_inactive = theme.confdir .. '/icons/titlebar/floating_normal_inactive.png' +theme.titlebar_floating_button_focus_inactive = theme.confdir .. '/icons/titlebar/floating_focus_inactive.png' +theme.titlebar_floating_button_normal_active = theme.confdir .. '/icons/titlebar/floating_normal_active.png' +theme.titlebar_floating_button_focus_active = theme.confdir .. '/icons/titlebar/floating_focus_active.png' +theme.titlebar_maximized_button_normal_inactive = theme.confdir .. '/icons/titlebar/maximized_normal_inactive.png' +theme.titlebar_maximized_button_focus_inactive = theme.confdir .. '/icons/titlebar/maximized_focus_inactive.png' +theme.titlebar_maximized_button_normal_active = theme.confdir .. '/icons/titlebar/maximized_normal_active.png' +theme.titlebar_maximized_button_focus_active = theme.confdir .. '/icons/titlebar/maximized_focus_active.png' + +theme.tasklist_fg_minimize = '#b3b3b3' +theme.tasklist_bg_minimize = '#4d4d4d' +theme.tasklist_plain_task_name = true +theme.tasklist_disable_icon = true + +return theme diff --git a/awesome/theme/info/battery.lua b/awesome/theme/info/battery.lua new file mode 100644 index 0000000..d26e043 --- /dev/null +++ b/awesome/theme/info/battery.lua @@ -0,0 +1,35 @@ +local theme = require('theme.base_theme') +local lain = require('lain') +local wibox = require('wibox') + +local baticon = wibox.widget.imagebox(nil) +local bat = lain.widget.bat({ + settings = function() + -- luacheck: globals widget bat_now + if bat_now.ac_status == 1 or bat_now.perc == 'N/A' then + baticon:set_image(theme.widget_bat_charge) + elseif bat_now.perc < 5 then + baticon:set_image(theme.widget_bat_empty) + elseif bat_now.perc < 15 then + baticon:set_image(theme.widget_bat_low) + elseif bat_now.perc < 50 then + baticon:set_image(theme.widget_bat_mid) + elseif bat_now.perc < 95 then + baticon:set_image(theme.widget_bat_high) + else + baticon:set_image(theme.widget_bat_full) + end + local perc = bat_now.perc ~= 'N/A' and bat_now.perc .. '%' or bat_now.perc + + if bat_now.ac_status == 1 then + perc = perc .. ' plug' + end + + widget:set_text(perc) + end, +}) + +return { { + widget = wibox.layout.fixed.horizontal(baticon, bat.widget), + bg = '#e54c62', +} } diff --git a/awesome/theme/info/clock.lua b/awesome/theme/info/clock.lua new file mode 100644 index 0000000..cd7a35e --- /dev/null +++ b/awesome/theme/info/clock.lua @@ -0,0 +1,21 @@ +local theme = require('theme.base_theme') +local lain = require('lain') +local wibox = require('wibox') + +os.setlocale(os.getenv('LANG')) -- to localize the clock +local mytextclock = wibox.widget.textclock('%I:%M %a %d.%m') +mytextclock.font = theme.font + +lain.widget.cal({ + attach_to = { mytextclock }, + notification_preset = { + font = 'Monospace 10', + fg = theme.fg_normal, + bg = theme.bg_normal, + }, +}) + +return { { + widget = mytextclock, + bg = '#7788af', +} } diff --git a/awesome/theme/info/cpu.lua b/awesome/theme/info/cpu.lua new file mode 100644 index 0000000..804fd87 --- /dev/null +++ b/awesome/theme/info/cpu.lua @@ -0,0 +1,16 @@ +local theme = require('theme.base_theme') +local lain = require('lain') +local wibox = require('wibox') +local cpu = lain.widget.cpu({ + settings = function() + -- luacheck: globals widget cpu_now + widget:set_text(cpu_now.usage .. '%') + end, +}) + +return { + { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_cpu), cpu.widget), + bg = '#e33a6e', + }, +} diff --git a/awesome/theme/info/fs.lua b/awesome/theme/info/fs.lua new file mode 100644 index 0000000..0d297a7 --- /dev/null +++ b/awesome/theme/info/fs.lua @@ -0,0 +1,27 @@ +local theme = require('theme.base_theme') +local lain = require('lain') +local gears = require('gears') +local awful = require('awful') + +local fs = lain.widget.fs({ + notification_preset = { font = 'Monospace 10', fg = theme.fg_normal }, + settings = function() + -- luacheck: max line length 150, globals widget fs_now + widget:set_text( + fs_now['/'].percentage + .. '% (' + .. string.format('%.3f', fs_now['/'].free) + .. ' ' + .. fs_now['/'].units + .. ' left)' + ) + end, +}) +fs.widget:buttons(gears.table.join(awful.button({}, 1, function() + awful.spawn('Thunar') +end))) + +return { { + widget = fs.widget, + bg = '#80d9d8', +} } diff --git a/awesome/theme/info/init.lua b/awesome/theme/info/init.lua new file mode 100644 index 0000000..a74809a --- /dev/null +++ b/awesome/theme/info/init.lua @@ -0,0 +1,14 @@ +local gears = require('gears') +local settings = require('theme.settings') + +local show_battery = settings['show_battery'] == true + +return gears.table.join( + require('theme.info.net'), + show_battery and require('theme.info.battery') or {}, + require('theme.info.volume'), + require('theme.info.mem'), + require('theme.info.cpu'), + require('theme.info.fs'), + require('theme.info.clock') +) diff --git a/awesome/theme/info/mem.lua b/awesome/theme/info/mem.lua new file mode 100644 index 0000000..8e700bb --- /dev/null +++ b/awesome/theme/info/mem.lua @@ -0,0 +1,17 @@ +local theme = require('theme.base_theme') +local lain = require('lain') +local wibox = require('wibox') + +local memory = lain.widget.mem({ + settings = function() + -- luacheck: globals widget mem_now + widget:set_text(mem_now.used .. 'M') + end, +}) + +return { + { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_mem), memory.widget), + bg = '#e0da37', + }, +} diff --git a/awesome/theme/info/net.lua b/awesome/theme/info/net.lua new file mode 100644 index 0000000..de642e2 --- /dev/null +++ b/awesome/theme/info/net.lua @@ -0,0 +1,23 @@ +local theme = require('theme.base_theme') +local lain = require('lain') +local wibox = require('wibox') + +local netdowninfo = wibox.widget.textbox() +local netupinfo = lain.widget.net({ + settings = function() + -- luacheck: globals widget net_now + widget:set_text(net_now.sent) + netdowninfo:set_text(net_now.received) + end, +}) + +return { + { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netdown), netdowninfo), + bg = '#87af5f', + }, + { + widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netup), netupinfo.widget), + bg = '#e54c62', + }, +} diff --git a/awesome/theme/info/volume.lua b/awesome/theme/info/volume.lua new file mode 100644 index 0000000..8890c40 --- /dev/null +++ b/awesome/theme/info/volume.lua @@ -0,0 +1,46 @@ +local theme = require('theme.base_theme') +local lain = require('lain') +local wibox = require('wibox') +local awful = require('awful') + +local volumeicon = wibox.widget.imagebox(nil) +local volume = lain.widget.alsa({ + settings = function() + -- luacheck: globals widget volume_now + if volume_now.status == 'off' then + volumeicon:set_image(theme.widget_vol_mute) + volume_now.level = 'M ' .. volume_now.level + elseif volume_now.level == 0 then + volumeicon:set_image(theme.widget_vol_mute) + elseif volume_now.level <= 50 then + volumeicon:set_image(theme.widget_vol_low) + else + volumeicon:set_image(theme.widget_vol_high) + end + + widget:set_text(' ' .. volume_now.level .. '%') + end, +}) + +local volumebuttons = awful.util.table.join( + awful.button({}, 1, function() -- left click + os.execute(string.format('%s set %s toggle', volume.cmd, volume.togglechannel or volume.channel)) + volume.update() + end), + awful.button({}, 4, function() + os.execute(string.format('%s set %s 1%%+', volume.cmd, volume.channel)) + volume.update() + end), + awful.button({}, 5, function() + os.execute(string.format('%s set %s 1%%-', volume.cmd, volume.channel)) + volume.update() + end) +) + +volume.widget:buttons(volumebuttons) +volumeicon:buttons(volumebuttons) + +return { { + widget = wibox.layout.fixed.horizontal(volumeicon, volume.widget), + bg = '#7493d2', +} } diff --git a/awesome/theme/init.lua b/awesome/theme/init.lua new file mode 100644 index 0000000..88cc1be --- /dev/null +++ b/awesome/theme/init.lua @@ -0,0 +1,154 @@ +local gears = require('gears') +local lain = require('lain') +local awful = require('awful') +local wibox = require('wibox') +local dpi = require('beautiful.xresources').apply_dpi + +local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility + +local theme = require('theme.base_theme') + +local function build_widget_list(widgets) + local out = {} + local last_bg = 'alpha' + + for _, widget in pairs(widgets) do + table.insert(out, lain.util.separators.arrow_left(last_bg, widget.bg)) + + local bg_widget = wibox.widget.background(wibox.container.margin(widget.widget, 5, 5), widget.bg) + bg_widget.fg = '#000000' + table.insert(out, bg_widget) + + last_bg = widget.bg + end + + return out +end + +-- MPD +--[[ +local mpdicon = wibox.widget.imagebox() +theme.mpd = lain.widget.mpd({ + settings = function() + mpd_notification_preset = { + text = string.format("%s [%s] - %s\n%s", mpd_now.artist, + mpd_now.album, mpd_now.date, mpd_now.title) + } + + if mpd_now.state == "play" then + artist = mpd_now.artist .. " > " + title = mpd_now.title .. " " + mpdicon:set_image(theme.widget_note_on) + elseif mpd_now.state == "pause" then + artist = "mpd " + title = "paused " + else + artist = "" + title = "" + --mpdicon:set_image() -- not working in 4.0 + mpdicon._private.image = nil + mpdicon:emit_signal("widget::redraw_needed") + mpdicon:emit_signal("widget::layout_changed") + end + widget:set_markup(markup.fontfg(theme.font, "#e54c62", artist) .. markup.fontfg(theme.font, "#b2b2b2", title)) + end +}) +]] +-- + +local info = build_widget_list(require(... .. '.info')) + +function theme.at_screen_connect(s) + -- Quake application + s.quake = lain.util.quake({ app = awful.util.terminal }) + + -- If wallpaper is a function, call it with the screen + local wallpaper = theme.wallpaper + if type(wallpaper) == 'function' then + wallpaper = wallpaper(s) + end + gears.wallpaper.maximized(wallpaper, s, true) + + -- Tags + awful.tag(awful.util.tagnames, s, awful.layout.layouts[1]) + + -- Create a promptbox for each screen + s.mypromptbox = awful.widget.prompt() + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + s.mylayoutbox = awful.widget.layoutbox(s) + s.mylayoutbox:buttons(my_table.join( + awful.button({}, 1, function() + awful.layout.inc(1) + end), + awful.button({}, 2, function() + awful.layout.set(awful.layout.layouts[1]) + end), + awful.button({}, 3, function() + awful.layout.inc(-1) + end), + awful.button({}, 4, function() + awful.layout.inc(1) + end), + awful.button({}, 5, function() + awful.layout.inc(-1) + end) + )) + -- Create a taglist widget + s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons) + + -- Create a tasklist widget + s.mytasklist = awful.widget.tasklist({ + screen = s, + filter = awful.widget.tasklist.filter.minimizedcurrenttags, + buttons = awful.util.tasklist_buttons, + style = { + shape = function(cr, w, h) + gears.shape.partially_rounded_rect(cr, w, h, false, false, true, true, 10) + end, + }, + layout = { + spacing = 5, + layout = wibox.layout.flex.horizontal, + }, + widget_template = { + { + { + id = 'text_role', + widget = wibox.widget.textbox, + }, + left = 10, + right = 10, + widget = wibox.container.margin, + }, + id = 'background_role', + widget = wibox.container.background, + }, + }) + s.mytasklist = wibox.container.margin(s.mytasklist, 10, 10, 0, 0) + + -- Create the wibox + s.mywibox = + awful.wibar({ position = 'top', screen = s, height = dpi(19), bg = theme.bg_normal, fg = theme.fg_normal }) + + -- Add widgets to the wibox + s.mywibox:setup({ + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + s.mylayoutbox, + s.mytaglist, + s.mypromptbox, + --mpdicon, + --theme.mpd.widget, + }, + s.mytasklist, -- Middle widget + --nil, + gears.table.join({ -- Right widgets + layout = wibox.layout.fixed.horizontal, + wibox.container.margin(wibox.widget.systray(), 0, 5), + }, info), + }) +end + +return theme diff --git a/awesome/theme/settings.lua b/awesome/theme/settings.lua new file mode 100644 index 0000000..e70e4ee --- /dev/null +++ b/awesome/theme/settings.lua @@ -0,0 +1,17 @@ +local naughty = require('naughty') + +return (function() + local status, settings = pcall(function() + return dofile(os.getenv('HOME') .. '/.config/awesome/settings.lua') + end) + if status then + return settings + else + naughty.notify({ + preset = naughty.config.presets.critical, + title = 'Error while parsing settings!', + text = settings, + }) + return {} + end +end)()