Implemented autostart
This commit is contained in:
parent
53c501a2cb
commit
2c30cd770f
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
build/
|
||||
.cache
|
||||
backup.tar
|
||||
autostart
|
||||
|
6
Makefile
6
Makefile
@ -12,7 +12,11 @@ testv: build
|
||||
|
||||
.PHONY: deploy
|
||||
deploy: build
|
||||
rsync -avmh --delete --exclude 'settings.lua' --include '*.lua' --include '*.so' --include '*.png' --include '*/' --include '*.rasi' --include '*.sh' --exclude '*' ./ ~/.config/awesome/
|
||||
rsync -avmh --delete \
|
||||
--exclude 'settings.lua' --exclude 'autostart' \
|
||||
--include '*.lua' --include '*.so' --include '*.png' --include '*/' --include '*.rasi' --include '*.sh' \
|
||||
--exclude '*' \
|
||||
./ ~/.config/awesome/
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
|
1
rc.lua
1
rc.lua
@ -48,3 +48,4 @@ end)
|
||||
local on_screen_connect = require('src.theme.wibar')
|
||||
require('awful').screen.connect_for_each_screen(function(s) on_screen_connect(s) end)
|
||||
require('awful').spawn.with_shell('xset s 0 0; xset dpms 0 0 0')
|
||||
require('src.autostart')
|
||||
|
26
src/autostart.lua
Normal file
26
src/autostart.lua
Normal file
@ -0,0 +1,26 @@
|
||||
local io = require('io')
|
||||
local spawn = require('awful').spawn.spawn
|
||||
local readable = require('gears.filesystem').file_readable
|
||||
local confdir = require('src.util.path').conf_dir
|
||||
|
||||
local xres_name = 'awesome.did_autostart'
|
||||
-- check
|
||||
local xres_fp = io.popen('xrdb -query')
|
||||
if xres_fp == nil then return end
|
||||
local xres = xres_fp:read('*a')
|
||||
if xres:match(xres_name) then return end
|
||||
-- set
|
||||
xres_fp = io.popen('xrdb -merge', 'w')
|
||||
if xres_fp == nil then return end
|
||||
xres_fp:write(xres_name, ':true')
|
||||
xres_fp:close()
|
||||
|
||||
local autostart_file = confdir .. '/autostart'
|
||||
if readable(autostart_file) then
|
||||
for line in io.lines(autostart_file, "*l") do
|
||||
---@cast line string
|
||||
if line:len() > 0 then
|
||||
spawn(line)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user