2019-01-15 17:21:27 +11:00
|
|
|
;;; 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))
|
2019-01-15 21:33:14 +11:00
|
|
|
(local beautiful (require :beautiful))
|
|
|
|
(local naughty (require :naughty))
|
|
|
|
|
2019-01-15 17:21:27 +11:00
|
|
|
(local spawn awful.spawn.with_shell)
|
2019-01-15 21:33:14 +11:00
|
|
|
(local async awful.spawn.easy_async_with_shell)
|
2019-01-15 17:21:27 +11:00
|
|
|
|
|
|
|
;;;
|
|
|
|
;; Functions
|
|
|
|
|
2019-01-15 21:33:14 +11:00
|
|
|
(fn cb [prog]
|
|
|
|
(lambda [stdout stderr exitreason exitcode]
|
|
|
|
(when (not (= 0 exitcode))
|
|
|
|
(naughty.notify
|
|
|
|
{:title (.. "async startup handler: " prog)
|
|
|
|
:text stderr}))))
|
|
|
|
|
2019-01-15 17:21:27 +11:00
|
|
|
(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
|
2019-01-15 21:33:14 +11:00
|
|
|
(string.format "pgrep -u $USER -x %s >/dev/null || (%s)" findme cmd)))))
|
2019-01-15 17:21:27 +11:00
|
|
|
|
|
|
|
;; Keyboard
|
2019-01-15 21:33:14 +11:00
|
|
|
(async "tpset \"Natural Scrolling\" 1" (cb "tpset"))
|
|
|
|
(async "tpset \"Tapping\" 1" (cb "tpset"))
|
2019-01-15 17:21:27 +11:00
|
|
|
(spawn "setxkbmap -option caps:ctrl_modifier")
|
|
|
|
|
2019-01-15 21:33:14 +11:00
|
|
|
(async (.. "feh --bg-fill " beautiful.wallpaper) (cb "feh"))
|
|
|
|
|
2019-01-15 17:21:27 +11:00
|
|
|
(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
|