pull #239; better implementation
This commit is contained in:
parent
14d047eaa7
commit
44864dba37
9 changed files with 52 additions and 42 deletions
12
scripts/dfs
12
scripts/dfs
|
@ -11,10 +11,11 @@
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Decoding options
|
# Decoding options
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
USAGE="Usage: $0 [-h(elp)] | [-n(arrow mode)] | [-w(eb output)]"
|
USAGE="Usage: $0 [-h(elp)] | [-n(arrow mode)] | [-w(eb output) | --type=<fstype> | --exclude-type=<fstype>]"
|
||||||
|
|
||||||
NARROW_MODE=0
|
NARROW_MODE=0
|
||||||
WEB_OUTPUT=0
|
WEB_OUTPUT=0
|
||||||
|
DF_OPTIONS=""
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -31,6 +32,12 @@ NARROW_MODE=1
|
||||||
"-w" )
|
"-w" )
|
||||||
WEB_OUTPUT=1
|
WEB_OUTPUT=1
|
||||||
;;
|
;;
|
||||||
|
--type=*)
|
||||||
|
DF_OPTIONS+=" $1"
|
||||||
|
;;
|
||||||
|
--exclude-type=*)
|
||||||
|
DF_OPTIONS+=" $1"
|
||||||
|
;;
|
||||||
* )
|
* )
|
||||||
echo $USAGE
|
echo $USAGE
|
||||||
exit
|
exit
|
||||||
|
@ -58,6 +65,9 @@ AWK_COMMAND="/usr/bin/env gawk"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Add additional df options
|
||||||
|
DF_COMMAND+=$DF_OPTIONS
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Grabbing "df" result
|
# Grabbing "df" result
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
|
@ -155,23 +155,23 @@ local function worker(args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
alsabar.bar:buttons (awful.util.table.join (
|
alsabar.bar:buttons(awful.util.table.join (
|
||||||
awful.button ({}, 1, function()
|
awful.button({}, 1, function()
|
||||||
awful.util.spawn(alsabar.mixer)
|
awful.util.spawn(alsabar.mixer)
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 2, function()
|
awful.button({}, 2, function()
|
||||||
awful.util.spawn(string.format("%s set %s 100%%", alsabar.cmd, alsabar.channel))
|
awful.util.spawn(string.format("%s set %s 100%%", alsabar.cmd, alsabar.channel))
|
||||||
pulsebar.update()
|
pulsebar.update()
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 3, function()
|
awful.button({}, 3, function()
|
||||||
awful.util.spawn(string.format("%s set %s toggle", alsabar.cmd, alsabar.channel))
|
awful.util.spawn(string.format("%s set %s toggle", alsabar.cmd, alsabar.channel))
|
||||||
alsabar.update()
|
alsabar.update()
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 4, function()
|
awful.button({}, 4, function()
|
||||||
awful.util.spawn(string.format("%s set %s %s+", alsabar.cmd, alsabar.channel, alsabar.step))
|
awful.util.spawn(string.format("%s set %s %s+", alsabar.cmd, alsabar.channel, alsabar.step))
|
||||||
alsabar.update()
|
alsabar.update()
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 5, function()
|
awful.button({}, 5, function()
|
||||||
awful.util.spawn(string.format("%s set %s %s-", alsabar.cmd, alsabar.channel, alsabar.step))
|
awful.util.spawn(string.format("%s set %s %s-", alsabar.cmd, alsabar.channel, alsabar.step))
|
||||||
alsabar.update()
|
alsabar.update()
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -27,15 +27,15 @@ local setmetatable = setmetatable
|
||||||
local calendar = {}
|
local calendar = {}
|
||||||
local cal_notification = nil
|
local cal_notification = nil
|
||||||
|
|
||||||
function calendar:hide()
|
function calendar.hide()
|
||||||
if cal_notification ~= nil then
|
if cal_notification ~= nil then
|
||||||
naughty.destroy(cal_notification)
|
naughty.destroy(cal_notification)
|
||||||
cal_notification = nil
|
cal_notification = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function calendar:show(t_out, inc_offset, scr)
|
function calendar.show(t_out, inc_offset, scr)
|
||||||
calendar:hide()
|
calendar.hide()
|
||||||
|
|
||||||
local f, c_text
|
local f, c_text
|
||||||
local offs = inc_offset or 0
|
local offs = inc_offset or 0
|
||||||
|
@ -96,7 +96,7 @@ function calendar:show(t_out, inc_offset, scr)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function calendar:attach(widget, args)
|
function calendar.attach(widget, args)
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
|
|
||||||
calendar.cal = args.cal or "/usr/bin/cal"
|
calendar.cal = args.cal or "/usr/bin/cal"
|
||||||
|
@ -119,11 +119,11 @@ function calendar:attach(widget, args)
|
||||||
widget:connect_signal("mouse::enter", function () calendar:show(0, 0, calendar.scr_pos) end)
|
widget:connect_signal("mouse::enter", function () calendar:show(0, 0, calendar.scr_pos) end)
|
||||||
widget:connect_signal("mouse::leave", function () calendar:hide() end)
|
widget:connect_signal("mouse::leave", function () calendar:hide() end)
|
||||||
widget:buttons(awful.util.table.join(awful.button({ }, 1, function ()
|
widget:buttons(awful.util.table.join(awful.button({ }, 1, function ()
|
||||||
calendar:show(0, -1, calendar.scr_pos) end),
|
calendar.show(0, -1, calendar.scr_pos) end),
|
||||||
awful.button({ }, 3, function ()
|
awful.button({ }, 3, function ()
|
||||||
calendar:show(0, 1, calendar.scr_pos) end),
|
calendar.show(0, 1, calendar.scr_pos) end),
|
||||||
awful.button({ }, 4, function ()
|
awful.button({ }, 4, function ()
|
||||||
calendar:show(0, -1, calendar.scr_pos) end),
|
calendar.show(0, -1, calendar.scr_pos) end),
|
||||||
awful.button({ }, 5, function ()
|
awful.button({ }, 5, function ()
|
||||||
calendar:show(0, 1, calendar.scr_pos) end)))
|
calendar:show(0, 1, calendar.scr_pos) end)))
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ local setmetatable = setmetatable
|
||||||
-- Keyboard layout switcher
|
-- Keyboard layout switcher
|
||||||
-- lain.widgets.contrib.kblayout
|
-- lain.widgets.contrib.kblayout
|
||||||
|
|
||||||
local function worker (args)
|
local function worker(args)
|
||||||
local kbdlayout = {}
|
local kbdlayout = {}
|
||||||
kbdlayout.widget = wibox.widget.textbox('')
|
kbdlayout.widget = wibox.widget.textbox('')
|
||||||
|
|
||||||
|
@ -36,21 +36,21 @@ local function worker (args)
|
||||||
awful.button({ }, 1, function () kbdlayout.next() end),
|
awful.button({ }, 1, function () kbdlayout.next() end),
|
||||||
awful.button({ }, 3, function () kbdlayout.prev() end)))
|
awful.button({ }, 3, function () kbdlayout.prev() end)))
|
||||||
|
|
||||||
local function run_settings (layout, variant)
|
local function run_settings(layout, variant)
|
||||||
widget = kbdlayout.widget
|
widget = kbdlayout.widget
|
||||||
kbdlayout_now = { layout=string.match(layout, "[^,]+"), -- Make sure to match the primary layout only.
|
kbdlayout_now = { layout=string.match(layout, "[^,]+"), -- Make sure to match the primary layout only.
|
||||||
variant=variant }
|
variant=variant }
|
||||||
settings()
|
settings()
|
||||||
end
|
end
|
||||||
|
|
||||||
function kbdlayout.update ()
|
function kbdlayout.update()
|
||||||
local status = read_pipe('setxkbmap -query')
|
local status = read_pipe('setxkbmap -query')
|
||||||
|
|
||||||
run_settings(string.match(status, "layout:%s*([^\n]*)"),
|
run_settings(string.match(status, "layout:%s*([^\n]*)"),
|
||||||
string.match(status, "variant:%s*([^\n]*)"))
|
string.match(status, "variant:%s*([^\n]*)"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function kbdlayout.set (i)
|
function kbdlayout.set(i)
|
||||||
idx = ((i - 1) % #layouts) + 1 -- Make sure to wrap around as needed.
|
idx = ((i - 1) % #layouts) + 1 -- Make sure to wrap around as needed.
|
||||||
local to_execute = 'setxkbmap ' .. layouts[idx].layout
|
local to_execute = 'setxkbmap ' .. layouts[idx].layout
|
||||||
|
|
||||||
|
@ -67,11 +67,11 @@ local function worker (args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function kbdlayout.next ()
|
function kbdlayout.next()
|
||||||
kbdlayout.set(idx + 1)
|
kbdlayout.set(idx + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function kbdlayout.prev ()
|
function kbdlayout.prev()
|
||||||
kbdlayout.set(idx - 1)
|
kbdlayout.set(idx - 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -30,15 +30,15 @@ function findLast(haystack, needle)
|
||||||
if i==nil then return nil else return i-1 end
|
if i==nil then return nil else return i-1 end
|
||||||
end
|
end
|
||||||
|
|
||||||
function task:hide()
|
function task.hide()
|
||||||
if task_notification ~= nil then
|
if task_notification ~= nil then
|
||||||
naughty.destroy(task_notification)
|
naughty.destroy(task_notification)
|
||||||
task_notification = nil
|
task_notification = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function task:show(scr_pos)
|
function task.show(scr_pos)
|
||||||
task:hide()
|
task.hide()
|
||||||
|
|
||||||
local f, c_text, scrp
|
local f, c_text, scrp
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ function task:show(scr_pos)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function task:prompt_add()
|
function task.prompt_add()
|
||||||
awful.prompt.run({ prompt = "Add task: " },
|
awful.prompt.run({ prompt = "Add task: " },
|
||||||
mypromptbox[mouse.screen].widget,
|
mypromptbox[mouse.screen].widget,
|
||||||
function (...)
|
function (...)
|
||||||
|
@ -92,7 +92,7 @@ function task:prompt_add()
|
||||||
awful.util.getdir("cache") .. "/history_task_add")
|
awful.util.getdir("cache") .. "/history_task_add")
|
||||||
end
|
end
|
||||||
|
|
||||||
function task:prompt_search()
|
function task.prompt_search()
|
||||||
awful.prompt.run({ prompt = "Search task: " },
|
awful.prompt.run({ prompt = "Search task: " },
|
||||||
mypromptbox[mouse.screen].widget,
|
mypromptbox[mouse.screen].widget,
|
||||||
function (...)
|
function (...)
|
||||||
|
@ -126,7 +126,7 @@ function task:prompt_search()
|
||||||
awful.util.getdir("cache") .. "/history_task")
|
awful.util.getdir("cache") .. "/history_task")
|
||||||
end
|
end
|
||||||
|
|
||||||
function task:attach(widget, args)
|
function task.attach(widget, args)
|
||||||
local args = args or {}
|
local args = args or {}
|
||||||
|
|
||||||
task.font_size = tonumber(args.font_size) or 12
|
task.font_size = tonumber(args.font_size) or 12
|
||||||
|
@ -143,8 +143,8 @@ function task:attach(widget, args)
|
||||||
task.notify_icon = icons_dir .. "/taskwarrior/task.png"
|
task.notify_icon = icons_dir .. "/taskwarrior/task.png"
|
||||||
task.notify_icon_small = icons_dir .. "/taskwarrior/tasksmall.png"
|
task.notify_icon_small = icons_dir .. "/taskwarrior/tasksmall.png"
|
||||||
|
|
||||||
widget:connect_signal("mouse::enter", function () task:show(task.scr_pos) end)
|
widget:connect_signal("mouse::enter", function () task.show(task.scr_pos) end)
|
||||||
widget:connect_signal("mouse::leave", function () task:hide() end)
|
widget:connect_signal("mouse::leave", function () task.hide() end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return setmetatable(task, { __call = function(_, ...) return create(...) end })
|
return setmetatable(task, { __call = function(_, ...) return create(...) end })
|
||||||
|
|
|
@ -28,17 +28,18 @@ local setmetatable = setmetatable
|
||||||
local fs = {}
|
local fs = {}
|
||||||
local fs_notification = nil
|
local fs_notification = nil
|
||||||
|
|
||||||
function fs:hide()
|
function fs.hide()
|
||||||
if fs_notification ~= nil then
|
if fs_notification ~= nil then
|
||||||
naughty.destroy(fs_notification)
|
naughty.destroy(fs_notification)
|
||||||
fs_notification = nil
|
fs_notification = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function fs:show(t_out)
|
function fs.show(t_out, fs_args)
|
||||||
fs:hide()
|
fs.hide()
|
||||||
|
|
||||||
local ws = helpers.read_pipe(helpers.scripts_dir .. "dfs"):gsub("\n*$", "")
|
local cmd = (fs_args and string.format("dfs %s", fs_args)) or "dfs"
|
||||||
|
local ws = helpers.read_pipe(helpers.scripts_dir .. cmd):gsub("\n*$", "")
|
||||||
|
|
||||||
if fs.followmouse then
|
if fs.followmouse then
|
||||||
fs.notification_preset.screen = mouse.screen
|
fs.notification_preset.screen = mouse.screen
|
||||||
|
|
|
@ -41,8 +41,7 @@ local function worker(args)
|
||||||
|
|
||||||
helpers.set_map(mail, 0)
|
helpers.set_map(mail, 0)
|
||||||
|
|
||||||
if not is_plain
|
if not is_plain then
|
||||||
then
|
|
||||||
password = helpers.read_pipe(password):gsub("\n", "")
|
password = helpers.read_pipe(password):gsub("\n", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,7 @@ local function worker(args)
|
||||||
maildir.widget = wibox.widget.textbox('')
|
maildir.widget = wibox.widget.textbox('')
|
||||||
|
|
||||||
function update()
|
function update()
|
||||||
if ext_mail_cmd ~= nil
|
if ext_mail_cmd then
|
||||||
then
|
|
||||||
awful.util.spawn(ext_mail_cmd)
|
awful.util.spawn(ext_mail_cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,6 +74,7 @@ local function worker(args)
|
||||||
p:close()
|
p:close()
|
||||||
|
|
||||||
newmail = "no mail"
|
newmail = "no mail"
|
||||||
|
|
||||||
-- Count the total number of mails irrespective of where it was found
|
-- Count the total number of mails irrespective of where it was found
|
||||||
total = 0
|
total = 0
|
||||||
|
|
||||||
|
|
|
@ -150,23 +150,23 @@ local function worker(args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pulsebar.bar:buttons (awful.util.table.join (
|
pulsebar.bar:buttons(awful.util.table.join (
|
||||||
awful.button ({}, 1, function()
|
awful.button({}, 1, function()
|
||||||
awful.util.spawn(pulsebar.mixer)
|
awful.util.spawn(pulsebar.mixer)
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 2, function()
|
awful.button({}, 2, function()
|
||||||
awful.util.spawn(string.format("pactl set-sink-lolume %d 100%%", pulsebar.sink))
|
awful.util.spawn(string.format("pactl set-sink-lolume %d 100%%", pulsebar.sink))
|
||||||
pulsebar.update()
|
pulsebar.update()
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 3, function()
|
awful.button({}, 3, function()
|
||||||
awful.util.spawn(string.format("pactl set-sink-mute %d toggle", pulsebar.sink))
|
awful.util.spawn(string.format("pactl set-sink-mute %d toggle", pulsebar.sink))
|
||||||
pulsebar.update()
|
pulsebar.update()
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 4, function()
|
awful.button({}, 4, function()
|
||||||
awful.util.spawn(string.format("pactl set-sink-volume %d +%s", pulsebar.sink, pulsebar.step))
|
awful.util.spawn(string.format("pactl set-sink-volume %d +%s", pulsebar.sink, pulsebar.step))
|
||||||
pulsebar.update()
|
pulsebar.update()
|
||||||
end),
|
end),
|
||||||
awful.button ({}, 5, function()
|
awful.button({}, 5, function()
|
||||||
awful.util.spawn(string.format("pactl set-sink-volume %d -%s", pulsebar.sink, pulsebar.step))
|
awful.util.spawn(string.format("pactl set-sink-volume %d -%s", pulsebar.sink, pulsebar.step))
|
||||||
pulsebar.update()
|
pulsebar.update()
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Reference in a new issue