From 076196acc053647f4ce10e9626fc1380e6633b0e Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 16 Feb 2019 16:37:01 +0000 Subject: [PATCH] [awesome] apply solarized theme --- home/.config/awesome/rc.lua | 94 ++------------------------------- home/.config/awesome/theme.lua | 96 ++++++++++++++++++++++++++++++++++ home/.config/awesome/utils.lua | 9 ++++ 3 files changed, 108 insertions(+), 91 deletions(-) create mode 100644 home/.config/awesome/theme.lua diff --git a/home/.config/awesome/rc.lua b/home/.config/awesome/rc.lua index ffef9e3..a8e64e5 100644 --- a/home/.config/awesome/rc.lua +++ b/home/.config/awesome/rc.lua @@ -14,10 +14,6 @@ local hotkeys_popup = require("awful.hotkeys_popup").widget -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") --- Load Debian menu entries -local debian = require("debian.menu") -local has_fdo, freedesktop = pcall(require, "freedesktop") - -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to -- another config (This code will only ever execute for the fallback config) @@ -45,9 +41,7 @@ end -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. -beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") -beautiful.font = "Terminess Powerline 8" -beautiful.wallpaper = "/usr/share/wallpapers/wallpaper.jpg" +beautiful.init(gears.filesystem.get_configuration_dir() .. "theme.lua") -- Default shell awful.util.shell = "/bin/zsh" @@ -101,44 +95,10 @@ end -- }}} -- {{{ Menu --- Create a launcher widget and a main menu -myawesomemenu = { - { "hotkeys", function() return false, hotkeys_popup.show_help end}, - { "manual", terminal .. " -e man awesome" }, - { "edit config", editor_cmd .. " " .. awesome.conffile }, - { "restart", awesome.restart }, - { "quit", function() awesome.quit() end} -} - -local menu_awesome = { "awesome", myawesomemenu, beautiful.awesome_icon } -local menu_terminal = { "open terminal", terminal } - -if has_fdo then - mymainmenu = freedesktop.menu.build({ - before = { menu_awesome }, - after = { menu_terminal } - }) -else - mymainmenu = awful.menu({ - items = { - menu_awesome, - { "Debian", debian.menu.Debian_menu.Debian }, - menu_terminal, - } - }) -end - - -mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, - menu = mymainmenu }) - -- Menubar configuration menubar.utils.terminal = terminal -- Set the terminal for applications that require it -- }}} --- Keyboard map indicator and switcher -mykeyboardlayout = awful.widget.keyboardlayout() - -- {{{ Wibar -- Create a textclock widget mytextclock = wibox.widget.textclock() @@ -206,7 +166,7 @@ awful.screen.connect_for_each_screen(function(s) set_wallpaper(s) -- Each screen has its own tag table. - awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1]) + awful.tag({ "一", "二", "三", "四", "五", "六", "七", "八", "九" }, s, awful.layout.layouts[1]) -- Create a promptbox for each screen s.mypromptbox = awful.widget.prompt() @@ -232,7 +192,6 @@ awful.screen.connect_for_each_screen(function(s) layout = wibox.layout.align.horizontal, { -- Left widgets layout = wibox.layout.fixed.horizontal, - mylauncher, s.mytaglist, s.mypromptbox, }, @@ -253,7 +212,6 @@ end) -- {{{ Mouse bindings root.buttons(gears.table.join( - awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 5, awful.tag.viewprev) )) @@ -282,9 +240,6 @@ globalkeys = gears.table.join( end, {description = "focus previous by index", group = "client"} ), - awful.key({ modkey, }, "w", function () mymainmenu:show() end, - {description = "show main menu", group = "awesome"}), - -- Layout manipulation awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, {description = "swap with next client by index", group = "client"}), @@ -342,8 +297,7 @@ globalkeys = gears.table.join( {description = "restore minimized", group = "client"}), -- Prompt - --awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, - awful.key({ modkey }, "r", function () awful.util.spawn({"rofi", "-show", "combi"}) end, + awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, {description = "run prompt", group = "launcher"}), awful.key({ modkey }, "x", @@ -532,48 +486,6 @@ client.connect_signal("manage", function (c) end end) --- Add a titlebar if titlebars_enabled is set to true in the rules. -client.connect_signal("request::titlebars", function(c) - -- buttons for the titlebar - local buttons = gears.table.join( - awful.button({ }, 1, function() - client.focus = c - c:raise() - awful.mouse.client.move(c) - end), - awful.button({ }, 3, function() - client.focus = c - c:raise() - awful.mouse.client.resize(c) - end) - ) - - awful.titlebar(c) : setup { - { -- Left - awful.titlebar.widget.iconwidget(c), - buttons = buttons, - layout = wibox.layout.fixed.horizontal - }, - { -- Middle - { -- Title - align = "center", - widget = awful.titlebar.widget.titlewidget(c) - }, - buttons = buttons, - layout = wibox.layout.flex.horizontal - }, - { -- Right - awful.titlebar.widget.floatingbutton (c), - awful.titlebar.widget.maximizedbutton(c), - awful.titlebar.widget.stickybutton (c), - awful.titlebar.widget.ontopbutton (c), - awful.titlebar.widget.closebutton (c), - layout = wibox.layout.fixed.horizontal() - }, - layout = wibox.layout.align.horizontal - } -end) - -- Enable sloppy focus, so that focus follows mouse. client.connect_signal("mouse::enter", function(c) if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier diff --git a/home/.config/awesome/theme.lua b/home/.config/awesome/theme.lua new file mode 100644 index 0000000..067a13d --- /dev/null +++ b/home/.config/awesome/theme.lua @@ -0,0 +1,96 @@ +local theme_assets = require("beautiful.theme_assets") +local xresources = require("beautiful.xresources") +local dpi = xresources.apply_dpi + +local gfs = require("gears.filesystem") +local themes_path = gfs.get_themes_dir() + +local spawn = require("awful.spawn") +local utils = require("../utils") + +local theme = {} + +theme.font = "Terminess Powerline 8" + +theme.colors = {} +theme.colors.base03 = "#fdf6e3" +theme.colors.base02 = "#eee8d5" +theme.colors.base01 = "#93a1a1" +theme.colors.base00 = "#839496" +theme.colors.base0 = "#657b83" +theme.colors.base1 = "#586e75" +theme.colors.base2 = "#073642" +theme.colors.base3 = "#002b36" +theme.colors.yellow = "#b58900" +theme.colors.orange = "#cb4b16" +theme.colors.red = "#dc322f" +theme.colors.magenta = "#d33682" +theme.colors.violet = "#6c71c4" +theme.colors.blue = "#268bd2" +theme.colors.cyan = "#2aa198" +theme.colors.green = "#859900" + +theme.bg_normal = theme.colors.base3 +theme.bg_focus = theme.colors.base2 +theme.bg_urgent = theme.colors.red +theme.bg_minimize = "#303030" +theme.bg_systray = theme.bg_normal + +theme.fg_normal = theme.colors.base02 +theme.fg_focus = theme.colors.base03 +theme.fg_urgent = theme.colors.base3 +theme.fg_minimize = "#ffffff" + +theme.taglist_font = "Unifont 10" +theme.taglist_bg_focus = theme.colors.green + +theme.useless_gap = dpi(0) +theme.border_width = dpi(0) +theme.border_normal = "#000000" +theme.border_focus = "#535d6c" + +theme.wibar_height = 21 + +theme.tasklist_disable_icon = true + +-- Hotkeys popup (Mod+s) +theme.hotkeys_font = "Iosevka sbruder Bold 10" +theme.hotkeys_description_font = "Iosevka sbruder 10" +theme.hotkeys_modifiers_fg = theme.fg_normal + +theme.wallpaper = function(s) + if utils.file_exists(utils.home() .. ".fehbg") then + spawn({utils.home() .. ".fehbg"}) + end +end + +-- Generate taglist squares: +local taglist_square_size = dpi(4) +theme.taglist_squares_sel = theme_assets.taglist_squares_sel( + taglist_square_size, theme.fg_normal +) +theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel( + taglist_square_size, theme.fg_normal +) + +-- You can use your own layout icons like this: +theme.layout_fairh = themes_path .. "default/layouts/fairhw.png" +theme.layout_fairv = themes_path .. "default/layouts/fairvw.png" +theme.layout_floating = themes_path .. "default/layouts/floatingw.png" +theme.layout_magnifier = themes_path .. "default/layouts/magnifierw.png" +theme.layout_max = themes_path .. "default/layouts/maxw.png" +theme.layout_fullscreen = themes_path .. "default/layouts/fullscreenw.png" +theme.layout_tilebottom = themes_path .. "default/layouts/tilebottomw.png" +theme.layout_tileleft = themes_path .. "default/layouts/tileleftw.png" +theme.layout_tile = themes_path .. "default/layouts/tilew.png" +theme.layout_tiletop = themes_path .. "default/layouts/tiletopw.png" +theme.layout_spiral = themes_path .. "default/layouts/spiralw.png" +theme.layout_dwindle = themes_path .. "default/layouts/dwindlew.png" +theme.layout_cornernw = themes_path .. "default/layouts/cornernww.png" +theme.layout_cornerne = themes_path .. "default/layouts/cornernew.png" +theme.layout_cornersw = themes_path .. "default/layouts/cornersww.png" +theme.layout_cornerse = themes_path .. "default/layouts/cornersew.png" + +return theme + +-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/home/.config/awesome/utils.lua b/home/.config/awesome/utils.lua index 82cff04..6219c43 100644 --- a/home/.config/awesome/utils.lua +++ b/home/.config/awesome/utils.lua @@ -8,4 +8,13 @@ function utils.readfile(command) return text:gsub("^%s*(.-)%s*$", "%1") end +function utils.file_exists(name) + local f=io.open(name,"r") + if f~=nil then io.close(f) return true else return false end +end + +function utils.home() + return os.getenv("HOME") .. "/" +end + return utils