[awesome] add tearstop widget (and remove zsh alias for that)
This commit is contained in:
parent
b1b70e1449
commit
c613821410
BIN
home/.config/awesome/icons/tearstop-off.png
Normal file
BIN
home/.config/awesome/icons/tearstop-off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 128 B |
BIN
home/.config/awesome/icons/tearstop-on.png
Normal file
BIN
home/.config/awesome/icons/tearstop-on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 128 B |
|
@ -203,6 +203,7 @@ awful.screen.connect_for_each_screen(function(s)
|
||||||
{ -- Right widgets
|
{ -- Right widgets
|
||||||
layout = wibox.layout.fixed.horizontal,
|
layout = wibox.layout.fixed.horizontal,
|
||||||
wibox.widget.systray(),
|
wibox.widget.systray(),
|
||||||
|
widgets.tearstop,
|
||||||
widgets.redshift,
|
widgets.redshift,
|
||||||
widgets.bluetooth,
|
widgets.bluetooth,
|
||||||
widgets.netdown_icon,
|
widgets.netdown_icon,
|
||||||
|
|
|
@ -6,7 +6,8 @@ local gfs = require("gears.filesystem")
|
||||||
local layout_icons_path = gfs.get_configuration_dir() .. "icons/layouts/"
|
local layout_icons_path = gfs.get_configuration_dir() .. "icons/layouts/"
|
||||||
|
|
||||||
local spawn = require("awful.spawn")
|
local spawn = require("awful.spawn")
|
||||||
local utils = require("../utils")
|
local utils = require("utils")
|
||||||
|
local helpers = require("lain.helpers")
|
||||||
|
|
||||||
local theme = {}
|
local theme = {}
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ theme.hotkeys_description_font = "Iosevka sbruder 10"
|
||||||
theme.hotkeys_modifiers_fg = theme.fg_normal
|
theme.hotkeys_modifiers_fg = theme.fg_normal
|
||||||
|
|
||||||
theme.wallpaper = function(s)
|
theme.wallpaper = function(s)
|
||||||
if utils.file_exists(utils.home() .. ".fehbg") then
|
if helpers.file_exists(utils.home() .. ".fehbg") then
|
||||||
spawn({utils.home() .. ".fehbg"})
|
spawn({utils.home() .. ".fehbg"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
local utils = {}
|
local helpers = require("lain.helpers")
|
||||||
|
|
||||||
function utils.file_exists(name)
|
local utils = {}
|
||||||
local f=io.open(name,"r")
|
|
||||||
if f~=nil then io.close(f) return true else return false end
|
|
||||||
end
|
|
||||||
|
|
||||||
function utils.home()
|
function utils.home()
|
||||||
return os.getenv("HOME") .. "/"
|
return os.getenv("HOME") .. "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function utils.handle_pid(command, callback)
|
||||||
|
helpers.async_with_shell(string.format("ps x -o pid=,command=|grep -E '^\\s*[0-9]* %s$'|sed 's/\\s*\\([0-9]*\\) .*/\\1/'", command), callback)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return utils
|
return utils
|
||||||
|
|
|
@ -7,6 +7,7 @@ local helpers = require("lain.helpers")
|
||||||
local markup = lain.util.markup
|
local markup = lain.util.markup
|
||||||
|
|
||||||
local theme = require("theme")
|
local theme = require("theme")
|
||||||
|
local utils = require("utils")
|
||||||
|
|
||||||
local gfs = require("gears.filesystem")
|
local gfs = require("gears.filesystem")
|
||||||
local iconsdir = gfs.get_configuration_dir() .. "icons/"
|
local iconsdir = gfs.get_configuration_dir() .. "icons/"
|
||||||
|
@ -112,7 +113,7 @@ helpers.newtimer("bluetooth", 10, widgets.bluetooth.update)
|
||||||
|
|
||||||
widgets.redshift = wibox.widget.imagebox(iconsdir .. "redshift-on.png")
|
widgets.redshift = wibox.widget.imagebox(iconsdir .. "redshift-on.png")
|
||||||
widgets.redshift.pid = nil
|
widgets.redshift.pid = nil
|
||||||
helpers.async_with_shell("ps x -o pid=,command=|grep -E '^[0-9]* redshift$' |cut -d' ' -f 1", function(pid)
|
utils.handle_pid("redshift", function(pid)
|
||||||
if pid and #pid > 0 then
|
if pid and #pid > 0 then
|
||||||
widgets.redshift.pid = tonumber(pid)
|
widgets.redshift.pid = tonumber(pid)
|
||||||
else
|
else
|
||||||
|
@ -138,4 +139,28 @@ widgets.redshift:buttons(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
widgets.tearstop = wibox.widget.imagebox(iconsdir .. "tearstop-off.png")
|
||||||
|
utils.handle_pid("compton --backend=glx", function(pid)
|
||||||
|
if pid and #pid > 0 then
|
||||||
|
widgets.tearstop.pid = tonumber(pid)
|
||||||
|
widgets.tearstop:set_image(iconsdir .. "tearstop-on.png")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
widgets.tearstop.pid = nil
|
||||||
|
|
||||||
|
widgets.tearstop:buttons(
|
||||||
|
table.join(
|
||||||
|
awful.button({ }, 1, function()
|
||||||
|
if widgets.tearstop.pid == nil then
|
||||||
|
widgets.tearstop.pid = awful.spawn.spawn({ "compton", "--backend=glx" })
|
||||||
|
widgets.tearstop:set_image(iconsdir .. "tearstop-on.png")
|
||||||
|
else
|
||||||
|
awful.spawn.spawn({ "kill", tostring(widgets.tearstop.pid) })
|
||||||
|
widgets.tearstop.pid = nil
|
||||||
|
widgets.tearstop:set_image(iconsdir .. "tearstop-off.png")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
return widgets
|
return widgets
|
||||||
|
|
|
@ -123,7 +123,6 @@ if which exa 2>&1 >> /dev/null;then
|
||||||
fi
|
fi
|
||||||
alias ipy="ipython3"
|
alias ipy="ipython3"
|
||||||
alias rls="/bin/ls --color=auto"
|
alias rls="/bin/ls --color=auto"
|
||||||
alias tearstop="compton --backend=glx"
|
|
||||||
alias line="chromium --user-data-dir=$HOME/.line --app=chrome-extension://ophjlpahpchlmihnnnihgmmeilfjmjjc/index.html"
|
alias line="chromium --user-data-dir=$HOME/.line --app=chrome-extension://ophjlpahpchlmihnnnihgmmeilfjmjjc/index.html"
|
||||||
|
|
||||||
## Environment variables
|
## Environment variables
|
||||||
|
|
Reference in a new issue