From 6dcdf5732835c39b70e3f0db02f3a84271fcabd6 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sun, 17 Mar 2019 15:04:32 +0100 Subject: [PATCH] separate color table from properties --- awesome/rc.lua | 109 +++++++++++++++++++-------------- awesome/themes/kadet/theme.lua | 25 +++++--- 2 files changed, 78 insertions(+), 56 deletions(-) diff --git a/awesome/rc.lua b/awesome/rc.lua index 0d8cbaa..45b3540 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -61,7 +61,8 @@ end -- Autostart programs run_once({ "xcompmgr", - "sleep 0.25 && xrandr --output DP-1 --primary --auto --pos 0x0 --output HDMI-0 --auto --pos 2560x180" + "sleep 0.25 && xrandr --output DP-1 --primary --auto --pos 0x0 --output HDMI-0 --auto --pos 2560x180", + "keepassxc" }) -- Choose the theme @@ -83,13 +84,13 @@ naughty.config.defaults.position = "top_right" naughty.config.defaults.margin = 8 naughty.config.defaults.gap = 1 naughty.config.defaults.ontop = true -naughty.config.defaults.font = "Fira Code 10" +naughty.config.defaults.font = "Fira Sans 10" naughty.config.defaults.icon = nil naughty.config.defaults.icon_size = 32 naughty.config.defaults.fg = beautiful.fg_tooltip naughty.config.defaults.bg = beautiful.bg_tooltip -naughty.config.defaults.border_color = beautiful.border_tooltip -naughty.config.defaults.border_width = 2 +naughty.config.defaults.border_color = beautiful.notification_border_color +naughty.config.defaults.border_width = 0 naughty.config.defaults.hover_timeout = nil awful.util.terminal = terminal @@ -104,9 +105,9 @@ awful.layout.layouts = { awful.layout.suit.spiral, awful.layout.suit.max, awful.layout.suit.max.fullscreen, - -- awful.layout.suit.magnifier, - awful.layout.suit.fair, - awful.layout.suit.fair.horizontal, + --awful.layout.suit.magnifier, + --awful.layout.suit.fair, + --awful.layout.suit.fair.horizontal, --awful.layout.suit.spiral.dwindle, --awful.layout.suit.corner.nw, --awful.layout.suit.corner.ne, @@ -223,9 +224,7 @@ awful.screen.connect_for_each_screen(function(s) beautiful.connect(s) end) -- Mouse bindings root.buttons(awful.util.table.join( - awful.button({ }, 3, function () awful.util.mymainmenu:toggle() end), - awful.button({ }, 4, awful.tag.viewnext), - awful.button({ }, 5, awful.tag.viewprev) + awful.button({ }, 3, function () awful.util.mymainmenu:toggle() end) )) -- {{{ Key bindings @@ -287,14 +286,21 @@ globalkeys = awful.util.table.join( {description = "jump to urgent client", group = "client"}), -- Window changing - awful.key({ altkey, }, "Tab", - function () - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end, - {description = "go back", group = "client"}), + awful.key({ altkey }, "Tab", function () + awful.client.focus.byidx(-1) + + if client.focus then + client.focus:raise() + end + end), + + awful.key({ altkey, "Shift" }, "Tab", function () + awful.client.focus.byidx(1) + + if client.focus then + client.focus:raise() + end + end), awful.key({ modkey, }, "Tab", function () awful.spawn("rofi -show window") end, {description = "go back", group = "client"}), @@ -314,11 +320,11 @@ globalkeys = awful.util.table.join( awful.key({ altkey, "Control" }, "]", function () lain.util.useless_gaps_resize(-1) end), -- Dynamic tagging - awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end, { group = "Tagging", description = "Add tag" }), - awful.key({ modkey, "Shift" }, "r", function () lain.util.rename_tag() end, { group = "Tagging", description = "Rename current tag" }), - awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end, { group = "Tagging", description = "Move tag to left" }), -- move to previous tag - awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end, { group = "Tagging", description = "Move tag to right" }), -- move to next tag - awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end, { group = "Tagging", description = "Remove crrent tag" }), + -- awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end, { group = "Tagging", description = "Add tag" }), + -- awful.key({ modkey, "Shift" }, "r", function () lain.util.rename_tag() end, { group = "Tagging", description = "Rename current tag" }), + -- awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end, { group = "Tagging", description = "Move tag to left" }), -- move to previous tag + -- awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end, { group = "Tagging", description = "Move tag to right" }), -- move to next tag + -- awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end, { group = "Tagging", description = "Remove crrent tag" }), -- Standard program awful.key({ modkey, "Control" }, "r", awesome.restart, @@ -476,6 +482,13 @@ clientbuttons = awful.util.table.join( root.keys(globalkeys) -- }}} +local client_colors = { + { rule = { class = "Firefox" }, color = "#0c0c0d" }, + { rule = { class = "jetbrains-toolbox" }, color = "#111314" }, + { rule = { class = "TelegramDesktop" }, color = "#17212B" }, + { rule_any = { class = { "jetbrains-phpstorm", "jetbrains-idea", "jetbrains-pycharm" } }, color = "#3c3f41" }, +} + -- Rules to apply to new clients (through the "manage" signal). awful.rules.rules = { -- All clients will match this rule. @@ -501,11 +514,11 @@ awful.rules.rules = { -- Set Firefox to always map on the first tag on screen 1. { rule = { class = "Firefox" }, - properties = { maximized = true, tag = awful.util.tagnames[3], titlebar_color = "#0c0c0d" } }, + properties = { maximized = true, tag = awful.util.tagnames[3] } }, -- Jetbrains stuff { rule_any = { class = { "jetbrains-phpstorm", "jetbrains-idea", "jetbrains-pycharm" } }, - properties = { titlebars_enabled = false, tag = awful.util.tagnames[1], maximized = false, titlebar_color = "#3c3f41" } }, + properties = { titlebars_enabled = false, tag = awful.util.tagnames[1], maximized = false } }, -- flameshot { rule = { class = "flameshot" }, @@ -513,15 +526,17 @@ awful.rules.rules = { -- keepassxc { rule = { class = "keepassxc" }, - properties = { titlebars_enabled = true, floating = true } }, + properties = { titlebars_enabled = true, floating = true, sticky = true } }, + + { rule = { class = "Gcolor2" }, + properties = { titlebars_enabled = true, floating = true, focus = true } }, -- messaging - { rule_any = { class = { "telegram-desktop", "Thunderbird", "jetbrains-toolbox" } }, + { rule_any = { class = { "TelegramDesktop", "Thunderbird" } }, properties = { screen = 2, tag = awful.util.tagnames[4] } }, - -- quake - { rule = { class = "QuakeDD" }, - properties = { allow_titlebars = false } }, + { rule = { class = "jetbrains-toolbox" }, + properties = { screen = 2, tag = awful.util.tagnames[5] } }, -- dialogs { rule = { type = "dialog" }, @@ -529,7 +544,11 @@ awful.rules.rules = { -- jetbrains bugs { rule = { class = "jetbrains-.*", name = "win.*" }, - properties = { titlebars_enabled = false, allow_titlebars = false, focusable = false, floating = true, titlebar_color = "#ff0000" } }, + properties = { titlebars_enabled = false, allow_titlebars = false, focusable = false, floating = true } }, + + -- quake + { rule = { class = "QuakeDD" }, + properties = { allow_titlebars = false } }, } -- Signals @@ -539,6 +558,10 @@ client.connect_signal("manage", function (c) -- i.e. put it at the end of others instead of setting it master. if not awesome.startup then awful.client.setslave(c) end + if c.floating then + c.border_width = 1 + end + if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then @@ -571,7 +594,14 @@ client.connect_signal("request::titlebars", function(c) ) local title = awful.titlebar.widget.titlewidget(c) - title.font = "Fira Code Regular 7" + title.font = "Fira Sans Medium 8" + + for index, rule in pairs(client_colors) do + if awful.rules.matches(c, rule) then + c.titlebar_color = rule.color + break + end + end awful.titlebar(c, { size = 20, fg_focus = "#ffffff", bg_focus = c.titlebar_color or beautiful.titlebar_bg_focus }) : setup { { -- Left @@ -586,7 +616,7 @@ client.connect_signal("request::titlebars", function(c) }, { -- Middle { - align = "left", + align = "center", widget = title, }, buttons = buttons, @@ -622,16 +652,3 @@ client.connect_signal("property::floating", function (c) c.border_width = 0 end end) - --- No border for maximized clients -client.connect_signal("focus", - function(c) - if c.maximized then - c.border_width_old = c.border_width - c.border_width = 0 - elseif #awful.screen.focused().clients > 1 then - c.border_width = c.border_width_old - end - end) - -client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) diff --git a/awesome/themes/kadet/theme.lua b/awesome/themes/kadet/theme.lua index 558da4d..1edef3b 100644 --- a/awesome/themes/kadet/theme.lua +++ b/awesome/themes/kadet/theme.lua @@ -77,8 +77,8 @@ theme.menu_width = 140 theme.notification_font = fonts.mono_regular theme.notification_bg = colors.dark .. "dd" theme.notification_fg = theme.fg_normal -theme.notification_border_width = 1 -theme.notification_border_color = colors.dark +theme.notification_border_width = 0 +theme.notification_border_color = colors.accent theme.notification_shape = gears.shape.rectangle theme.notification_opacity = 1 theme.notification_margin = 30 @@ -110,7 +110,8 @@ theme.layout_cornerne = theme.dir .. "/icons/layout/cp theme.layout_cornernw = theme.dir .. "/icons/layout/cornernw.png" theme.tasklist_disable_icon = true -theme.useless_gap = 4 +theme.useless_gap = 3 +theme.master_width_factor = 0.66 -- titlebar theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close.png" @@ -167,10 +168,13 @@ local clock_widget = wibox.container.background(wibox.container.margin(wibox.wid local calendar = lain.widget.calendar({ cal = "cal --color=always", attach_to = { clock_widget }, + followtag = true, notification_preset = { - font = fonts.mono_regular, - fg = theme.fg_normal, - bg = theme.bg_normal + font = fonts.mono_regular, + fg = theme.fg_normal, + bg = theme.bg_normal, + position = "top_middle", + screen = awful.mouse.screen, } }) @@ -206,6 +210,7 @@ local temp_widget = wibox.widget { image.icons.temp, temp.widget, layout = wibox local fs_icon = wibox.widget.imagebox(theme.widget_hdd) local fs = lain.widget.fs({ notification_preset = { fg = theme.fg_normal, bg = theme.bg_normal, font = fonts.widget }, + followtag = true, settings = function() local fsp = string.format(" %3.2f %s ", fs_now["/home"].free, fs_now["/home"].units) widget:set_markup(markup.font(fonts.widget, markup.fg.color(theme.fg_widget, fsp))) @@ -233,12 +238,12 @@ function theme.connect(s) -- Tags --awful.tag(awful.util.tagnames, s, awful.layout.layouts[1]) layout = { - awful.layout.layouts[3], - awful.layout.layouts[10], + awful.layout.layouts[1], + awful.layout.layouts[1], awful.layout.layouts[8], awful.layout.layouts[7], - awful.layout.layouts[10], - awful.layout.layouts[10], + awful.layout.layouts[6], + awful.layout.layouts[1], } awful.tag({ " ", " >_ ", " web ", " & ", " etc ", " # " }, s, layout)