From 53fdeb8db0e5218f33be055bbaa7eebda7240bd9 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 12 Feb 2021 05:32:47 -0600 Subject: [PATCH] Finally made real laptop detection --- awesome/init.fnl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/awesome/init.fnl b/awesome/init.fnl index ce7eb9c..147d14f 100644 --- a/awesome/init.fnl +++ b/awesome/init.fnl @@ -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"}))