[awesome] add tearstop widget (and remove zsh alias for that)

legacy
Simon Bruder 2019-06-14 16:09:32 +00:00
parent b1b70e1449
commit c613821410
No known key found for this signature in database
GPG Key ID: 6F03E0000CC5B62F
7 changed files with 37 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View File

@ -203,6 +203,7 @@ awful.screen.connect_for_each_screen(function(s)
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
wibox.widget.systray(),
widgets.tearstop,
widgets.redshift,
widgets.bluetooth,
widgets.netdown_icon,

View File

@ -6,7 +6,8 @@ local gfs = require("gears.filesystem")
local layout_icons_path = gfs.get_configuration_dir() .. "icons/layouts/"
local spawn = require("awful.spawn")
local utils = require("../utils")
local utils = require("utils")
local helpers = require("lain.helpers")
local theme = {}
@ -57,7 +58,7 @@ theme.hotkeys_description_font = "Iosevka sbruder 10"
theme.hotkeys_modifiers_fg = theme.fg_normal
theme.wallpaper = function(s)
if utils.file_exists(utils.home() .. ".fehbg") then
if helpers.file_exists(utils.home() .. ".fehbg") then
spawn({utils.home() .. ".fehbg"})
end
end

View File

@ -1,12 +1,14 @@
local utils = {}
local helpers = require("lain.helpers")
function utils.file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
local utils = {}
function utils.home()
return os.getenv("HOME") .. "/"
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

View File

@ -7,6 +7,7 @@ local helpers = require("lain.helpers")
local markup = lain.util.markup
local theme = require("theme")
local utils = require("utils")
local gfs = require("gears.filesystem")
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.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
widgets.redshift.pid = tonumber(pid)
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

View File

@ -123,7 +123,6 @@ if which exa 2>&1 >> /dev/null;then
fi
alias ipy="ipython3"
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"
## Environment variables