Finally made real laptop detection

This commit is contained in:
Chris Cochrun 2021-02-12 05:32:47 -06:00
parent 4be501d3ef
commit 53fdeb8db0

View file

@ -1,4 +1,5 @@
;; Standard awesome library
;; -*- comment-end: ""; -*-
;; Standard awesome library|#
(local gears (require "gears"))
(local awful (require "awful"))
(require "awful.autofocus")
@ -66,12 +67,16 @@
(local ctrl "Control")
(local alt "Mod1")
;; Set hostname so that we can utilize specific features on different machines|#
(var laptop false)
(awful.spawn.easy_async "hostname" (fn [ stdout stderr reason exit_code ]
(if (= "chris-linuxlaptop\n" stdout)
(set laptop true)
(set laptop true))))
;; Set hostname so that we can utilize specific features on different machines|#|#
(local hostname-handle (io.popen "hostname"))
(local hostname (hostname-handle:read "a"))
(hostname-handle:close)
(local laptop (= hostname "chris-linuxlaptop\n"))
;; (local laptop false)
;; (fn set-laptop [str]
;; (set laptop str))
;; (fn get-hostname [?callback]
;; (awful.spawn.easy_async "hostname" (fn [ stdout ] stdout)))
(naughty.notify {:text (tostring laptop)})
;; (if laptop (naughty.notify {:text "laptop detected"}) (naughty.notify {:text "laptop not detected"}))