📜 ⬆️ ⬇️

My acquaintance with WM Awesome. Part 3

The third part of my post (the previous one can be found here )

In this piece, assign mouse buttons and keyboards. A small note: for Mod4 + PrntScr, I assigned to take a screenshot of the selected area, and on just a PtntScrn screenshot of the entire screen, but the second case does not work — you don’t get your hands on the screen (for the screenshots you will need to install the xsnap package


Purpose of buttons and combinations
----------------------------------- ---   --- ----------------------------------- root.buttons(awful.util.table.join( --   -   awful.button({ }, right_button, function() main_menu:toggle() end), --   -     awful.button({ }, plus_button, awful.tag.viewnext ), awful.button({ }, minus_button, awful.tag.viewprev ) )) ------------------------------------------- ---   --- ------------------------------------------- --    globalkeys = awful.util.table.join( --    awful.key( { modkey, }, key_Left, awful.tag.viewprev ), awful.key( { modkey, }, key_Right, awful.tag.viewnext ), awful.key( { modkey, }, key_Esc, awful.tag.history.restore ), --awful.key( { }, key_Alt_R, function () kbdcfg.switch() end), --    ( ) awful.key( { modkey, }, key_Tab, function() awful.client.focus.history.previous() if client.focus then client.focus:raise() end end ), --    --  awful.key( { modkey, }, key_X, function() awful.util.spawn(terminal) end ), --   awful.key( { modkey, }, key_R, function() bottom_prompt_box[mouse.screen]:run() end ), awful.key( { }, key_Home, function() awful.util.spawn_with_shell("google-chrome-stable") end ), --  awesome awful.key( { modkey, "Control" }, key_R, awesome.restart), awful.key( { modkey }, key_F1, function () awful.util.spawn('slimlock') end), awful.key( { }, key_Print, function () awful.util.spawn_with_shell("DATE=`date +%d%m%Y_%H%M%S`; xsnap -file $HOME/Snapshots/snap$DATE") end), awful.key( { modkey }, key_Print, function () awful.util.spawn_with_shell("DATE=`date +%d%m%Y_%H%M%S`; xsnap -nogui -file $HOME/Snapshots/snap$DATE") end), awful.key( { }, key_Vol_Up, function () volumecfg.up() end), awful.key( { }, key_Vol_Down, function () volumecfg.down() end), awful.key( { }, key_Mute, function () volumecfg.toggle() end) ) ------------------------------------------------------ ---    --- ------------------------------------------------------ clientkeys = awful.util.table.join( --     awful.key( { modkey, }, key_F, function(c) c.fullscreen = not c.fullscreen end ), --   awful.key( { modkey, "Shift" }, key_C, function(c) c:kill() end ), --      awful.key( { modkey, "Control" }, key_Space, awful.client.floating.toggle ), --      awful.key( { modkey, "Control" }, key_Return, function(c) c:swap( awful.client.getmaster() ) end ), --     ??? awful.key( { modkey, }, key_O, awful.client.movetoscreen ), --     awful.key( { modkey, }, key_T, function(c) c.ontop = not c.ontop end ), --   awful.key( { modkey, }, key_N, function(c) c.minimized = true end ), --   awful.key( { modkey, }, key_M, function(c) c.maximized_horizontal = not c.maximized_horizontal c.maximized_vertical = not c.maximized_vertical end ) ) 


')
Here are defined some combinations for tags, roles and signals. For example, the pidgin at me opens only on 4 tags, and in the signal I prescribe - to display the maximize button on the windows, close, the window icon and title.
Combinations for windows, rules and signals
 ----------------------------------------------------------------------------------------------------------------------- ---             --- ----------------------------------------------------------------------------------------------------------------------- for i = 1, 9 do -- modkey + < > --     globalkeys = awful.util.table.join( globalkeys, awful.key({ modkey }, "#" .. i + 9, function() local screen = mouse.screen local tag = awful.tag.gettags(screen)[i] if tag then awful.tag.viewonly(tag) end end), -- modkey + Ctrl + < > --      awful.key({ modkey, "Control" }, "#" .. i + 9, function() local screen = mouse.screen local tag = awful.tag.gettags(screen)[i] if tag then awful.tag.viewtoggle(tag) end end), -- modkey + < > --        awful.key({ modkey, "Shift" }, "#" .. i + 9, function() local tag = awful.tag.gettags(client.focus.screen)[i] if client.focus and tag then awful.client.movetotag(tag) end end), -- modkey + < > --       ,       awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, function() local tag = awful.tag.gettags(client.focus.screen)[i] if client.focus and tag then awful.client.toggletag(tag) end end) ) end ---------------------------------------------------------------------------- ---       --- ---------------------------------------------------------------------------- clientbuttons = awful.util.table.join( --   awful.button( { }, left_button, function(c) client.focus = c; c:raise() end), --  awful.button( { modkey }, left_button, awful.mouse.client.move), --   awful.button( { modkey }, right_button, awful.mouse.client.resize) ) --    root.keys(globalkeys) ---------------------------------- ---   --- ---------------------------------- awful.rules.rules = { { --      rule = { }, properties = { border_width = beautiful.border_width, --     border_color = beautiful.border_normal, --       focus = awful.client.focus.filter, --     :( keys = clientkeys, --   buttons = clientbuttons} --   }, --{ rule = { class = "MPlayer" }, -- properties = { floating = true } }, --{ rule = { class = "pinentry" }, -- properties = { floating = true } }, --{ rule = { class = "Gimp" }, -- properties = { floating = true } }, -- Set Firefox to always map on tags number 5 of screen 1. --{ rule = { class = "Firefox" }, -- properties = { tag = tags[1][5] } } -- "":     { rule = { class = "Conky"}, properties = { border_width = 0, floating = true } }, { rule = { instance = "Pidgin" }, properties = { tag = tags[1][4], floating = false, maximized_horizontal = false, maximized_vertical = false } }, { rule = { instance = "Skype" }, properties = { floating = true, maximized_horizontal = false, maximized_vertical = false } } } -------------------- ---  --- -------------------- 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, -- ie 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 end) --     client.connect_signal("focus", function(c) --    c.border_color = beautiful.border_focus --    --      local left_layout = wibox.layout.fixed.horizontal() left_layout:add(awful.titlebar.widget.iconwidget(c)) --       local right_layout = wibox.layout.fixed.horizontal() --right_layout:add(kbdcfg.widget) right_layout:add(awful.titlebar.widget.maximizedbutton(c)) right_layout:add(awful.titlebar.widget.closebutton(c)) --   local middle_layout = wibox.layout.flex.horizontal() local title = awful.titlebar.widget.titlewidget(c) title:set_align("center") middle_layout:add(title) --      local layout = wibox.layout.align.horizontal() layout:set_left(left_layout) layout:set_right(right_layout) layout:set_middle(middle_layout) --      awful.titlebar(c):set_widget(layout) --     awful.titlebar(c, {size = 18}) end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal awful.titlebar(c, {size = 18}) end) 



Switch layouts.



I’ll say right away that xkbcomp should be rolled back to version 1.2.3, since there is a bug in 1.2.4 (when switching layouts, the mouse buttons do not work)

About the layout in general, you can add an implementation like this in the gentoo wiki is written, but then we will not have hotkeys working (for system keys, we specified key codes, so this is not a problem for us), but such as ctrl + C, etc. . will not work.

in the new versions of Xorg, the servers removed xorg.conf, now the configuration is in a different place. Create a directory
sudo mkdir /etc/X11/xorg.conf.d

And in it we will create 2 files, 01-keyboard-layout.conf and 01-enable-pointerkeys.conf
In the first:
 Section "InputClass" Identifier "keyboard-layout" MatchIsKeyboard "on" Option "XkbLayout" "us,ru" Option "XkbOptions" "grp:ctrl_shift_toggle,terminate:ctrl_alt_bksp EndSection 

Restart the X server with ctrl + alt + backspace and change the layout using ctrl + shift

After changing the layout, the mouse buttons are disabled by default; therefore, we’ll write them in the second one (with the xkbcomp-1.2.4 version, this does not work):
 Section "InputClass" Identifier "Keyboard Defaults" MatchIsKeyboard "yes" Option "XkbOptions" "keypad:pointerkeys" EndSection 


Now let's make our urxvt pleasing to our eyes, for this we edit the ~ / .Xdefaults file (again, if we don’t have it, feel free to create it)
My ~ / .Xdefaults
 !darkgray *background: #212121 !silver *foreground: #C0C0C0 !black *color0: #251f1f *color8: #5e5e5e !red *color1: #eb4509 *color9: #eb4509 !green *color2: #94e76b *color10: #95e76b !yellow *color3: #ffac18 *color11: #ffac18 !blue *color4: #46aede *color12: #46aede !magenta *color5: #e32c57 *color13: #e32c57 !cyan *color6: #d6dbac *color14: #d6dbac !white *color7: #efefef *color15: #efefef !save 5000 lines URxvt*saveLines: 5000 !left button URxvt.matcher.button: 1 !default brauser google chrome URxvt.urlLauncher: google-chrome-stable !underline links URxvt.underlineURLs: true ! URxvt.keysym.Mu: perl:url-select:select_next !disabled button 'new tab' URxvt.tabbed.new-button:no !? URxvt.tabbed.tabbar-fg: 15 !? URxvt.tabbed.tabbar-bg: 8 !? URxvt.tabbed.tab-fg: 8 !? URxvt.tabbed.tab-bg: 14 Rxvt.font: -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1 URxvt.boldFont: -misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1 !disable scrollbar URxvt*scrollBar: false 



As a result, we get a pleasant color scheme for our terminal.

As a result, we get just such a pleasant and very convenient system:




Of course, I have not reached such a level as unlogic and my config can still be improved to infinity, but I got a convenient and workable system.

PS In emacs I have a monokai color scheme.
PPS I hope I did not forget to describe.

Source: https://habr.com/ru/post/214471/


All Articles