diff --git a/.Xresources b/.Xresources index 10e754d..3bdb6cb 100644 --- a/.Xresources +++ b/.Xresources @@ -6,8 +6,8 @@ ! ╚═╝░░╚═╝╚═╝░░╚═╝╚══════╝╚══════╝░╚═════╝░░╚═════╝░╚═╝░░╚═╝░╚═════╝╚══════╝╚══════╝ ! ! ----------------------------------- -!Xft.dpi: 102 -Xft.dpi: 96 +Xft.dpi: 102 +!Xft.dpi: 96 Xft.antialias: true Xft.hinting: true Xft.rgba: rgb @@ -23,24 +23,22 @@ URxvt.scrollBar: off URxvt.font: xft:monospace:size=12 URxvt.internalBorder: 22 ! ================= - -*background: #1E2541 -*foreground: #EEFFFF -*cursorColor: #EEFFFF -*color0: #1E2541 -*color1: #F0719B -*color2: #5AF7B0 -*color3: #FFA56B -*color4: #57C7FF -*color5: #C792EA -*color6: #89DDFF -*color7: #EEFFFF -*color8: #354274 -*color9: #F02E6E -*color10: #2CE592 -*color11: #FF8537 -*color12: #1DA0E2 -*color13: #A742EA -*color14: #47BAE8 -*color15: #DEE6E7 -*color16: #2A335A +*background: #1D1F28 +*foreground: #FDFDFD +*cursorColor: #C574DD +*color0: #282A36 +*color1: #F37F97 +*color2: #5ADECD +*color3: #F2A272 +*color4: #8897F4 +*color5: #C574DD +*color6: #79E6F3 +*color7: #FDFDFD +*color8: #414458 +*color9: #FF4971 +*color10: #18E3C8 +*color11: #FF8037 +*color12: #556FFF +*color13: #B043D1 +*color14: #3FDCEE +*color15: #BEBEC1 diff --git a/README.md b/README.md index 5fb466f..8d7a4c1 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,120 @@ # dotfiles +## Some details ++ **OS**: Ubuntu 16.04 ++ **WM**: Awesome ++ **Terminal**: Termite ++ **File Manager**: Nemo for GUI, Ranger for terminal ++ **Launcher**: Rofi ++ **Editors**: Spacemacs and Vim ++ **Browsers**: Firefox and Qutebrowser -OS: Ubuntu 16.04 + + -WM: awesome +## Tips / Notes ++ You can open an issue if you have any questions / problems. ++ Are you new to AwesomeWM? -![Alt text](./screenshot.png?raw=true "Current desktop") + Then I suggest you start from the default configuration and add pieces you like to it instead of trying to modify someone else's configuration even if you feel really comfortable with that specific config. + Otherwise you will have no idea how anything works and how you can modify things to your own liking. Trust me, I've been there. ++ Don't forget to use the [API Documentation for AwesomeWM](https://awesomewm.org/apidoc/index.html). + + It is well written and has plenty of examples. + +### File structure ++ I have split my `rc.lua` into multiple files for organization purposes. ++ The `noodle` directory contains widgets that usually take up more than 50 lines of code. + I prefer not filling my `bars.lua` with a ton of widget configurations, but also not making a seperate file for every widget. + ++ In `themes` you can find a directory for each available theme. + + Such a directory should include at least a `theme.lua` and optionally icons, wallpaper, and whatever asset you need that is theme-specific. + +### Things to do before trying out these dotfiles ++ Configure default applications + + In `rc.lua` there is a section where default applications such as terminal, editor and file manager are defined. + You should change those to your liking. + ++ Configure autostart applications in `autostart.sh` + ++ Install rofi + + I use rofi extensively for window switching and launching stuff. + ++ Install a Nerd Font + + [Nerd Fonts](https://nerdfonts.com/#downloads) are monospace fonts with a ton of icons included. + I use them quite a lot in my bars as icons. + ++ Have a general idea of what my keybinds do + + My keybinds will most probably not suit you, but on your first login you might need to know how to navigate the desktop. + + See the next section for more details. + +### Basic keybinds + +I use `super` AKA Windows key as my main modifier. + +#### Keyboard ++ `super + enter` - Spawn terminal ++ `super + shift + enter` - Spawn floating terminal ++ `super + d` - Launch rofi ++ `super + shift + q` - Close client ++ `super + control + space` - Toggle floating client ++ `super + [1-0]` - View tag AKA change workspace (for you i3 folks) ++ `super + shift + [1-0]` - Move focused client to tag ++ `super + s` - Tiling layout ++ `super + shift + s` - Floating layout ++ `super + w` - Maximized / Monocle layout ++ `super + [arrow keys]` - Change focus by direction ++ `super + j/k` - Cycle through clients ++ `super + h/l` - Add / remove clients to / from master area ++ `super + shift + [arrow keys] / [hjkl]` - Move client by direction. Move to edge if it is floating. ++ `super + control + [arrow keys] / [hjkl]` - Resize ++ `super + f` - Toggle fullscreen ++ `super + m` - Toggle maximize ++ `super + n` - Minimize ++ `super + shift + n` - Restore minimized ++ `super + c` - Center floating client ++ `super + u` - Jump to urgent client (or back to last tag if there is no such client) ++ `super + shift + b` - Toggle bar ++ `super + =` - Toggle tray ++ ... And many many more. + +#### Mouse on desktop ++ `right click` - Main menu ++ `middle click` - Sidebar ++ `scroll up/down` - Cycle through tags ++ `double left click` - Jump to urgent client (or back to last tag if there is no such client) ++ ... And more. + +### More details about the sidebar ++ Can be toggled with `super+grave`, middle clicking anywhere on the desktop, or clicking the left icon on the bottom bar. ++ Can be activated by moving the mouse to the edge of the screen and hidden by moving the mouse out of it (these settings can be easily enabled/disabled in your `theme.lua`. ++ By default it is always above windows, and does not grab your keyboard (so you can have it open while doing something else, or just toggle it for a second to check your battery while you are watching something in fullscreen) ++ Most widgets (volume, search, exit, music...) are clickable. ++ Volume and music update only when they need to, as they are subscribed to pulse and mpd events respectively. ++ For the weather widget I modified this [polybar custom script](https://github.com/x70b1/polybar-scripts/tree/master/polybar-scripts/openweathermap-simple). It uses the [openweathermap API](https://openweathermap.org/api). If you want this to work, you will need to create an account there, get your key, look for your city ID, and place them in `noodle/weather.lua`. + +### More details about the exit screen ++ Activate it with `super+escape`, by clicking Exit on the sidebar, or in the right click menu (awesome -> quit) ++ Mouse controls: Click on any icon to execute the command, `right click` or `middle click` anywhere to cancel. ++ Keyboard controls: + + `escape` or `q` or `x` to cancel + + `p` to poweroff + + `r` to reboot + + `s` to suspend + + `e` to exit (logout) + + `l` to lock + +## Theme previews +### Manta +![Alt text](./previews/manta.png?raw=true "manta theme") + +### Reasons +![Alt text](./previews/reasons.png?raw=true "reasons theme") diff --git a/config/awesome/autostart.sh b/config/awesome/autostart.sh index d46f390..0516230 100755 --- a/config/awesome/autostart.sh +++ b/config/awesome/autostart.sh @@ -7,12 +7,18 @@ # TODO: run_once function run { - if ! pgrep $1 ; + if ! pgrep $1 > /dev/null ; then $@& fi } +# Music +run mpd ~/.config/mpd/mpd.conf + +# Emacs daemon +#run emacs --daemon + # Load terminal colorscheme and settings #xrdb ~/.Xresources @@ -20,10 +26,7 @@ function run { #run urxvtd -q -o -f # Mpv input file -mkfifo /tmp/mpv.fifo - -# Volume notification daemon -#run volume-daemon +#mkfifo /tmp/mpv.fifo # For desktop effects run compton --config ~/.config/compton/compton.conf @@ -32,20 +35,29 @@ run compton --config ~/.config/compton/compton.conf run numlockx # For battery notifications -run xfce4-power-manager +# run xfce4-power-manager # Network manager tray icon run nm-applet # Keyboard -setxkbmap -layout "us,gr" -option "grp:alt_shift_toggle" +#setxkbmap -layout "us,gr" -option "grp:alt_shift_toggle" #setxkbmap -layout "us,gr,ru" -option "grp:alt_shift_toggle" -# Kill redshift processes -#pkill redshift +# Caps Lock is Escape (Escape remains as is) +# setxkbmap -option caps:escape -# Music -run mpd ~/.config/mpd/mpd.conf +# Kill redshift processes +# pkill redshift # Scratchpad #scratchpad + +# Update battery status and send signals +CHARGING="$(udevadm info --path=/sys/class/power_supply/BAT0 | grep POWER_SUPPLY_STATUS | grep Charging)" +if [ ${#CHARGING} -eq "0" ]; then + AWESOME_SIGNAL="charger_unplugged" +else + AWESOME_SIGNAL="charger_plugged" +fi +awesome-client "awesome.emit_signal(\"$AWESOME_SIGNAL\")" diff --git a/config/awesome/bars.lua b/config/awesome/bars.lua index 55a8a72..07e586c 100644 --- a/config/awesome/bars.lua +++ b/config/awesome/bars.lua @@ -9,120 +9,51 @@ local helpers = require("helpers") local keys = require("keys") -- {{{ Widgets -local desktop_mode_widget = require("noodle.desktop_mode_widget") +local desktop_control = require("noodle.desktop_control") local minimal_tasklist = require("noodle.minimal_tasklist") +local icon_taglist = require("noodle.icon_taglist") --- Volume widget prefix -volumebar_prefix = wibox.widget.textbox(" ") -volumebar_prefix.markup = helpers.colorize_text(volumebar_prefix.text, beautiful.prefix_fg) - --- Keyboard map indicator and switcher -keyboardlayout_prefix = wibox.widget.textbox(" ") -keyboardlayout_prefix.markup = helpers.colorize_text(keyboardlayout_prefix.text, beautiful.prefix_fg) -mykeyboardlayout = awful.widget.keyboardlayout() - --- Create a textclock widget that shows date -date_prefix = wibox.widget.textbox(" ") -date_prefix.markup = helpers.colorize_text(date_prefix.text, beautiful.prefix_fg) ---mytextdate = wibox.widget.textclock("%a %d %B") -mytextdate = wibox.widget.textclock("%j days around the sun") --HAHA very useful --- Create a textclock widget -clock_prefix = wibox.widget.textbox(" ") -clock_prefix.markup = helpers.colorize_text(clock_prefix.text, beautiful.prefix_fg) -mytextclock = wibox.widget.textclock("%H:%M") +-- Start button widget (can toggle sidebar, tray, scratchpad) +start_widget = wibox.widget.imagebox(beautiful.sidebar_icon) +start_widget:buttons(gears.table.join( + -- Left click - Toggle sidebar + awful.button({ }, 1, function () + sidebar.visible = not sidebar.visible + end), + -- Middle click - Toggle scratchpad + awful.button({ }, 2, function () + if client.focus ~= nil and client.focus.class == "scratchpad" then + client.focus.minimized = true + return + end + local matcher = function (c) + return awful.rules.match(c, {class = 'scratchpad'}) + end + awful.client.run_or_raise( "scratchpad" , matcher) + end), + -- Right click - Toggle tray + awful.button({ }, 3, function () + awful.screen.focused().traybox.visible = not awful.screen.focused().traybox.visible + end) +)) -- Create item separator textseparator = wibox.widget.textbox() textseparator.text = beautiful.separator_text +textseparator.font = "hurmit nerd font bold 14" textseparator.markup = helpers.colorize_text(textseparator.text, beautiful.separator_fg) -- Create padding pad = wibox.widget.textbox(" ") --- Create a wibox for each screen and add it -local taglist_buttons = gears.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.viewprev(t.screen) end), - awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end) - ) - -local tasklist_buttons = gears.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), - -- Middle mouse button closes the window - awful.button({ }, 2, function (c) c:kill() end), - awful.button({ }, 3, helpers.client_menu_toggle()), - awful.button({ }, 4, function () - awful.client.focus.byidx(-1) - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(1) - end) -) --- }}} - awful.screen.connect_for_each_screen(function(s) - -- Create a promptbox for each screen - s.mypromptbox = awful.widget.prompt({prompt = " Run: ", fg = beautiful.prompt_fg}) - -- Create an imagebox widget which will contain an icon indicating which layout we're using. - -- We need one layoutbox per screen. - s.mylayoutbox = awful.widget.layoutbox(s) - s.mylayoutbox:buttons(gears.table.join( - awful.button({ }, 1, function () awful.layout.inc( 1) end), - awful.button({ }, 3, function () awful.layout.inc(-1) end), - awful.button({ }, 4, function () awful.layout.inc( 1) end), - awful.button({ }, 5, function () awful.layout.inc(-1) end))) - -- Create a taglist widget - s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons) - s.mytaglist.font = beautiful.font - - -- Create a tasklist widget - -- Show all clients - --s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons) - -- Show only focused client - --s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.focused, tasklist_buttons) - -- Show only minimized clients - --s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.minimizedcurrenttags, tasklist_buttons) - - -- Outer gaps - --awful.screen.padding(awful.screen.focused(),{left = 28, right = 28, top = 28, bottom = 28}) - -- Create a system tray widget s.systray = wibox.widget.systray() - s.systray.visible = false -- can be toggled by a keybind -- Wibar detached - Method: Transparent useless bar -- Requires compositor if beautiful.wibar_detached then s.useless_wibar = awful.wibar({ position = beautiful.wibar_position, screen = s, height = beautiful.screen_margin * 2, opacity = 0 }) - --TODO - --s.useless_wibar:buttons(keys.desktopbuttons) end -- Create the wibox s.mywibox = awful.wibar({ position = beautiful.wibar_position, screen = s, width = beautiful.wibar_width, height = beautiful.wibar_height, shape = helpers.rrect(beautiful.wibar_border_radius)}) @@ -132,101 +63,23 @@ awful.screen.connect_for_each_screen(function(s) layout = wibox.layout.align.horizontal, { -- Left widgets layout = wibox.layout.fixed.horizontal, - --s.mylayoutbox, - --mylauncher, - s.mytaglist, - textseparator, - minimal_tasklist + pad, + start_widget + -- minimal_tasklist }, { -- Middle widgets layout = wibox.layout.fixed.horizontal, - --s.mypromptbox, - --textseparator, - --s.mytasklist, - --minimal_tasklist + -- textseparator, + textseparator, + icon_taglist, }, { -- Right widgets layout = wibox.layout.fixed.horizontal, - --mpdarc_widget, - --textseparator, - --volumebar_prefix, - --volumebar_widget, - --textseparator, - --keyboardlayout_prefix, - --mykeyboardlayout, - --textseparator, - s.systray, - --minimal_tasklist, textseparator, - --date_prefix, - mytextdate, - textseparator, - --clock_prefix, - mytextclock, - textseparator, - desktop_mode_widget, - pad, + desktop_control, pad }, } - - -- Second (alternate panel) - if beautiful.wibar_alt_enabled then - if beautiful.wibar_alt_detached then - s.useless_wibar_alt = awful.wibar({ position = beautiful.wibar_alt_position, screen = s, height = beautiful.screen_margin * 2, opacity = 0 }) - s.useless_wibar_alt:buttons(gears.table.join( - --TODO - --keys.desktopbuttons - )) - end - s.mywibox_alt = awful.wibox({ position = beautiful.wibar_alt_position, screen = s, width = beautiful.wibar_alt_width, height = beautiful.wibar_alt_height, shape = helpers.rrect(beautiful.wibar_alt_border_radius)}) - -- Only set them if they exist, else they overwrite the position variable - if beautiful.wibar_alt_x then - s.mywibox_alt.x = beautiful.wibar_alt_x - end - if beautiful.wibar_alt_y then - s.mywibox_alt.y = beautiful.wibar_alt_y - end - -- Second wibar items - -- Add or remove widgets here - s.mywibox_alt:setup { - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - --pad, - --s.mylayoutbox, - --mylauncher, - }, - { -- Middle widgets - layout = wibox.layout.fixed.horizontal, - --s.mypromptbox, - --s.mytasklist, - --textseparator, - }, - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - --mpdarc_widget, - --textseparator, - --volumebar_prefix, - --volumebar_widget, - --textseparator, - --keyboardlayout_prefix, - --mykeyboardlayout, - --textseparator, - s.systray, - minimal_tasklist, - textseparator, - date_prefix, - mytextdate, - textseparator, - clock_prefix, - mytextclock, - textseparator, - desktop_mode_widget, - pad - }, - } - end -- Only set them if they exist, else they overwrite the position variable if beautiful.wibar_x then @@ -236,5 +89,27 @@ awful.screen.connect_for_each_screen(function(s) s.mywibox.y = beautiful.wibar_y end + -- Create a wibox that will only show the tray + -- Hidden by default. Can be toggled with a keybind. + s.traybox = wibox({visible = false, ontop = true, shape = helpers.rbar(), type = "dock"}) + s.traybox.width = 150 + s.traybox.height = 30 + s.traybox.x = beautiful.screen_margin * 2 + -- s.traybox.x = s.geometry.width - s.traybox.width - beautiful.screen_margin * 2 + s.traybox.y = s.geometry.height - s.traybox.height - beautiful.screen_margin * 2 + s.traybox.bg = beautiful.bg_systray + s.traybox:setup { + -- wibox.widget.textbox("test"), + pad, + s.systray, + pad, + layout = wibox.layout.align.horizontal + } + s.traybox:buttons(gears.table.join( + -- Middle click - Hide traybox + awful.button({ }, 2, function () + s.traybox.visible = false + end) + )) end) diff --git a/config/awesome/helpers.lua b/config/awesome/helpers.lua index 106d9de..8f3f3bd 100644 --- a/config/awesome/helpers.lua +++ b/config/awesome/helpers.lua @@ -8,13 +8,24 @@ local helpers = {} -- Create rounded rectangle shape helpers.rrect = function(radius) return function(cr, width, height) - --gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 12) gears.shape.rounded_rect(cr, width, height, radius) --gears.shape.octogon(cr, width, height, radius) --gears.shape.rounded_bar(cr, width, height) end end +helpers.rbar = function() + return function(cr, width, height) + gears.shape.rounded_bar(cr, width, height) + end +end + +helpers.prrect = function(radius, tl, tr, br, bl) + return function(cr, width, height) + gears.shape.partially_rounded_rect(cr, width, height, tl, tr, br, bl, radius) + end +end + -- Create info bubble shape -- TODO helpers.infobubble = function(radius) @@ -88,4 +99,24 @@ function helpers.create_titlebar(c, titlebar_buttons, titlebar_position, titleba } end + +local double_tap_timer = nil +function helpers.single_double_tap(single_tap_function, double_tap_function) + if double_tap_timer then + double_tap_timer:stop() + double_tap_timer = nil + double_tap_function() + -- naughty.notify({text = "We got a double tap"}) + return + end + + double_tap_timer = + gears.timer.start_new(0.20, function() + double_tap_timer = nil + -- naughty.notify({text = "We got a single tap"}) + single_tap_function() + return false + end) +end + return helpers diff --git a/config/awesome/keys.lua b/config/awesome/keys.lua index defb914..de49ea0 100644 --- a/config/awesome/keys.lua +++ b/config/awesome/keys.lua @@ -9,136 +9,135 @@ local helpers = require("helpers") local keys = {} -- Mod keys -modkey = "Mod4" +superkey = "Mod4" altkey = "Mod1" ctrlkey = "Control" shiftkey = "Shift" --- {{{ Mouse bindings +-- {{{ Mouse bindings on desktop keys.desktopbuttons = gears.table.join( - awful.button({ }, 1, function () + awful.button({ }, 1, function () mymainmenu:hide() - uc = awful.client.urgent.get() - -- If there is no urgent client, go back to last tag - if uc == nil then + sidebar.visible = false + naughty.destroy_all_notifications() + + local function double_tap() + uc = awful.client.urgent.get() + -- If there is no urgent client, go back to last tag + if uc == nil then awful.tag.history.restore() - else + else awful.client.urgent.jumpto() + end end + helpers.single_double_tap(nil, double_tap) end), awful.button({ }, 3, function () mymainmenu:toggle() end), - -- Side buttons - Minimize and restore minimized client - awful.button({ }, 8, function() - if client.focus ~= nil then - client.focus.minimized = true - end + -- Middle button - Toggle sidebar + awful.button({ }, 2, function () + sidebar.visible = not sidebar.visible end), - awful.button({ }, 9, function() - local c = awful.client.restore() - -- Focus restored client - if c then - client.focus = c - c:raise() - end - end), - - -- Middle click and scrolling - Control volume - awful.button({ }, 2, function () awful.spawn.with_shell("volume-control.sh toggle") end), - awful.button({ }, 4, function () awful.spawn.with_shell("volume-control.sh up") end), - awful.button({ }, 5, function () awful.spawn.with_shell("volume-control.sh down") end) - -- Switch tags with sidebuttons - --awful.button({ }, 8, awful.tag.viewprev), - --awful.button({ }, 9, awful.tag.viewnext) + -- Scrolling - Switch tags + awful.button({ }, 4, awful.tag.viewprev), + awful.button({ }, 5, awful.tag.viewnext), + + -- Side buttons - Control volume + awful.button({ }, 9, function () awful.spawn.with_shell("volume-control.sh up") end), + awful.button({ }, 8, function () awful.spawn.with_shell("volume-control.sh down") end) + + -- Side buttons - Minimize and restore minimized client + -- awful.button({ }, 8, function() + -- if client.focus ~= nil then + -- client.focus.minimized = true + -- end + -- end), + -- awful.button({ }, 9, function() + -- local c = awful.client.restore() + -- -- Focus restored client + -- if c then + -- client.focus = c + -- c:raise() + -- end + -- end) ) -- }}} -- {{{ Key bindings keys.globalkeys = gears.table.join( - --awful.key({ modkey, }, "s", hotkeys_popup.show_help, + --awful.key({ superkey, }, "s", hotkeys_popup.show_help, --{description="show help", group="awesome"}), - --awful.key({ modkey, }, "comma", awful.tag.viewprev, + --awful.key({ superkey, }, "comma", awful.tag.viewprev, --{description = "view previous", group = "tag"}), - --awful.key({ modkey, }, "period", awful.tag.viewnext, + --awful.key({ superkey, }, "period", awful.tag.viewnext, --{description = "view next", group = "tag"}), -- Focus client by direction - awful.key({ modkey }, "Down", + awful.key({ superkey }, "Down", function() awful.client.focus.bydirection("down") if client.focus then client.focus:raise() end end, {description = "focus down", group = "client"}), - awful.key({ modkey }, "Up", + awful.key({ superkey }, "Up", function() awful.client.focus.bydirection("up") if client.focus then client.focus:raise() end end, {description = "focus up", group = "client"}), - awful.key({ modkey }, "Left", + awful.key({ superkey }, "Left", function() awful.client.focus.bydirection("left") if client.focus then client.focus:raise() end end, {description = "focus left", group = "client"}), - awful.key({ modkey }, "Right", - function() - awful.client.focus.bydirection("right") - if client.focus then client.focus:raise() end - end, - {description = "focus right", group = "client"}), - awful.key({ modkey, altkey }, "j", - function() - awful.client.focus.bydirection("down") - if client.focus then client.focus:raise() end - end, - {description = "focus down", group = "client"}), - awful.key({ modkey, altkey }, "k", - function() - awful.client.focus.bydirection("up") - if client.focus then client.focus:raise() end - end, - {description = "focus up", group = "client"}), - awful.key({ modkey, altkey }, "h", - function() - awful.client.focus.bydirection("left") - if client.focus then client.focus:raise() end - end, - {description = "focus left", group = "client"}), - awful.key({ modkey, altkey }, "l", + awful.key({ superkey }, "Right", function() awful.client.focus.bydirection("right") if client.focus then client.focus:raise() end end, {description = "focus right", group = "client"}), -- Focus client by index (cycle through clients) - awful.key({ modkey }, "j", + awful.key({ superkey }, "j", function () awful.client.focus.byidx( 1) end, {description = "focus next by index", group = "client"} ), - awful.key({ modkey }, "k", + awful.key({ superkey }, "k", function () awful.client.focus.byidx(-1) end, {description = "focus previous by index", group = "client"} ), - awful.key({ modkey, }, "g", + -- Focus client by index (cycle through clients) + awful.key({ superkey }, "z", + function () + awful.client.focus.byidx( 1) + end, + {description = "focus next by index", group = "client"} + ), + awful.key({ superkey, shiftkey }, "z", + function () + awful.client.focus.byidx(-1) + end, + {description = "focus previous by index", group = "client"} + ), + awful.key({ superkey, shiftkey }, "minus", function () awful.tag.incgap(5, nil) end, {description = "increment gaps size for the current tag", group = "gaps"} ), - awful.key({ modkey, shiftkey }, "g", + awful.key({ superkey }, "minus", function () awful.tag.incgap(-5, nil) end, {description = "decrement gap size for the current tag", group = "gaps"} ), - -- Kill all visible clients - awful.key({ modkey, altkey }, "q", + -- Kill all visible clients for the current tag + awful.key({ superkey, altkey }, "q", function () local clients = awful.screen.focused().clients for _, c in pairs(clients) do @@ -148,13 +147,18 @@ keys.globalkeys = gears.table.join( {description = "kill all visible clients for the current tag", group = "gaps"} ), -- Main menu - --awful.key({ modkey, }, "w", function () mymainmenu:show() end, - --{description = "show main menu", group = "awesome"}), - awful.key({ modkey, }, "Escape", awful.tag.history.restore, - {description = "go back", group = "tag"}), + awful.key({ superkey, shiftkey }, "v", function () mymainmenu:show() end, + {description = "show main menu", group = "awesome"}), + + -- Logout, Shutdown, Restart, Suspend, Lock + awful.key({ superkey, }, "Escape", + function () + exit_screen_show() + end, + {description = "exit", group = "awesome"}), -- Layout manipulation - awful.key({ modkey, shiftkey }, "j", function () + awful.key({ superkey, shiftkey }, "j", function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: move client to edge @@ -169,7 +173,19 @@ keys.globalkeys = gears.table.join( end, --{description = "swap with next client by index", group = "client"}), {description = "swap with direction down", group = "client"}), - awful.key({ modkey, shiftkey }, "k", function () + awful.key({ superkey, shiftkey }, "Down", function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: move client to edge + if c ~= nil and (current_layout == "floating" or c.floating) then + helpers.move_to_edge(c, "down") + else + awful.client.swap.bydirection("down", c, nil) + + end + end, + {description = "swap with direction down", group = "client"}), + awful.key({ superkey, shiftkey }, "k", function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: move client to edge @@ -182,12 +198,25 @@ keys.globalkeys = gears.table.join( end end, {description = "swap with direction up", group = "client"}), + awful.key({ superkey, shiftkey }, "Up", function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: move client to edge + if c ~= nil and (current_layout == "floating" or c.floating) then + --c:relative_move( 0, -40, 0, 0) + helpers.move_to_edge(c, "up") + else + --awful.client.swap.byidx( -1) + awful.client.swap.bydirection("up", c, nil) + end + end, + {description = "swap with direction up", group = "client"}), -- No need for these (single screen setup) - --awful.key({ modkey, ctrlkey }, "j", function () awful.screen.focus_relative( 1) end, + --awful.key({ superkey, ctrlkey }, "j", function () awful.screen.focus_relative( 1) end, --{description = "focus the next screen", group = "screen"}), - --awful.key({ modkey, ctrlkey }, "k", function () awful.screen.focus_relative(-1) end, + --awful.key({ superkey, ctrlkey }, "k", function () awful.screen.focus_relative(-1) end, --{description = "focus the previous screen", group = "screen"}), - awful.key({ modkey, }, "u", + awful.key({ superkey, }, "u", function () uc = awful.client.urgent.get() -- If there is no urgent client, go back to last tag @@ -198,34 +227,27 @@ keys.globalkeys = gears.table.join( end end, {description = "jump to urgent client", group = "client"}), - awful.key({ modkey }, "Tab", function() awful.spawn.with_shell("~/scr/Rofi/rofi_combi") end, - {description = "window switcher", group = "launcher"}), - --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({ superkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + {description = "go back", group = "client"}), -- Standard program - awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end, + awful.key({ superkey, }, "Return", function () awful.spawn(terminal) end, {description = "open a terminal", group = "launcher"}), - awful.key({ modkey, }, "t", function () awful.spawn(tmux) end, - {description = "open a terminal with tmux", group = "launcher"}), - -- Spawn floating terminal (see awful.rules below) - awful.key({ modkey, shiftkey }, "Return", function() - awful.spawn(floating_terminal) + -- Spawn floating terminal + awful.key({ superkey, shiftkey }, "Return", function() + awful.spawn(terminal, {floating = true}) end, {description = "spawn floating terminal", group = "launcher"}), - awful.key({ modkey, shiftkey }, "t", function() awful.spawn(floating_tmux) end, - {description = "spawn floating terminal with tmux", group = "launcher"}), - awful.key({ modkey, shiftkey }, "r", awesome.restart, + awful.key({ superkey, shiftkey }, "r", awesome.restart, {description = "reload awesome", group = "awesome"}), - awful.key({ modkey, shiftkey }, "x", awesome.quit, + awful.key({ superkey, shiftkey }, "x", awesome.quit, {description = "quit awesome", group = "awesome"}), - awful.key({ modkey, ctrlkey }, "h", function () + awful.key({ superkey, ctrlkey }, "h", function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: resize client @@ -236,7 +258,18 @@ keys.globalkeys = gears.table.join( end end, {description = "decrease master width factor", group = "layout"}), - awful.key({ modkey, ctrlkey }, "l", function () + awful.key({ superkey, ctrlkey }, "Left", function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: resize client + if current_layout == "floating" or c.floating == true then + c:relative_move( 0, 0, -20, 0) + else + awful.tag.incmwfact(-0.05) + end + end, + {description = "decrease master width factor", group = "layout"}), + awful.key({ superkey, ctrlkey }, "l", function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: resize client @@ -247,8 +280,32 @@ keys.globalkeys = gears.table.join( end end, {description = "increase master width factor", group = "layout"}), - awful.key({ modkey, shiftkey }, "h", - function () + awful.key({ superkey, ctrlkey }, "Right", function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: resize client + if current_layout == "floating" or c.floating == true then + c:relative_move( 0, 0, 20, 0) + else + awful.tag.incmwfact( 0.05) + end + end, + {description = "increase master width factor", group = "layout"}), + awful.key({ superkey, shiftkey }, "h", + function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: move client to edge + if c ~= nil and (current_layout == "floating" or c.floating) then + --c:relative_move( -40, 0, 0, 0) + helpers.move_to_edge(c, "left") + else + awful.client.swap.bydirection("left", c, nil) + end + end, + {description = "swap with direction left", group = "client"}), + awful.key({ superkey, shiftkey }, "Left", + function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: move client to edge @@ -260,8 +317,8 @@ keys.globalkeys = gears.table.join( end end, {description = "swap with direction left", group = "client"}), - awful.key({ modkey, shiftkey }, "l", - function () + awful.key({ superkey, shiftkey }, "l", + function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: move client to edge @@ -273,43 +330,77 @@ keys.globalkeys = gears.table.join( end end, {description = "swap with direction right", group = "client"}), - awful.key({ modkey }, "h", + awful.key({ superkey, shiftkey }, "Right", + function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: move client to edge + if c ~= nil and (current_layout == "floating" or c.floating) then + --c:relative_move( 40, 0, 0, 0) + helpers.move_to_edge(c, "right") + else + awful.client.swap.bydirection("right", c, nil) + end + end, + {description = "swap with direction right", group = "client"}), + awful.key({ superkey }, "h", function () awful.tag.incnmaster( 1, nil, true) end, {description = "increase the number of master clients", group = "layout"}), - awful.key({ modkey }, "l", + awful.key({ superkey }, "l", function () awful.tag.incnmaster(-1, nil, true) end, {description = "decrease the number of master clients", group = "layout"}), - awful.key({ modkey, shiftkey, ctrlkey }, "h", function () + awful.key({ superkey, shiftkey, ctrlkey }, "h", function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: move client + if c ~= nil and (current_layout == "floating" or c.floating) then + c:relative_move( -20, 0, 0, 0) + else + awful.tag.incncol( 1, nil, true) + end + end, + {description = "increase the number of columns", group = "layout"}), + awful.key({ superkey, shiftkey, ctrlkey }, "Left", function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: move client if c ~= nil and (current_layout == "floating" or c.floating) then c:relative_move( -20, 0, 0, 0) else - awful.tag.incncol( 1, nil, true) + awful.tag.incncol( 1, nil, true) end end, {description = "increase the number of columns", group = "layout"}), - awful.key({ modkey, shiftkey, ctrlkey }, "l", function () + awful.key({ superkey, shiftkey, ctrlkey }, "l", function () + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + local c = client.focus + -- Floating: move client + if c ~= nil and (current_layout == "floating" or c.floating) then + c:relative_move( 20, 0, 0, 0) + else + awful.tag.incncol(-1, nil, true) + end + end), + awful.key({ superkey, shiftkey, ctrlkey }, "Right", function () local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) local c = client.focus -- Floating: move client if c ~= nil and (current_layout == "floating" or c.floating) then c:relative_move( 20, 0, 0, 0) else - awful.tag.incncol(-1, nil, true) + awful.tag.incncol(-1, nil, true) end end), - --awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, + --awful.key({ superkey, }, "space", function () awful.layout.inc( 1) end, --{description = "select next", group = "layout"}), - --awful.key({ modkey, shiftkey }, "space", function () awful.layout.inc(-1) end, + --awful.key({ superkey, shiftkey }, "space", function () awful.layout.inc(-1) end, --{description = "select previous", group = "layout"}), - awful.key({ modkey, shiftkey }, "n", + awful.key({ superkey, shiftkey }, "n", function () local c = awful.client.restore() -- Focus restored client @@ -319,35 +410,17 @@ keys.globalkeys = gears.table.join( end end, {description = "restore minimized", group = "client"}), - - -- Prompt -- Run program (d for dmenu ;) - --awful.key({ modkey }, "d", function () awful.screen.focused().mypromptbox:run() end, - --{description = "run prompt", group = "launcher"}), - awful.key({ modkey }, "d", function() awful.spawn.with_shell("~/scr/Rofi/rofi_launch") end, - {description = "rofi launcher", group = "launcher"}), - - -- Run lua code - --awful.key({ modkey }, "r", - --function () - --awful.prompt.run { - --prompt = " Lua: ", - --textbox = awful.screen.focused().mypromptbox.widget, - --exe_callback = awful.util.eval, - --history_path = awful.util.get_cache_dir() .. "/history_eval" - --} - --end, - --{description = "lua execute prompt", group = "awesome"}), - + awful.key({ superkey }, "d", + function() + awful.spawn.with_shell("rofi -show combi") + end, + {description = "rofi launcher", group = "launcher"}), -- Dismiss notifications awful.key( { ctrlkey }, "space", function() naughty.destroy_all_notifications() end, {description = "dismiss notification", group = "notifications"}), - - -- Menubar - --awful.key({ modkey, ctrlkey }, "b", function() menubar.show() end, - --{description = "show the menubar", group = "launcher"}), -- Volume Control awful.key( { }, "XF86AudioMute", function() awful.spawn.with_shell("volume-control.sh toggle") @@ -364,41 +437,50 @@ keys.globalkeys = gears.table.join( -- Screenshots awful.key( { }, "Print", function() awful.spawn.with_shell("screenshot.sh") end, {description = "take full screenshot", group = "screenshots"}), - awful.key( { modkey, shiftkey }, "c", function() awful.spawn.with_shell("screenshot.sh -s") end, + awful.key( { superkey, shiftkey }, "c", function() awful.spawn.with_shell("screenshot.sh -s") end, {description = "select area to capture", group = "screenshots"}), - awful.key( { modkey, ctrlkey }, "c", function() awful.spawn.with_shell("screenshot.sh -c") end, + awful.key( { superkey, ctrlkey }, "c", function() awful.spawn.with_shell("screenshot.sh -c") end, {description = "select area to copy to clipboard", group = "screenshots"}), - awful.key( { modkey }, "Print", function() awful.spawn.with_shell("screenshot.sh -b") end, + awful.key( { superkey }, "Print", function() awful.spawn.with_shell("screenshot.sh -b") end, {description = "browse screenshots", group = "screenshots"}), - awful.key( { modkey, shiftkey }, "Print", function() awful.spawn.with_shell("screenshot.sh -e") end, + awful.key( { superkey, shiftkey }, "Print", function() awful.spawn.with_shell("screenshot.sh -e") end, {description = "edit most recent screenshot with gimp", group = "screenshots"}), -- Toggle tray visibility - awful.key({ modkey }, "=", function () - awful.screen.focused().systray.visible = not awful.screen.focused().systray.visible + awful.key({ superkey }, "=", function () + awful.screen.focused().traybox.visible = not awful.screen.focused().traybox.visible end, - {description = "toggle systray visibility", group = "custom"}), + {description = "toggle tray visibility", group = "awesome"}), -- Toggle night light - awful.key({ modkey }, "x", function() awful.spawn.with_shell("flux") end, + awful.key({ superkey }, "x", function() awful.spawn.with_shell("flux") end, {description = "toggle night light", group = "launcher"}), -- Toggle compositor - awful.key({ modkey }, "z", function() awful.spawn.with_shell("compositor") end, - {description = "toggle compositor", group = "launcher"}), + awful.key({ superkey }, "XF86Launch3", + function() + awful.spawn.with_shell("compositor") + end, + {description = "toggle compositor", group = "launcher"}), -- Media keys - awful.key({ modkey }, "period", function() awful.spawn.with_shell("mpc next") end, + awful.key({ superkey }, "period", function() awful.spawn.with_shell("mpc next") end, {description = "next song", group = "media"}), - awful.key({ modkey }, "comma", function() awful.spawn.with_shell("mpc prev") end, + awful.key({ superkey }, "comma", function() awful.spawn.with_shell("mpc prev") end, {description = "previous song", group = "media"}), - awful.key({ modkey }, "space", function() awful.spawn.with_shell("mpc toggle") end, + awful.key({ superkey }, "space", function() awful.spawn.with_shell("mpc toggle") end, {description = "toggle pause/play", group = "media"}), - awful.key({ modkey, shiftkey }, "period", function() awful.spawn.with_shell("mpvc next") end, + awful.key({ superkey, shiftkey }, "period", function() awful.spawn.with_shell("mpvc next") end, {description = "mpv next song", group = "media"}), - awful.key({ modkey, shiftkey }, "comma", function() awful.spawn.with_shell("mpvc prev") end, + awful.key({ superkey, shiftkey }, "comma", function() awful.spawn.with_shell("mpvc prev") end, {description = "mpv previous song", group = "media"}), - awful.key({ modkey, shiftkey}, "space", function() awful.spawn.with_shell("mpvc toggle") end, + awful.key({ superkey, shiftkey}, "space", function() awful.spawn.with_shell("mpvc toggle") end, {description = "mpv toggle pause/play", group = "media"}), - awful.key({ modkey, shiftkey}, "F8", function() awful.spawn.with_shell("mpvc quit") end, + awful.key({ superkey }, "F8", function() awful.spawn.with_shell("mpvc quit") end, {description = "mpv quit", group = "media"}), - awful.key({ modkey }, "q", function() + awful.key({ superkey }, "F7", function() awful.spawn.with_shell("freeze firefox") end, + {description = "send STOP signal to all firefox processes", group = "other"}), + awful.key({ superkey, shiftkey }, "F7", function() awful.spawn.with_shell("freeze -u firefox") end, + {description = "send CONT signal to all firefox processes", group = "other"}), + awful.key({ superkey }, "F6", function() awful.spawn.with_shell("i3lock") end, + {description = "lock screen", group = "other"}), + awful.key({ superkey }, "q", function() if client.focus ~= nil and client.focus.class == "scratchpad" then client.focus.minimized = true return @@ -410,22 +492,22 @@ keys.globalkeys = gears.table.join( end, {description = "scratchpad", group = "launcher"}), -- Set max layout - awful.key({ modkey }, "w", function() + awful.key({ superkey }, "w", function() awful.layout.set(awful.layout.suit.max) end, {description = "set max layout", group = "tag"}), -- Set tiled layout - awful.key({ modkey }, "s", function() + awful.key({ superkey }, "s", function() awful.layout.set(awful.layout.suit.tile) end, {description = "set tiled layout", group = "tag"}), -- Set floating layout - awful.key({ modkey, shiftkey }, "s", function() + awful.key({ superkey, shiftkey }, "s", function() awful.layout.set(awful.layout.suit.floating) end, {description = "set floating layout", group = "tag"}), -- Run or raise or minimize calcurse - awful.key({ modkey }, "F1", function() + awful.key({ superkey }, "F1", function() if client.focus ~= nil and client.focus.class == "calendar" then client.focus.minimized = true return @@ -437,69 +519,112 @@ keys.globalkeys = gears.table.join( end, {description = "calcurse", group = "launcher"}), -- Spawn ranger in a terminal - awful.key({ modkey }, "F2", function() awful.spawn(terminal .. " -e ranger") end, + awful.key({ superkey }, "F2", function() awful.spawn(terminal .. " -e ranger") end, {description = "ranger", group = "launcher"}), -- Spawn ncmpcpp in a terminal - awful.key({ modkey }, "F3", function() awful.spawn(terminal .. " -e ncmpcpp") end, + awful.key({ superkey }, "F3", function() awful.spawn(terminal .. " -e ncmpcpp") end, {description = "ncmpcpp", group = "launcher"}), -- Spawn cava in a terminal - awful.key({ modkey }, "F4", function() awful.spawn(terminal .. " -e cava") end, + awful.key({ superkey, shiftkey }, "F4", function() awful.spawn(terminal .. " -e cava") end, {description = "cava", group = "launcher"}), - -- Show system info (cpu, ram, battery, temp) - awful.key({ modkey }, "grave", function() awful.spawn.with_shell("~/scr/info/stats") end, - {description = "current system info", group = "launcher"}), + -- Spawn ncmpcpp in a terminal, with a special visualizer config + awful.key({ superkey }, "F4", function() awful.spawn(terminal .. " -e 'ncmpcpp -c ~/.config/ncmpcpp/config_visualizer -s visualizer'") end, + {description = "ncmpcpp", group = "launcher"}), + -- Toggle sidebar + awful.key({ superkey }, "grave", function() sidebar.visible = not sidebar.visible end, + {description = "show or hide sidebar", group = "awesome"}), + -- Toggle wibar + awful.key({ superkey, shiftkey }, "b", + function() + local s = awful.screen.focused() + s.mywibox.visible = not s.mywibox.visible + if beautiful.wibar_detached then + s.useless_wibar.visible = not s.useless_wibar.visible + end + end, + {description = "show or hide wibar", group = "awesome"}), + -- Open new emacs client frame + awful.key({ superkey }, "e", function() awful.spawn.with_shell("em") end, + {description = "emacs", group = "launcher"}), -- Quick edit config file - awful.key({ modkey }, "e", function() awful.spawn.with_shell("~/scr/Rofi/rofi_quickedit") end, - {description = "quick edit", group = "launcher"}), + awful.key({ superkey, shiftkey }, "e", function() awful.spawn.with_shell("~/scr/Rofi/rofimacs") end, + {description = "quick edit", group = "launcher"}), -- mpvtube - awful.key({ modkey }, "y", function() awful.spawn.with_shell("~/scr/Rofi/rofi_mpvtube") end, + awful.key({ superkey }, "y", function() awful.spawn.with_shell("~/scr/Rofi/rofi_mpvtube") end, {description = "mpvtube", group = "launcher"}), -- mpvtube song - awful.key({ modkey, shiftkey }, "y", function() awful.spawn.with_shell("~/scr/info/mpv-query.sh") end, + awful.key({ superkey, shiftkey }, "y", function() awful.spawn.with_shell("~/scr/info/mpv-query.sh") end, {description = "show mpv media title", group = "launcher"}), + -- Spawn file manager + awful.key({ superkey, shiftkey }, "f", function() awful.spawn(filemanager, {floating = true}) end, + {description = "file manager", group = "launcher"}), -- Spawn htop in a terminal - awful.key({ modkey }, "p", function() awful.spawn(terminal .. " -e htop") end, + awful.key({ superkey }, "p", function() awful.spawn(terminal .. " -e htop") end, {description = "htop", group = "launcher"}) ) keys.clientkeys = gears.table.join( -- Move floating client (relative) - awful.key({ modkey, shiftkey }, "Down", function (c) c:relative_move( 0, 40, 0, 0) end), - awful.key({ modkey, shiftkey }, "Up", function (c) c:relative_move( 0, -40, 0, 0) end), - awful.key({ modkey, shiftkey }, "Left", function (c) c:relative_move(-40, 0, 0, 0) end), - awful.key({ modkey, shiftkey }, "Right", function (c) c:relative_move( 40, 0, 0, 0) end), + awful.key({ superkey, shiftkey }, "Down", function (c) c:relative_move( 0, 40, 0, 0) end), + awful.key({ superkey, shiftkey }, "Up", function (c) c:relative_move( 0, -40, 0, 0) end), + awful.key({ superkey, shiftkey }, "Left", function (c) c:relative_move(-40, 0, 0, 0) end), + awful.key({ superkey, shiftkey }, "Right", function (c) c:relative_move( 40, 0, 0, 0) end), -- Center client - awful.key({ modkey }, "c", function (c) + awful.key({ superkey }, "c", function (c) awful.placement.centered(c,{honor_workarea=true}) --awful.placement.centered(c,nil) end), -- Resize client - awful.key({ modkey, ctrlkey }, "j", function (c) + awful.key({ superkey, ctrlkey }, "j", function (c) local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) if current_layout == "floating" or c.floating == true then c:relative_move( 0, 0, 0, 20) else - awful.client.incwfact(0.15) + awful.client.incwfact(0.05) end end), - awful.key({ modkey, ctrlkey }, "k", function (c) + awful.key({ superkey, ctrlkey }, "Down", function (c) + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + if current_layout == "floating" or c.floating == true then + c:relative_move( 0, 0, 0, 20) + else + awful.client.incwfact(0.05) + end + end), + awful.key({ superkey, ctrlkey }, "k", function (c) + local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) + if current_layout == "floating" or c.floating == true then + c:relative_move( 0, 0, 0, -20) + else + awful.client.incwfact(-0.05) + end + end), + awful.key({ superkey, ctrlkey }, "Up", function (c) local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) if current_layout == "floating" or c.floating == true then c:relative_move( 0, 0, 0, -20) else - awful.client.incwfact(-0.15) + awful.client.incwfact(-0.05) end end), - awful.key({ modkey, shiftkey, ctrlkey }, "j", function (c) + awful.key({ superkey, shiftkey, ctrlkey }, "j", function (c) -- Relative move c:relative_move(0, 20, 0, 0) end), - awful.key({ modkey, shiftkey, ctrlkey }, "k", function (c) + awful.key({ superkey, shiftkey, ctrlkey }, "Down", function (c) + -- Relative move + c:relative_move(0, 20, 0, 0) + end), + awful.key({ superkey, shiftkey, ctrlkey }, "k", function (c) + -- Relative move + c:relative_move(0, -20, 0, 0) + end), + awful.key({ superkey, shiftkey, ctrlkey }, "Up", function (c) -- Relative move c:relative_move(0, -20, 0, 0) end), -- Toggle titlebar (for focused client only) - awful.key({ modkey, }, "b", + awful.key({ superkey, }, "t", function (c) -- Don't toggle if titlebars are used as borders if not beautiful.titlebars_imitate_borders then @@ -508,7 +633,7 @@ keys.clientkeys = gears.table.join( end, {description = "toggle titlebar", group = "client"}), -- Toggle titlebar (for all visible clients in selected tag) - awful.key({ modkey, shiftkey }, "b", + awful.key({ superkey, shiftkey }, "t", function (c) --local s = awful.screen.focused() local clients = awful.screen.focused().clients @@ -521,63 +646,62 @@ keys.clientkeys = gears.table.join( end, {description = "toggle titlebar", group = "client"}), -- Toggle fullscreen - awful.key({ modkey, }, "f", + awful.key({ superkey, }, "f", function (c) c.fullscreen = not c.fullscreen c:raise() end, {description = "toggle fullscreen", group = "client"}), - -- Resize and set floating + -- Resize and set floating - Predetermined size according to screen -- F for focused view - awful.key({ modkey, shiftkey }, "f", + awful.key({ superkey, ctrlkey }, "f", function (c) - c.width = 950 - c.height = 600 - --c.width = 750 - --c.height = 500 - c.floating = true - awful.placement.centered(c,{honor_workarea=true}) - c:raise() - end, - {description = "focus mode", group = "client"}), - -- Resize and set floating 2: Electric Boogaloo - -- F for focused view - awful.key({ modkey, ctrlkey }, "f", - function (c) - c.width = 600 - c.height = 600 - --c.width = 750 - --c.height = 500 + -- c.width = 950 + -- c.height = 600 + c.width = screen_width * 0.7 + c.height = screen_height * 0.75 c.floating = true awful.placement.centered(c,{honor_workarea=true}) c:raise() end, {description = "focus mode", group = "client"}), + -- V for vertical view + awful.key({ superkey, ctrlkey }, "v", + function (c) + c.width = screen_width * 0.45 + c.height = screen_height * 0.85 + c.floating = true + awful.placement.centered(c,{honor_workarea=true}) + c:raise() + end, + {description = "focus mode", group = "client"}), -- T for tiny window - awful.key({ modkey, ctrlkey }, "t", + awful.key({ superkey, ctrlkey }, "t", function (c) - c.width = 400 - c.height = 260 + -- c.width = 400 + -- c.height = 260 + c.width = screen_width * 0.3 + c.height = screen_height * 0.35 c.floating = true awful.placement.centered(c,{honor_workarea=true}) c:raise() end, {description = "tiny mode", group = "client"}), -- N for normal window - awful.key({ modkey, ctrlkey }, "n", + awful.key({ superkey, ctrlkey }, "n", function (c) - c.width = 640 - c.height = 400 + c.width = screen_width * 0.45 + c.height = screen_height * 0.5 c.floating = true awful.placement.centered(c,{honor_workarea=true}) c:raise() end, {description = "normal mode", group = "client"}), - awful.key({ modkey, shiftkey }, "q", function (c) c:kill() end, + awful.key({ superkey, shiftkey }, "q", function (c) c:kill() end, {description = "close", group = "client"}), - --awful.key({ modkey, ctrlkey }, "space", awful.client.floating.toggle , + --awful.key({ superkey, ctrlkey }, "space", awful.client.floating.toggle , -- Toggle floating - awful.key({ modkey, ctrlkey }, "space", + awful.key({ superkey, ctrlkey }, "space", function(c) local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) if current_layout ~= "floating" then @@ -586,38 +710,38 @@ keys.clientkeys = gears.table.join( --c:raise() end, {description = "toggle floating", group = "client"}), - awful.key({ modkey, ctrlkey }, "Return", function (c) c:swap(awful.client.getmaster()) end, + awful.key({ superkey, ctrlkey }, "Return", function (c) c:swap(awful.client.getmaster()) end, {description = "move to master", group = "client"}), - awful.key({ modkey, }, "o", function (c) c:move_to_screen() end, + awful.key({ superkey, }, "o", function (c) c:move_to_screen() end, {description = "move to screen", group = "client"}), -- P for pin: keep on top OR sticky -- On top - awful.key({ modkey, shiftkey }, "p", function (c) c.ontop = not c.ontop end, + awful.key({ superkey, shiftkey }, "p", function (c) c.ontop = not c.ontop end, {description = "toggle keep on top", group = "client"}), -- Sticky - awful.key({ modkey, ctrlkey }, "p", function (c) c.sticky = not c.sticky end, + awful.key({ superkey, ctrlkey }, "p", function (c) c.sticky = not c.sticky end, {description = "toggle sticky", group = "client"}), -- Minimize - awful.key({ modkey, }, "n", + awful.key({ superkey, }, "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 , {description = "minimize", group = "client"}), - awful.key({ modkey, }, "m", + awful.key({ superkey, }, "m", function (c) c.maximized = not c.maximized c:raise() end , {description = "(un)maximize", group = "client"}), - awful.key({ modkey, ctrlkey }, "m", + awful.key({ superkey, ctrlkey }, "m", function (c) c.maximized_vertical = not c.maximized_vertical c:raise() end , {description = "(un)maximize vertically", group = "client"}), - awful.key({ modkey, shiftkey }, "m", + awful.key({ superkey, shiftkey }, "m", function (c) c.maximized_horizontal = not c.maximized_horizontal c:raise() @@ -632,7 +756,7 @@ local ntags = 10 for i = 1, ntags do keys.globalkeys = gears.table.join(keys.globalkeys, -- View tag only. - awful.key({ modkey }, "#" .. i + 9, + awful.key({ superkey }, "#" .. i + 9, function () local screen = awful.screen.focused() local tag = screen.tags[i] @@ -657,7 +781,7 @@ for i = 1, ntags do end, {description = "view tag #"..i, group = "tag"}), -- Toggle tag display. - awful.key({ modkey, ctrlkey }, "#" .. i + 9, + awful.key({ superkey, ctrlkey }, "#" .. i + 9, function () local screen = awful.screen.focused() local tag = screen.tags[i] @@ -667,7 +791,7 @@ for i = 1, ntags do end, {description = "toggle tag #" .. i, group = "tag"}), -- Move client to tag. - awful.key({ modkey, shiftkey }, "#" .. i + 9, + awful.key({ superkey, shiftkey }, "#" .. i + 9, function () if client.focus then local tag = client.focus.screen.tags[i] @@ -678,7 +802,7 @@ for i = 1, ntags do end, {description = "move focused client to tag #"..i, group = "tag"}), -- Move all visible clients to tag and focus that tag - awful.key({ modkey, altkey }, "#" .. i + 9, + awful.key({ superkey, altkey }, "#" .. i + 9, function () local tag = client.focus.screen.tags[i] local clients = awful.screen.focused().clients @@ -691,7 +815,7 @@ for i = 1, ntags do end, {description = "move all visible clients to tag #"..i, group = "tag"}), -- Toggle tag on focused client. - awful.key({ modkey, ctrlkey, shiftkey }, "#" .. i + 9, + awful.key({ superkey, ctrlkey, shiftkey }, "#" .. i + 9, function () if client.focus then local tag = client.focus.screen.tags[i] @@ -707,8 +831,9 @@ end -- Mouse buttons on the client (whole window, not just titlebar) keys.clientbuttons = gears.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, function(c) + awful.button({ superkey }, 1, awful.mouse.client.move), + awful.button({ superkey }, 2, function (c) c:kill() end), + awful.button({ superkey }, 3, function(c) awful.mouse.resize(c, nil, {jump_to_corner=true}) end) ) @@ -718,10 +843,4 @@ keys.clientbuttons = gears.table.join( root.keys(keys.globalkeys) root.buttons(keys.desktopbuttons) - - - - - - return keys diff --git a/config/awesome/noodle/desktop_mode_widget.lua b/config/awesome/noodle/desktop_mode_widget.lua deleted file mode 100644 index 5a1e437..0000000 --- a/config/awesome/noodle/desktop_mode_widget.lua +++ /dev/null @@ -1,120 +0,0 @@ -local awful = require("awful") -local gears = require("gears") -local beautiful = require("beautiful") -local wibox = require("wibox") - --- Get theme variables -local floating_color = beautiful.desktop_mode_color_floating or "#1D8CD2" -local tile_color = beautiful.desktop_mode_color_tile or "#2DD283" -local max_color = beautiful.desktop_mode_color_max or "#D21D43" -local floating_text = beautiful.desktop_mode_text_floating or "(fl)" -local tile_text = beautiful.desktop_mode_text_tile or "(ti)" -local max_text = beautiful.desktop_mode_text_max or "(ma)" - ---local desktop_mode_widget = wibox.widget.textbox("") ---desktop_mode_widget.font = beautiful.font ---desktop_mode_widget.align = "center" -local desktop_mode_widget = wibox.widget{ - font = beautiful.font, - markup = '  ', - align = 'center', - valign = 'center', - widget = wibox.widget.textbox -} - --- Mouse control -desktop_mode_widget:buttons(gears.table.join( - -- Old Left click: toggle between tile and floating + toggle titlebars - -- Left click: toggle titlebar for focused client - awful.button({ }, 1, function () - --switch_modes() - if client.focus ~= nil then - awful.titlebar.toggle(client.focus, beautiful.titlebar_position) - end - end), - -- Right click: Toggle titlebars in all visible clients - awful.button({ }, 3, function () - local clients = awful.screen.focused().clients - for _, c in pairs(clients) do - -- Don't toggle if titlebars are used as borders - if not beautiful.titlebars_imitate_borders then - awful.titlebar.toggle(c, beautiful.titlebar_position) - end - end - end), - -- TODO - awful.button({ }, 4, function () - awful.layout.inc(-1) - --local clients = awful.screen.focused().clients - --for _, c in pairs(clients) do - --awful.titlebar.show(c, beautiful.titlebar_position) - --end - end), - awful.button({ }, 5, function () - awful.layout.inc(1) - --local clients = awful.screen.focused().clients - --for _, c in pairs(clients) do - ---- Don't hide if titlebars are used as borders - --if not beautiful.titlebars_imitate_borders then - --awful.titlebar.hide(c, beautiful.titlebar_position) - --end - --end - end) -)) - -function switch_modes() - local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) - if current_layout == "floating" then - local clients = awful.screen.focused().clients - for _, c in pairs(clients) do - -- Don't hide if titlebars are used as borders - if not beautiful.titlebars_imitate_borders then - awful.titlebar.hide(c, beautiful.titlebar_position) - end - end - awful.layout.set(awful.layout.suit.tile) - else - --elseif current_layout == "tile" then - local clients = awful.screen.focused().clients - for _, c in pairs(clients) do - awful.titlebar.show(c, beautiful.titlebar_position) - end - -- Delay so that the windows will first be resized properly - -- by the tiling layout - gears.timer.delayed_call(function() - awful.layout.set(awful.layout.suit.floating) - end) - end -end - -local function update_widget() - local current_layout = awful.layout.getname(awful.layout.get(awful.screen.focused())) - local color - local txt - if current_layout == "max" then - color = max_color - txt = max_text - elseif current_layout == "tile" then - color = tile_color - txt = tile_text - elseif current_layout == "floating" then - color = floating_color - txt = floating_text - else - --default - color = tile_color - txt = tile_text - end - - desktop_mode_widget.markup = "" .. txt .. "" -end - --- Signals -awful.tag.attached_connect_signal(s, "property::selected", function () - update_widget() -end) -awful.tag.attached_connect_signal(s, "property::layout", function () - update_widget() -end) - -return desktop_mode_widget diff --git a/config/awesome/noodle/minimal_tasklist.lua b/config/awesome/noodle/minimal_tasklist.lua index 84a8fca..b65f2f9 100644 --- a/config/awesome/noodle/minimal_tasklist.lua +++ b/config/awesome/noodle/minimal_tasklist.lua @@ -11,13 +11,11 @@ local hidden_clients_color = beautiful.minimal_tasklist_hidden_clients_color or local hidden_clients_text = beautiful.minimal_tasklist_hidden_clients_text or "h: " local minimal_tasklist = wibox.widget{ - font = beautiful.font, - text = "placeholder", + text = "minimal_tasklist widget", align = 'center', valign = 'center', widget = wibox.widget.textbox } - --TODO forced_width = ? -- Mouse control minimal_tasklist:buttons(gears.table.join( @@ -90,19 +88,12 @@ local function update_widget() minimal_tasklist.text = txt minimal_tasklist.markup = "" - .. visible_clients_text .. "" .. vpad .. #clients .. " ·~" + .. visible_clients_text .. "" .. vpad .. #clients .. "" .. hidden_clients_text .. "" .. hpad .. #hidden_clients end -- Signals ---minimal_tasklist:connect_signal("mouse::enter", function () - --awful.spawn.with_shell("notify-send hello") ---end) ---minimal_tasklist:connect_signal("mouse::leave", function () - --awful.spawn.with_shell("notify-send bye") ---end) - client.connect_signal("unmanage", function(c) update_widget() end) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index cd9f2c9..9642496 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -10,13 +10,12 @@ -------------------------------------------------------------------------------- local theme_collection = { - "manta", -- 1 -- - --"whatever", -- 2 -- - -- Add more themes here + "manta", -- 1 -- + "lovelace" -- 2 -- } -- Change this number to use a different theme -local theme_name = theme_collection[1] +local theme_name = theme_collection[2] -------------------------------------------------------------------------------- @@ -44,16 +43,24 @@ local hotkeys_popup = require("awful.hotkeys_popup").widget -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") +-- ~~ Noodle Cleanup Script ~~ +-- Some of my widgets (mpd, volume) rely on scripts that have to be +-- run persistently in the background. +-- They sleep until mpd/volume state changes, in an infinite loop. +-- As a result when awesome restarts, they keep running in background, along with the new ones that are created after the restart. +-- This script cleans up the old processes. +awful.spawn.with_shell("~/.config/awesome/awesome-cleanup.sh") + -- {{{ Initialize stuff local helpers = require("helpers") local bars = require("bars") local keys = require("keys") local titlebars = require("titlebars") +local sidebar = require("sidebar") +local exit_screen = require("exit_screen") -- }}} --- {{{ Third party stuff ---local volumebar_widget = require("third_party.awesome-wm-widgets.volumebar-widget.volumebar") ---local mpdarc_widget = require("third_party.awesome-wm-widgets.mpdarc-widget.mpdarc") +-- {{{ Third party -- }}} -- {{{ Error handling @@ -82,18 +89,20 @@ end -- }}} -- {{{ Variable definitions --- This is used later as the default terminal and editor to run. terminal = "termite" -floating_terminal = "termite --class Diptera" tmux = terminal .. " -e tmux new " -floating_tmux = terminal .. " --class Diptera -e tmux new " editor = "vim" --editor = os.getenv("EDITOR") or "nano" editor_cmd = terminal .. " -e " .. editor .. " " +filemanager = "nemo" + +-- Get screen geometry +screen_width = awful.screen.focused().geometry.width +screen_height = awful.screen.focused().geometry.height -- Table of layouts to cover with awful.layout.inc, order matters. awful.layout.layouts = { - -- I only ever use these + -- I only ever use these 3 awful.layout.suit.tile, awful.layout.suit.floating, awful.layout.suit.max, @@ -132,21 +141,21 @@ naughty.config.defaults.margin = beautiful.notification_margin naughty.config.defaults.border_width = beautiful.notification_border_width naughty.config.presets.normal = { - font = beautiful.font, + font = beautiful.notification_font, fg = beautiful.notification_fg, bg = beautiful.notification_bg, border_width = beautiful.notification_border_width, margin = beautiful.notification_margin, - position = beautiful.notification_position + position = beautiful.notification_position } naughty.config.presets.low = { - font = beautiful.font, + font = beautiful.notification_font, fg = beautiful.notification_fg, bg = beautiful.notification_bg, border_width = beautiful.notification_border_width, margin = beautiful.notification_margin, - position = beautiful.notification_position + position = beautiful.notification_position } naughty.config.presets.ok = naughty.config.presets.low @@ -154,12 +163,12 @@ naughty.config.presets.info = naughty.config.presets.low naughty.config.presets.warn = naughty.config.presets.normal naughty.config.presets.critical = { - font = beautiful.font, - fg = beautiful.notification_crit_fg, - bg = beautiful.notification_crit_bg, + font = beautiful.notification_font, + fg = beautiful.notification_crit_fg, + bg = beautiful.notification_crit_bg, border_width = beautiful.notification_border_width, margin = beautiful.notification_margin, - position = beautiful.notification_position + position = beautiful.notification_position } -- }}} @@ -167,56 +176,73 @@ naughty.config.presets.critical = { -- {{{ Menu -- Create a launcher widget and a main menu myawesomemenu = { - { "hotkeys", function() return false, hotkeys_popup.show_help end}, - { "manual", terminal .. " -e \"man awesome\"" }, - { "restart", awesome.restart }, - { "quit", function() awesome.quit() end} -} -mymusicmenu = { - { "mpd toggle", function() awful.spawn.with_shell("mpc toggle") end}, - { "mpd next", function() awful.spawn.with_shell("mpc next") end}, - { "mpd previous", function() awful.spawn.with_shell("mpc prev") end}, - { "ncmpcpp", function() awful.spawn.with_shell(terminal .. " -e ncmpcpp") end}, - { "--------------", nil}, - { "mpv toggle", function() awful.spawn.with_shell("mpvc toggle") end}, - { "mpv next", function() awful.spawn.with_shell("mpvc next") end}, - { "mpv previous", function() awful.spawn.with_shell("mpvc prev") end}, - { "mpvtube", function() awful.spawn.with_shell("~/scr/Rofi/rofi_mpvtube") end} + { "hotkeys", function() return false, hotkeys_popup.show_help end, beautiful.keyboard_icon}, + { "manual", terminal .. " -e \"man awesome\"", beautiful.manual_icon }, + { "restart", awesome.restart, beautiful.reboot_icon }, + { "quit", function() exit_screen_show() end, beautiful.exit_icon} + -- { "quit", function() awesome.quit() end} } - - --- Need to allow these commands to be run without password --- Or if you are using systemd: systemctl [suspend|hibernate] -mypowermenu = { - { "reboot", "reboot" }, - { "suspend", "sudo pm-suspend" }, - { "hibernate", "sudo pm-hibernate" }, - { "poweroff", "poweroff" } -} - ---mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, - --{ "music", mymusicmenu, beautiful.awesome_icon }, - --{ "power", mypowermenu, beautiful.awesome_icon }, -mymainmenu = awful.menu({ items = { - { "awesome", myawesomemenu }, - { "music", mymusicmenu }, - { "firefox", "firefox" }, - { "files", "nemo" }, - { "discord", "discord" }, - { "gimp", "gimp" }, - { "appearance", "lxappearance" }, - { "volume", "pavucontrol" }, - { "games", "lutris" }, - { "steam", "steam" }, - { "terminal", terminal }, - { "power", mypowermenu } +mymainmenu = awful.menu({ items = { + { "awesome", myawesomemenu, beautiful.home_icon }, + { "firefox", "firefox", beautiful.firefox_icon }, + { "mail", + function () + local matcher = function (c) + return awful.rules.match(c, {class = 'Thunderbird'}) + end + awful.client.run_or_raise("thunderbird", matcher) + end, + beautiful.mail_icon }, + { "editor", "em", beautiful.editor_icon }, + { "files", filemanager, beautiful.files_icon }, + { "discord", + function () + local matcher = function (c) + return awful.rules.match(c, {class = 'discord'}) + end + awful.client.run_or_raise("discord", matcher) + end, + beautiful.discord_icon }, + { "gimp", + function () + local matcher = function (c) + return awful.rules.match(c, {class = 'Gimp'}) + end + awful.client.run_or_raise("gimp", matcher) + end, + beautiful.gimp_icon }, + { "appearance", "lxappearance", beautiful.appearance_icon }, + { "volume", + function () + local matcher = function (c) + return awful.rules.match(c, {class = 'Pavucontrol'}) + end + awful.client.run_or_raise("pavucontrol", matcher) + end, + beautiful.volume_icon }, + { "lutris", + function () + local matcher = function (c) + return awful.rules.match(c, {class = 'Lutris'}) + end + awful.client.run_or_raise("lutris", matcher) + end, + beautiful.lutris_icon }, + { "steam", + function () + local matcher = function (c) + return awful.rules.match(c, {class = 'Steam'}) + end + awful.client.run_or_raise("steam", matcher) + end, + beautiful.steam_icon }, + { "terminal", terminal, beautiful.terminal_icon }, } }) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) - -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} @@ -244,19 +270,67 @@ end -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution) screen.connect_signal("property::geometry", set_wallpaper) --- Tag Names -local tagnames = beautiful.tagnames or { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" } - awful.screen.connect_for_each_screen(function(s) -- Wallpaper set_wallpaper(s) - -- Layouts -- Each screen has its own tag table. + -- Layouts local l = awful.layout.suit -- Alias to save time :) - local layouts = { l.max, l.floating, l.max, l.tile , l.tile, - l.max, l.floating, l.max, l.floating, l.floating} - awful.tag(tagnames, s, layouts) + -- Initialize layouts array + local layouts = { l.max, l.floating, l.max, l.max , l.tile, + l.max, l.max, l.max, l.floating, l.fair} + + -- Initialize tagnames array + local tagnames = beautiful.tagnames or { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" } + + -- Create tags + awful.tag.add(tagnames[1], { + -- icon = "/path/to/icon1.png", + layout = layouts[1], + screen = s, + selected = true, + }) + awful.tag.add(tagnames[2], { + layout = layouts[2], + screen = s, + }) + awful.tag.add(tagnames[3], { + layout = layouts[3], + screen = s, + }) + awful.tag.add(tagnames[4], { + layout = layouts[4], + screen = s, + }) + awful.tag.add(tagnames[5], { + layout = layouts[5], + master_width_factor = 0.65, + screen = s, + }) + awful.tag.add(tagnames[6], { + layout = layouts[6], + screen = s, + }) + awful.tag.add(tagnames[7], { + layout = layouts[7], + screen = s, + }) + awful.tag.add(tagnames[8], { + layout = layouts[8], + screen = s, + }) + awful.tag.add(tagnames[9], { + layout = layouts[9], + screen = s, + }) + awful.tag.add(tagnames[10], { + layout = layouts[10], + screen = s, + }) + + -- Create all tags at once (without seperate configuration for each tag) + -- awful.tag(tagnames, s, layouts) end) -- {{{ Rules @@ -278,6 +352,11 @@ awful.rules.rules = { } }, + -- Add titlebars to normal clients and dialogs + { rule_any = {type = { "normal", "dialog" } + }, properties = { titlebars_enabled = true }, + }, + -- Floating clients { rule_any = { instance = { @@ -288,7 +367,8 @@ awful.rules.rules = { "Galculator", "feh", "Gpick", - "Diptera", -- Floating Termite + "Lxappearance", + "Pavucontrol", }, name = { @@ -300,13 +380,14 @@ awful.rules.rules = { } }, properties = { floating = true, ontop = false }}, - -- Add titlebars to normal clients and dialogs - -- Not needed anymore -- - { rule_any = {type = { "normal", "dialog" } - }, properties = { titlebars_enabled = true }--, - --callback = function (c) - --end - }, + -- Fullscreen clients + { rule_any = { + class = { + "dota2", + "Terraria.bin.x86", + "dontstarve_steam", + }, + }, properties = { fullscreen = true }}, -- Centered clients { rule_any = { @@ -318,6 +399,7 @@ awful.rules.rules = { }, name = { "Save As", + "File Upload", }, role = { "GtkFileChooserDialog", @@ -333,14 +415,14 @@ awful.rules.rules = { { rule_any = { class = { "qutebrowser", - "feh", - "Gimp", + -- "feh", + -- "Gimp", "Sublime_text", --"discord", --"TelegramDesktop", "Firefox", + "Steam", "Chromium-browser", - "Rofi", }, }, properties = {}, callback = function (c) @@ -355,11 +437,15 @@ awful.rules.rules = { -- Titlebars of these clients will be shown regardless of the theme setting { rule_any = { class = { - --"feh", - --"qutebrowser", - --"Firefox", - --"Rofi" + --"???", }, + name = { + "File Upload", + "Open File", + "Select a filename", + "Enter name of file to save to…", + "Library" + }, }, properties = {}, callback = function (c) awful.titlebar.show(c, beautiful.titlebar_position) @@ -382,25 +468,23 @@ awful.rules.rules = { { rule_any = { class = { "Termite", - "Diptera", "mpvtube", "kitty", "st-256color", "st", "URxvt", - "XTerm", }, - }, properties = { width = 640, height = 400 } + }, properties = { width = screen_width * 0.45, height = screen_height * 0.5 } }, -- File managers - { rule_any = { - class = { - "Nemo", - "Thunar" - }, - }, properties = { floating = true, width = 580, height = 440 } - }, + -- { rule_any = { + -- class = { + -- "Nemo", + -- "Thunar" + -- }, + -- }, properties = { width = screen_width * 0.7, height = screen_height * 0.75} + -- }, -- Rofi configuration -- Needed only if option "-normal-window" is used @@ -412,6 +496,9 @@ awful.rules.rules = { callback = function (c) c.skip_taskbar = true awful.placement.centered(c,{honor_workarea=true}) + if not beautiful.titlebars_imitate_borders then + awful.titlebar.hide(c, beautiful.titlebar_position) + end end }, @@ -446,7 +533,7 @@ awful.rules.rules = { "scratchpad", "calendar", }, - }, properties = { tag = awful.screen.focused().tags[10], floating = true, ontop = false, sticky = true }, + }, properties = { tag = awful.screen.focused().tags[10], floating = true, ontop = false, sticky = true, width = screen_width * 0.7, height = screen_height * 0.75}, callback = function (c) c.skip_taskbar = true c.minimized = true @@ -454,13 +541,19 @@ awful.rules.rules = { end }, + -- Steam guard + { rule = { name = "Steam Guard - Computer Authorization Required" }, + properties = { floating = true }, + callback = function (c) + gears.timer.delayed_call(function() + awful.placement.centered(c,{honor_workarea=true}) + end) + end + }, + --------------------------------------------- -- Start application on specific workspace -- --------------------------------------------- - -- Example: - -- Set Firefox to always map on the tag named "2" on screen 1. - --{ rule = { class = "Firefox" }, - --properties = { screen = 1, tag = "2" } }, -- Browsing { rule_any = { class = { @@ -468,9 +561,18 @@ awful.rules.rules = { "Chromium-browser", "qutebrowser", }, - --local clients = }, properties = { screen = 1, tag = awful.screen.focused().tags[1] } }, + -- Games + { rule_any = { + class = { + "dota2", + "Terraria.bin.x86", + "dontstarve_steam", + "Wine", + }, + }, properties = { screen = 1, tag = awful.screen.focused().tags[2] } }, + -- Chatting { rule_any = { class = { @@ -478,7 +580,6 @@ awful.rules.rules = { "TelegramDesktop", "TeamSpeak 3", }, - --local clients = }, properties = { screen = 1, tag = awful.screen.focused().tags[3] } }, -- Photo editing @@ -489,7 +590,15 @@ awful.rules.rules = { }, }, properties = { screen = 1, tag = awful.screen.focused().tags[6] } }, - -- Gaming + -- Mail / Torrent + { rule_any = { + class = { + "Thunderbird", + "Deluge", + }, + }, properties = { screen = 1, tag = awful.screen.focused().tags[7] } }, + + -- Gaming clients { rule_any = { class = { "Steam", @@ -506,8 +615,7 @@ awful.rules.rules = { --name = { --"mpvtube", --}, - - }, properties = { screen = 1, tag = awful.screen.focused().tags[10] }, + }, properties = { screen = 1, tag = awful.screen.focused().tags[9] }, callback = function (c) awful.placement.centered(c,{honor_workarea=true}) gears.timer.delayed_call(function() @@ -515,6 +623,7 @@ awful.rules.rules = { end) end }, + } -- }}} @@ -539,12 +648,12 @@ client.connect_signal("manage", function (c) -- If the layout is not floating, every floating client that appears is centered if awful.layout.get(mouse.screen) ~= awful.layout.suit.floating then - awful.placement.centered(c,{honor_workarea=true}) + awful.placement.centered(c,{honor_workarea=true}) else - -- If the layout is floating, and there is no other client visible, center it - if #mouse.screen.clients == 1 then - awful.placement.centered(c,{honor_workarea=true}) - end + -- If the layout is floating, and there is no other client visible, center it + if #mouse.screen.clients == 1 then + awful.placement.centered(c,{honor_workarea=true}) + end end end) @@ -564,14 +673,10 @@ if beautiful.border_radius ~= 0 then end end) - -- Make sure fullscreen clients do not have rounded corners + -- Fullscreen clients should not have rounded corners client.connect_signal("property::fullscreen", function (c) if c.fullscreen then - -- Use delayed_call in order to avoid flickering when corners - -- change shape - gears.timer.delayed_call(function() - c.shape = helpers.rect() - end) + c.shape = helpers.rect() else c.shape = helpers.rrect(beautiful.border_radius) end @@ -580,7 +685,8 @@ end -- When a client starts up in fullscreen, resize it to cover the fullscreen a short moment later -- Fixes wrong geometry when titlebars are enabled -client.connect_signal("property::fullscreen", function(c) +--client.connect_signal("property::fullscreen", function(c) +client.connect_signal("manage", function(c) if c.fullscreen then gears.timer.delayed_call(function() if c.valid then @@ -605,14 +711,14 @@ client.connect_signal("focus", function(c) c.border_color = beautiful.border_foc client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- Scratchpad gets minimized when it loses focus ---client.connect_signal("unfocus", function(c) - --if c.class == "scratchpad" or c.class == "calendar" then - --c.minimized = true - --end ---end) +-- client.connect_signal("unfocus", function(c) +-- if c.class == "scratchpad" or c.class == "calendar" then +-- c.minimized = true +-- end +-- end) -- Scratchpad gets minimized if it is focused and tag changes -awful.tag.attached_connect_signal(s, "property::selected", function () +awful.tag.attached_connect_signal(s, "property::selected", function () local c = client.focus if c ~= nil then if c.class == "scratchpad" or c.class == "calendar" then @@ -667,7 +773,7 @@ client.connect_signal('property::geometry', end ) --- Make rofi possible to raise minimized clients +-- Make rofi able to unminimize minimized clients -- Note: causes clients to unminimize after restarting awesome client.connect_signal("request::activate", function(c, context, hints) @@ -680,5 +786,4 @@ client.connect_signal("request::activate", -- Startup applications awful.spawn.with_shell( os.getenv("HOME") .. "/.config/awesome/autostart.sh") - -- }}} diff --git a/config/awesome/titlebars.lua b/config/awesome/titlebars.lua index 6b197a1..d1a16d7 100644 --- a/config/awesome/titlebars.lua +++ b/config/awesome/titlebars.lua @@ -10,13 +10,24 @@ local pad = helpers.pad -- Mouse buttons titlebars.buttons = gears.table.join( -- Left button - move + -- (Double tap - Toggle maximize) -- A little BUGGY awful.button({ }, 1, function() - c = mouse.object_under_pointer() + local c = mouse.object_under_pointer() client.focus = c c:raise() - awful.mouse.client.move(c) + -- awful.mouse.client.move(c) + local function single_tap() + awful.mouse.client.move(c) + end + local function double_tap() + gears.timer.delayed_call(function() + c.maximized = not c.maximized + end) + end + helpers.single_double_tap(single_tap, double_tap) + -- helpers.single_double_tap(nil, double_tap) end), - -- Middle button - close + -- Middle button - close awful.button({ }, 2, function () window_to_kill = mouse.object_under_pointer() window_to_kill:kill() @@ -28,18 +39,6 @@ titlebars.buttons = gears.table.join( c:raise() awful.mouse.client.resize(c) end), - -- Scroll up - toggle ontop - awful.button({ }, 4, function() - c = mouse.object_under_pointer() - --c.maximized = not c.maximized - c.ontop = not c.ontop - c:raise() - end), - -- Scroll down - minimize - awful.button({ }, 5, function() - c = mouse.object_under_pointer() - c.minimized = true - end), -- Side button up - toggle floating awful.button({ }, 9, function() c = mouse.object_under_pointer() @@ -48,10 +47,10 @@ titlebars.buttons = gears.table.join( c.floating = not c.floating c:raise() end), - -- Side button down - toggle sticky + -- Side button down - toggle ontop awful.button({ }, 8, function() - c = mouse.object_under_pointer() - c.sticky = not c.sticky + local c = mouse.object_under_pointer() + c.ontop = not c.ontop end) ) @@ -96,13 +95,12 @@ client.connect_signal("request::titlebars", function(c) --awful.titlebar.widget.closebutton (c), --awful.titlebar.widget.maximizedbutton(c), --awful.titlebar.widget.minimizebutton (c), - --awful.titlebar.widget.ontopbutton (c), - --awful.titlebar.widget.stickybutton (c), - --awful.titlebar.widget.floatingbutton (c), - + -- awful.titlebar.widget.ontopbutton (c), + -- awful.titlebar.widget.stickybutton (c), + -- awful.titlebar.widget.floatingbutton (c), buttons = buttons, --awful.titlebar.widget.iconwidget(c), - + layout = titlebar_item_layout }, { -- Middle diff --git a/screenshot.png b/screenshot.png deleted file mode 100644 index 6179bbe..0000000 Binary files a/screenshot.png and /dev/null differ