You are not logged in.
Howdy-ha, folks. Here's my situation: Currently, I use Eminent to hide tags which aren't in use in the taglist, as I typically don't have more than two or three tags open. Eminent does a decent job, but while most of my tags are dedicated categories or tasks, I have about a half-dozen apps I'd like to open in their own tags. Now, while Eminent does what it does well enough, the problem I see is that it requires one to use the pre-defined tag scheme, which a) is limited the total of 9 tags; and b) hard-codes those tags to number keys in the order they're listed in rc.lua. Since I'm dealing with either full-screen apps or groups of tiled apps, this would mean flipping from, say, tag 2 to tag 7, which with Eminent can get tedious, whereas with Shifty I could create a list of more than 9 tags that will be created and destroyed as necessary, and switch between two tags using "Mod + 1" and "Mod + 2." Or at least, this is my understanding.
The problem is that the Awesome wiki page on Shifty is outdated, with the last update coming in a full year ago (someone was polite enough to edit the page to state just that, without actually noting the changes that need to be made). The instructions aren't at all clear to me (does "Remove all the existing tag creation/settings code from your rc.lua" mean every instance of the term "tag" that appears? Because there whole sections seem to depend on a single instance of that term). Moreover, most of the links on the page are dead, save for the link to bioe007's github, which contains shifty.rc.lua--which also appears outdated (as evidenced by the keybinding syntax and the fact that using it as the default config file results in Awesome returning to fallback mode, with "awesome -k" reporting no errors). So how might I go about implementing this? The closest thing to a real guide I've found so far is this; I've tried using that as a stand-in for my own config, I've tried diffing that as well as other configs on the Awesome wiki and shifty.rc.lua into my own config--no luck. The closest I've come is just pasting the code on the Shifty page into my rc.lua, which results in the first "init = true" Shifty tag being created, plus my predefined tags, with no apparent extra functionality. What's the best advice on going about this? Am I just looking at this all wrong, or should I maybe just stick with Eminent for now, until I build my Lua chops?
Offline
Hmm, no responses yet. Maybe I was too verbose?
Offline
Since I'm dealing with either full-screen apps or groups of tiled apps, this would mean flipping from, say, tag 2 to tag 7, which with Eminent can get tedious, whereas with Shifty I could create a list of more than 9 tags that will be created and destroyed as necessary, and switch between two tags using "Mod + 1" and "Mod + 2." Or at least, this is my understanding.
This is correct.
The problem is that the Awesome wiki page on Shifty is outdated,
also correct.
<back story>
This is essentially because a long while ago I decided shifty sucked, and basically stopped bothering about it. (See my dynawful branch and all the use of awful's ability to manage dynamic tags).
Subsequently I started messing with KDE + awesome, then just KDE, until returning to awesome not too long ago.
</back story>
I was very surprised to find people still using shifty at all, as I think the capability of awesome to now do dynamic tagging was intrinsically better than shifty.
But it seems like Shifty is still filling a need. So I maintain a 3.4.x version on my 3.4 branch.
So how might I go about implementing this?
The example shifty.rc.lua should work with 3.4.x. If it does not, please let me know, preferably from github, irc, email or here.
I am terrible about forums, so the first two options are more likely to get rapid response.
There are also some other shifty users in #awesome (on oftc), I am almost always lurking there or in #archlinux (freenode)
hth
..ps i go by resixian on irc these days
Offline
Thanks for the feedback bioe007; over the past couple days I've managed to get Shifty working to a usable degree. I did so by taking the example rc.lua you linked to and inserting bits of my config piecemeal; it was a little tedious, but it works well enough for now until I can get everything "just so." I do have a couple follow-up questions, for anyone able to help.
Firstly, I can't resize or move floating clients, or rearrange tiled clients, using "Modkey + [relevant mouse button]". As near as I can tell, the relevant code for this is
{match = { "" }, buttons = {
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, function (c) awful.mouse.client.move() end),
awful.button({ modkey }, 3, awful.mouse.client.resize ), }, },
but merely inserting it into my config file under the tag assignments (as per the Awesome wiki) has no effect. What am I missing here? Here's my rc.lua for reference:
-- default rc.lua for shifty
--
-- Standard awesome library
require("awful")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
-- shifty - dynamic tagging library
require("shifty")
require("scratch")
require("revalation")
-- useful for debugging, marks the beginning of rc.lua exec
print("Entered rc.lua: " .. os.time())
-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
-- The default is a dark theme
beautiful.init("/home/anoknusa/.config/awesome/themes/yum/theme.lua")
theme.wallpaper_cmd = { "/usr/bin/nitrogen --restore" }
awesome.font = ("anorexia 10")
-- Actually load theme
beautiful.init(theme_path)
-- This is used later as the default terminal and editor to run.
browser = "chromium"
terminal = "terminator"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key, I suggest you to remap
-- Mod4 to another key using xmodmap or other tools. However, you can use
-- another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
layouts =
{
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier,
awful.layout.suit.floating
}
-- Define if we want to use titlebar on all applications.
use_titlebar = false
-- }}}
--{{{ Shifty configured tags.
shifty.config.tags = {
["[Chromium]"] = {
layout = awful.layout.suit.max,
mwfact = 0.70,
exclusive = false,
solitary = false,
position = 1,
init = true,
screen = 1,
persist = false,},
["[Util]"] = {
layout = awful.layout.suit.tile.bottom,
mwfact = 0.50,
exclusive = true,
solitary = true,
persist = false,
position = 2,},
["[Work]"] = {
layout = awful.layout.suit.tile.bottom,
mwfact = 0.50,
exclusive = false,
solitary = false,
persist = false,
position = 3,
slave = true},
["[What]"] = {
layout = awful.layout.suit.tile,
exclusive = false,
solitary = false,
persist = false,
position = 4},
["[Amarok]"] = {
layout = awful.layout.suit.maximum,
persist = false,
position = 4},
["[Okular]"] = {
layout = awful.layout.suit.maximum,
persist = false,
position = 4},
["[Comix]"] = {
layout = awful.layout.suit.maximum,
persist = false,
position = 4},
["[Media]"] = {
layout = awful.layout.suit.tile,
persist = false,
position = 4},
["[Media]"] = {
layout = awful.layout.suit.tile,
persist = false,
position = 4},
}
--}}}
--{{{SHIFTY: application matching rules
-- order here matters, early rules will be applied first
shifty.config.apps = { buttons = clientbuttons,
{match = {"Chromium"}, honorsizehints = false, tag = "[Chromium]"},
{match = {"Dolphin", "Transmission", "Gpartedbin", "luckybackup"}, tag = "[Util]", nopopup = true},
{match = {"Meld", "Gtg"}, tag = "[Work]", slave = true},
{match = {"Kate", "lowriter"}, tag = "[Work]", nopopup = true},
{match = {}, tag = "[Work]",},
{match = {"Soundkonverter", "Easytag", "Audacity"}, tag = "[What]", nopopup = true},
{match = {"Comix", "Okular"}, tag = "[Reader]", nopopup = true},
{match = {"Vlc", "K9copy"}, tag = "[Media]", nopopup = true},
{match = {"Amarok"}, tag = "[Amarok]", nopopup = true},
{match = {"Gimp"}, tag = "[Gimp]", nopopup = true},
{match = {"Tomboy"}, slave = true},
{match = {terminal}, honorsizehints = false, slave = true},
{match = { "" }, buttons = {
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, function (c) awful.mouse.client.move() end),
awful.button({ modkey }, 3, awful.mouse.client.resize ), }, },
}
--}}}
--{{{SHIFTY: default tag creation rules
-- parameter description
-- * floatBars : if floating clients should always have a titlebar
-- * guess_name : should shifty try and guess tag names when creating
-- new (unconfigured) tags?
-- * guess_position: as above, but for position parameter
-- * run : function to exec when shifty creates a new tag
-- * all other parameters (e.g. layout, mwfact) follow awesome's tag API
shifty.config.defaults = {
layout = awful.layout.suit.tile.bottom,
ncol = 1,
mwfact = 0.60,
floatBars = false,
guess_name = true,
guess_position = true,
}
--}}}
-- {{{Wibox
-- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" }, "%a %b %d - %I:%M", 59)
-- Separator/Spacer icons
separator = widget({ type = "textbox", align = "left"})
separator.text = '<span color="#ab7c00"> || </span>'
space = widget({ type = "textbox" })
space.text = " "
-- Status Labels
c1 = widget({ type = "textbox" })
c1.text = "(1)"
c2 = widget({ type = "textbox" })
c2.text = "(2)"
rlabel = widget({ type = "textbox" })
rlabel.text = "Root:"
hlabel = widget({ type = "textbox" })
hlabel.text = "Home:"
vlabel = widget({ type = "textbox" })
vlabel.text = "<span color='#ab7c00'>Vol:</span>"
wlabel = widget({ type = "textbox" })
wlabel.text = "<span color='#ab7c00'>WiFi:</span>"
-- Separator/Spacer icons
separator = widget({ type = "textbox", align = "left"})
separator.text = '<span color="#ab7c00"> || </span>'
space = widget({ type = "textbox" })
space.text = " "
-- Status Labels
c1 = widget({ type = "textbox" })
c1.text = "(1)"
c2 = widget({ type = "textbox" })
c2.text = "(2)"
rlabel = widget({ type = "textbox" })
rlabel.text = "Root:"
hlabel = widget({ type = "textbox" })
hlabel.text = "Home:"
vlabel = widget({ type = "textbox" })
vlabel.text = "<span color='#ab7c00'>Vol:</span>"
wlabel = widget({ type = "textbox" })
wlabel.text = "<span color='#ab7c00'>WiFi:</span>"
-- Create a laucher widget and a main menu
myawesomemenu = {
{"manual", terminal .. " -e man awesome"},
{"edit config",
editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua"},
{"restart", awesome.restart},
{"quit", awesome.quit}
}
mymainmenu = awful.menu(
{items = {{"awesome", myawesomemenu, beautiful.awesome_icon},
{"open terminal", terminal}}
})
mylauncher = awful.widget.launcher({image = image(beautiful.awesome_icon),
menu = mymainmenu})
-- Create a systray
mysystray = widget({type = "systray", align = "right"})
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
-- This will also un-minimize
-- the client, if needed
client.focus = c
c:raise()
end
end),
awful.button({ }, 3, function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end))
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] =
awful.widget.prompt({layout = awful.widget.layout.horizontal.leftright})
-- Create an imagebox widget which will contains an icon indicating which
-- layout we're using. We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({}, 1, function() awful.layout.inc(layouts, 1) end),
awful.button({}, 3, function() awful.layout.inc(layouts, -1) end),
awful.button({}, 4, function() awful.layout.inc(layouts, 1) end),
awful.button({}, 5, function() awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist.new(s,
awful.widget.taglist.label.all,
mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist.new(function(c)
return awful.widget.tasklist.label.currenttags(c, s)
end,
mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibox({position = "top", height = 16, screen = s})
-- Add widgets to the wibox - order matters
mywibox[s].widgets = {
{
mylauncher, space,
mytaglist[s],
mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright
},
mylayoutbox[s],
mytextclock,
s == 1 and mysystray or nil,
mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft
}
mywibox[s].screen = s
end
-- }}}
--{{{SHIFTY: initialize shifty
-- the assignment of shifty.taglist must always be after its actually
-- initialized with awful.widget.taglist.new()
shifty.taglist = mytaglist
shifty.init()
--}}}
-- {{{Mouse bindings
root.buttons({
awful.button({}, 3, function() mymainmenu:toggle() end),
awful.button({}, 4, awful.tag.viewnext),
awful.button({}, 5, awful.tag.viewprev)
})
-- disable startup-notification globally
local oldspawn = awful.util.spawn
awful.util.spawn = function (s)
oldspawn(s, false)
end
-- }}}
-- {{{ Key bindings
globalkeys = awful.util.table.join(
awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end
end),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({}, "Menu", function () mymainmenu:show({keygrabber=true}) end),
awful.key({ modkey }, "b", function ()
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
end),
-- Shifty: keybindings specific to shifty
awful.key({modkey, "Shift"}, "d", shifty.del), -- delete a tag
awful.key({modkey}, "/", shifty.send_next), -- client to next tag
awful.key({modkey, "Control"}, "n", function()
shifty.tagtoscr(awful.util.cycle(screen.count(), mouse.screen + 1))
end), -- move client to next tag
awful.key({modkey}, "a", shifty.add), -- creat a new tag
awful.key({modkey,}, "r", shifty.rename), -- rename a tag
awful.key({modkey, "Shift"}, "a", -- nopopup new tag
function()
shifty.add({nopopup = true})
end),
awful.key({modkey,}, "j",
function()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.key({modkey,}, "k",
function()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end),
awful.key({modkey,}, "w", function() mymainmenu:show(true) end),
-- Volume Control
awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer set Master 2+") end),
awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer set Master 2-") end),
-- Power Management
awful.key({ }, "XF86PowerOff", function () awful.util.spawn("obshutdown") end),
awful.key({modkey, }, "XF86PowerOff", function () awful.util.spawn("sudo pm-suspend") end),
-- Brightness Control
awful.key({modkey }, "F6", function () awful.util.spawn("xbacklight -dec 50") end),
awful.key({modkey }, "F7", function () awful.util.spawn("xbacklight -inc 50") end),
-- Dmenu
--awful.key({modkey }, "space", function()
--awful.util.spawn_with_shell( "dmenu_run -p 'Arch Linux' -nf '#838383' -nb '#1b1b1b' -sf '#B50000' -sb '#838383'")
--end),
awful.key({ modkey }, "space", function ()
awful.util.spawn("dmenu_run -i -p 'Arch Linux' -nb '" ..
beautiful.bg_normal .. "' -nf '" .. beautiful.fg_normal ..
"' -sb '" .. beautiful.bg_focus ..
"' -sf '" .. beautiful.fg_focus .. "'") end),
-- Lock Screen
awful.key({modkey }, "F1", function () awful.util.spawn("slimlock") end),
-- Turn off touchpad
awful.key({modkey, "Shift" }, "x", function () awful.util.spawn("touchoff") end),
-- Revalation
awful.key({ modkey }, "e", revelation.revelation),
-- Drop-down terminal
awful.key({}, "F12", function () scratch.drop("terminator", "top", "center", 1, .70) end),
-- Print Screen
awful.key({ }, "Print", function () awful.util.spawn("ksnapshot") end),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, ",", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, }, ".", function () awful.layout.inc(layouts, -1) end),
awful.key({ modkey, "Control" }, "n", awful.client.restore),
-- Prompt
awful.key({ modkey, }, "r", function () mypromptbox[mouse.screen]:run() end),
awful.key({ modkey }, "x",
function ()
awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget,
awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval")
end)
)
clientkeys = awful.util.table.join(
awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey }, "F4", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
awful.key({ modkey, }, "o", awful.client.movetoscreen ),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end),
awful.key({ modkey, }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical
end)
)
-- SHIFTY: assign client keys to shifty for use in
-- match() function(manage hook)
shifty.config.clientkeys = clientkeys
shifty.config.modkey = modkey
--}}}
-- Compute the maximum number of digit we need, limited to 9
for i = 1, (shifty.config.maxtags or 9) do
globalkeys = awful.util.table.join(globalkeys,
awful.key({modkey}, i, function()
local t = awful.tag.viewonly(shifty.getpos(i))
end),
awful.key({modkey, "Control"}, i, function()
local t = shifty.getpos(i)
t.selected = not t.selected
end),
awful.key({modkey, "Control", "Shift"}, i, function()
if client.focus then
awful.client.toggletag(shifty.getpos(i))
end
end),
-- move clients to other tags
awful.key({modkey, "Shift"}, i, function()
if client.focus then
t = shifty.getpos(i)
awful.client.movetotag(t)
awful.tag.viewonly(t)
end
end))
end
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Naughty settings
naughty.config.notify_callback = function(args)
awful.util.spawn("twmnc -c '" .. args.text .. "' -t '" .. args.title .. "'")
return nil
end
-- {{{Hooks
-- Hook function to execute when focusing a client.
client.add_signal("focus", function(c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_focus
end
end)
-- Hook function to execute when unfocusing a client.
client.add_signal("unfocus", function(c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_normal
end
end)
-- }}}
-- Naughty / TWMN
naughty.config.notify_callback = function(args)
awful.util.spawn("twmnc -c '" .. args.text .. "' -t '" .. args.title .. "'")
return nil
end
-- vim: fdm=marker:tw=80:
The second issue is that, when switching tags, a client won't grab focus unless I pass the mouse pointer over its entry in the tasklist; even clicking on the window has no effect. I have no idea what the issue may be there.
Thanks in advance to anyone who can help.
Offline
I have this in my rc.lua, you may want to change altkey.
-- client manipulation
{ match = { "" },
honorsizehints = false,
buttons = awful.util.table.join (
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ altkey }, 1, awful.mouse.client.move),
awful.button({ altkey }, 3, awful.mouse.client.resize))
},
}
--}}}
The second issue is something i can´t see, sorry.
Offline
That solved client mouse manipulation; thanks a lot, kaptenen.
Offline
So a while back I managed to get Shifty working pretty well. There's one thing that I'd like clarified: Is it possible to have hotkeys dynamically assigned to spawned tags based on their position in the taglist, i.e. "Mod + 3" pulls up the third tag in the list regardless of which distinct tag is in that position? This would greatly help efficiency. Thanks for the help in advance.
Offline