From c4b453901f83c6e2e0288163a0d6d6fa0524747c Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Wed, 24 Aug 2016 09:12:22 +0200 Subject: [PATCH] Better rc.lua --- awesome/rc.lua | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/awesome/rc.lua b/awesome/rc.lua index 9d52150..ee77dd7 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -1,3 +1,5 @@ +os.setlocale("fr_FR.UTF-8") + -- Standard awesome library local gears = require("gears") local awful = require("awful") @@ -21,7 +23,6 @@ local calendar = require("calendar") home = "/home/thomas" os.execute('xset m 16/1 0') -os.setlocale("fr_FR.UTF-8") -- awful.util.spawn_with_shell("xcompmgr -cF &") @@ -63,8 +64,20 @@ end -- Themes define colours, icons, font and wallpapers. beautiful.init("~/.config/awesome/themes/default/theme.lua") +function file_exists(name) + local f=io.open(name,"r") + if f~=nil then io.close(f) return true else return false end +end + function change_wallpaper(path) - theme.wallpaper = '/home/thomas/Pictures/Wallpapers/' .. path; + path = '/home/thomas/Pictures/Wallpapers/' .. path + + if not file_exists(path) then + return + end + + theme.wallpaper = path + if beautiful.wallpaper then for s = 1, screen.count() do gears.wallpaper.maximized(beautiful.wallpaper, s, true) @@ -72,9 +85,7 @@ function change_wallpaper(path) end end --- if os.execute('check isin') then --- change_wallpaper('arch2.png'); --- end +change_wallpaper('1200custom.png') -- This is used later as the default terminal and editor to run. terminal = "terminator"