From e6fd7b56134694c7ccbf18d107ecd4c63c2c74fb Mon Sep 17 00:00:00 2001 From: xeals Date: Tue, 15 Jan 2019 17:21:27 +1100 Subject: [PATCH] feat(autostart): implement in awesome itself --- cfg.fnl | 4 +--- module/autostart.fnl | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 module/autostart.fnl diff --git a/cfg.fnl b/cfg.fnl index d595347..67ba5ca 100644 --- a/cfg.fnl +++ b/cfg.fnl @@ -9,6 +9,7 @@ (require :module.decorate) (require :module.sidebar) +(require :module.autostart) (require :conf.client) (require :conf.tags) @@ -36,7 +37,4 @@ :unfocus (lambda [c] (set c.border_color beautiful.border_normal))} (fun.each (fn [event callback] (client.connect_signal event callback)))) -;; (awful.spawn.with_shell "~/.config/awesome/autostart") - -;; Empty return {} diff --git a/module/autostart.fnl b/module/autostart.fnl new file mode 100644 index 0000000..f7711fa --- /dev/null +++ b/module/autostart.fnl @@ -0,0 +1,39 @@ +;;; module/auto-start.fnl --- Auto-start utilities + +;;; Commentary: +;; Largely copied from +;; https://github.com/PapyElGringo/material-awesome/blob/master/module/auto-start.lua + +;;; Code: + +(local awful (require :awful)) +(local spawn awful.spawn.with_shell) + +;;; +;; Functions + +(fn run-once [cmds] + (each [_ cmd (ipairs cmds)] + (let [first-space (: cmd :find " ") + findme (if first-space + (: cmd :sub 0 (- first-space 1)) + cmd)] + (spawn + (string.format "pgrep -u $USER -x %s >/dev/null || (%s)" findme cmd))) )) + +;; Keyboard +(spawn "tpset 'Natural Scrolling' 1") +(spawn "tpset 'Tapping' 1") +(spawn "setxkbmap -option caps:ctrl_modifier") + +(run-once + ["nm-applet" ;; WiFi + "pa-applet" ;; Sound manager + "blueman-applet" ;; Bluetooth + "compton -b" ;; Compositor + "libinput-gestures" + "fcitx-autostart" ;; Keyboard + ]) + +{} +;;; module/auto-start.fnl ends here