1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | -- {{{ Required Libraries
gears = require("gears")
awful = require("awful")
awful.rules = require("awful.rules")
awful.autofocus = require("awful.autofocus")
wibox = require("wibox")
beautiful = require("beautiful")
naughty = require("naughty")
drop = require("scratchdrop")
lain = require("lain")
freedesktop = require("freedesktop")
eminent = require("eminent")
menubar = require("menubar")
revelation = require("revelation")
myplacesmenu = require("places")
awesompd = require("awesompd/awesompd")
capi = {
screen = screen,
tag = tag,
timer = timer,
mouse = mouse,
client = client,
keygrabber = keygrabber
}
-- }}}
-- {{{ Error Handling
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
do
in_error = false
awesome.connect_signal("debug::error", function (err)
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = err })
in_error = false
end)
end
-- }}}
-- {{{ Variable Definitions
os.setlocale(os.getenv("LANG"))
-- Useful Paths
home = os.getenv("HOME")
confdir = home .. "/.config/awesome"
scriptdir = home .. "/.bin"
themes = confdir .. "/themes"
scr_res = "1920x1200"
-- Choose Your Theme
active_theme = themes .. "/darkness"
beautiful.init(active_theme .. "/theme.lua")
terminal = "urxvt -icon " .. freedesktop.utils.lookup_icon({ icon='terminal' })
drop_terminal = "urxvt -pe tabbedex -name Drop-Terminal -icon " .. freedesktop.utils.lookup_icon({ icon='tilda' })
editor = "vim"
editor_cmd = terminal .. " -e " .. editor
gui_editor = "gvim"
browser = "firefox"
fileman = "spacefm " .. "/home/data/"
cli_fileman = terminal .. " -title Ranger -icon " .. freedesktop.utils.lookup_icon({ icon='file-manager' }) .. " -e ranger " .. "/home/data"
music = terminal .. " -title Music " .. freedesktop.utils.lookup_icon({ icon='music-player' }) .. " -e ncmpcpp "
tasks = terminal .. " -icon " .. freedesktop.utils.lookup_icon({ icon='htop' }) .. " -e htop "
wifi = terminal .. " -icon " .. freedesktop.utils.lookup_icon({ icon='networkmanager' }) .. " -e wicd-curses "
chat = terminal .. " -title Chat -icon " .. freedesktop.utils.lookup_icon({ icon='im' }) .. " -e weechat "
iptraf = terminal .. " -e sudo iptraf-ng -i all "
mixer = terminal .. " -e alsamixer "
torrent = terminal .. " -icon " .. freedesktop.utils.lookup_icon({ icon='transmission' }) .. " -e rtorrent "
-- Default modkey.
modkey = "Mod4"
altkey = "Mod1"
-- }}}
-- {{{ Wallpaper
if beautiful.wallpaper then
for s = 1, screen.count() do
gears.wallpaper.maximized(beautiful.wallpaper, s, true)
end
end
-- }}}
--{{{ Naughty
naughty.config.defaults.timeout = 5
naughty.config.defaults.margin = "1"
naughty.config.defaults.ontop = true
naughty.config.defaults.screen = 1
naughty.config.defaults.position = "top_right"
naughty.config.defaults.border_width = 1
naughty.config.defaults.border_color = beautiful.tooltip_border_color
naughty.config.defaults.bg = "#000000"
naughty.config.defaults.fg = "#FFFFFF"
--}}}
-- {{{ lain & layouts
local layouts =
{
awful.layout.suit.floating,
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.spiral,
}
-- }}}
-- {{{ Tags
tags = {}
for s = 1, screen.count() do
-- tags[s] = awful.tag({ "term", "www", "file", "chat", "media", "extra" }, s,
-- tags[s] = awful.tag( { "", "", "", "", "", "" }, s,
tags[s] = awful.tag( { "", "", "", "", "" }, s,
{ layouts[4], layouts[4], layouts[4], layouts[8], layouts[4], layouts[4]}
)
end
-- }}}
-- {{{ Revelation
revelation.config.tag_name = ""
revelation.exact = awful.rules.match
revelation.any = awful.rules.match_any
-- }}}
-- {{{ Menu
-- Create a laucher widget and a main menu
function mvscr(c)
local scrs = {}
for s = 1, capi.screen.count() do
scrs[s] = { s, function () awful.client.movetoscreen(c, s) end }
end
return scrs
end
function tag(func, c)
local tags_n = {}
for t = 1, #awful.tag.gettags(c.screen) do
tags_n[t] = { t, function() func(awful.tag.gettags(c.screen)[t], c) end }
end
return tags_n
end
function clsmenu()
local cls = capi.client.get()
local cls_t = {}
for k, c in pairs(cls) do
cls_t[#cls_t + 1] = {
awful.util.escape(c.name) or "",
function ()
if not c:isvisible() then
awful.tag.viewmore(c:tags(), c.screen)
end
if c.minimized then
c.minimized = not c.minimized
end
capi.client.focus = c
c:raise()
awful.screen.focus(c.screen)
end,
c.icon }
end
return cls_t
end
function setlay(c, arg) -- FIXME set layout for selected client tag
local lay_m = {}
for s = 1, #arg do
lay_m[s] = { awful.layout.getname(arg[s]), function () awful.layout.set(arg[s], awful.tag.selected(c.screen)) end, beautiful["layout_" .. awful.layout.getname(arg[s])] }
end
return lay_m
end
function ClientMenu(c, args)
local args = args or {}
c = c or capi.client.focus
local menu = {}
menu.fclient = {
{"Close", function() c:kill() end},
{(c.minimized and "Restore") or "Minimize", function() c.minimized = not c.minimized end},
{(c.fullscreen and "Restore") or "Fullscreen", function () c.fullscreen = not c.fullscreen end},
{(c.maximized_horizontal and "Restore") or "Maximize", function () c.maximized_horizontal = not c.maximized_horizontal c.maximized_vertical = not c.maximized_vertical end},
{(c.sticky and "Un-Stick") or "Stick", function() c.sticky = not c.sticky end},
{(c.ontop and "Offtop") or "Ontop", function() c.ontop = not c.ontop if c.ontop then c:raise() end end},
{((awful.client.floating.get(c) and "Tile") or "Float"), function() awful.client.floating.toggle(c) end},
{"Set Master", function() c:swap(awful.client.getmaster(1)) end},
{"Set Slave",function() awful.client.setslave(c) end},
{(awful.client.property.get(c, "titlebar") and "Remove titlebar") or "Add titlebar",
function()
if awful.client.property.get(c, "titlebar") then
remove_titlebar(c)
else
add_titlebar(c)
end end}}
menu.mynav = {
{ "<b>" .. awful.util.escape(c.class) .. "</b>",
menu.fclient, c.icon},
{ " ", function () c_menu:hide() end},
{"Move to Tag", tag(awful.client.movetotag, c)},
{"Toggle Tag", tag(awful.client.toggletag, c)},
{"Move to Screen", mvscr(c)},
{"Set tag layout", setlay(c, layouts)},
{"Running Clients", clsmenu()},}
args.items = menu.mynav
c_menu = awful.menu(args)
return c_menu
end
myawesomemenu = {
{ "manual", terminal .. " -e man awesome", freedesktop.utils.lookup_icon({ icon = 'help' }) },
{ "edit config", editor_cmd .. " " .. awesome.conffile, freedesktop.utils.lookup_icon({ icon = 'package_settings' }) },
{ "restart", awesome.restart, freedesktop.utils.lookup_icon({ icon = 'gtk-refresh' }) },
{ "quit", awesome.quit, freedesktop.utils.lookup_icon({ icon = 'gtk-quit' }) }
}
exitmenu = {
{ "Shutdown", "poweroff", freedesktop.utils.lookup_icon({ icon='system-shutdown' }) },
{ "Restart", "reboot", freedesktop.utils.lookup_icon({ icon='view-refresh' }) },
{ "Lock", "slimlock", freedesktop.utils.lookup_icon({ icon='system-lock-screen' }) },
{ "awesome", myawesomemenu, beautiful.awesome_icon }
}
volume = {
{ "Un/Mute", "amixer set Master toggle", freedesktop.utils.lookup_icon({ icon='audio-volume-muted' }) },
{ "30%", "pamixer --set-volume 30", freedesktop.utils.lookup_icon({ icon='audio-volume-low' }) },
{ "50%", "pamixer --set-volume 50", freedesktop.utils.lookup_icon({ icon='audio-volume-low' }) },
{ "80%", "pamixer --set-volume 80", freedesktop.utils.lookup_icon({ icon='audio-volume-medium' }) },
{ "100%", "pamixer --set-volume 100", freedesktop.utils.lookup_icon({ icon='audio-volume-high' }) },
{ "Mixer", volmixer }
}
musicmenu = {
{ "Play/Pause", "mpc toggle", freedesktop.utils.lookup_icon({ icon='stock_media-play' }) },
{ "Stop", "mpc stop", freedesktop.utils.lookup_icon({ icon='stock_media-stop' }) },
{ "Previous", "mpc prev", freedesktop.utils.lookup_icon({ icon='stock_media-prev' }) },
{ "Next", "mpc next", freedesktop.utils.lookup_icon({ icon='stock_media-next' }) },
{ "CLI", music, freedesktop.utils.lookup_icon({ icon='multimedia-volume-control' }) },
{ "GUI", "cantata", freedesktop.utils.lookup_icon({ icon='multimedia-volume-control' }) },
{ "Volume", volume, freedesktop.utils.lookup_icon({ icon='stock_volume' }) }
}
beautiful.default_app_icon = freedesktop.utils.lookup_icon({ icon='application-default-icon' })
mymainmenu = awful.menu({ items = awful.util.table.join({
{ "&File Manager", fileman, freedesktop.utils.lookup_icon({ icon='file-manager' }) },
{ "&Browser", browser, freedesktop.utils.lookup_icon({ icon='browser' }) },
{ "&Terminal", terminal, freedesktop.utils.lookup_icon({ icon='terminal' }) },
{ " ", function () awful.menu.hide(mymainmenu) end, nil},
-- { "Home", myplacesmenu.genMenu('/home/arkhan/'), freedesktop.utils.lookup_icon({ icon='folder-home' }) },
-- { "Data", myplacesmenu.genMenu('/home/data/'), freedesktop.utils.lookup_icon({ icon='folder-home' }) },
-- { " ", function () awful.menu.hide(mymainmenu) end, nil}
},
freedesktop.menu.new(),
{
{ " ", function () awful.menu.hide(mymainmenu) end, nil},
{ "Music", musicmenu, freedesktop.utils.lookup_icon({ icon='audio-headphones' }) },
{ " ", function () awful.menu.hide(mymainmenu) end, nil},
{ "Exit", exitmenu, freedesktop.utils.lookup_icon({ icon='exit' }) }})
})
mylauncher = awful.widget.launcher({ menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- {{{ Widgets
-- markup
markup = lain.util.markup
gray = beautiful.fg_normal
white = beautiful.fg_focus
-- Clock & Date
-- Clock & Date
mytextclock = awful.widget.textclock(markup(gray, "| ") .. markup(white, "%A %d %B ") .. markup(gray, "/") .. markup(white, " %H:%M "))
-- Calendar with the Clock
lain.widgets.calendar:attach(mytextclock, {
font = "Monaco",
font_size = 9,
fg = "#FFFFFF",
bg = "#000000", })
-- /home fs
fswidget = lain.widgets.fs({
fg = "#FFFFFF",
bg = "#000000",
partition = '/home',
settings = function()
widget:set_markup(markup(gray, "| Hdd ") .. markup(white, fs_now.used))
end
})
-- Volume widget
volumewidget = lain.widgets.alsa({
settings = function()
if volume_now.status == "off" then
volume_now.level = volume_now.level .. "M"
end
widget:set_markup(markup(gray, "| Vol ") .. markup(white, volume_now.level))
end
})
-- Music
musicwidget = awesompd:create()
musicwidget.font = beautiful.font
musicwidget.scrolling = true
musicwidget.output_size = 200
musicwidget.update_interval = 10
musicwidget.path_to_icons = confdir .. "/awesompd/icons"
musicwidget.jamendo_format = awesompd.FORMAT_MP3
musicwidget.show_album_cover = true
musicwidget.album_cover_size = 100
musicwidget.mpd_config = home .. "/.mpd/mpd.conf"
musicwidget.browser = "firefox"
musicwidget.ldecorator = " "
musicwidget.rdecorator = " "
musicwidget.servers = {
{ server = "localhost", port = 6600 },
}
musicwidget:register_buttons({ { "", awesompd.MOUSE_LEFT, musicwidget:command_toggle() },
{ "Control", awesompd.MOUSE_SCROLL_UP, musicwidget:command_prev_track() },
{ "Control", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_next_track() },
{ "", awesompd.MOUSE_SCROLL_UP, musicwidget:command_volume_up() },
{ "", awesompd.MOUSE_SCROLL_DOWN, musicwidget:command_volume_down() },
{ "", awesompd.MOUSE_RIGHT, musicwidget:command_show_menu() },
{ "", "XF86AudioLowerVolume", musicwidget:command_volume_down() },
{ "", "XF86AudioRaiseVolume", musicwidget:command_volume_up() },
{ modkey, "Pause", musicwidget:command_playpause() } })
musicwidget:run()
-- Net Info
netwidget = lain.widgets.net({
settings = function()
widget:set_markup(markup(gray, "Net ") .. markup(white, net_now.received) .. markup(gray, " ▼▲ ") .. markup(white, net_now.sent))
end
})
netwidget:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn(wifi) end)
))
-- Battery
batwidget = lain.widgets.bat({
battery = "BAT0",
settings = function()
if bat_now.perc == "N/A" then
bat_now.perc = "AC "
else
bat_now.perc = bat_now.perc
end
widget:set_markup(markup(gray, "| Bat ") .. markup(white, bat_now.perc) .. markup(gray, " Time ") .. markup(white, bat_now.time))
end
})
-- }}}
-- {{{ Spacers
-- Separators
rbracket = wibox.widget.textbox()
rbracket:set_text(']')
lbracket = wibox.widget.textbox()
lbracket:set_text('[')
line = wibox.widget.textbox()
line:set_text('│')
space = wibox.widget.textbox()
space:set_text(' ')
-- }}}
-- {{{ Wibox
mywibox = {}
mybottomwibox = {}
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, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c.minimized = false
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
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
mypromptbox[s] = awful.widget.prompt()
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)))
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
mywibox[s] = awful.wibox({ position = "top", screen = s, border_width = 0, height = 16 })
left_layout = wibox.layout.fixed.horizontal()
left_layout:add(mytaglist[s])
left_layout:add(space)
left_layout:add(mypromptbox[s])
left_layout:add(space)
right_layout = wibox.layout.fixed.horizontal()
right_layout:add(space)
right_layout:add(musicwidget.widget)
right_layout:add(space)
right_layout:add(netwidget)
right_layout:add(space)
right_layout:add(fswidget)
right_layout:add(space)
right_layout:add(batwidget)
right_layout:add(space)
right_layout:add(volumewidget)
right_layout:add(space)
right_layout:add(mytextclock)
right_layout:add(space)
right_layout:add(mylayoutbox[s])
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_right(right_layout)
mywibox[s]:set_widget(layout)
mybottomwibox[s] = awful.wibox({ position = "bottom", screen = s, border_width = 0, height = 16 })
mybottomwibox[s].visible = false
bottom_right_layout = wibox.layout.fixed.horizontal()
bottom_right_layout:add(space)
if s == 1 then bottom_right_layout:add(wibox.widget.systray()) end
bottom_layout = wibox.layout.align.horizontal()
bottom_layout:set_left(bottom_left_layout)
bottom_layout:set_middle(mytasklist[s])
bottom_layout:set_right(bottom_right_layout)
mybottomwibox[s]:set_widget(bottom_layout)
end
-- }}}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end)
-- awful.button({ }, 4, awful.tag.viewnext),
-- awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ 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}, "e", revelation ),
awful.key({ }, "Print", function() os.execute(scriptdir .. "/screenshot") end),
-- Show/Hide Wibox
awful.key({ modkey, "Control" }, "F1", function ()
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
end),
awful.key({ modkey }, "F1", function ()
mybottomwibox[mouse.screen].visible = not mybottomwibox[mouse.screen].visible
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 ()
awful.menu.menu_keys.down = {"j"}
awful.menu.menu_keys.up = {"k"}
awful.menu.menu_keys.exec = {"l"}
awful.menu.menu_keys.back = {"h"}
mymainmenu:show({keygrabber=true})
end),
-- On the fly useless gaps change
awful.key({ altkey, "Control" }, "+", function () lain.utils.useless_gaps_resize(1) end),
awful.key({ altkey, "Control" }, "-", function () lain.utils.useless_gaps_resize(-1) end),
awful.key({ altkey }, "Tab",
function ()
menu = {theme = {width = 300, height = 23}}
menu.items = clsmenu()
local m = awful.menu(menu)
m:show() end),
-- Prompt
-- awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),-- Prompt
awful.key({ modkey }, "r",
function()
os.execute(
"dmenu_run -b -i -p 'Run:" ..
"' -nb '" .. beautiful.bg_dmenu_normal ..
"' -nf '" .. beautiful.fg_normal ..
"' -sb '" .. beautiful.bg_dmenu_focus ..
"' -sf '" .. beautiful.fg_focus ..
"' -fn '" .. beautiful.dfont .. "'")
end),
-- Widgets popups
awful.key({ altkey, }, "c", function () lain.widgets.calendar:show(7) end),
awful.key({ altkey, }, "h", function () lain.widgets.fs:show(7) end),
-- awful.key({ altkey, }, "n", function () lain.widgets.net:show(7) end),
-- Transparency
-- awful.key({ altkey }, 4, function (c) awful.util.spawn("transset-df --actual --inc 0.1") end),
-- awful.key({ altkey }, 5, function (c) awful.util.spawn("transset-df --actual --dec 0.1") 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 () lain.util.tag_view_nonempty(1) end),
awful.key({ modkey, "Shift" }, "Tab", function () lain.util.tag_view_nonempty(-1) end),
-- Standard program
awful.key({ modkey, }, "p", function () awful.util.spawn(music) end),
awful.key({ modkey, }, "t", function () awful.util.spawn(fileman) end),
awful.key({ modkey, }, "f", function () awful.util.spawn(cli_fileman) end),
awful.key({ modkey, }, "b", function () awful.util.spawn(browser) end),
awful.key({ modkey, }, "i", function () awful.util.spawn(chat) end),
awful.key({ modkey, }, "d", function () awful.util.spawn(torrent) end),
awful.key({ modkey, }, "Return",function () awful.util.spawn(terminal) end),
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
-- Record a Screencast
awful.key({ modkey, }, "F7", function() awful.util.spawn(scriptdir .. "/start_screencast") end),
awful.key({ modkey, }, "F8", function() awful.util.spawn(scriptdir .. "/stop_screencast") end),
-- Dropdown terminal
awful.key({ }, "F12", function () drop(drop_terminal, "top", "center", 0.9, 0.7, false, false) end),
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, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
awful.key({ modkey, "Control" }, "n", awful.client.restore),
-- Music keys
awful.key({ }, "XF86AudioPlay", function () os.execute("ncmpcpp toggle" ) end),
awful.key({ }, "XF86AudioNext", function () os.execute("ncmpcpp next" ) end),
awful.key({ }, "XF86AudioPrev", function () os.execute("ncmpcpp prev" ) end),
-- Volume control
awful.key({ altkey }, "Up",
function ()
os.execute("pamixer --increase 2")
volumewidget.update()
end),
awful.key({ altkey }, "Down",
function ()
os.execute("pamixer --decrease 2")
volumewidget.update()
end),
awful.key({ altkey }, "m",
function ()
os.execute("pamixer --toggle-mute")
volumewidget.update()
end),
-- awful.key({ altkey, "Control" }, "m",
-- function ()
-- os.execute("amixer -q set Master playback 100%")
-- volumewidget.update()
-- 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, "Shift" }, "f", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", 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, }, "n",
function (c)
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)
)
keynumber = 0
for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber));
end
for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9,
function ()
screen = mouse.screen
if tags[screen][i] then
awful.tag.viewonly(tags[screen][i])
end
end),
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
screen = mouse.screen
if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i])
end
end),
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i])
end
end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i])
end
end))
end
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize))
-- Set keys
musicwidget:append_global_keys()
root.keys(globalkeys)
-- }}}
-- {{{ Rules
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = true,
keys = clientkeys,
maximized_vertical = false,
maximized_horizontal = false,
buttons = clientbuttons,
size_hints_honor = false
}
},
{ rule_any = { class = { "Vlc", "MPlayer", "Umplayer", "Smplayer", "mpv" } },
properties = { tag = tags[1][4], switchtotag = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Gsharkdown.py" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "Qalculate" },
properties = { floating = true } },
{ rule = { class = "SimpleScreenRecorder" },
properties = { floating = true }
},
{ rule = { class = "Gimp" },
properties = { tag = tags[1][4] },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Xfburn" },
properties = { tag = tags[1][4] } },
{ rule = { instance = "plugin-container" },
properties = { floating = true } },
{ rule = { class = "Firefox" },
properties = { tag = tags[1][1], switchtotag = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Iron" },
properties = { tag = tags[1][1], },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Firefox" , instance = "DTA" },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Firefox" , instance = "Toplevel" },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Firefox" , instance = "Browser" },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Firefox" , instance = "Descargas" },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Firefox" , name = "Install user style" },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Geary" },
properties = { tag = tags[1][1] },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Geary", name = "Mensaje nuevo" },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Geary", name = "Re: " },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Geary", name = "RE: " },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Thunderbird" },
properties = { tag = tags[1][1], switchtotag = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "Thunderbird", name = "Redacción: " },
properties = { tag = tags[1][1], floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
-- { rule = { class = "URxvt", name = "Terminal" },
-- properties ={ tag = tags[1][1], switchtotag = true },
-- callback = function (c)
-- awful.placement.centered(c,nil)
-- end
-- },
{ rule = { class = "XTerm" },
properties = { floating = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "URxvt", name = "saidar" },
properties = { tag = tags[1][5], switchtotag = true, floating = true } },
{ rule = { class = "URxvt", name = "Music" },
properties = { tag = tags[1][5], switchtotag = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "URxvt", name = "Drop-Terminal" },
properties = { floating = true } },
{ rule = { class = "URxvt", name = "MusicInfo" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "URxvt", name = "Mail" },
properties = { tag = tags[1][1], switchtotag = true } },
{ rule = { class = "URxvt", name = "Chat" },
properties = { tag = tags[1][3], switchtotag = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "URxvt", name = "Feed" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "URxvt", name = "Ranger" },
properties = { tag = tags[1][2], switchtotag = true },
callback = function (c)
awful.placement.centered(c,nil)
end
},
{ rule = { class = "URxvt", name = "ranger:~" },
properties = { tag = tags[1][2], switchtotag = true } },
{ rule = { class = "URxvt", name = "Youtube" },
properties = { tag = tags[1][1], switchtotag = true } },
{ rule = { name = "gcalctool" },
properties = { tag = tags[1][5], switchtotag = true, floating = true } },
{ rule = { class = "URxvt", name = "Abook" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "URxvt", name = "Elinks" },
properties = { tag = tags[1][1], switchtotag = true } },
{ rule = { class = "Display" },
properties = { tag = tags[1][1], floating = true } },
{ rule = { class = "Thunar" },
properties = { tag = tags[1][3], floating = true, switchtotag = true } },
{ rule = { class = "Skype" },
properties = { tag = tags[1][4], floating = true } },
{ rule = { class = "Pidgin" },
properties = { tag = tags[1][4] } },
{ rule = { class = "Nomacs" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "Evince" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "Zathura" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "feh" },
properties = { tag = tags[1][4], switchtotag = true } },
{ rule = { class = "Spacefm" },
properties = { tag = tags[1][2], switchtotag = true } },
{ rule = { class = "Gucharmap" },
properties = { tag = tags[1][3], switchtotag = true } },
{ rule = { class = "Nitrogen" },
properties = { tag = tags[1][3], switchtotag = true } },
{ rule = { class = "Geany" },
properties = { tag = tags[1][5], switchtotag = true } },
{ rule = { class = "libreoffice-impress" },
properties = { tag = tags[1][2], switchtotag = true } },
{ rule = { class = "libreoffice-math" },
properties = { tag = tags[1][2], floating = true, switchtotag = true } },
{ rule = { class = "libreoffice-calc" },
properties = { tag = tags[1][2], switchtotag = true } },
{ rule = { class = "Torrent-search" },
properties = { tag = tags[1][3] } },
{ rule = { class = "TuxGuitar" },
properties = { tag = tags[1][5] } },
{ rule = { class = "Unetbootin.elf" },
properties = { tag = tags[1][5], switchtotag = true } },
{ rule = { class = "Bleachbit" },
properties = { tag = tags[1][3] } },
{ rule = { class = "Gpartedbin" },
properties = { tag = tags[1][3], switchtotag = true } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c, startup)
-- Enable sloppy focus
c:connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
end
end)
if not startup then
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- awful.client.setslave(c)
-- Put windows in a smart way, only if they does not set an initial position.
if not c.size_hints.user_position and not c.size_hints.program_position then
awful.placement.no_overlap(c)
awful.placement.no_offscreen(c)
end
end
local titlebars_enabled = false
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(awful.titlebar.widget.iconwidget(c))
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
right_layout:add(awful.titlebar.widget.floatingbutton(c))
right_layout:add(awful.titlebar.widget.maximizedbutton(c))
right_layout:add(awful.titlebar.widget.stickybutton(c))
right_layout:add(awful.titlebar.widget.ontopbutton(c))
right_layout:add(awful.titlebar.widget.closebutton(c))
-- The title goes in the middle
local title = awful.titlebar.widget.titlewidget(c)
title:buttons(awful.util.table.join(
awful.button({ }, 1, function()
client.focus = c
c:raise()
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
client.focus = c
c:raise()
awful.mouse.client.resize(c)
end)
))
-- Now bring it all together
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_right(right_layout)
layout:set_middle(title)
awful.titlebar(c):set_widget(layout)
end
end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | -- {{{ Basic
theme = {}
theme.confdir = os.getenv("HOME") .. "/.config/awesome/themes/darkness"
theme.wallpaper = theme.confdir .. "/wallpaper/3.jpg"
-- }}}
-- {{{ Fonts
theme.font = "Terminus 10"
theme.dfont = "Terminus-10"
theme.taglist_font = "FontAwesome 12"
-- }}}
-- {{{ Colors
theme.bg_normal = "#070707AA"
theme.bg_focus = "#070707AA"
theme.bg_urgent = "#ff0000AA"
theme.bg_systray = theme.bg_normal
theme.bg_dmenu_normal = "#000000"
theme.bg_dmenu_focus = "#111111"
theme.fg_normal = "#777777"
theme.fg_focus = "#DDDDDD"
theme.fg_urgent = "#CC9393"
theme.border_width = 1
theme.border_normal = "#070707"
theme.border_focus = "#292929"
theme.titlebar_bg_focus = "#000000"
theme.taglist_fg_focus = "#dddcff"
theme.taglist_bg_focus = "#070707AA"
theme.tooltip_bg_color = "#070707AA"
theme.tooltip_fg_color = "#dddcff"
theme.tooltip_border_width = 1
theme.tooltip_border_color = "#121212"
--}}}
-- {{{ Awful
theme.awful_widget_height = "10"
theme.awful_widget_margin_top = "2"
-- }}}
-- {{{ Menu
theme.menu_height = "20"
theme.menu_width = "150"
-- }}}
-- {{{ Tag list images
theme.taglist_squares_sel = theme.confdir .. "/taglist/square_sel.png"
theme.taglist_squares_unsel = theme.confdir .. "/taglist/square_unsel.png"
-- }}}
-- {{{ Tasklis float icon
theme.tasklist_floating_icon = theme.confdir .. "/floating.png"
-- }}}
-- {{{ Layout
theme.useless_gap_width = 5
theme.layout_tile = theme.confdir .. "/layouts2/tile.png"
theme.layout_tileleft = theme.confdir .. "/layouts2/tileleft.png"
theme.layout_tilebottom = theme.confdir .. "/layouts2/tilebottom.png"
theme.layout_tiletop = theme.confdir .. "/layouts2/tiletop.png"
theme.layout_fairv = theme.confdir .. "/layouts2/fairv.png"
theme.layout_fairh = theme.confdir .. "/layouts2/fairh.png"
theme.layout_spiral = theme.confdir .. "/layouts2/spiral.png"
theme.layout_dwindle = theme.confdir .. "/layouts2/dwindle.png"
theme.layout_max = theme.confdir .. "/layouts2/max.png"
theme.layout_fullscreen = theme.confdir .. "/layouts2/fullscreen.png"
theme.layout_magnifier = theme.confdir .. "/layouts2/magnifier.png"
theme.layout_floating = theme.confdir .. "/layouts2/floating.png"
-- }}}
-- {{{ Widgets
theme.arrl_lr_pre = theme.confdir .. "/icons/arrl_lr_pre.png"
theme.arrl_lr_post = theme.confdir .. "/icons/arrl_lr_post.png"
-- }}}
-- {{{ Menu Icons
theme.awesome_icon = theme.confdir .. "/icons/awesome.png"
theme.menu_submenu_icon = theme.confdir .. "/icons/submenu.png"
-- }}}
return theme
|
x
neringan said about 9 years ago
Wow, beautiful !
Could you share your dotfiles please ? :)