From c1e3c460343736921bba2a019817675014effcbe Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Sat, 26 Dec 2020 00:58:32 +0800 Subject: [PATCH] update awesome config and add shell script --- awesome/README.org | 30 ++ awesome/multicolor-config.patch | 22 ++ awesome/rc.lua | 512 +++++++++++++++++++------------- gentoo_portage/package.use | 17 +- 4 files changed, 370 insertions(+), 211 deletions(-) create mode 100644 awesome/README.org create mode 100644 awesome/multicolor-config.patch diff --git a/awesome/README.org b/awesome/README.org new file mode 100644 index 0000000..08019e5 --- /dev/null +++ b/awesome/README.org @@ -0,0 +1,30 @@ +#+title: Awesome配置 +#+author: Zedhugh Chen + +* 安装 awesome-copycats + 运行如下命令克隆 =awesome-copycats= 配置到 *=~/.config/awesome/=* + #+begin_src sh + git clone --recursive https://github.com/lcpz/awesome-copycats.git ~/.config/awesome + #+end_src + +* 将 awesome 配置文件链接到配置目录下 + #+begin_src sh + ln -s ./rc.lua ~/.config/awesome/ + ln -s ./pravitekeys.lua ~/.config/awesome/ + #+end_src + +* 修改 =awesome-copycats= 代码 + 修改 =awesome-copycats= 代码的原因有两个: + 1. 下拉终端使用 =st= ,=awesome-copycats= 实现下拉终端时需要设置 =st= 终端的窗口名, + =st= 设置窗口名的命令行参数为 /-n/ 而非 =xterm= 和 =rxvt-unicode= 使用的 /-name/ 。 + 2. 在我们自定义的配置中,会根据显示器数量设置不同的 *tag名称* ,=awesome-copycats= 默认 + 的每个屏幕的 =tag= 都相同。 + + 实现该功能无需手动修改代码,直接使用[[./multicolor-config.patch][该补丁]]即可,命令如下: + #+begin_src sh + dir=$(pwd) + file="${dir}/multicolor-config.patch" + + cd ~/.config/awesome/ + git apply $file + #+end_src diff --git a/awesome/multicolor-config.patch b/awesome/multicolor-config.patch new file mode 100644 index 0000000..d8c224d --- /dev/null +++ b/awesome/multicolor-config.patch @@ -0,0 +1,22 @@ +diff --git a/themes/multicolor/theme.lua b/themes/multicolor/theme.lua +index df22666..749d82f 100644 +--- a/themes/multicolor/theme.lua ++++ b/themes/multicolor/theme.lua +@@ -253,7 +253,7 @@ theme.mpd = lain.widget.mpd({ + + function theme.at_screen_connect(s) + -- Quake application +- s.quake = lain.util.quake({ app = awful.util.terminal }) ++ s.quake = lain.util.quake({ app = awful.util.terminal, argname = "-n %s" }) + + -- If wallpaper is a function, call it with the screen + local wallpaper = theme.wallpaper +@@ -263,7 +263,7 @@ function theme.at_screen_connect(s) + gears.wallpaper.maximized(wallpaper, s, true) + + -- Tags +- awful.tag(awful.util.tagnames, s, awful.layout.layouts) ++ -- awful.tag(awful.util.tagnames, s, awful.layout.layouts) + + -- Create a promptbox for each screen + s.mypromptbox = awful.widget.prompt() diff --git a/awesome/rc.lua b/awesome/rc.lua index fa62ae7..6925ce2 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -21,6 +21,7 @@ local freedesktop = require("freedesktop") local hotkeys_popup = require("awful.hotkeys_popup").widget require("awful.hotkeys_popup.keys") local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility +local dpi = require("beautiful.xresources").apply_dpi -- }}} -- {{{ Error handling @@ -56,7 +57,7 @@ local function run_once(cmd_arr) end end -run_once({ "urxvtd", "unclutter -root" }) -- entries must be separated by commas +run_once({ "unclutter -root" }) -- entries must be separated by commas -- This function implements the XDG autostart specification --[[ @@ -71,13 +72,30 @@ awful.spawn.with_shell( -- }}} -- {{{ Variable definitions -local chosen_theme = "multicolor" + +local themes = { + "blackburn", -- 1 + "copland", -- 2 + "dremora", -- 3 + "holo", -- 4 + "multicolor", -- 5 + "powerarrow", -- 6 + "powerarrow-dark", -- 7 + "rainbow", -- 8 + "steamburn", -- 9 + "vertex", -- 10 +} + +local chosen_theme = themes[5] local modkey = "Mod4" local altkey = "Mod1" local terminal = "st" -local editor = os.getenv("EDITOR") or "nano" or "vi" -local gui_editor = "gvim" -local browser = "firefox" +local vi_focus = false -- vi-like client focus - https://github.com/lcpz/awesome-copycats/issues/275 +local cycle_prev = true -- cycle trough all previous client or just the first -- https://github.com/lcpz/awesome-copycats/issues/274 +local editor = os.getenv("EDITOR") or "vim" +local gui_editor = os.getenv("GUI_EDITOR") or "gvim" +local browser = os.getenv("BROWSER") or "firefox" +local scrlocker = "slock" awful.util.terminal = terminal -- ❶❷❸❹❺❻❼❽❾❿ ➊➋➌➍➎➏➐➑➒➓ @@ -161,73 +179,71 @@ local function tag_config() end local mytags = tag_config() --- when screen changed, reload awesome config -awesome.connect_signal("screen::change", awesome.restart) -awful.util.taglist_buttons = awful.util.table.join( - awful.button({ }, 1, function(t) t:view_only() end), - awful.button({ modkey }, 1, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end), - awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), - awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) - ) -awful.util.tasklist_buttons = awful.util.table.join( - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - -- Without this, the following - -- :isvisible() makes no sense - c.minimized = false - if not c:isvisible() and c.first_tag then - c.first_tag:view_only() - end - -- This will also un-minimize - -- the client, if needed - client.focus = c - c:raise() - end - end), - awful.button({ }, 3, function() - local instance = nil +awful.util.taglist_buttons = my_table.join( + awful.button({ }, 1, function(t) t:view_only() end), + awful.button({ modkey }, 1, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end), + awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end), + awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) +) - return function () - if instance and instance.wibox.visible then - instance:hide() - instance = nil - else - instance = awful.menu.clients({ theme = { width = 250 } }) - end - end - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - end)) +awful.util.tasklist_buttons = my_table.join( + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + --c:emit_signal("request::activate", "tasklist", {raise = true}) + + -- Without this, the following + -- :isvisible() makes no sense + c.minimized = false + if not c:isvisible() and c.first_tag then + c.first_tag:view_only() + end + -- This will also un-minimize + -- the client, if needed + client.focus = c + c:raise() + end + end), + awful.button({ }, 2, function (c) c:kill() end), + awful.button({ }, 3, function () + local instance = nil + + return function () + if instance and instance.wibox.visible then + instance:hide() + instance = nil + else + instance = awful.menu.clients({theme = {width = dpi(250)}}) + end + end + end), + awful.button({ }, 4, function () awful.client.focus.byidx(1) end), + awful.button({ }, 5, function () awful.client.focus.byidx(-1) end) +) lain.layout.termfair.nmaster = 3 lain.layout.termfair.ncol = 1 lain.layout.termfair.center.nmaster = 3 lain.layout.termfair.center.ncol = 1 -lain.layout.cascade.tile.offset_x = 2 -lain.layout.cascade.tile.offset_y = 32 -lain.layout.cascade.tile.extra_padding = 5 +lain.layout.cascade.tile.offset_x = dpi(2) +lain.layout.cascade.tile.offset_y = dpi(32) +lain.layout.cascade.tile.extra_padding = dpi(5) lain.layout.cascade.tile.nmaster = 5 lain.layout.cascade.tile.ncol = 2 -local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme) -beautiful.init(theme_path) +beautiful.init(string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme)) -- }}} -- {{{ Menu @@ -239,7 +255,7 @@ local myawesomemenu = { { "quit", function() awesome.quit() end } } awful.util.mymainmenu = freedesktop.menu.build({ - icon_size = beautiful.menu_height or 16, + icon_size = beautiful.menu_height or dpi(16), before = { { "Awesome", myawesomemenu, beautiful.awesome_icon }, -- other triads can be put here @@ -249,6 +265,9 @@ awful.util.mymainmenu = freedesktop.menu.build({ -- other triads can be put here } }) +-- hide menu when mouse leaves it +--awful.util.mymainmenu.wibox:connect_signal("mouse::leave", function() awful.util.mymainmenu:hide() end) + --menubar.utils.terminal = terminal -- Set the Menubar terminal for applications that require it -- }}} @@ -265,12 +284,24 @@ screen.connect_signal("property::geometry", function(s) gears.wallpaper.maximized(wallpaper, s, true) end end) + +-- No borders when rearranging only 1 non-floating or maximized client +screen.connect_signal("arrange", function (s) + local only_one = #s.tiled_clients == 1 + for _, c in pairs(s.clients) do + if only_one and not c.floating or c.maximized then + c.border_width = 0 + else + c.border_width = beautiful.border_width + end + end +end) -- Create a wibox for each screen and add it awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end) -- }}} -- {{{ Mouse bindings -root.buttons(awful.util.table.join( +root.buttons(my_table.join( awful.button({ }, 3, function () awful.util.mymainmenu:toggle() end), awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 5, awful.tag.viewprev) @@ -278,14 +309,19 @@ root.buttons(awful.util.table.join( -- }}} -- {{{ Key bindings -globalkeys = awful.util.table.join( +globalkeys = my_table.join( -- Take a screenshot - -- https://github.com/copycat-killer/dots/blob/master/bin/screenshot - awful.key({ modkey }, "p", function() os.execute("screenshot") end), + -- https://github.com/lcpz/dots/blob/master/bin/screenshot + -- awful.key({ altkey }, "p", function() os.execute("screenshot") end, + -- {description = "take a screenshot", group = "hotkeys"}), + + -- X screen locker + awful.key({ altkey, "Control" }, "l", function () os.execute(scrlocker) end, + {description = "lock screen", group = "hotkeys"}), -- Hotkeys awful.key({ modkey, }, "s", hotkeys_popup.show_help, - {description="show help", group="awesome"}), + {description = "show help", group="awesome"}), -- Tag browsing awful.key({ modkey, }, "Left", awful.tag.viewprev, {description = "view previous", group = "tag"}), @@ -295,9 +331,9 @@ globalkeys = awful.util.table.join( {description = "go back", group = "tag"}), -- Non-empty tag browsing - awful.key({ modkey, "Shift" }, "Left", function () lain.util.tag_view_nonempty(-1) end, + awful.key({ altkey }, "Left", function () lain.util.tag_view_nonempty(-1) end, {description = "view previous nonempty", group = "tag"}), - awful.key({ modkey, "Shift" }, "Right", function () lain.util.tag_view_nonempty(1) end, + awful.key({ altkey }, "Right", function () lain.util.tag_view_nonempty(1) end, {description = "view previous nonempty", group = "tag"}), -- Default client focus @@ -317,67 +353,93 @@ globalkeys = awful.util.table.join( -- By direction client focus awful.key({ modkey }, "j", function() - awful.client.focus.bydirection("down") + awful.client.focus.global_bydirection("down") if client.focus then client.focus:raise() end - end), + end, + {description = "focus down", group = "client"}), awful.key({ modkey }, "k", function() - awful.client.focus.bydirection("up") + awful.client.focus.global_bydirection("up") if client.focus then client.focus:raise() end - end), - awful.key({ modkey }, "h", - function() - awful.client.focus.bydirection("left") - if client.focus then client.focus:raise() end - end), + end, + {description = "focus up", group = "client"}), + -- awful.key({ modkey }, "h", + -- function() + -- awful.client.focus.global_bydirection("left") + -- if client.focus then client.focus:raise() end + -- end, + -- {description = "focus left", group = "client"}), -- awful.key({ modkey }, "l", -- function() - -- awful.client.focus.bydirection("right") + -- awful.client.focus.global_bydirection("right") -- if client.focus then client.focus:raise() end - -- end), + -- end, + -- {description = "focus right", group = "client"}), -- awful.key({ modkey, }, "w", function () awful.util.mymainmenu:show() end, -- {description = "show main menu", group = "awesome"}), -- Layout manipulation - awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, - {description = "swap with next client by index", group = "client"}), - awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, - {description = "swap with previous client by index", group = "client"}), + -- awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, + -- {description = "swap with next client by index", group = "client"}), + -- awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, + -- {description = "swap with previous client by index", group = "client"}), awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, {description = "focus the next screen", group = "screen"}), - awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, - {description = "focus the previous screen", group = "screen"}), - awful.key({ modkey, }, "u", awful.client.urgent.jumpto, - {description = "jump to urgent client", group = "client"}), - awful.key({ modkey, }, "Tab", - function () - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end, - {description = "go back", group = "client"}), + -- awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, + -- {description = "focus the previous screen", group = "screen"}), + -- awful.key({ modkey, }, "u", awful.client.urgent.jumpto, + -- {description = "jump to urgent client", group = "client"}), + -- awful.key({ modkey, }, "Tab", + -- function () + -- if cycle_prev then + -- awful.client.focus.history.previous() + -- else + -- awful.client.focus.byidx(-1) + -- end + -- if client.focus then + -- client.focus:raise() + -- end + -- end, + -- {description = "cycle with previous/go back", group = "client"}), + -- awful.key({ modkey, "Shift" }, "Tab", + -- function () + -- if cycle_prev then + -- awful.client.focus.byidx(1) + -- if client.focus then + -- client.focus:raise() + -- end + -- end + -- end, + -- {description = "go forth", group = "client"}), -- Show/Hide Wibox awful.key({ modkey }, "b", function () - for s in screen do - s.mywibox.visible = not s.mywibox.visible - if s.mybottomwibox then - s.mybottomwibox.visible = not s.mybottomwibox.visible + for s in screen do + s.mywibox.visible = not s.mywibox.visible + if s.mybottomwibox then + s.mybottomwibox.visible = not s.mybottomwibox.visible + end end - end - end), + end, + {description = "toggle wibox", group = "awesome"}), -- On the fly useless gaps change - -- awful.key({ altkey, "Control" }, "+", function () lain.util.useless_gaps_resize(1) end), - -- awful.key({ altkey, "Control" }, "-", function () lain.util.useless_gaps_resize(-1) end), + awful.key({ altkey, "Control" }, "+", function () lain.util.useless_gaps_resize(1) end, + {description = "increment useless gaps", group = "tag"}), + awful.key({ altkey, "Control" }, "-", function () lain.util.useless_gaps_resize(-1) end, + {description = "decrement useless gaps", group = "tag"}), -- Dynamic tagging - -- awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end), - -- awful.key({ modkey, "Shift" }, "r", function () lain.util.rename_tag() end), - -- awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(1) end), -- move to next tag - -- awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(-1) end), -- move to previous tag - -- awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end), + -- awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end, + -- {description = "add new tag", group = "tag"}), + -- awful.key({ modkey, "Shift" }, "r", function () lain.util.rename_tag() end, + -- {description = "rename tag", group = "tag"}), + -- awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end, + -- {description = "move tag to the left", group = "tag"}), + -- awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end, + -- {description = "move tag to the right", group = "tag"}), + -- awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end, + -- {description = "delete tag", group = "tag"}), -- Standard program awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, @@ -387,18 +449,18 @@ globalkeys = awful.util.table.join( awful.key({ modkey, "Shift" }, "q", awesome.quit, {description = "quit awesome", group = "awesome"}), - awful.key({ altkey, "Shift" }, "l", function () awful.tag.incmwfact( 0.05) end, - {description = "increase master width factor", group = "layout"}), - awful.key({ altkey, "Shift" }, "h", function () awful.tag.incmwfact(-0.05) end, - {description = "decrease master width factor", group = "layout"}), - awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, - {description = "increase the number of master clients", group = "layout"}), + -- awful.key({ altkey, "Shift" }, "l", function () awful.tag.incmwfact( 0.05) end, + -- {description = "increase master width factor", group = "layout"}), + -- awful.key({ altkey, "Shift" }, "h", function () awful.tag.incmwfact(-0.05) end, + -- {description = "decrease master width factor", group = "layout"}), + -- awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, + -- {description = "increase the number of master clients", group = "layout"}), -- awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, -- {description = "decrease the number of master clients", group = "layout"}), - awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, - {description = "increase the number of columns", group = "layout"}), - awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, - {description = "decrease the number of columns", group = "layout"}), + -- awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, + -- {description = "increase the number of columns", group = "layout"}), + -- awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, + -- {description = "decrease the number of columns", group = "layout"}), awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, {description = "select next", group = "layout"}), awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, @@ -416,62 +478,80 @@ globalkeys = awful.util.table.join( {description = "restore minimized", group = "client"}), -- Dropdown application - awful.key({ modkey, }, "z", function () awful.screen.focused().quake:toggle() end), + awful.key({ modkey, }, "z", function () awful.screen.focused().quake:toggle() end, + {description = "dropdown application", group = "launcher"}), -- Widgets popups - -- awful.key({ altkey, }, "c", function () lain.widget.calendar.show(7) end), - -- awful.key({ altkey, }, "h", function () if beautiful.fs then beautiful.fs.show(7) end end), - -- awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end), + -- awful.key({ altkey, }, "c", function () if beautiful.cal then beautiful.cal.show(7) end end, + -- {description = "show calendar", group = "widgets"}), + -- awful.key({ altkey, }, "h", function () if beautiful.fs then beautiful.fs.show(7) end end, + -- {description = "show filesystem", group = "widgets"}), + -- awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end, + -- {description = "show weather", group = "widgets"}), + + -- Brightness + awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end, + {description = "+10%", group = "hotkeys"}), + awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 10") end, + {description = "-10%", group = "hotkeys"}), -- ALSA volume control - -- awful.key({ }, "XF86AudioRaiseVolume", + -- awful.key({ altkey }, "Up", -- function () - -- os.execute(string.format("amixer set %s 1%%+", beautiful.volume.channel)) + -- os.execute(string.format("amixer -q set %s 1%%+", beautiful.volume.channel)) -- beautiful.volume.update() - -- end), - -- awful.key({ }, "XF86AudioLowerVolume", + -- end, + -- {description = "volume up", group = "hotkeys"}), + -- awful.key({ altkey }, "Down", -- function () - -- os.execute(string.format("amixer set %s 1%%-", beautiful.volume.channel)) + -- os.execute(string.format("amixer -q set %s 1%%-", beautiful.volume.channel)) -- beautiful.volume.update() - -- end), - -- awful.key({ }, "XF86AudioMute", + -- end, + -- {description = "volume down", group = "hotkeys"}), + -- awful.key({ altkey }, "m", -- function () - -- os.execute(string.format("amixer set %s toggle", beautiful.volume.togglechannel or beautiful.volume.channel)) + -- os.execute(string.format("amixer -q set %s toggle", beautiful.volume.togglechannel or beautiful.volume.channel)) -- beautiful.volume.update() - -- end), + -- end, + -- {description = "toggle mute", group = "hotkeys"}), -- awful.key({ altkey, "Control" }, "m", -- function () - -- os.execute(string.format("amixer set %s 100%%", beautiful.volume.channel)) + -- os.execute(string.format("amixer -q set %s 100%%", beautiful.volume.channel)) -- beautiful.volume.update() - -- end), - - -- awful.key({ altkey, "Control" }, "0", - -- function () - -- os.execute(string.format("amixer -q set %s 0%%", beautiful.volume.channel)) - -- beautiful.volume.update() - -- end), + -- end, + -- {description = "volume 100%", group = "hotkeys"}), + -- awful.key({ altkey, "Control" }, "0", + -- function () + -- os.execute(string.format("amixer -q set %s 0%%", beautiful.volume.channel)) + -- beautiful.volume.update() + -- end, + -- {description = "volume 0%", group = "hotkeys"}), -- MPD control - awful.key({ altkey, "Control" }, "Up", - function () - awful.spawn.with_shell("mpc toggle") - beautiful.mpd.update() - end), - awful.key({ altkey, "Control" }, "Down", - function () - awful.spawn.with_shell("mpc stop") - beautiful.mpd.update() - end), - awful.key({ altkey, "Control" }, "Left", - function () - awful.spawn.with_shell("mpc prev") - beautiful.mpd.update() - end), - awful.key({ altkey, "Control" }, "Right", - function () - awful.spawn.with_shell("mpc next") - beautiful.mpd.update() - end), + -- awful.key({ altkey, "Control" }, "Up", + -- function () + -- os.execute("mpc toggle") + -- beautiful.mpd.update() + -- end, + -- {description = "mpc toggle", group = "widgets"}), + -- awful.key({ altkey, "Control" }, "Down", + -- function () + -- os.execute("mpc stop") + -- beautiful.mpd.update() + -- end, + -- {description = "mpc stop", group = "widgets"}), + -- awful.key({ altkey, "Control" }, "Left", + -- function () + -- os.execute("mpc prev") + -- beautiful.mpd.update() + -- end, + -- {description = "mpc prev", group = "widgets"}), + -- awful.key({ altkey, "Control" }, "Right", + -- function () + -- os.execute("mpc next") + -- beautiful.mpd.update() + -- end, + -- {description = "mpc next", group = "widgets"}), -- awful.key({ altkey }, "0", -- function () -- local common = { text = "MPD widget ", position = "top_middle", timeout = 2 } @@ -483,23 +563,21 @@ globalkeys = awful.util.table.join( -- common.text = common.text .. lain.util.markup.bold("ON") -- end -- naughty.notify(common) - -- end), + -- end, + -- {description = "mpc on/off", group = "widgets"}), -- Copy primary to clipboard (terminals to gtk) - --awful.key({ modkey }, "c", function () awful.spawn("xsel | xsel -i -b") end), + -- awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end, + -- {description = "copy terminal to gtk", group = "hotkeys"}), -- Copy clipboard to primary (gtk to terminals) - --awful.key({ modkey }, "v", function () awful.spawn("xsel -b | xsel") end), + -- awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end, + -- {description = "copy gtk to terminal", group = "hotkeys"}), -- User programs - -- awful.key({ modkey }, "e", function () awful.spawn(gui_editor) end), - -- awful.key({ modkey }, "e", function () awful.spawn("pcmanfm") end), - -- awful.key({ modkey }, "q", function () awful.spawn(browser) end), - -- awful.key({ modkey }, "q", function () - -- local matcher = function (c) - -- return awful.rules.match(c, {class = "Firefox"}) - -- end - -- awful.client.run_or_raise("firefox", matcher) - -- end), + -- awful.key({ modkey }, "q", function () awful.spawn(browser) end, + -- {description = "run browser", group = "launcher"}), + -- awful.key({ modkey }, "a", function () awful.spawn(gui_editor) end, + -- {description = "run gui editor", group = "launcher"}), -- Default --[[ Menubar @@ -508,9 +586,19 @@ globalkeys = awful.util.table.join( --]] --[[ dmenu awful.key({ modkey }, "x", function () - awful.spawn(string.format("dmenu_run -i -fn 'Monospace' -nb '%s' -nf '%s' -sb '%s' -sf '%s'", - beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) - end) + os.execute(string.format("dmenu_run -i -fn 'Monospace' -nb '%s' -nf '%s' -sb '%s' -sf '%s'", + beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus)) + end, + {description = "show dmenu", group = "launcher"}) + --]] + -- alternatively use rofi, a dmenu-like application with more features + -- check https://github.com/DaveDavenport/rofi for more details + --[[ rofi + awful.key({ modkey }, "x", function () + os.execute(string.format("rofi -show %s -theme %s", + 'run', 'dmenu')) + end, + {description = "show rofi", group = "launcher"}), --]] -- Prompt awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, @@ -529,8 +617,9 @@ globalkeys = awful.util.table.join( --]] ) -clientkeys = awful.util.table.join( - awful.key({ altkey, "Shift" }, "m", lain.util.magnify_client ), +clientkeys = my_table.join( + awful.key({ altkey, "Shift" }, "m", lain.util.magnify_client, + {description = "magnify client", group = "client"}), awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen @@ -566,7 +655,15 @@ clientkeys = awful.util.table.join( -- Be careful: we use keycodes to make it works on any keyboard layout. -- This should map on the top row of your keyboard, usually 1 to 9. for i = 1, 9 do - globalkeys = awful.util.table.join(globalkeys, + -- Hack to only show tags 1 and 9 in the shortcut window (mod+s) + local descr_view, descr_toggle, descr_move, descr_toggle_focus + if i == 1 or i == 9 then + descr_view = {description = "view tag #", group = "tag"} + descr_toggle = {description = "toggle tag #", group = "tag"} + descr_move = {description = "move focused client to tag #", group = "tag"} + descr_toggle_focus = {description = "toggle focused client on tag #", group = "tag"} + end + globalkeys = my_table.join(globalkeys, -- View tag only. awful.key({ modkey }, "#" .. i + 9, function () @@ -576,7 +673,7 @@ for i = 1, 9 do tag:view_only() end end, - {description = "view tag #"..i, group = "tag"}), + descr_view), -- Toggle tag display. awful.key({ modkey, "Control" }, "#" .. i + 9, function () @@ -586,7 +683,7 @@ for i = 1, 9 do awful.tag.viewtoggle(tag) end end, - {description = "toggle tag #" .. i, group = "tag"}), + descr_toggle), -- Move client to tag. awful.key({ modkey, "Shift" }, "#" .. i + 9, function () @@ -597,7 +694,7 @@ for i = 1, 9 do end end end, - {description = "move focused client to tag #"..i, group = "tag"}), + descr_move), -- Toggle tag on focused client. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function () @@ -608,14 +705,23 @@ for i = 1, 9 do end end end, - {description = "toggle focused client on tag #" .. i, group = "tag"}) + descr_toggle_focus) ) 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)) +clientbuttons = gears.table.join( + awful.button({ }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + end), + awful.button({ modkey }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 3, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + awful.mouse.client.resize(c) + end) +) local pravitekeys = require("pravitekeys") @@ -658,7 +764,7 @@ awful.rules.rules = { properties = { tag = mytags.specify.virtualbox } }, { rule = { class = "Emacs" }, - properties = { tag = mytags.specify.emacs } }, + properties = { tag = mytags.specify.emacs, switchtotag = true, fullscreen = true } }, { rule = { class = "Gimp", role = "gimp-image-window" }, properties = { maximized = true } }, @@ -690,20 +796,19 @@ client.connect_signal("request::titlebars", function(c) -- Default -- buttons for the titlebar - local buttons = awful.util.table.join( + local buttons = my_table.join( awful.button({ }, 1, function() - client.focus = c - c:raise() + c:emit_signal("request::activate", "titlebar", {raise = true}) awful.mouse.client.move(c) end), + awful.button({ }, 2, function() c:kill() end), awful.button({ }, 3, function() - client.focus = c - c:raise() + c:emit_signal("request::activate", "titlebar", {raise = true}) awful.mouse.client.resize(c) end) ) - awful.titlebar(c, {size = 16}) : setup { + awful.titlebar(c, {size = dpi(16)}) : setup { { -- Left awful.titlebar.widget.iconwidget(c), buttons = buttons, @@ -731,22 +836,10 @@ end) -- Enable sloppy focus, so that focus follows mouse. client.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 + c:emit_signal("request::activate", "mouse_enter", {raise = vi_focus}) end) --- No border for maximized clients -client.connect_signal("focus", - function(c) - if c.maximized then -- no borders if only 1 client visible - c.border_width = 0 - elseif #awful.screen.focused().clients > 1 then - c.border_width = beautiful.border_width - c.border_color = beautiful.border_focus - 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) -- turn off energy saving when some window is fullscreen @@ -784,4 +877,7 @@ client.connect_signal("unmanage", end end ) + +-- possible workaround for tag preservation when switching back to default screen: +-- https://github.com/lcpz/awesome-copycats/issues/251 -- }}} diff --git a/gentoo_portage/package.use b/gentoo_portage/package.use index 7403cfa..f590f35 100644 --- a/gentoo_portage/package.use +++ b/gentoo_portage/package.use @@ -24,9 +24,11 @@ dev-lang/python sqlite dev-libs/gmp static-libs dev-libs/libpcre2 pcre16 media-libs/mesa -vaapi -gallium +net-misc/curl telnet net-misc/openssh libedit sys-apps/util-linux static-libs sys-boot/grub mount +sys-libs/zlib static-libs #sys-devel/binutils gold default-gold # nvidia driver @@ -48,9 +50,9 @@ app-arch/p7zip rar -wxwidgets app-editors/vim lua python # file manager -dev-libs/libxml2 python -gnome-base/gvfs udisks -x11-libs/libfm udisks +#dev-libs/libxml2 python +#gnome-base/gvfs udisks +#x11-libs/libfm udisks # pdf app-text/poppler cairo @@ -69,3 +71,12 @@ app-text/mupdf -opengl # postgresql dev-db/postgresql python + +# st +x11-terms/st savedconfig + +# imagemagick +media-gfx/imagemagick svg xml + +# pulseaudio +media-sound/pulseaudio -orc \ No newline at end of file