shortcuts: Cleanup and fix deprecation warnings
This commit is contained in:
parent
73fccb506f
commit
1646d09722
|
@ -140,6 +140,7 @@ The first modification is to include the module at the top of your `rc.lua`
|
|||
|
||||
```lua
|
||||
local tyrannical = require("tyrannical")
|
||||
--require("tyrannical.shortcut") --optional
|
||||
```
|
||||
|
||||
Then this line have to be removed:
|
||||
|
|
84
shortcut.lua
84
shortcut.lua
|
@ -21,68 +21,95 @@ end
|
|||
|
||||
-- Delete a tag as of 3.5.5, this have a few issue. Patches are on their way
|
||||
local function delete_tag()
|
||||
aw_tag.delete(aw_tag.selected(get_current_screen()) )
|
||||
local t = get_current_screen().selected_tag
|
||||
if not t then return end
|
||||
t:delete()
|
||||
end
|
||||
|
||||
-- Create a new tag at the end of the list
|
||||
local function new_tag()
|
||||
aw_tag.add("NewTag",{screen= get_current_screen() }):view_only()
|
||||
aw_tag.add("NewTag", {
|
||||
screen= get_current_screen()
|
||||
}):view_only()
|
||||
end
|
||||
|
||||
local function new_tag_with_focussed()
|
||||
local c = capi.client.focus
|
||||
local t = aw_tag.add(c.class,{screen= get_current_screen(),layout=aw_layout.suit.tile, volatile=true })
|
||||
if c then c:tags(aw_util.table.join(c:tags(), {t})) end
|
||||
aw_tag.viewonly(t)
|
||||
if not c then return end
|
||||
|
||||
local t = aw_tag.add(c.class, {
|
||||
screen = get_current_screen(),
|
||||
layout = aw_layout.suit.tile,
|
||||
volatile = true
|
||||
})
|
||||
|
||||
c:tags(aw_util.table.join(c:tags(), {t}))
|
||||
|
||||
t:view_only()
|
||||
end
|
||||
|
||||
local function move_to_new_tag()
|
||||
local c = capi.client.focus
|
||||
local t = aw_tag.add(c.class,{screen= get_current_screen() })
|
||||
if c then
|
||||
c:tags({t})
|
||||
aw_tag.viewonly(t)
|
||||
end
|
||||
if not c then return end
|
||||
|
||||
local t = aw_tag.add(c.class, {
|
||||
screen = get_current_screen()
|
||||
})
|
||||
|
||||
c:tags({t})
|
||||
t:view_only()
|
||||
end
|
||||
|
||||
local function rename_tag_to_focussed()
|
||||
if capi.client.focus then
|
||||
local t = aw_tag.selected(capi.client.focus.screen)
|
||||
t.name = capi.client.focus.class
|
||||
end
|
||||
if not capi.client.focus then return end
|
||||
|
||||
local t = capi.client.focus.screen.selected_tag
|
||||
if not t then return end
|
||||
|
||||
t.name = capi.client.focus.class
|
||||
end
|
||||
|
||||
local function rename_tag()
|
||||
aw_prompt.run({ prompt = "New tag name: " },
|
||||
mypromptbox[capi.mouse.screen].widget,
|
||||
function(new_name)
|
||||
aw_prompt.run {
|
||||
prompt = "New tag name: ",
|
||||
textbox = mypromptbox[capi.mouse.screen].widget,
|
||||
exe_callback = function(new_name)
|
||||
if not new_name or #new_name == 0 then
|
||||
return
|
||||
else
|
||||
local screen = capi.mouse.screen
|
||||
local t = aw_tag.selected(screen)
|
||||
local t = capi.mouse.screen.selected_tag
|
||||
if t then
|
||||
t.name = new_name
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
}
|
||||
end
|
||||
|
||||
local function term_in_current_tag()
|
||||
aw_spawn(terminal,{tag=get_current_screen().selected_tag,slave=true,screen=get_current_screen()})
|
||||
aw_spawn(terminal, {
|
||||
tag = get_current_screen().selected_tag,
|
||||
slave = true,
|
||||
screen = get_current_screen()
|
||||
})
|
||||
end
|
||||
|
||||
local function new_tag_with_term()
|
||||
aw_spawn(terminal,{new_tag={volatile = true,screen=get_current_screen()}})
|
||||
aw_spawn(terminal, {
|
||||
new_tag = {
|
||||
volatile = true,
|
||||
screen = get_current_screen()
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function fork_tag()
|
||||
local s = get_current_screen()
|
||||
local t = aw_tag.selected(s)
|
||||
local t = get_current_screen().selected_tag
|
||||
if not t then return end
|
||||
|
||||
local clients = t:clients()
|
||||
local t2 = aw_tag.add(t.name,aw_tag.getdata(t))
|
||||
|
||||
t2:clients(clients)
|
||||
t2:view_only()
|
||||
end
|
||||
|
@ -90,9 +117,16 @@ end
|
|||
local function aero_tag()
|
||||
local c = capi.client.focus
|
||||
if not c then return end
|
||||
|
||||
local c2 = aw_client.focus.history.list[2]
|
||||
if (not c2) or c2 == c then return end
|
||||
local t = aw_tag.add("Aero",{screen= c.screen ,layout=aw_layout.suit.tile,mwfact=0.5})
|
||||
|
||||
local t = aw_tag.add("Aero", {
|
||||
screen = c.screen,
|
||||
layout = aw_layout.suit.tile,
|
||||
mwfact = 0.5
|
||||
})
|
||||
|
||||
t:clients({c,c2})
|
||||
|
||||
t:view_only()
|
||||
|
|
Loading…
Reference in New Issue