diff --git a/.gitignore b/.gitignore index 9cf0dc41..106ca561 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,13 @@ *.bak .~ local.lua + +runtest.sh +inspect.lua + +awful +beautiful.lua +gears +menubar +naughty.lua +wibox diff --git a/.gitmodules b/.gitmodules index fd95839f..2567a506 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ -[submodule "eminent"] - path = eminent +[submodule "third_party/eminent"] + path = third_party/eminent url = https://github.com/guotsuan/eminent.git branch = master diff --git a/CHANGELOG.txt b/CHANGELOG.txt deleted file mode 100644 index 36df844e..00000000 --- a/CHANGELOG.txt +++ /dev/null @@ -1,22 +0,0 @@ - -===== 0.4.355.1 ===== - -widgets: -- added 'advanced layout box' widget -- strip music widget output -- moved parser of untagged media for music widget to a separate module -- added cmus backend to music widget -- use la in cpu widget - -theming: -- added lcars_modern theme -- updated tango_dark, pokemon_dark and LCARS themes -- added hack for panel margin -- added generalized widget decorations -- placed some widgets inside decorated containers -- added icons for big floating titlebar - -fix: -- escape double quotes in async pipe receiver -- client menu on empty tag -- lots of minor fixes diff --git a/Meslo LG S Regular for Lcarsline.otf b/Meslo LG S Regular for Lcarsline.otf new file mode 100644 index 00000000..38945bcf Binary files /dev/null and b/Meslo LG S Regular for Lcarsline.otf differ diff --git a/README.md b/README.md index 1980f038..c5b83c37 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,41 @@ awesome_config ============== example of config/local.lua: https://gist.github.com/actionless/229eef7795915068bad9 + +### Default theme appearance: + +![Screenshot](http://fc08.deviantart.net/fs70/f/2014/213/7/0/monovedek_set_____by_actionless-d7sr317.png "Screenshot") + +### Keyboard widget appearance (with different themes) + +#### Monovedek theme with transparency and blur: + +![hotkeys_monovedek](http://i.imgur.com/auQdZC5.png "hotkeys_monovedek") + +#### Monovedek theme without transparency and blur: + +![hotkeys_monovedek](http://i.imgur.com/ygsVm7E.png "hotkeys_monovedek") + +#### "LCARS modern" theme without transparency and blur: + +![hotkeys_lm](http://i.imgur.com/t6XRD7m.png "hotkeys_lm") + +#### "LCARS xresources" with "jwr_dark" xresources theme without transparency and blur: + +![hotkeys_xjwr](http://i.imgur.com/y4o3vY0.png "hotkeys_xjwr") + +#### "Pokemon Light" theme without transparency and blur: + +![hotkeys_pokemon_light](http://i.imgur.com/hgijuIo.png "hotkeys_pokemon_light") + +#### "Pokemon Dark" theme without transparency and blur: + +![pokemon_dark](http://i.imgur.com/BWnzpfh.png?1 "pokemon_dark") + +#### "Gnome Noble Dark" theme without transparency and blur: + +![hotkeys_noble_dark](http://i.imgur.com/XfpBqrV.png "hotkeys_noble_dark") + +![noble_dark](http://i.imgur.com/AXGAT3Q.png "noble_dark") + + diff --git a/actionless.rc.lua b/actionless.rc.lua deleted file mode 100644 index 5ec66f1e..00000000 --- a/actionless.rc.lua +++ /dev/null @@ -1,45 +0,0 @@ --- localization -os.setlocale(os.getenv("LANG")) - -require("eminent") -local awful = require("awful") -require("awful.autofocus") -local naughty = require("naughty") -local beautiful = require("beautiful") -local status = { - widgets = {}, - menu = {}, - modkey = "Mod4", - altkey = "Mod1", - theme_dir = awful.util.getdir("config") .. "/themes/noble_dark/theme.lua", - config = { - net_preset = 'netctl-auto', - wlan_if = 'wlp12s0', - eth_if = 'enp0s25', - cpu_cores_num = 2, - }, - autorun = {}, -} - -pcall(function() - local local_config = require("config.local") - if local_config then - status = local_config.init(status) or status - end -end) -beautiful.init(status.theme_dir) - -local widget_config = require("actionless.config") -widget_config.init(status) - -local config = require("config") - -config.notify.init(status) -config.variables.init(status) -config.autorun.init(status) -config.layouts.init(status) -config.menus.init(status) -config.toolbar.init(status) -config.keys.init(status) -config.rules.init(status) -config.signals.init(status) diff --git a/actionless/async.lua b/actionless/async.lua index 12361758..bf59b096 100644 --- a/actionless/async.lua +++ b/actionless/async.lua @@ -1,9 +1,12 @@ +--[[ + Licensed under GNU General Public License v2 + 20?? Alexander Yakushev + 2014 Yauheni Kirylau +--]] + -- Asynchronous io.popen for Awesome WM. --- How to use... --- ...asynchronously: --- async.execute('wscript -Kiev', function(f) wwidget.text = f:read("*l") end) --- ...synchronously --- wwidget.text = async.demand('wscript -Kiev', 5):read("*l") or "Error" +-- How to use: +-- async.execute('echo hello!', function(str) widget.text = str end) local awful = require('awful') @@ -19,22 +22,6 @@ local function next_id() return string.format("%d", async.id_counter) end -function async.wait(seconds, callback) - local id = next_id() - async.request_table[id] = {callback = callback} - local req = string.format( - [[ bash -c 'sleep %s; - echo "async.deliver_timer(\"%s\")" | awesome-client' 2> /dev/null ]], - seconds, id) - awful.util.spawn_with_shell(req, false) - return id -end - -function async.deliver_timer(id) - async.request_table[id].callback() - async.request_table[id] = nil -end - -- Sends an asynchronous request for an output of the shell command. -- @param command Command to be executed and taken output from -- @param callback Function to be called when the command finishes @@ -48,8 +35,11 @@ function async.execute(command, callback) [[ echo async.pipe_multiline_done\(\"%q\", \""$(%s | %s)"\"\) | awesome-client; ]], - id, command:gsub('"','\"'), [[awk 1 ORS='\\\\n' | sed 's/"/\\"/g']] - )) --:-'")]])) that beardy smiley is helping my stupid syntax highlighter + --"]]-- syntax highlighter fix + id, + command:gsub('"','\"'), + [[awk 1 ORS='\\\\n' | sed 's/"/\\"/g']] + )) return id end @@ -60,69 +50,4 @@ function async.pipe_multiline_done(id, str) async.request_table[id] = nil end --- Sends an asynchronous request for an output of the shell command. --- @param command Command to be executed and taken output from --- @param callback Function to be called when the command finishes --- @return Request ID -function async.execute_iter(command, callback) - local id = next_id() - async.request_table[id] = { - callback = callback, - table = {}} - awful.util.spawn_with_shell(string.format( - [[ sh -c ' - %s | while read line; do - echo "async.pipe_consume(\"%q\", \"$line\")" | awesome-client; - done - echo "async.pipe_finish(\"%q\")" | awesome-client;' - ]], - string.gsub(command, "'", "'\\''"), id, id - )) - return id -end - --- Consumes command's output line by line --- @param id Request ID --- @param line The next line of the command's output -function async.pipe_consume(id, line) - if not async.request_table[id] then return end - async.request_table[id].table:insert(line) -end - --- Calls the remembered callback function on the output of the shell --- command. --- @param id Request ID -function async.pipe_finish(id) - if not async.request_table[id] then return end - async.request_table[id].callback( - async.request_table[id].table) - async.request_table[id] = nil -end - ------------------------------------------------------------------------------- - -async.folder = "/tmp/async" -async.file_template = async.folder .. '/req' --- Create a directory for asynchell response files -os.execute("mkdir -p " .. async.folder) - --- Sends a synchronous request for an output of the command. Waits for --- the output, but if the given timeout expires returns nil. --- @param command Command to be executed and taken output from --- @param timeout Maximum amount of time to wait for the result --- @return File handler on success, nil otherwise -function async.demand(command, timeout) - local id = next_id() - local tmpfname = async.file_template .. id - local f = io.popen(string.format( - [[ (%s > %s; echo async_done) & - (sleep %s; echo async_timeout) ]], - command, tmpfname, timeout)) - local result = f:read("*line") - if result == "async_done" then - return io.open(tmpfname) - end -end - - return async diff --git a/themes/ceti/theme.lua b/actionless/common_theme.lua similarity index 61% rename from themes/ceti/theme.lua rename to actionless/common_theme.lua index bb5b06d0..59258ff8 100644 --- a/themes/ceti/theme.lua +++ b/actionless/common_theme.lua @@ -1,73 +1,108 @@ -theme = {} - -themes_dir = os.getenv("HOME") .. "/.config/awesome/themes/ceti" -theme.dir = themes_dir -theme.wallpaper= themes_dir .. "/pattern.png" - -theme.fg = "#F5FBFF" -theme.alt_fg = "#a8a8a8" - -theme.bg = "#303942" -theme.alt_bg = "#a562b3" -theme.shiny = "#ffffff" - -theme.theme = "#265D8A" -theme.error = "#f92672" - -theme.border = "#000000" -theme.sel_border = "#d33862" -theme.titlebar = "#3c3c3c" -theme.titlebar_focus = "#66436C" - -theme.font = "DejaVu Sans Mono 9" ---theme.font = "Dina 8" ---theme.font = "Fira Mono 9" ---theme.font = "Meslo LG S 10" ---theme.font = "monoOne 10" ---theme.font = "PT Mono 8" ---theme.font = "Share Tech Mono 11" ---theme.font = "Source Code Pro Medium 9.4" ---theme.font = "tewi 9" - -theme.sans_font = "PT Sans 10" ---theme.sans_font = "Share Tech 11" ---theme.sans_font = "Source Sans Pro Regular 10" +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + +local common_theme = {} + +function common_theme.generate_theme(theme_dir, colors16, panel_colors) + +local theme = {} +theme.color = colors16 +theme.panel_colors = panel_colors +theme.dir = theme_dir + + +-- Use plain color: +theme.wallpaper_cmd = "hsetroot" +-- Use nitrogen: +--theme.wallpaper_cmd = "nitrogen --restore" +-- Use wallpaper tile: +--theme.wallpaper = theme.dir .. '/pattern.png' + +theme.show_widget_icon = false +theme.widget_decoration_arrl = '' +theme.widget_decoration_arrr = '' + +--Source*Pro: +--theme.font = "Source Code Pro Bold 10.5" +--theme.sans_font = "Source Sans Pro Bold 10.3" +--Meslo+Paratype: +--theme.font = "Meslo LG S for Lcarsline Bold 10.5" +--theme.sans_font = "PT Sans Bold 10.3" +-- use ~/.fonts.conf, Luke ;) +theme.font = "Monospace Bold 10.5" +theme.sans_font = "Sans Bold 10.3" +-- Don't use sans font: +--theme.sans_font = theme.font + +-- COLORS: + +theme.error = theme.color[9] +theme.warning = theme.color[10] +theme.color.err = theme.error +theme.color.warn = theme.warning + +theme.bg = theme.color.b +theme.alt_bg = theme.color[4] + +theme.fg = theme.color[7] +theme.alt_fg = theme.color.f +theme.shiny = theme.color.b + +theme.theme = theme.color[13] +theme.theme2 = theme.color[2] + +theme.border = theme.bg +theme.sel_border = theme.color[10] +theme.titlebar_border = theme.border +theme.titlebar_focus_border = theme.sel_border theme.fg_normal = theme.fg theme.bg_normal = theme.bg -theme.fg_focus = theme.fg +theme.fg_focus = theme.shiny theme.bg_focus = theme.theme theme.fg_urgent = theme.bg theme.bg_urgent = theme.error theme.screen_margin = 0 -theme.border_width = "12" +theme.border_width = "10" theme.border_normal = theme.border theme.border_focus = theme.sel_border theme.border_marked = theme.error -theme.panel_opacity = 1.0 +theme.panel_bg = theme.bg +theme.panel_fg = theme.fg +--theme.panel_opacity = 0.96 +theme.panel_opacity = 0.92 +theme.panel_height = 24 +theme.panel_margin = 3 +theme.panel_enbolden_details = false theme.taglist_font = theme.font -theme.taglist_fg_focus = theme.shiny -theme.taglist_bg_focus = theme.theme +theme.taglist_fg_occupied = theme.bg +theme.taglist_bg_occupied = theme.color[theme.panel_colors.taglist] +theme.taglist_fg_empty = theme.bg +theme.taglist_bg_empty = theme.theme +theme.taglist_fg_focus = theme.color[theme.panel_colors.taglist] +theme.taglist_bg_focus = theme.bg theme.tasklist_font = theme.sans_font -theme.tasklist_fg_focus = theme.fg +theme.tasklist_fg_focus = theme.alt_bg theme.tasklist_bg_focus = theme.bg theme.tasklist_fg_normal = theme.fg theme.tasklist_bg_normal = theme.bg theme.tasklist_fg_minimize = theme.bg -theme.tasklist_bg_minimize = "#818181" +theme.tasklist_bg_minimize = theme.alt_bg ---theme.titlebar_font = theme.sans_font -theme.titlebar_font = "PT Caption Bold 10.5" ---theme.titlebar_font = "Source Sans Pro Bold 10.5" -theme.titlebar_fg_focus = theme.shiny -theme.titlebar_fg_normal = theme.bg -theme.titlebar_bg_focus = theme.titlebar_focus -theme.titlebar_bg_normal = theme.titlebar +theme.titlebar_opacity = 0.7 +theme.titlebar_position = 'top' +theme.titlebar_font = theme.font +theme.titlebar_fg_focus = theme.tasklist_fg_focus +theme.titlebar_bg_focus = theme.bg +theme.titlebar_fg_normal = theme.tasklist_fg_normal +theme.titlebar_bg_normal = theme.bg theme.notification_opacity = 0.8 theme.notification_font = theme.sans_font @@ -84,24 +119,20 @@ theme.menu_border_width = "3" theme.menu_height = "16" theme.menu_width = "140" -theme.player_text = "#8d5f88" +theme.player_text = theme.color[13] -- ICONS -icons_dir = theme.dir .. "/icons/" +local icons_dir = theme.dir .. "/icons/" theme.icons_dir = icons_dir -theme.close_button = icons_dir .. "close.png" -theme.close_button_hover = icons_dir .. "close_hover.png" - -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" theme.menu_submenu_icon = icons_dir .. "submenu.png" + theme.taglist_squares_sel = icons_dir .. "square_sel.png" theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" -theme.arrl = icons_dir .. "arrl.png" +theme.small_separator = icons_dir .. "small_separator.png" theme.widget_ac = icons_dir .. "ac.png" theme.widget_ac_charging = icons_dir .. "ac_charging.png" @@ -123,6 +154,7 @@ theme.widget_net_searching = icons_dir .. "net_searching.png" theme.widget_music = icons_dir .. "note.png" theme.widget_music_on = icons_dir .. "note_on.png" +theme.widget_music_off = icons_dir .. "note_off.png" theme.widget_vol_high = icons_dir .. "vol_high.png" theme.widget_vol = icons_dir .. "vol.png" theme.widget_vol_low = icons_dir .. "vol_low.png" @@ -138,7 +170,7 @@ theme.tasklist_disable_icon = true --theme.tasklist_maximized_horizontal = "_" --theme.tasklist_maximized_vertical = "|" -layout_icons_dir = icons_dir .. "layout/" +local layout_icons_dir = icons_dir .. "layout/" theme.layout_icons_dir = layout_icons_dir theme.layout_tile = layout_icons_dir .. "tile.png" theme.layout_tilegaps = layout_icons_dir .. "tilegaps.png" @@ -154,7 +186,7 @@ theme.layout_fullscreen = layout_icons_dir .. "fullscreen.png" theme.layout_magnifier = layout_icons_dir .. "magnifier.png" theme.layout_floating = layout_icons_dir .. "floating.png" -titlebar_icons_dir = icons_dir .. "titlebar/" +local titlebar_icons_dir = icons_dir .. "titlebar/" theme.titlebar_icons_dir = titlebar_icons_dir theme.titlebar_close_button_focus = titlebar_icons_dir .. "/close_focus.png" theme.titlebar_close_button_normal = titlebar_icons_dir .. "/close_normal.png" @@ -185,3 +217,60 @@ theme.titlebar_minimize_button_focus_inactive = titlebar_icons_dir .. "/minimize theme.titlebar_minimize_button_normal_inactive = titlebar_icons_dir .. "/minimized_normal.png" return theme +end + + +function common_theme.generate_default_theme(theme_dir) +-- TERMINAL COLORSCHEME: +-- +color = {} +--black +color[0] = '#000000' +color[8] = '#465457' +--red +color[1] = '#960050' +color[9] = '#F92672' +--green +color[2] = '#008877' +color[10] = '#A6E22E' +--yellow +color[3] = '#FD971F' +color[11] = '#e6db74' +--blue +color[4] = '#7711dd' +color[12] = '#8432ff' +--purple +color[5] = '#890089' +color[13] = '#85509b' +--cyan +color[6] = '#00d6b5' +color[14] = '#51edbc' +--white +color[7] = '#888a85' +color[15] = '#ffffff' + +color.b = '#0e0021' +color.f = '#bcbcbc' +color.c = '#ae81ff' + +-- PANEL COLORS: +-- +panel_colors = { + taglist=7, + close=1, + tasklist='b', + media=14, + info=13 +} + +-- GENERATE DEFAULT THEME: +-- +return generate_theme( + theme_dir, + color, + panel_colors +) +end + + +return common_theme diff --git a/actionless/config.lua b/actionless/config.lua index da1e6f26..19f988fc 100644 --- a/actionless/config.lua +++ b/actionless/config.lua @@ -1,8 +1,8 @@ local config = {} -function config.init(status) +function config.init(awesome_context) - config.status = status + config.awesome = awesome_context end diff --git a/actionless/helpers.lua b/actionless/helpers.lua index 669c7420..a1cc877f 100644 --- a/actionless/helpers.lua +++ b/actionless/helpers.lua @@ -1,5 +1,5 @@ --[[ - Licensed under GNU General Public License v2 + Licensed under GNU General Public License v2 * (c) 2013-2014 Yauheni Kirylau * (c) 2013, Luke Bonham * (c) 2010-2012, Peter Hofmann @@ -10,15 +10,15 @@ local awful = require("awful") local capi = { timer = timer, client = client, mouse = mouse } -local beautiful = require("beautiful") +local beautiful = require("beautiful") -- helper functions for internal use local helpers = {} +helpers.font = string.match(beautiful.get().font or "monospace 8", "([%a, ]+) %d+") -helpers.font = string.match(beautiful.get().font, "([%a, ]+) %d+") helpers.dir = debug.getinfo(1, 'S').source:match[[^@(.*/).*$]] helpers.scripts_dir = helpers.dir .. 'scripts/' @@ -39,13 +39,40 @@ end helpers.timer_table = {} +function helpers.newinterval(name, timeout, fun, nostart) + local timer = capi.timer({ timeout = timeout }) + timer:connect_signal("timeout", patched_function) + timer:start() + if not nostart then + timer:emit_signal("timeout") + end + helpers.timer_table[name] = timer +end + function helpers.newtimer(name, timeout, fun, nostart) - helpers.timer_table[name] = capi.timer({ timeout = timeout }) - helpers.timer_table[name]:connect_signal("timeout", fun) - helpers.timer_table[name]:start() - if not nostart then - helpers.timer_table[name]:emit_signal("timeout") - end + local timer = capi.timer({ timeout = timeout }) + local patched_function = function(...) + timer:stop() + fun(...) + timer:again() + end + timer:connect_signal("timeout", patched_function) + timer:start() + if not nostart then + timer:emit_signal("timeout") + end + helpers.timer_table[name] = timer +end + +function helpers.newdelay(name, timeout, fun) + local timer = capi.timer({ timeout = timeout }) + local patched_function = function(...) + timer:stop() + fun(...) + end + timer:connect_signal("timeout", patched_function) + timer:start() + helpers.timer_table[name] = timer end -- }}} @@ -64,59 +91,6 @@ end -- }}} -function helpers.only_digits(str) - if not str then return nil end - return tonumber(str:match("%d+")) -end - -function helpers.split_string(str, sep) - local sep, fields = sep or ":", {} - local pattern = string.format("([^%s]+)", sep) - str:gsub(pattern, function(c) fields[#fields+1] = c end) - return fields -end - -function helpers.imerge(t, set) - for _, v in ipairs(set) do - table.insert(t, v) - end -end - -function helpers.getn(dict) - local num_items = 0 - for k,v in pairs(dict) do - num_items = num_items + 1 - end - return num_items -end - -function helpers.merge(t, set) - for k, v in pairs(set) do - t[k] = v - end -end - -function helpers.map_table_values(t, func) - for k, v in pairs(t) do - t[k] = func(v) - end -end - -function helpers.deepcopy(orig) - local orig_type = type(orig) - local copy - if orig_type == 'table' then - copy = {} - for orig_key, orig_value in next, orig, nil do - copy[helpers.deepcopy(orig_key)] = helpers.deepcopy(orig_value) - end - setmetatable(copy, helpers.deepcopy(getmetatable(orig))) - else -- number, string, boolean, etc - copy = orig - end - return copy -end - function helpers.run_once(cmd) local findme = cmd local firstspace = cmd:find(" ") @@ -134,35 +108,14 @@ function helpers.get_current_screen() end end -local xml_entity_names = { - ["'"] = "'", - ["\""] = """, - ["<"] = "<", - [">"] = ">", - ["&"] = "&" -} -function helpers.escape(result) - --return text and text:gsub("['&<>\"]", xml_entity_names) or nil - return result and result:gsub("[&<>\"]", xml_entity_names) or nil -end -function helpers.unicode_length(unicode_string) - local _, string_length = string.gsub(unicode_string, "[^\128-\193]", "") - return string_length -end - -function helpers.unicode_max_length(unicode_string, max_length) - if #unicode_string <= max_length then - return unicode_string - end - local result = '' - local counter = 0 - for uchar in string.gmatch(unicode_string, '([%z\1-\127\194-\244][\128-\191]*)') do - result = result .. uchar - counter = counter + 1 - if counter > max_length then break end +function helpers.client_floats(c) + local l = awful.layout.get(c.screen) + if awful.layout.getname(l) == 'floating' or awful.client.floating.get(c) then + return true end - return result + return false end + return helpers diff --git a/actionless/hotkeys.lua b/actionless/hotkeys.lua new file mode 100644 index 00000000..ae883be2 --- /dev/null +++ b/actionless/hotkeys.lua @@ -0,0 +1,269 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + +local capi = { screen = screen } +local awful = require("awful") +local wibox = require("wibox") +local beautiful = require("beautiful") + +local helpers = require("actionless.helpers") +local h_table = require("actionless.table") +local markup = require("actionless.markup") +local bordered_widget = require("actionless.widgets.common").bordered + +local APPEARANCE = { + width = 1400, + height = 600, + key_padding = 5, + key_margin = 5, + comment_font_size = 8, + comment_width_chars = 10, + pressed_color_group = 2, +} +local hotkeys = { + bindings = { + --[[ + Mod4 = { + Space = { + comment = 'app launcher', + group = 5 + }, + }, + --]] + }, + cached_keyboards = {}, + last_modifiers = nil, + last_visible = false, + popup = { + visible = false, + } +} +local KEYBOARD = { + { 'Escape', '#67', '#68', '#69', '#70', '#71', '#72', '#73', '#74', '#75', '#76', '#95', '#96', 'Home', 'End'}, + { '`', '#10', '#11', '#12', '#13', '#14', '#15', '#16', '#17', '#18', '#19', '#20', '#21', 'Insert', 'Delete' }, + { 'Tab', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 'Backspace' }, + { 'Caps', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', "'", '\\', 'Return' }, + { 'Shift', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 'Next', 'Up' , 'Prior' }, + { 'Fn', 'Control', 'Mod4', 'Mod1', '', 'space', '', '', 'Alt Gr', 'Print', 'Control', 'Left', 'Down', 'Right'}, +} +local KEYBOARD_LABELS = { + { 'Esc', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12', 'Home', 'End'}, + { '~', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 'Ins', 'Del'}, + { 'Tab', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 'BackSpc' }, + { 'Caps', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', "'", '\\', 'Enter' }, + { 'Shift', 'z', 'x', 'c', 'v', 'b', 'n', 'm', '<', '>', '?', 'PgUp', 'Up' , 'PgDn' }, + { 'Fn', 'Ctrl', 'Super', 'Alt', '', 'Space', '', '', 'Alt G', 'PrScr', 'Ctrl', 'Left', 'Down', 'Right'}, +} +local SPECIAL_KEYBUTTONS = { + 'Esc', + 'Tab', + 'Caps', + 'Shift', + 'Ctrl', + 'Super', + 'Alt', + 'Alt G', + 'PrScr', + 'PgUp', + 'PgDn', + 'BackSpc', + 'Enter', + 'Ins', + 'Del', + 'Home', + 'End', + 'F1', + 'F2', + 'F3', + 'F4', + 'F5', + 'F6', + 'F7', + 'F8', + 'F9', + 'F10', + 'F11', + 'F12', +} + +local MODIFIERS = { + Control = '#37' +} +local function keyname_to_keycode(keyname) + --[[ + by default modifier can't be binded as a hotkey, only as a modifier. + but it's possible to bind it if use it's keycode instead of alias, + like '#37' instead of 'Control' + --]] + for k, v in pairs(MODIFIERS) do + if k == keyname then return v end + end + return nil +end + +local function get_mod_table_name(modifiers) + local copied = h_table.deepcopy(modifiers) + table.sort(copied) + return table.concat(copied) +end + + +local function new_keybutton(key_label, comment, key_group) + local obj = {} + + local letter_widget = wibox.widget.textbox() + letter_widget:set_markup(markup.big( + key_label + )) + local comment_widget = wibox.widget.textbox() + comment_widget:set_font(helpers.font .. " " .. APPEARANCE.comment_font_size) + comment_widget:set_text(comment or '') + + local button_layout = wibox.layout.fixed.vertical() + button_layout:add(letter_widget) + button_layout:add(comment_widget) + + local button_widget = bordered_widget( + button_layout, { + padding = APPEARANCE.key_padding, + margin = APPEARANCE.key_margin, + }) + + local key_group_bg = nil + local key_group_fg = beautiful.bg + if key_group then + key_group_bg = beautiful.color[key_group] + elseif comment then + key_group_bg = beautiful.theme + elseif h_table.contains(SPECIAL_KEYBUTTONS, key_label) then + key_group_bg = "#333333" + key_group_fg = "#000000" + end + if key_group_bg then + button_widget:set_bg(key_group_bg) + button_widget:set_fg(key_group_fg) + end + + setmetatable(obj, { __index = button_widget }) + return obj +end + + +local function init_keyboard(modifiers) + local modifiers_table_name = get_mod_table_name(modifiers) + + for i, modifier in ipairs(modifiers) do + hotkeys.bindings[modifiers_table_name][modifier] = { + comment='pressed', + group=APPEARANCE.pressed_color_group, + } + end + + local keyboard_layout = wibox.layout.flex.vertical() + for i1, row in ipairs(KEYBOARD) do + local row_layout = wibox.layout.flex.horizontal() + for i2, key in ipairs(row) do + local hotkey_record = hotkeys.bindings[modifiers_table_name][key] or + { comment=nil, group=nil } + row_layout:add(new_keybutton( + KEYBOARD_LABELS[i1][i2], hotkey_record.comment, hotkey_record.group + )) + end + keyboard_layout:add(row_layout) + end + + return keyboard_layout +end + + +local function init_popup(modifiers) + local scrgeom = capi.screen[helpers.get_current_screen()].workarea + local width = APPEARANCE.width + local height = APPEARANCE.height + local x = (scrgeom.width - width) / 2 + local y = (scrgeom.height - height) / 2 + + local mywibox = wibox({ + ontop = true, + opacity = beautiful.notification_opacity, + }) + mywibox:geometry({ + x = x, + y = y, + height = height, + width = width, + }) + mywibox:set_widget( + bordered_widget(init_keyboard(modifiers), { + padding = APPEARANCE.key_padding, + margin = APPEARANCE.key_margin, + })) + + return mywibox +end + + +function hotkeys.init(awesome_context) + hotkeys.modkey = awesome_context.modkey + hotkeys.altkey = awesome_context.altkey +end + + +function hotkeys.key(modifiers, key, key_press_function, key_release_function, + comment, key_group) + local patched_key_press_function + + if key_press_function == 'show_help' then + -- {{ that needed if popup is called by modifier itself: + local modifiers_to_show = h_table.deepcopy(modifiers) + if h_table.contains_key(MODIFIERS, key) then + table.insert(modifiers_to_show, key) + key = keyname_to_keycode(key) + end + -- }} + patched_key_press_function = function() + hotkeys.show_by_modifiers(modifiers_to_show) + end + comment = "show this help" + else + patched_key_press_function = function(...) + hotkeys.popup.visible = false + hotkeys.last_visible = false + key_press_function(...) + end + end + + local mod_table = get_mod_table_name(modifiers) + if not hotkeys.bindings[mod_table] then hotkeys.bindings[mod_table] = {} end + hotkeys.bindings[mod_table][key] = { + comment=comment, + group=key_group, + } + + return awful.key(modifiers, key, patched_key_press_function, key_release_function) +end + +function hotkeys.on(modifiers, key, key_press_function, comment, key_group) + return hotkeys.key(modifiers, key, key_press_function, nil, comment, key_group) +end + +function hotkeys.show_by_modifiers(modifiers) + if hotkeys.last_modifiers ~= modifiers then + local mod_table = get_mod_table_name(modifiers) + if not hotkeys.cached_keyboards[mod_table] then + hotkeys.cached_keyboards[mod_table] = init_popup(modifiers) + end + local old_popup = hotkeys.popup + hotkeys.popup = hotkeys.cached_keyboards[mod_table] + hotkeys.popup.visible = true + old_popup.visible = false + else + hotkeys.popup.visible = not hotkeys.popup.visible + end + hotkeys.last_visible = hotkeys.popup.visible + hotkeys.last_modifiers = modifiers +end + +return hotkeys diff --git a/actionless/init.lua b/actionless/init.lua index 0c2ec565..33a95ebc 100644 --- a/actionless/init.lua +++ b/actionless/init.lua @@ -3,16 +3,17 @@ local actionless = { widgets = require("actionless.widgets"), -- awesome addons menu_addon = require("actionless.menu_addon"), - -- awesome forks - tasklist = require("actionless.tasklist"), - common_widget_with_margin = require("actionless.common_widget_with_margin"), + tasklist_addon = require("actionless.tasklist_addon"), -- lain markup = require("actionless.markup"), -- misc titlebar = require("actionless.titlebar"), helpers = require("actionless.helpers"), - settings = require("actionless.settings"), + table = require("actionless.table"), async = require("actionless.async"), + xresources = require("actionless.xresources"), + hotkeys = require("actionless.hotkeys"), + common_theme = require("actionless.common_theme"), } return actionless diff --git a/actionless/menu_addon.lua b/actionless/menu_addon.lua index b6c64da9..07eda9e4 100644 --- a/actionless/menu_addon.lua +++ b/actionless/menu_addon.lua @@ -8,7 +8,7 @@ local tags = require("awful.tag") local capi = { client = client } local escape_f = require("awful.util").escape -local table_merge = require("actionless.helpers").imerge +local table_add = require("actionless.table").add local menu_addon = { mt={} } @@ -37,16 +37,16 @@ function menu_addon.clients_on_tag(args, item_args) }) if item_args then if type(item_args) == "function" then - table_merge(cls_t[#cls_t], item_args(c)) + table_add(cls_t[#cls_t], item_args(c)) else - table_merge(cls_t[#cls_t], item_args) + table_add(cls_t[#cls_t], item_args) end end end end args = args or {} args.items = args.items or {} - table_merge(args.items, cls_t) + table_add(args.items, cls_t) local m = menu.new(args) m:show(args) diff --git a/actionless/parse.lua b/actionless/parse.lua index 75c8bcbb..8d76b0f7 100644 --- a/actionless/parse.lua +++ b/actionless/parse.lua @@ -1,8 +1,17 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + local helpers = require("actionless.helpers") +local h_table = require("actionless.table") +local h_string = require("actionless.string") + + local parse = {} function parse.string_to_lines(str) - return helpers.split_string(str, '\n') + return h_string.split(str, '\n') end function parse.lines_to_string(lines) @@ -65,7 +74,7 @@ end function parse.find_values_in_lines(lines, regex, match_keys, post_func) local key, value = nil, nil local result_values = {} - local match_keys_length = helpers.getn(match_keys) + local match_keys_length = h_table.getn(match_keys) for _, line in ipairs(lines) do if match_keys_length <= 0 then return result_values diff --git a/actionless/settings.lua b/actionless/settings.lua deleted file mode 100644 index 79cfe0a8..00000000 --- a/actionless/settings.lua +++ /dev/null @@ -1,10 +0,0 @@ -local settings = { - gtk3_app_classes = {} -} -settings.gtk3_app_classes["Transmission-gtk"] = true -settings.gtk3_app_classes["Gedit"] = true -settings.gtk3_app_classes["Gnome-terminal"] = true -settings.gtk3_app_classes["Gtk3-widget-factory"] = true -settings.gtk3_app_classes["Nautilus"] = true - -return settings diff --git a/actionless/string.lua b/actionless/string.lua new file mode 100644 index 00000000..2efc4000 --- /dev/null +++ b/actionless/string.lua @@ -0,0 +1,73 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + +-- helper functions for internal use +local string_helpers = {} + + +function string_helpers.only_digits(str) + if not str then return nil end + return tonumber(str:match("%d+")) +end + +function string_helpers.split(str, separator) + local separator, fields = separator or ":", {} + local pattern = string.format("([^%s]+)", separator) + str:gsub(pattern, function(c) fields[#fields+1] = c end) + return fields +end + +local xml_entity_names = { + ["'"] = "'", + ["\""] = """, + ["<"] = "<", + [">"] = ">", + ["&"] = "&" +} +function string_helpers.escape(str) + --return str and str:gsub("['&<>\"]", xml_entity_names) or nil + return str and str:gsub("[&<>\"]", xml_entity_names) or nil +end + +function string_helpers.getn(unicode_string) + local _, string_length = string.gsub(unicode_string, "[^\128-\193]", "") + return string_length +end + +function string_helpers.max_length(unicode_string, max_length) + if #unicode_string <= max_length then + return unicode_string + end + local result = '' + local counter = 0 + for uchar in string.gmatch(unicode_string, '([%z\1-\127\194-\244][\128-\191]*)') do + result = result .. uchar + counter = counter + 1 + if counter > max_length then break end + end + return result +end + +function string_helpers.multiline_limit(unicode_string, max_length) + if not unicode_string then return nil end + local result = '' + local line = '' + local counter = 0 + for uchar in string.gmatch(unicode_string, '([%z\1-\127\194-\244][\128-\191]*)') do + line = line .. uchar + counter = counter + 1 + if counter == max_length then + result = result .. line .. "\n" + line = '' + counter = 0 + end + end + if counter > 0 then + result = result .. line .. string.rep(' ', max_length - string_helpers.getn(line)) + end + return result +end + +return string_helpers diff --git a/actionless/table.lua b/actionless/table.lua new file mode 100644 index 00000000..b408c566 --- /dev/null +++ b/actionless/table.lua @@ -0,0 +1,106 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + + +-- helper functions for internal use +local table_helpers = {} + + +function table_helpers.merge(container, addition) + container = container or {} + addition = addition or {} + for key, value in pairs(addition) do + container[key] = value + end + return container +end + +function table_helpers.add(container, addition) + container = container or {} + addition = addition or {} + for index, value in pairs(addition) do + table.insert(container, value) + end + return container +end + +function table_helpers.getn(container_table) + local number_of_items = 0 + for key, value in pairs(container_table) do + number_of_items = number_of_items + 1 + end + return number_of_items +end + +function table_helpers.range(original_table, range_start, range_finish) + range_finish = range_finish or #table + local result = {} + for i=range_start,range_finish do + table.insert(result, original_table[i]) + end + return result +end + +function table_helpers.contains(container_table, desired_value) + for key, value in pairs(container_table) do + if value == desired_value then return true end + end + return false +end + +function table_helpers.contains_key(container_table, desired_key) + for key, value in pairs(container_table) do + if key == desired_key then return true end + end + return false +end + +function table_helpers.apply(container_table, func) + for key, value in pairs(container_table) do + container_table[key] = func(value) + end +end + +function table_helpers.map(container_table, func) + local result = {} + for key, value in pairs(container_table) do + result[key] = func(value) + end + return result +end + +function table_helpers.reduce(container_table, func) + local result + for key, value in pairs(container_table) do + result = func(result, value) + end + return result +end + +function table_helpers.deepcopy(obj) + if type(obj) == 'table' then + return setmetatable( + table_helpers.map( + obj, + function(value) return table_helpers.deepcopy(value) end + ), + table_helpers.deepcopy(getmetatable(obj)) + ) + else -- number, string, boolean, etc + return obj + end +end + +function table_helpers.sum(tables) + return table_helpers.reduce( + tables, + function(container, addition) + return table_helpers.add(container, addition) + end + ) +end + + +return table_helpers diff --git a/actionless/tasklist.lua b/actionless/tasklist.lua deleted file mode 100644 index ee2f94be..00000000 --- a/actionless/tasklist.lua +++ /dev/null @@ -1,288 +0,0 @@ ---------------------------------------------------------------------------- --- @author Julien Danjou <julien@danjou.info> --- @copyright 2008-2009 Julien Danjou --- @release v3.5.1 ---------------------------------------------------------------------------- - --- Grab environment we need -local capi = { screen = screen, - client = client } -local wibox = require("wibox") -local awful = require("awful") -local client = require("awful.client") -local util = require("awful.util") -local tag = require("awful.tag") -local flex = require("wibox.layout.flex") -local fixed = require("wibox.layout.fixed") -local beautiful = require("beautiful") - -local common = require("actionless.common_widget_with_margin") -local markup = require("actionless.markup") - ---- Tasklist widget module for awful --- awful.widget.tasklist -local tasklist = { mt = {} } - - --- Public structures -tasklist.filter = {} - -local function tasklist_label(c, args) - if not args then args = {} end - local theme = beautiful.get() - local fg_normal = args.fg_normal or theme.tasklist_fg_normal or theme.fg_normal - local bg_normal = args.bg_normal or theme.tasklist_bg_normal or theme.bg_normal - local fg_focus = args.fg_focus or theme.tasklist_fg_focus or theme.fg_focus - local bg_focus = args.bg_focus or theme.tasklist_bg_focus or theme.bg_focus - local fg_urgent = args.fg_urgent or theme.tasklist_fg_urgent or theme.fg_urgent - local bg_urgent = args.bg_urgent or theme.tasklist_bg_urgent or theme.bg_urgent - local fg_minimize = args.fg_minimize or theme.tasklist_fg_minimize or theme.fg_minimize - local bg_minimize = args.bg_minimize or theme.tasklist_bg_minimize or theme.bg_minimize - local bg_image_normal = args.bg_image_normal or theme.bg_image_normal - local bg_image_focus = args.bg_image_focus or theme.bg_image_focus - local bg_image_urgent = args.bg_image_urgent or theme.bg_image_urgent - local bg_image_minimize = args.bg_image_minimize or theme.bg_image_minimize - local tasklist_disable_icon = args.tasklist_disable_icon or theme.tasklist_disable_icon or false - local font = theme.tasklist_font or theme.font - local bg = nil - local text = "" - local name = "" - local bg_image = nil - - -- symbol to use to indicate certain client properties - local sticky = args.sticky or theme.tasklist_sticky or "▪" - local ontop = args.ontop or theme.tasklist_ontop or '⌃' - local floating = args.floating or theme.tasklist_floating or '✈' - local maximized_horizontal = args.maximized_horizontal or theme.tasklist_maximized_horizontal or '⬌' - local maximized_vertical = args.maximized_vertical or theme.tasklist_maximized_vertical or '⬍' - - if not theme.tasklist_plain_task_name then - if c.sticky then name = name .. sticky end - if c.ontop then name = name .. ontop end - if client.floating.get(c) then name = name .. floating end - if c.maximized_horizontal then name = name .. maximized_horizontal end - if c.maximized_vertical then name = name .. maximized_vertical end - end - - if c.minimized then - name = name .. (util.escape(c.icon_name) or util.escape(c.name) or util.escape("")) - else - name = name .. (util.escape(c.name) or util.escape("")) - end - if capi.client.focus == c then - bg = bg_focus - bg_image = bg_image_focus - if fg_focus then - text = text .. "".. - (beautiful.panel_enbolden_details - and markup.bold(name) - or name) - .."" - else - text = text .. "".. - (beautiful.panel_enbolden_details - and markup.bold(name) - or name) - .."" - end - elseif c.urgent and fg_urgent then - bg = bg_urgent - text = text .. ""..name.."" - bg_image = bg_image_urgent - elseif c.minimized and fg_minimize and bg_minimize then - bg = bg_minimize - text = text .. ""..name.."" - bg_image = bg_image_minimize - else - bg = bg_normal - text = text .. ""..name.."" - bg_image = bg_image_normal - end - text = text .. "" - return text, bg, bg_image, not tasklist_disable_icon and c.icon or nil -end - -local function tasklist_update(s, w, buttons, filter, data, style, update_function, right_margin) - local clients = {} - local capi_clients = capi.client.get() - if filter == tasklist.filter.focused_and_minimized_current_tags - then - for k, c in ipairs(capi_clients) do - if not (c.skip_taskbar or c.hidden - or c.type == "splash" or c.type == "dock" or c.type == "desktop" or awful.layout.get(c.screen) == awful.layout.suit.floating) - and tasklist.filter.focused(c, s) then - table.insert(clients, c) - end - end - for k, c in ipairs(capi_clients) do - if not (c.skip_taskbar or c.hidden - or c.type == "splash" or c.type == "dock" or c.type == "desktop") - and tasklist.filter.minimizedcurrenttags(c, s) then - table.insert(clients, c) - end - end - else - for k, c in ipairs(capi_clients) do - if not (c.skip_taskbar or c.hidden - or c.type == "splash" or c.type == "dock" or c.type == "desktop") - and filter(c, s) then - table.insert(clients, c) - end - end - end - - local function label(c) return tasklist_label(c, style) end - - update_function(w, buttons, label, data, clients, right_margin) -end - ---- Create a new tasklist widget. The last two arguments (update_function --- and base_widget) serve to customize the layout of the tasklist (eg. to --- make it vertical). For that, you will need to copy the --- awful.widget.common.list_update function, make your changes to it --- and pass it as update_function here. Also change the base_widget if the --- default is not what you want. --- @param screen The screen to draw tasklist for. --- @param filter Filter function to define what clients will be listed. --- @param buttons A table with buttons binding to set. --- @param style The style overrides default theme. --- @param update_function Optional function to create a tag widget on each --- update. @see awful.widget.common. --- @param base_widget Optional container widget for tag widgets. Default --- is wibox.layout.flex.horizontal(). --- bg_normal The background color for unfocused client. --- fg_normal The foreground color for unfocused client. --- bg_focus The background color for focused client. --- fg_focus The foreground color for focused client. --- bg_urgent The background color for urgent clients. --- fg_urgent The foreground color for urgent clients. --- bg_minimize The background color for minimized clients. --- fg_minimize The foreground color for minimized clients. --- floating Symbol to use for floating clients. --- ontop Symbol to use for ontop clients. --- maximized_horizontal Symbol to use for clients that have been horizontally maximized. --- maximized_vertical Symbol to use for clients that have been vertically maximized. --- font The font. -function tasklist.new(screen, filter, buttons, resize, style, update_function, base_widget) - local uf = update_function or common.list_update - local right_margin = 3 - if resize == 'fixed' then - f_layout = fixed.horizontal() - else - f_layout = flex.horizontal() - end - local w = base_widget or f_layout - - local data = setmetatable({}, { __mode = 'k' }) - local u = function () tasklist_update(screen, w, buttons, filter, data, style, uf, right_margin) end - tag.attached_connect_signal(screen, "property::selected", u) - tag.attached_connect_signal(screen, "property::activated", u) - capi.client.connect_signal("property::urgent", u) - capi.client.connect_signal("property::sticky", u) - capi.client.connect_signal("property::ontop", u) - capi.client.connect_signal("property::floating", u) - capi.client.connect_signal("property::maximized_horizontal", u) - capi.client.connect_signal("property::maximized_vertical", u) - capi.client.connect_signal("property::minimized", u) - capi.client.connect_signal("property::name", u) - capi.client.connect_signal("property::icon_name", u) - capi.client.connect_signal("property::icon", u) - capi.client.connect_signal("property::skip_taskbar", u) - capi.client.connect_signal("property::screen", u) - capi.client.connect_signal("property::hidden", u) - capi.client.connect_signal("tagged", u) - capi.client.connect_signal("untagged", u) - capi.client.connect_signal("unmanage", u) - capi.client.connect_signal("list", u) - capi.client.connect_signal("focus", u) - capi.client.connect_signal("unfocus", u) - u() - return w -end - ---- Filtering function to include all clients. --- @param c The client. --- @param screen The screen we are drawing on. --- @return true -function tasklist.filter.allscreen(c, screen) - return true -end - ---- Filtering function to include the clients from all tags on the screen. --- @param c The client. --- @param screen The screen we are drawing on. --- @return true if c is on screen, false otherwise -function tasklist.filter.alltags(c, screen) - -- Only print client on the same screen as this widget - return c.screen == screen -end - ---- Filtering function to include only the clients from currently selected tags. --- @param c The client. --- @param screen The screen we are drawing on. --- @return true if c is in a selected tag on screen, false otherwise -function tasklist.filter.currenttags(c, screen) - -- Only print client on the same screen as this widget - if c.screen ~= screen then return false end - -- Include sticky client too - if c.sticky then return true end - local tags = tag.gettags(screen) - for k, t in ipairs(tags) do - if t.selected then - local ctags = c:tags() - for _, v in ipairs(ctags) do - if v == t then - return true - end - end - end - end - return false -end - ---- Filtering function to include only the minimized clients from currently selected tags. --- @param c The client. --- @param screen The screen we are drawing on. --- @return true if c is in a selected tag on screen and is minimized, false otherwise -function tasklist.filter.minimizedcurrenttags(c, screen) - -- Only print client on the same screen as this widget - if c.screen ~= screen then return false end - -- Check client is minimized - if not c.minimized then return false end - -- Include sticky client - if c.sticky then return true end - local tags = tag.gettags(screen) - for k, t in ipairs(tags) do - -- Select only minimized clients - if t.selected then - local ctags = c:tags() - for _, v in ipairs(ctags) do - if v == t then - return true - end - end - end - end - return false -end - ---- Filtering function to include only the currently focused client. --- @param c The client. --- @param screen The screen we are drawing on. --- @return true if c is focused on screen, false otherwise -function tasklist.filter.focused(c, screen) - -- Only print client on the same screen as this widget - return c.screen == screen and capi.client.focus == c -end - -function tasklist.filter.focused_and_minimized_current_tags(c, screen) - return "it's a mock for tasklist_update" -end - -function tasklist.mt:__call(...) - return tasklist.new(...) -end - -return setmetatable(tasklist, tasklist.mt) - --- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/actionless/common_widget_with_margin.lua b/actionless/tasklist_addon.lua similarity index 80% rename from actionless/common_widget_with_margin.lua rename to actionless/tasklist_addon.lua index 511a6cf4..7db5cd5b 100644 --- a/actionless/common_widget_with_margin.lua +++ b/actionless/tasklist_addon.lua @@ -1,20 +1,22 @@ --------------------------------------------------------------------------- -- @author Julien Danjou <julien@danjou.info> -- @copyright 2008-2009 Julien Danjou --- @release v3.5.5 +-- 2013-2014 Yauhen Kirylau --------------------------------------------------------------------------- -- Grab environment we need -local capi = { button = button } +local capi = { button = button, + client = client } local util = require("awful.util") +local tag = require("awful.tag") local wibox = require("wibox") local imagebox = require("wibox.widget.imagebox") local textbox = require("wibox.widget.textbox") ---- Common utilities for awful widgets -local common = {} +--- Additions for awful tasklist widget +local tasklist_addon = {} -function common.create_buttons(buttons, object) +function tasklist_addon.create_buttons(buttons, object) if buttons then local btns = {} for kb, b in ipairs(buttons) do @@ -32,9 +34,9 @@ function common.create_buttons(buttons, object) end end -function common.list_update(w, buttons, label, data, objects, right_margin) +function tasklist_addon.list_update(w, buttons, label, data, objects, spacing_length) -- update the widgets, creating them if needed - right_margin = right_margin or 0 + spacing_length = spacing_length or 3 w:reset() for i, o in ipairs(objects) do local cache = data[o] @@ -59,13 +61,13 @@ function common.list_update(w, buttons, label, data, objects, right_margin) -- And all of this gets a background bgb:set_widget(l) - bgb:buttons(common.create_buttons(buttons, o)) + bgb:buttons(tasklist_addon.create_buttons(buttons, o)) data[o] = { ib = ib, tb = tb, bgb = bgb, - m = m + m = m, } end @@ -80,15 +82,13 @@ function common.list_update(w, buttons, label, data, objects, right_margin) end bgb:set_bgimage(bg_image) ib:set_image(icon) - if right_margin and i~=1 then - local delimiter = wibox.layout.margin(bgb, right_margin, 0) - w:add(delimiter) - else - w:add(bgb) + if spacing_length then + bgb = wibox.layout.margin(bgb, spacing_length, 0) end + w:add(bgb) end end -return common +return tasklist_addon -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/actionless/titlebar.lua b/actionless/titlebar.lua index c4e43412..3e38cdb9 100644 --- a/actionless/titlebar.lua +++ b/actionless/titlebar.lua @@ -1,10 +1,14 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + local awful = require("awful") local client = client local wibox = require("wibox") local beautiful = require("beautiful") local widgets = require("actionless.widgets") -local settings = require("actionless.settings") local titlebar = {} @@ -36,9 +40,6 @@ end function titlebar.make_titlebar(c) c.border_color = beautiful.titlebar_focus_border - if settings.gtk3_app_classes[c.class] then - return - end -- buttons for the titlebar local buttons = awful.util.table.join( awful.button({ }, 1, function() diff --git a/actionless/widgets/alsa.lua b/actionless/widgets/alsa.lua index 4f717c92..d8f5b595 100644 --- a/actionless/widgets/alsa.lua +++ b/actionless/widgets/alsa.lua @@ -1,5 +1,5 @@ --[[ - Licensed under GNU General Public License v2 + Licensed under GNU General Public License v2 * (c) 2013-2014, Yauhen Kirylau * (c) 2013, Luke Bonham * (c) 2010, Adrian C. @@ -26,8 +26,7 @@ local function worker(args) local args = args or {} local color_n = args.color_n or 1 - alsa.widget = decorated_widget({ - left = args.left, right = args.right, color_n = color_n }) + alsa.widget = decorated_widget(args) alsa.widget:buttons(awful.util.table.join( awful.button({ }, 1, function () alsa.toggle() end), awful.button({ }, 5, function () alsa.down() end), @@ -102,13 +101,13 @@ local function worker(args) function alsa.update_indicator() if alsa.volume.status == "off" then - alsa.widget:set_color('warn') + alsa.widget:set_color({color_n='warn'}) alsa.widget:set_image(beautiful.widget_vol_mute) elseif alsa.volume.level == 0 then - alsa.widget:set_color('err') + alsa.widget:set_color({color_n='err'}) alsa.widget:set_image(beautiful.widget_vol_no) else - alsa.widget:set_color(color_n) + alsa.widget:set_color({color_n=color_n, fg=args.fg}) if alsa.volume.level <= 50 then alsa.widget:set_image(beautiful.widget_vol_low) elseif alsa.volume.level <= 75 then diff --git a/actionless/widgets/bat.lua b/actionless/widgets/bat.lua index 1c650800..e1834654 100644 --- a/actionless/widgets/bat.lua +++ b/actionless/widgets/bat.lua @@ -9,6 +9,7 @@ local beautiful = require("beautiful") local async = require("actionless.async") local helpers = require("actionless.helpers") +local h_string = require("actionless.string") local parse = require("actionless.parse") local common_widget = require("actionless.widgets.common").widget @@ -42,7 +43,7 @@ local function worker(args) state='state', on_low_battery='on-low-battery' } ) - bat.now.percentage = helpers.only_digits(bat.now.percentage) + bat.now.percentage = h_string.only_digits(bat.now.percentage) bat.widget:set_markup( string.format("%-4s", bat.now.percentage .. "%")) @@ -56,8 +57,8 @@ local function worker(args) elseif bat.now.state == 'charging' then if bat.now.percentage < 30 then bat.widget:set_image(beautiful.widget_ac_charging_low) - bat.widget:set_bg(beautiful.theme) - bat.widget:set_fg(bg) + bat.widget:set_bg(beautiful.warning) + bat.widget:set_fg(fg) else bat.widget:set_image(beautiful.widget_ac_charging) bat.widget:set_bg(bg) @@ -68,10 +69,10 @@ local function worker(args) if bat.now.on_low_battery == 'yes' then bat.widget:set_image(beautiful.widget_battery_empty) bat.widget:set_bg(beautiful.error) - bat.widget:set_fg(bg) + bat.widget:set_fg(fg) elseif bat.now.percentage < 30 then bat.widget:set_image(beautiful.widget_battery_low) - bat.widget:set_bg(beautiful.theme) + bat.widget:set_bg(beautiful.warning) bat.widget:set_fg(fg) else bat.widget:set_image(beautiful.widget_battery) diff --git a/actionless/widgets/calendar.lua b/actionless/widgets/calendar.lua index be6461de..56fb5a87 100644 --- a/actionless/widgets/calendar.lua +++ b/actionless/widgets/calendar.lua @@ -1,5 +1,5 @@ --[[ - Licensed under GNU General Public License v2 + Licensed under GNU General Public License v2 * (c) 2013, Luke Bonham --]] diff --git a/actionless/widgets/common.lua b/actionless/widgets/common.lua index ca55a36e..ef155ba9 100644 --- a/actionless/widgets/common.lua +++ b/actionless/widgets/common.lua @@ -1,70 +1,28 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + local wibox = require("wibox") local beautiful = require("beautiful") -local awful = require("awful") local config = require("actionless.config") -beautiful.init(config.status.theme_dir) - +local helpers = require("actionless.helpers") +local h_table = require("actionless.table") +beautiful.init(config.awesome.theme_dir) -local common = {} - -function common.make_text_separator(separator_character, bg, fg) - --'' .. separator_character .. '')) - local fg = fg or beautiful.panel_fg - local widget = wibox.widget.background() - if separator_character == 'sq' then - separator_character = ' ' - function widget:set_fg(...) widget:set_bg(...) end - else - local bg = bg or beautiful.panel_bg - widget:set_bg(bg) - end - widget:set_fg(fg) - widget:set_widget(wibox.widget.textbox(separator_character)) - return widget -end -function common.make_image_separator(image_name, bg) - local bg = bg or beautiful.panel_bg - local widget = wibox.widget.background() - widget:set_bg(bg) - local image_widget = wibox.widget.imagebox(beautiful[image_name]) - image_widget:set_resize(false) - widget:set_widget(image_widget) - return widget +local function get_color(color_n) + return beautiful.color[color_n] end -function common.make_separator(separator_id) - if separator_id == 'arrl' or separator_id == 'arrr' then - if beautiful.widget_use_text_decorations then - return common.make_text_separator( - beautiful['widget_decoration_' .. separator_id]) - else - return common.make_image_separator(separator_id) - end - elseif separator_id == 'separator' then - return common.make_text_separator(' ') - end -end -function common.set_separator_color(widget, separator_id, color_id) - if separator_id == 'arrl' or separator_id == 'arrr' then - if beautiful.widget_use_text_decorations then - widget:set_fg( - beautiful['color' .. color_id]) - else - widget.widget:set_image( - beautiful[separator_id .. color_id]) - end - else - widget:set_bg( - beautiful['color' .. color_id]) - end -end +local common = {} -function common.widget(force_show_icon) - local show_icon = force_show_icon or beautiful.show_widget_icon +function common.widget(args) + args = args or {} + local show_icon = args.force_show_icon or beautiful.show_widget_icon local widget = {} widget.text_widget = wibox.widget.textbox('') @@ -108,54 +66,157 @@ function common.widget(force_show_icon) end +function common.centered(widget) + if not widget then widget=wibox.widget.background() end + local centered_widget = {} + centered_widget.widget = widget + + local horizontal_align = wibox.layout.align.horizontal() + horizontal_align:set_second(widget) + local vertical_align = wibox.layout.align.vertical() + vertical_align:set_second(horizontal_align) + + setmetatable(centered_widget, { __index = centered_widget.widget }) + return setmetatable(centered_widget, { __index = vertical_align }) +end + + +function common.bordered(widget, args) + if not widget then return nil end + local margin = args.margin or 0 + local padding = args.padding or 0 + local obj = {} + + obj.padding = wibox.layout.margin() + obj.padding:set_widget(widget) + obj.padding:set_margins(padding) + + obj.background = wibox.widget.background() + obj.background:set_widget(obj.padding) + + obj.margin = wibox.layout.margin() + obj.margin:set_widget(obj.background) + obj.margin:set_margins(margin) + + setmetatable(obj, { __index = obj.margin }) + function obj:set_bg(...) + obj.background:set_bg(...) + end + + function obj:set_fg(...) + obj.background:set_fg(...) + end + return obj +end + + +function common.make_separator(separator_character, args) + local separator_alias = beautiful['widget_decoration_' .. separator_character] + if separator_alias then + return common.make_separator(separator_alias, args) + end + + args = args or {} + local bg = args.bg + local fg = args.fg or get_color(args.color_n) or beautiful.fg + local inverted = args.inverted or false + + if separator_character == 'sq' then + separator_character = ' ' + inverted = not inverted + end + + local widget = wibox.widget.background() + if inverted then + widget.set_fg, widget.set_bg = widget.set_bg, widget.set_fg + end + widget:set_bg(bg) + widget:set_fg(fg) + widget:set_widget(wibox.widget.textbox(separator_character)) + return widget +end + +function common.make_image_separator(image_path, args) + args = args or {} + local bg = args.bg + + local widget = wibox.widget.background() + local separator_widget = wibox.widget.imagebox(image_path) + separator_widget:set_resize(false) + widget:set_bg(bg) + widget:set_widget(separator_widget) + return widget +end + + function common.decorated(args) - local args = args or {} - local left_separators = {} - local right_separators = {} - --if beautiful.show_widget_decorations then - left_separators = args.left or { 'arrl' } - right_separators = args.right or { 'arrr' } - --end - local color_n = args.color_n - - local decorated = {} - decorated.widget = args.widget or common.widget() + local decorated = { + left_separator_widgets = {}, + widget_list = {}, + right_separator_widgets = {}, + } + + args = args or {} + local fg = args.fg or get_color(args.color_n) + local bg = args.bg or beautiful.panel_bg + local widget_inverted = args.widget_inverted + if widget_inverted then + args.inverted = widget_inverted + end + local left_separators = args.left_separators or { 'arrl' } + local right_separators = args.right_separators or { 'arrr' } + + if args.widget then + decorated.widget_list = {args.widget} + else + decorated.widget_list = args.widgets + or {common.widget(args)} + end + + decorated.widget = decorated.widget_list[1] decorated.wibox = wibox.layout.fixed.horizontal() - local separator for _, separator_id in ipairs(left_separators) do - separator = common.make_separator(separator_id) + local separator = common.make_separator(separator_id, args) + table.insert(decorated.left_separator_widgets, separator) decorated.wibox:add(separator) end - decorated.wibox:add(decorated.widget) + for _, each_widget in ipairs(decorated.widget_list) do + decorated.wibox:add(each_widget) + end for _, separator_id in ipairs(right_separators) do - separator = common.make_separator(separator_id) + local separator = common.make_separator(separator_id, args) + table.insert(decorated.right_separator_widgets, separator) decorated.wibox:add(separator) end - function decorated:set_color(color_id) - local widget - for i, separator_id in ipairs(left_separators) do - common.set_separator_color( - decorated.wibox.widgets[i], - separator_id, - color_id) - end - for i, separator_id in ipairs(right_separators) do - common.set_separator_color( - decorated.wibox.widgets[#left_separators + 1 + i], - separator_id, - color_id) - end - if self.widget.set_fg then - self.widget:set_bg(beautiful['color' .. color_id]) - self.widget:set_fg(beautiful.colorb) + setmetatable(decorated.wibox, { __index = decorated.widget }) + setmetatable(decorated, { __index = decorated.wibox }) + function decorated:set_color(args) + args = args or {} + local fg = args.fg or get_color(args.color_n) + local bg = args.bg or beautiful.panel_bg + for _, widget in ipairs(h_table.sum({ + self.left_separator_widgets, + self.widget_list, + self.right_separator_widgets + })) do + if widget_inverted then + if bg and widget.set_fg then + widget:set_fg(bg) end + if fg and widget.set_bg then + widget:set_bg(fg) end + else + if fg and widget.set_fg then + widget:set_fg(fg) end + if bg and widget.set_bg then + widget:set_bg(bg) end + end end end - if color_n then decorated:set_color(color_n) end - setmetatable(decorated.wibox, { __index = decorated.widget }) - return setmetatable(decorated, { __index = decorated.wibox }) + decorated:set_color({fg=fg, bg=bg}) + return decorated end diff --git a/actionless/widgets/cpu.lua b/actionless/widgets/cpu.lua index f5491a28..f2763c99 100644 --- a/actionless/widgets/cpu.lua +++ b/actionless/widgets/cpu.lua @@ -1,7 +1,7 @@ --[[ - Licensed under GNU General Public License v2 + Licensed under GNU General Public License v2 * (c) 2013-2014, Yauheni Kirylau --]] diff --git a/actionless/widgets/layoutbox.lua b/actionless/widgets/layoutbox.lua index 8b27c167..6b4a3da9 100644 --- a/actionless/widgets/layoutbox.lua +++ b/actionless/widgets/layoutbox.lua @@ -2,6 +2,7 @@ -- @author Julien Danjou <julien@danjou.info> -- @copyright 2009 Julien Danjou -- @release v3.5.5 +-- @ 2013-2014 Yauhen Kirylau --------------------------------------------------------------------------- local setmetatable = setmetatable @@ -18,22 +19,6 @@ local helpers = require("actionless.helpers") local decorated = require("actionless.widgets.common").decorated --- Layoutbox widget "class". -local layoutbox = { mt = {} } -function layoutbox:update_layout() - local layout = layout.getname(layout.get(self.screen)) - self.layout.widget:set_image(layout and beautiful["layout_" .. layout]) -end -function layoutbox:update_nmaster(t) - self.n_master.widget:set_text(tag.getnmaster(t)) -end -function layoutbox:update_ncol(t) - self.n_col.widget:set_text(tag.getncol(t)) -end -function layoutbox:update_all(t) - self:update_layout() - self:update_nmaster(t) - self:update_ncol(t) -end --- Create a layoutbox widget. It draws a picture with the current layout @@ -41,48 +26,63 @@ end -- @param screen The screen number that the layout will be represented for. -- @return An imagebox widget configured as a layoutbox. function worker(args) + + local layoutbox = { mt = {} } + local args = args or {} - local fg = args.fg or beautiful.fg - local bg = args.bg or beautiful.bg - local object = helpers.deepcopy(layoutbox) - object.screen = args.screen or 1 + local color_n = args.color_n or 'f' + local bg = args.bg or beautiful.color[color_n] + local fg = args.fg or beautiful.panel_bg + layoutbox.screen = args.screen or 1 + + layoutbox.n_master = wibox.widget.background() + layoutbox.n_master:set_widget(textbox()) + layoutbox.layout = wibox.widget.background() + layoutbox.layout:set_widget(imagebox()) + layoutbox.n_col = wibox.widget.background() + layoutbox.n_col:set_widget(textbox()) - object.n_master = wibox.widget.background() - object.n_master:set_fg(fg) - object.n_master:set_bg(bg) - object.n_master:set_widget(textbox()) - object.layout = wibox.widget.background() - object.layout:set_fg(fg) - object.layout:set_bg(bg) - object.layout:set_widget(imagebox()) - object.n_col = wibox.widget.background() - object.n_col:set_fg(fg) - object.n_col:set_bg(bg) - object.n_col:set_widget(textbox()) + layoutbox.widget = decorated({ + widgets={ + layoutbox.n_master, layoutbox.layout, layoutbox.n_col + }, + color_n = color_n, + widget_inverted=true, + }) - object.widget = wibox.layout.fixed.horizontal() - object.widget:add(object.n_master) - object.widget:add(object.layout) - object.widget:add(object.n_col) - object.widget = decorated({ widget=object.widget }) + function layoutbox:update_layout() + local layout = layout.getname(layout.get(self.screen)) + self.layout.widget:set_image(layout and beautiful["layout_" .. layout]) + end + function layoutbox:update_nmaster(t) + self.n_master.widget:set_text(tag.getnmaster(t)) + end + function layoutbox:update_ncol(t) + self.n_col.widget:set_text(tag.getncol(t)) + end + function layoutbox:update_all(t) + self:update_layout() + self:update_nmaster(t) + self:update_ncol(t) + end - object:update_all(nil) + layoutbox:update_all(nil) tag.attached_connect_signal( - object.screen, "property::selected", - function(t) object:update_all(t) end) + layoutbox.screen, "property::selected", + function(t) layoutbox:update_all(t) end) tag.attached_connect_signal( - object.screen, "property::layout", - function(t) object:update_layout() end) + layoutbox.screen, "property::layout", + function(t) layoutbox:update_layout() end) tag.attached_connect_signal( - object.screen, "property::ncol", - function(t) object:update_ncol(t) end) + layoutbox.screen, "property::ncol", + function(t) layoutbox:update_ncol(t) end) tag.attached_connect_signal( - object.screen, "property::nmaster", - function(t) object:update_nmaster(t) end) - return setmetatable(object, { __index = object.widget }) + layoutbox.screen, "property::nmaster", + function(t) layoutbox:update_nmaster(t) end) + return setmetatable(layoutbox, { __index = layoutbox.widget }) end -return setmetatable(layoutbox, { __call = function(_, ...) return worker(...) end }) +return setmetatable({}, { __call = function(_, ...) return worker(...) end }) -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/actionless/widgets/manage_client.lua b/actionless/widgets/manage_client.lua index a571d3e2..f64084da 100644 --- a/actionless/widgets/manage_client.lua +++ b/actionless/widgets/manage_client.lua @@ -1,5 +1,5 @@ --[[ - Licensed under GNU General Public License v2 + Licensed under GNU General Public License v2 * (c) 2013-2014, Yauheni Kirylau --]] @@ -35,12 +35,14 @@ local function worker(args) "mouse::leave", function () manage_client.widget:set_image(beautiful.close_button) end) else manage_client.widget.text_widget:set_text(' x ') - manage_client.widget = common.decorated({widget=manage_client.widget}) - manage_client.widget:set_color(args.color_n or 1) + manage_client.widget = common.decorated({ + widget=manage_client.widget, bg=bg, widget_inverted=true, + }) + manage_client.widget:set_color({color_n=args.color_n or 1}) manage_client.widget:connect_signal( - "mouse::enter", function () manage_client.widget:set_color('err') end) + "mouse::enter", function () manage_client.widget:set_color({color_n='err'}) end) manage_client.widget:connect_signal( - "mouse::leave", function () manage_client.widget:set_color(args.color_n or 1) end) + "mouse::leave", function () manage_client.widget:set_color({color_n=args.color_n or 1}) end) end manage_client.widget:buttons(awful.util.table.join( diff --git a/actionless/widgets/mem.lua b/actionless/widgets/mem.lua index 6339cb49..106c4380 100644 --- a/actionless/widgets/mem.lua +++ b/actionless/widgets/mem.lua @@ -1,5 +1,5 @@ --[[ - Licensed under GNU General Public License v2 + Licensed under GNU General Public License v2 * (c) 2013-2014, Yauheni Kirylau * (c) 2013, Luke Bonham * (c) 2010-2012, Peter Hofmann diff --git a/actionless/widgets/music/backends/clementine.lua b/actionless/widgets/music/backends/clementine.lua index cc204314..d196559a 100644 --- a/actionless/widgets/music/backends/clementine.lua +++ b/actionless/widgets/music/backends/clementine.lua @@ -6,69 +6,69 @@ local awful = require("awful") local async = require("actionless.async") -local helpers = require("actionless.helpers") +local h_table = require("actionless.table") local parse = require("actionless.parse") -local clementine = {} -clementine.player_status = {} -clementine.cover_path = "/tmp/playercover.png" +local dbus_cmd = "qdbus org.mpris.MediaPlayer2.clementine " + +local clementine = { + player_status = {}, +} -function clementine.init(parse_status_callback) - clementine.parse_status_callback = parse_status_callback -end ------------------------------------------------------------------------------- function clementine.toggle() - awful.util.spawn_with_shell( - "qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 PlayPause") + awful.util.spawn_with_shell(dbus_cmd .. "/org/mpris/MediaPlayer2 PlayPause") end function clementine.next_song() - awful.util.spawn_with_shell( - "qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 Next") + awful.util.spawn_with_shell(dbus_cmd .. "/org/mpris/MediaPlayer2 Next") end function clementine.prev_song() - awful.util.spawn_with_shell( - "qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 Previous") + awful.util.spawn_with_shell(dbus_cmd .. "/org/mpris/MediaPlayer2 Previous") end ------------------------------------------------------------------------------- -function clementine.update() +function clementine.update(parse_status_callback) async.execute( - "qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 PlaybackStatus", - function(str) clementine.post_update(str) end) + dbus_cmd .. " /org/mpris/MediaPlayer2 PlaybackStatus", + function(str) clementine.post_update(str, parse_status_callback) end + ) end ------------------------------------------------------------------------------- -function clementine.post_update(str) +function clementine.post_update(result_string, parse_status_callback) clementine.player_status = {} local state = nil - if str:match("Playing") then + if result_string:match("Playing") then state = 'play' - elseif str:match("Paused") then + elseif result_string:match("Paused") then state = 'pause' end clementine.player_status.state = state - if state == 'play' or state == 'pause' - then + if state == 'play' or state == 'pause' then async.execute( - "qdbus org.mpris.MediaPlayer2.clementine /Player GetMetadata", - function(str) clementine.parse_metadata(str) end) + dbus_cmd .. "/Player GetMetadata", + function(str) clementine.parse_metadata(str, parse_status_callback) end + ) else - clementine.parse_status_callback(clementine.player_status) + parse_status_callback(clementine.player_status) end end ------------------------------------------------------------------------------- -function clementine.parse_metadata(str) +function clementine.parse_metadata(result_string, parse_status_callback) local player_status = parse.find_values_in_string( - str, "([%w]+): (.*)$", { - file='location', + result_string, + "([%w]+): (.*)$", + { file='location', artist='artist', title='title', album='album', date='year', - cover='arturl'}) - helpers.merge(clementine.player_status, player_status) - clementine.parse_status_callback(clementine.player_status) + cover='arturl' + } + ) + h_table.merge(clementine.player_status, player_status) + parse_status_callback(clementine.player_status) end return clementine diff --git a/actionless/widgets/music/backends/cmus.lua b/actionless/widgets/music/backends/cmus.lua index 78b2d714..57531998 100644 --- a/actionless/widgets/music/backends/cmus.lua +++ b/actionless/widgets/music/backends/cmus.lua @@ -7,25 +7,11 @@ local awful = require("awful") local string = { format = string.format, match = string.match } -local helpers = require("actionless.helpers") local parse = require("actionless.parse") local async = require("actionless.async") -local cmus = { - player_status = {}, -} +local cmus = {} -function cmus.init(args, - parse_status_callback, notification_callback) - local args = args or {} - cmus.music_dir = args.music_dir or os.getenv("HOME") .. "/Music" - cmus.host = args.host or "127.0.0.1" - cmus.port = args.port or "6600" - cmus.password = args.password or [[""]] - - cmus.parse_status_callback = parse_status_callback - cmus.notification_callback = notification_callback -end ------------------------------------------------------------------------------- function cmus.toggle() awful.util.spawn_with_shell( @@ -42,49 +28,37 @@ function cmus.prev_song() "cmus-remote --prev") end ------------------------------------------------------------------------------- -function cmus.update() - async.execute - ( +function cmus.update(parse_status_callback) + async.execute( "cmus-remote --query", function(str) - cmus.parse_metadata(str) + cmus.parse_metadata(str, parse_status_callback) end ) end ------------------------------------------------------------------------------- -function cmus.parse_metadata(str) - cmus.player_status = {} +function cmus.parse_metadata(result_string, parse_status_callback) + local player_status = {} local state = nil - if str:match("status playing") then + if result_string:match("status playing") then state = 'play' - elseif str:match("status paused") then + elseif result_string:match("status paused") then state = 'pause' end if state then - cmus.player_status = parse.find_values_in_string( - str, "([%w]+) (.*)$", { + player_status = parse.find_values_in_string( + result_string, "([%w]+) (.*)$", { file='file', artist='Artist', title='Title', album='Album', date='Date'}) end - cmus.player_status.state = state + player_status.state = state - cmus.parse_status_callback(cmus.player_status) + parse_status_callback(player_status) end ------------------------------------------------------------------------------- -function cmus.resize_cover(cover_size, default_art) - async.execute(string.format( - "%s %q %q %d %q", - cmus.cover_script, - cmus.music_dir, - cmus.player_status.file, - cover_size, - default_art), - function(f) cmus.notification_callback() end) -end - return cmus diff --git a/actionless/widgets/music/backends/init.lua b/actionless/widgets/music/backends/init.lua index 8bedb568..fb00cd64 100644 --- a/actionless/widgets/music/backends/init.lua +++ b/actionless/widgets/music/backends/init.lua @@ -1,7 +1,8 @@ local backends = { mpd = require("actionless.widgets.music.backends.mpd"), cmus = require("actionless.widgets.music.backends.cmus"), - clementine = require("actionless.widgets.music.backends.clementine") + clementine = require("actionless.widgets.music.backends.clementine"), + spotify = require("actionless.widgets.music.backends.spotify"), } return backends diff --git a/actionless/widgets/music/backends/mpd.lua b/actionless/widgets/music/backends/mpd.lua index b8fe5366..f8a40f07 100644 --- a/actionless/widgets/music/backends/mpd.lua +++ b/actionless/widgets/music/backends/mpd.lua @@ -11,39 +11,35 @@ local helpers = require("actionless.helpers") local parse = require("actionless.parse") local async = require("actionless.async") -local mpd = { - player_status = {}, - cover_script = helpers.scripts_dir .. "mpdcover" -} -function mpd.init(args, - parse_status_callback, notification_callback) +local mpd = {} + +cover_script = helpers.scripts_dir .. "mpdcover" + +function mpd.init(args) local args = args or {} mpd.music_dir = args.music_dir or os.getenv("HOME") .. "/Music" mpd.host = args.host or "127.0.0.1" mpd.port = args.port or "6600" mpd.password = args.password or [[""]] - - mpd.parse_status_callback = parse_status_callback - mpd.notification_callback = notification_callback end ------------------------------------------------------------------------------- function mpd.toggle() awful.util.spawn_with_shell( - "mpc toggle || ncmpcpp toggle || ncmpc toggle || pms toggle") + "mpc toggle || ncmpcpp toggle") end function mpd.next_song() awful.util.spawn_with_shell( - "mpc next || ncmpcpp next || ncmpc next || pms next") + "mpc next || ncmpcpp next") end function mpd.prev_song() awful.util.spawn_with_shell( - "mpc prev || ncmpcpp prev || ncmpc prev || pms prev") + "mpc prev || ncmpcpp prev") end ------------------------------------------------------------------------------- -function mpd.update() +function mpd.update(parse_status_callback) async.execute( [[mpc --format "file:%file% Artist:%artist% @@ -51,42 +47,47 @@ function mpd.update() Album:%album% Date:%date%"]], -- "function( -- <==workaround for syntax highlighter :) @TODO - function(str) mpd.parse_metadata(str) end) + function(str) mpd.parse_metadata(str, parse_status_callback) end) end ------------------------------------------------------------------------------- -function mpd.parse_metadata(str) - mpd.player_status = {} +function mpd.parse_metadata(result_string, parse_status_callback) + local player_status = {} local state = nil - if str:match("%[playing%]") then + if result_string:match("%[playing%]") then state = 'play' - elseif str:match("%[paused%]") then + elseif result_string:match("%[paused%]") then state = 'pause' end if state then - mpd.player_status = parse.find_values_in_string( - str, "([%w]+):(.*)$", { + player_status = parse.find_values_in_result_stringing( + result_string, "([%w]+):(.*)$", { file='file', artist='Artist', title='Title', album='Album', date='Date'}) end - mpd.player_status.state = state + player_status.state = state - mpd.parse_status_callback(mpd.player_status) + parse_status_callback(player_status) end ------------------------------------------------------------------------------- -function mpd.resize_cover(cover_size, default_art) - async.execute(string.format( - "%s %q %q %d %q", - mpd.cover_script, - mpd.music_dir, - mpd.player_status.file, - cover_size, - default_art), - function(f) mpd.notification_callback() end) +function mpd.resize_cover( + player_status, cover_size, default_art, notification_callback +) + async.execute( + string.format( + "%s %q %q %d %q", + cover_script, + mpd.music_dir, + player_status.file, + cover_size, + default_art + ), + function(f) notification_callback() end + ) end return mpd diff --git a/actionless/widgets/music/backends/spotify.lua b/actionless/widgets/music/backends/spotify.lua new file mode 100644 index 00000000..1dc50a88 --- /dev/null +++ b/actionless/widgets/music/backends/spotify.lua @@ -0,0 +1,88 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014, Yauheni Kirylau +--]] + +local awful = require("awful") + +local async = require("actionless.async") +local h_table = require("actionless.table") +local parse = require("actionless.parse") + +-- @TODO: change to native dbus implementation instead of calling qdbus +local dbus_cmd = "qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 " + +local spotify = { + player_status = {}, +} + +------------------------------------------------------------------------------- +function spotify.toggle() + awful.util.spawn_with_shell(dbus_cmd .. "PlayPause") +end + +function spotify.next_song() + awful.util.spawn_with_shell(dbus_cmd .. "Next") +end + +function spotify.prev_song() + awful.util.spawn_with_shell(dbus_cmd .. "Previous") +end +------------------------------------------------------------------------------- +function spotify.update(parse_status_callback) + async.execute( + dbus_cmd .. "PlaybackStatus", + function(str) spotify.post_update(str, parse_status_callback) end + ) +end +------------------------------------------------------------------------------- +function spotify.post_update(result_string, parse_status_callback) + spotify.player_status = {} + local state = nil + if result_string:match("Playing") then + state = 'play' + elseif result_string:match("Paused") then + state = 'pause' + end + spotify.player_status.state = state + if state == 'play' or state == 'pause' then + async.execute( + dbus_cmd .. "Metadata", + function(str) spotify.parse_metadata(str, parse_status_callback) end + ) + else + parse_status_callback(spotify.player_status) + end +end +------------------------------------------------------------------------------- +function spotify.parse_metadata(result_string, parse_status_callback) + local player_status = parse.find_values_in_string( + result_string, + "([%w]+): (.*)$", + { artist='artist', + title='title', + album='album', + date='contentCreated', + cover_url='artUrl' + } + ) + player_status.file = 'spotify stream' + h_table.merge(spotify.player_status, player_status) + parse_status_callback(spotify.player_status) +end + +------------------------------------------------------------------------------- +function spotify.resize_cover( + player_status, cover_size, output_coverart_path, notification_callback +) + async.execute( + string.format( + "wget %s -O %s", + player_status.cover_url, + output_coverart_path + ), + function(f) notification_callback() end + ) +end + +return spotify diff --git a/actionless/widgets/music/tag_parser.lua b/actionless/widgets/music/tag_parser.lua index 55f428e0..979e151e 100644 --- a/actionless/widgets/music/tag_parser.lua +++ b/actionless/widgets/music/tag_parser.lua @@ -1,3 +1,8 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + --local N_A = "N/A" local N_A = nil @@ -27,6 +32,13 @@ local tag_parser = {} return player_status end +------------------------------------------------------------------------------- + if not player_status.artist or not player_status.title then + -- @TODO: rewrite this big piece of whatever it is + -- + --local inspect = require("inspect") + --naughty.notify({text=inspect(player_status)}) + local a --1 a = player_status.file:match("^.*[/](.*)[/]%d+[-%. ].*[/]") @@ -65,7 +77,7 @@ local tag_parser = {} end --2 end --1 - local f = player_status.file:match('.*/(.*)$') + local f = player_status.file:match('.*/(.*)$') or '' local t = player_status.title or f local new_t = '' naughty.notify({text=t}) @@ -106,6 +118,9 @@ local tag_parser = {} player_status.artist = a end + end -- +------------------------------------------------------------------------------ + -- let's insert placeholders for all the missing fields for _, k in ipairs({ 'file', 'locationartist', 'title', 'album', 'date', 'cover', 'artist', diff --git a/actionless/widgets/music/widget.lua b/actionless/widgets/music/widget.lua index d8fb77dd..290453c5 100644 --- a/actionless/widgets/music/widget.lua +++ b/actionless/widgets/music/widget.lua @@ -11,7 +11,7 @@ local string = { format = string.format } local setmetatable = setmetatable local helpers = require("actionless.helpers") -local escape_f = helpers.escape +local h_string = require("actionless.string") local common_widget = require("actionless.widgets.common").widget local markup = require("actionless.markup") local async = require("actionless.async") @@ -21,9 +21,28 @@ local tag_parser = require("actionless.widgets.music.tag_parser") -- player infos -local player = {id=nil} -player.cover = "/tmp/playercover.png" -player.widget = common_widget() +local player = { + widget=common_widget(), + id=nil, + cmd=nil, + player_status = { + state=nil, + title=nil, + artist=nil, + album=nil, + date=nil, + file=nil + }, + cover="/tmp/awesome_cover.png" +} + +local parse_status_callback = function(player_status) + player.parse_status(player_status) +end + +local show_notification_callback = function() + player.show_notification() +end local function worker(args) local args = args or {} @@ -41,34 +60,32 @@ local function worker(args) local text_color = beautiful.player_text or fg or beautiful.fg_normal - local parse_status_callback = function(player_status) - player.parse_status(player_status) - end - local show_notification_callback = function() - player.show_notification() - end + --[[ + music player backends: + + backend should have methods: + * .toggle () + * .next_song () + * .prev_song () + * .update (parse_status_callback) + optional: + * .init(args) + * .resize_cover(coversize, default_art, show_notification_callback) + --]] if backend_name == 'mpd' then player.backend = backends.mpd - player.backend.init( - args, - parse_status_callback, - show_notification_callback) + player.backend.init(args) player.cmd = args.player_cmd or 'st -e ncmpcpp' - elseif backend_name == 'cmus' then player.backend = backends.cmus - player.backend.init( - args, - parse_status_callback, - show_notification_callback) player.cmd = args.player_cmd or 'st -e cmus' - elseif backend_name == 'clementine' then player.backend = backends.clementine - player.backend.init( - parse_status_callback) player.cmd = args.player_cmd or 'clementine' + elseif backend_name == 'spotify' then + player.backend = backends.spotify + player.cmd = args.player_cmd or 'spotify' end helpers.set_map("current player track", nil) @@ -142,7 +159,7 @@ local function worker(args) )) ------------------------------------------------------------------------------- function player.update() - player.backend.update() + player.backend.update(parse_status_callback) end ------------------------------------------------------------------------------- function player.parse_status(player_status) @@ -154,19 +171,19 @@ local function worker(args) if player_status.state == "play" then -- playing - artist = player_status.artist - title = player_status.title + artist = player_status.artist or "playing" + title = player_status.title or " " player.widget:set_image(beautiful.widget_music_on) - if #player_status.artist + #player_status.title > 40 then - if #player_status.artist > 15 then - artist = helpers.unicode_max_length(player_status.artist, 15) .. "…" + if #artist + #title > 40 then + if #artist > 15 then + artist = h_string.max_length(artist, 15) .. "…" end if #player_status.title > 25 then - title = helpers.unicode_max_length(player_status.title, 25) .. "…" + title = h_string.max_length(title, 25) .. "…" end end - artist = markup.fg.color(text_color, escape_f(artist)) - title = escape_f(title) + artist = markup.fg.color(text_color, h_string.escape(artist)) + title = h_string.escape(title) -- playing new song if player_status.title ~= helpers.get_map("current player track") then helpers.set_map("current player track", player_status.title) @@ -210,18 +227,27 @@ local function worker(args) end ------------------------------------------------------------------------------- function player.resize_cover() + -- backend supports it: if player.backend.resize_cover then - return player.backend.resize_cover(cover_size, default_art) + return player.backend.resize_cover( + player.player_status, cover_size, player.cover, show_notification_callback + ) end + -- fallback: local resize = string.format('%sx%s', cover_size, cover_size) + if not player.player_status.cover then + player.player_status.cover = default_art + end async.execute( string.format( [[convert %q -thumbnail %q -gravity center -background "none" -extent %q %q]], player.player_status.cover, resize, resize, - player.cover), - function(f) player.show_notification() end) + player.cover + ), + function(f) player.show_notification() end + ) end ------------------------------------------------------------------------------- helpers.newtimer("player", update_interval, player.update) @@ -232,5 +258,6 @@ return setmetatable( player, { __call = function(_, ...) return worker(...) - end } + end + } ) diff --git a/actionless/widgets/netctl.lua b/actionless/widgets/netctl.lua index eeceef84..5201d6cc 100644 --- a/actionless/widgets/netctl.lua +++ b/actionless/widgets/netctl.lua @@ -1,5 +1,5 @@ --[[ - Licensed under GNU General Public License v2 + Licensed under GNU General Public License v2 * (c) 2013-2014, Yauheni Kirylau --]] @@ -94,7 +94,7 @@ local function worker(args) function netctl.netctl_auto_update() async.execute( - 'netctl-auto current', + 'sudo netctl-auto current', function(str) if #str ~= 0 then netctl.interface = netctl.wlan_if diff --git a/actionless/widgets/systray_toggle.lua b/actionless/widgets/systray_toggle.lua index 5670ac67..f0ae3410 100644 --- a/actionless/widgets/systray_toggle.lua +++ b/actionless/widgets/systray_toggle.lua @@ -18,7 +18,7 @@ local setmetatable = setmetatable local error = error local abs = math.abs -local async = require("actionless.async") +local helpers = require("actionless.helpers") --- widgets.systray_toggle local systray_toggle = { mt = {}, arrow=false, popup=false } @@ -40,14 +40,17 @@ function systray_toggle.initialize() local systray = systray_widget() local flayout = wibox.layout.flex.horizontal() flayout:add(systray) - local lmargin = wibox.layout.margin(wibox.widget.textbox(''), - systray_toggle.geometry['lmargin'], 0, - systray_toggle.geometry['tmargin'], systray_toggle.geometry['bmargin'] - ) - local rmargin = wibox.layout.margin(wibox.widget.textbox(''), - 0, systray_toggle.geometry['rmargin'], - systray_toggle.geometry['tmargin'], systray_toggle.geometry['bmargin'] - ) + local sg = systray_toggle.geometry + local lmargin = wibox.layout.margin( + wibox.widget.textbox(''), + sg['lmargin'], 0, + sg['tmargin'], sg['bmargin'] + ) + local rmargin = wibox.layout.margin( + wibox.widget.textbox(''), + 0, sg['rmargin'], + sg['tmargin'], sg['bmargin'] + ) local layout = wibox.layout.align.horizontal() layout:set_left(lmargin) layout:set_middle(flayout) @@ -60,7 +63,7 @@ function systray_toggle.initialize() end function systray_toggle.check() - async.wait(0.3, systray_toggle.post_check) + helpers.newdelay('systray_toggle', 0.3, systray_toggle.post_check) end function systray_toggle.post_check() if not systray_toggle.popup and not systray_toggle.arrow then @@ -108,7 +111,7 @@ local function worker(args) systray_toggle.scrgeom = capi.screen[scr].workarea systray_toggle.geometry = { scr = scr, - icon_size = 24, + icon_size = 32, x = systray_toggle.scrgeom.width - 350 , y = 18, lmargin = 5, diff --git a/actionless/xresources.lua b/actionless/xresources.lua new file mode 100644 index 00000000..345ea885 --- /dev/null +++ b/actionless/xresources.lua @@ -0,0 +1,60 @@ +--[[ + Licensed under GNU General Public License v2 + * (c) 2014 Yauheni Kirylau +--]] + +local os = os +local parse = require("actionless.parse") + +local xresources = {} + +function xresources.read(path) + path = path or os.getenv("HOME") .. "/.Xresources" + local result = parse.find_values_in_file( + path, + ".*%*(.*):[%s%t]+(.*)", + { + color0='color0', + color1='color1', + color2='color2', + color3='color3', + color4='color4', + color5='color5', + color6='color6', + color7='color7', + color8='color8', + color9='color9', + color10='color10', + color11='color11', + color12='color12', + color13='color13', + color14='color14', + color15='color15', + background='background', + foreground='foreground', + cursorColor='cursorColor', + colorUL='colorUL', + underlineColor='underlineColor' + } + ) + return result +end + +function xresources.get_theme(xresources_table) + local result = {} + for i = 0, 15 do + result[i] = xresources_table['color' .. tostring(i)] + end + result.b = xresources_table.background + result.f = xresources_table.foreground + result.c = xresources_table.colorUL + return result +end + +function xresources.read_theme(path) + return xresources.get_theme( + xresources.read(path) + ) +end + +return xresources diff --git a/config/autorun.lua b/config/autorun.lua index f604c430..818cf7d8 100644 --- a/config/autorun.lua +++ b/config/autorun.lua @@ -5,23 +5,25 @@ local run_once = require("actionless.helpers").run_once local autorun = {} -function autorun.init(status) - - ---awful.util.spawn_with_shell("eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg)") ---awful.util.spawn_with_shell("/home/lie/.screenlayout/awesome.sh") -awful.util.spawn_with_shell("redshift") -awful.util.spawn_with_shell("xset r rate 250 25") -awful.util.spawn_with_shell("xset b off") ---run_once(status.cmds.compositor) -run_once("dropboxd") ---run_once("xscreensaver -no-splash") -run_once("unclutter") -run_once("gxkb") - -for _, item in ipairs(status.autorun) do - awful.util.spawn_with_shell(item) -end +function autorun.init(awesome_context) + + --awful.util.spawn_with_shell("eval $(gnome-keyring-daemon -s --components=pkcs11,secrets,ssh,gpg)") + --awful.util.spawn_with_shell("/home/lie/.screenlayout/awesome.sh") + --run_once("redshift") + awful.util.spawn_with_shell("xset r rate 250 25") + awful.util.spawn_with_shell("xset b off") + --run_once(awesome_context.cmds.compositor) + run_once("start-pulseaudio-x11") + run_once("xfce4-power-manager") + run_once("dropboxd") + --run_once("xscreensaver -no-splash") + run_once("unclutter") + run_once("gxkb") + + for _, item in ipairs(awesome_context.autorun) do + awful.util.spawn_with_shell(item) + end end + return autorun diff --git a/config/init.lua b/config/init.lua index 9895f176..16fbe420 100644 --- a/config/init.lua +++ b/config/init.lua @@ -7,7 +7,8 @@ local config = { toolbar = require("config.toolbar"), keys = require("config.keys"), rules = require("config.rules"), - signals = require("config.signals") + signals = require("config.signals"), + widgets = require("config.widgets") } return config diff --git a/config/keys.lua b/config/keys.lua index d1cda7aa..51ba112c 100644 --- a/config/keys.lua +++ b/config/keys.lua @@ -1,382 +1,651 @@ local awful = require("awful") -local wibox = require("wibox") -local beautiful = require("beautiful") local menubar = require("menubar") -local capi = { screen = screen } local client = client -local root = root -local awesome = awesome +local capi = { + screen = screen, + client = client, + root = root, + awesome = awesome, +} local widgets = require("actionless.widgets") local helpers = require("actionless.helpers") local titlebar = require("actionless.titlebar") local menu_addon = require("actionless.menu_addon") +local floats = require("actionless.helpers").client_floats +local hk = require("actionless.hotkeys") + + local keys = {} +function keys.init(awesome_context) + +hk.init(awesome_context) +local modkey = awesome_context.modkey +local altkey = awesome_context.altkey +local cmd = awesome_context.cmds -function keys.init(status) +local RESIZE_STEP = 15 -local modkey = status.modkey -local altkey = status.altkey +local TO_DEFINE_COLOR = nil -local cmd = status.cmds +local TAG_COLOR = 4 +local CLIENT_COLOR = 3 +local MENU_COLOR = 5 +local IMPORTANT_COLOR = 9 +local CLIENT_MANIPULATION = 10 +local LAYOUT_MANIPULATION = 12 -- {{{ Mouse bindings -root.buttons(awful.util.table.join( - awful.button({ }, 3, function () status.menu.mainmenu:toggle() end), - awful.button({ }, 5, awful.tag.viewnext), - awful.button({ }, 4, awful.tag.viewprev) +capi.root.buttons(awful.util.table.join( + awful.button({ }, 3, function () awesome_context.menu.mainmenu:toggle() end), + awful.button({ }, 5, awful.tag.viewnext), + awful.button({ }, 4, awful.tag.viewprev) )) -- }}} + -- {{{ Key bindings local globalkeys = awful.util.table.join( - awful.key({ modkey, "Control" }, "t", - function() status.widgets.systray_toggle.toggle() end), - awful.key({ modkey, "Control" }, "s", - function() helpers.run_once("xscreensaver-command -lock") end), - - awful.key({ modkey, }, ",", - function() - awful.tag.viewprev(helpers.get_current_screen()) - end), - awful.key({ modkey, }, ".", - function() - awful.tag.viewnext(helpers.get_current_screen()) - end), - awful.key({ modkey, }, "Escape", - awful.tag.history.restore), - - -- By direction screen focus - awful.key({ modkey, }, "Next", - function() - awful.screen.focus_relative(1) - end), - awful.key({ modkey, }, "Prior", - function() - awful.screen.focus_relative(-1) - end), - - -- By direction client focus - awful.key({ modkey, }, "Down", - function() - awful.client.focus.bydirection("down") - if client.focus then client.focus:raise() end - end), - awful.key({ modkey }, "Up", - function() - awful.client.focus.bydirection("up") - if client.focus then client.focus:raise() end - end), - awful.key({ modkey }, "Left", - function() - awful.client.focus.bydirection("left") - if client.focus then client.focus:raise() end - end), - awful.key({ modkey }, "Right", - function() - awful.client.focus.bydirection("right") - if client.focus then client.focus:raise() end - end), - - -- By direction client swap - awful.key({ modkey, "Shift" }, "Down", - function() - awful.client.swap.bydirection("down") - if client.swap then client.swap:raise() end - end), - awful.key({ modkey, "Shift" }, "Up", - function() - awful.client.swap.bydirection("up") - if client.swap then client.swap:raise() end - end), - awful.key({ modkey, "Shift" }, "Left", - function() - awful.client.swap.bydirection("left") - if client.swap then client.swap:raise() end - end), - awful.key({ modkey, "Shift" }, "Right", - function() - awful.client.swap.bydirection("right") - if client.swap then client.swap:raise() end - end), - - -- Client resize - awful.key({ modkey, "Control" }, "Right", - function () awful.tag.incmwfact( 0.05) end), - awful.key({ modkey, "Control" }, "Left", - function () awful.tag.incmwfact(-0.05) end), - awful.key({ modkey, "Control" }, "Down", - function () awful.client.incwfact(-0.05) end), - awful.key({ modkey, "Control" }, "Up", - function () awful.client.incwfact( 0.05) end), - - -- Layout tuning - awful.key({ modkey, altkey }, "Down", - function () awful.tag.incnmaster(-1) end), - awful.key({ modkey, altkey }, "Up", - function () awful.tag.incnmaster( 1) end), - awful.key({ modkey, altkey }, "Left", - function () awful.tag.incncol(-1) end), - awful.key({ modkey, altkey }, "Right", - function () awful.tag.incncol( 1) end), - - -- By direction client focus (VIM style) - awful.key({ modkey }, "j", - function() - awful.client.focus.bydirection("down") - if client.focus then client.focus:raise() end - end), - awful.key({ modkey }, "k", - function() - awful.client.focus.bydirection("up") - if client.focus then client.focus:raise() end - end), - awful.key({ modkey }, "h", - function() - awful.client.focus.bydirection("left") - if client.focus then client.focus:raise() end - end), - awful.key({ modkey }, "l", - function() - awful.client.focus.bydirection("right") - if client.focus then client.focus:raise() end - end), - - -- By direction client swap (VIM style) - awful.key({ modkey, "Shift" }, "j", - function() - awful.client.swap.bydirection("down") - if client.swap then client.swap:raise() end - end), - awful.key({ modkey, "Shift" }, "k", - function() - awful.client.swap.bydirection("up") - if client.swap then client.swap:raise() end - end), - awful.key({ modkey, "Shift" }, "h", - function() - awful.client.swap.bydirection("left") - if client.swap then client.swap:raise() end - end), - awful.key({ modkey, "Shift" }, "l", - function() - awful.client.swap.bydirection("right") - if client.swap then client.swap:raise() end - end), - - -- Client resize (VIM style) - awful.key({ modkey, "Control" }, "l", - function () awful.tag.incmwfact( 0.05) end), - awful.key({ modkey, "Control" }, "h", - function () awful.tag.incmwfact(-0.05) end), - awful.key({ modkey, "Control" }, "j", - function () awful.client.incwfact(-0.05) end), - awful.key({ modkey, "Control" }, "k", - function () awful.client.incwfact( 0.05) end), - - -- Layout tuning (VIM style) - awful.key({ modkey, altkey }, "j", - function () awful.tag.incnmaster(-1) end), - awful.key({ modkey, altkey }, "k", - function () awful.tag.incnmaster( 1) end), - awful.key({ modkey, altkey }, "h", - function () awful.tag.incncol(-1) end), - awful.key({ modkey, altkey }, "l", - function () awful.tag.incncol( 1) end), - - - -- Menus - awful.key({ modkey, }, "w", - function () status.menu.mainmenu:show() end), - awful.key({ modkey, }, "i", - function () - status.menu.instance = menu_addon.clients_on_tag({ - theme = {width=capi.screen[helpers.get_current_screen()].workarea.width}, - coords = {x=0, y=18}}) - end), - awful.key({ modkey, }, "p", - function () - status.menu.instance = awful.menu.clients({ - theme = {width=capi.screen[helpers.get_current_screen()].workarea.width}, - coords = {x=0, y=18}}) - end), - awful.key({ modkey, "Control"}, "p", - function() menubar.show() end), - --awful.key({ modkey, }, "space", - -- function() menubar.show() end), - awful.key({ modkey, }, "space", - function() awful.util.spawn_with_shell(cmd.dmenu) end), - - -- Layout manipulation - awful.key({ modkey, "Control" }, "n", - function() - c=awful.client.restore() - if c then - -- @TODO: - -- it's a workaround for some strange upstream issue - client.focus = c - end - end), - - awful.key({ modkey, }, "u", - awful.client.urgent.jumpto), - awful.key({ modkey, }, "Tab", - function () - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end), - - awful.key({ altkey, }, "space", - function () awful.layout.inc(status.layouts, 1) end), - awful.key({ altkey, "Shift" }, "space", - function () awful.layout.inc(status.layouts, -1) end), - - - -- Prompt - awful.key({ modkey }, "r", - function () status.widgets.promptbox[helpers.get_current_screen()]:run() end), - awful.key({ modkey }, "x", - function () - awful.prompt.run({ prompt = "Run Lua code: " }, - status.widgets.promptbox[helpers.get_current_screen()].widget, - awful.util.eval, nil, - awful.util.getdir("cache") .. "/history_eval") - end), - - -- ALSA volume control - awful.key({}, "#123", function () status.widgets.volume.up() end), - awful.key({}, "#122", function () status.widgets.volume.down() end), - awful.key({}, "#121", function () status.widgets.volume.toggle() end), - awful.key({}, "#198", function () status.widgets.volume.toggle_mic() end), - - -- MPD control - awful.key({}, "#150", function () status.widgets.music.prev_song() end), - awful.key({}, "#148", function () status.widgets.music.next_song() end), - awful.key({}, "#172", function () status.widgets.music.toggle() end), - - -- Copy to clipboard - awful.key({ modkey }, "c", - function () os.execute("xsel -p -o | xsel -i -b") end), - - -- Standard program - awful.key({ modkey, }, "Return", - function () awful.util.spawn(cmd.tmux) end), - awful.key({ modkey, }, "s", - function () awful.util.spawn(cmd.file_manager) end), - awful.key({ modkey, "Control" }, "c", - function () awful.util.spawn_with_shell(cmd.chromium) end), - awful.key({ modkey, "Control" }, "g", - function () awful.util.spawn_with_shell(cmd.chrome) end), - awful.key({ modkey, "Control" }, "f", - function () awful.util.spawn_with_shell(cmd.firefox) end), - - awful.key({ modkey, "Control" }, "r", - awesome.restart), - awful.key({ modkey, "Shift" }, "q", - awesome.quit), - - -- Scrot stuff - awful.key({ "Control" }, "Print", - function () - awful.util.spawn_with_shell( - "scrot -ub '%Y-%m-%d--%s_$wx$h_scrot.png' -e " .. cmd.scrot_preview_cmd) - end), - awful.key({ altkey }, "Print", - function () - awful.util.spawn_with_shell( - "scrot -s '%Y-%m-%d--%s_$wx$h_scrot.png' -e " .. cmd.scrot_preview_cmd) - end), - awful.key({ }, "Print", - function () - awful.util.spawn_with_shell( - "scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e " .. cmd.scrot_preview_cmd) - end) + hk.on({ modkey, }, "/", "show_help"), + hk.on({ modkey, altkey }, "/", "show_help"), + hk.on({ modkey, altkey, "Shift" }, "/", "show_help"), + hk.on({ modkey, altkey, "Control" }, "/", "show_help"), + hk.on({ modkey, "Shift" }, "/", "show_help"), + hk.on({ modkey, "Control" }, "/", "show_help"), + hk.on({ modkey, "Shift", "Control" }, "/", "show_help"), + + -- hk.on({ modkey, }, "Control", "show_help"), -- show hotkey on hold + + hk.on({ modkey, "Control" }, "t", + function() awesome_context.widgets.systray_toggle.toggle() end, + "toggle sysTray popup", MENU_COLOR + ), + + hk.on({ modkey, "Control" }, "s", + function() helpers.run_once("xscreensaver-command -lock") end, + "xScreensaver lock", IMPORTANT_COLOR + ), + + hk.on({ modkey, }, ",", + function() awful.tag.viewprev(helpers.get_current_screen()) end, + "prev tag", TAG_COLOR + ), + hk.on({ modkey, }, ".", + function() awful.tag.viewnext(helpers.get_current_screen()) end, + "next tag", TAG_COLOR + ), + hk.on({ modkey, }, "Escape", + awful.tag.history.restore, + "cycle tags", TAG_COLOR + ), + + -- By direction screen focus + hk.on({ modkey, }, "Next", + function() awful.screen.focus_relative(1) end, + "next screen", TO_DEFINE_COLOR + ), + hk.on({ modkey, }, "Prior", + function() awful.screen.focus_relative(-1) end, + "prev screen", TO_DEFINE_COLOR + ), + + -- By direction client focus + hk.on({ modkey, }, "Down", + function() + awful.client.focus.bydirection("down") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + hk.on({ modkey }, "Up", + function() + awful.client.focus.bydirection("up") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + hk.on({ modkey }, "Left", + function() + awful.client.focus.bydirection("left") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + hk.on({ modkey }, "Right", + function() + awful.client.focus.bydirection("right") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + + + -- By direction client focus (VIM style) + hk.on({ modkey }, "j", + function() + awful.client.focus.bydirection("down") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + hk.on({ modkey }, "k", + function() + awful.client.focus.bydirection("up") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + hk.on({ modkey }, "h", + function() + awful.client.focus.bydirection("left") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + hk.on({ modkey }, "l", + function() + awful.client.focus.bydirection("right") + if client.focus then client.focus:raise() end + end, + "client focus", CLIENT_COLOR + ), + + + -- Menus + hk.on({ modkey, }, "w", + function () awesome_context.menu.mainmenu:show() end, + "aWesome menu", MENU_COLOR + ), + hk.on({ modkey, }, "i", + function () + awesome_context.menu.instance = menu_addon.clients_on_tag({ + theme = {width=capi.screen[helpers.get_current_screen()].workarea.width}, + coords = {x=0, y=18}}) + end, + "current clients", MENU_COLOR + ), + hk.on({ modkey, }, "p", + function () + awesome_context.menu.instance = awful.menu.clients({ + theme = {width=capi.screen[helpers.get_current_screen()].workarea.width}, + coords = {x=0, y=18} + }) + end, + "all clients", MENU_COLOR + ), + hk.on({ modkey, "Control"}, "p", + function() menubar.show() end, + "aPPlications menu", MENU_COLOR + ), + hk.on({ modkey, }, "space", + function() awful.util.spawn_with_shell(cmd.dmenu) end, + "app launcher", IMPORTANT_COLOR + ), + + -- Layout manipulation + hk.on({ modkey, "Control" }, "n", + function() + local c = awful.client.restore() + -- @TODO: it's a workaround for some strange upstream issue + if c then client.focus = c end + end, + "de-icoNify", CLIENT_MANIPULATION + ), + + hk.on({ modkey, }, "u", + awful.client.urgent.jumpto, + "jump to Urgent client", IMPORTANT_COLOR + ), + hk.on({ modkey, }, "Tab", + function () + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end, + "cycle clients", CLIENT_COLOR + ), + + -- Layouts + hk.on({ modkey, "Control" }, "space", + function () awful.layout.inc(1) end, + "next layout", LAYOUT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "space", + function () awful.layout.inc(-1) end, + "prev layout", LAYOUT_MANIPULATION + ), + + -- Layout tuning + hk.on({ modkey, altkey }, "Down", + function () + awful.tag.incnmaster(-1) + end, + "master-", LAYOUT_MANIPULATION + ), + hk.on({ modkey, altkey }, "Up", + function () awful.tag.incnmaster( 1) end, + "master+", LAYOUT_MANIPULATION + ), + hk.on({ modkey, altkey }, "Left", + function () awful.tag.incncol(-1) end, + "columns-", LAYOUT_MANIPULATION + ), + hk.on({ modkey, altkey }, "Right", + function () awful.tag.incncol( 1) end, + "columns+", LAYOUT_MANIPULATION + ), + + -- Layout tuning (VIM style) + hk.on({ modkey, altkey }, "j", + function () awful.tag.incnmaster(-1) end, + "master-", LAYOUT_MANIPULATION + ), + hk.on({ modkey, altkey }, "k", + function () awful.tag.incnmaster( 1) end, + "master+", LAYOUT_MANIPULATION + ), + hk.on({ modkey, altkey }, "h", + function () awful.tag.incncol(-1) end, + "columns-", LAYOUT_MANIPULATION + ), + hk.on({ modkey, altkey }, "l", + function () awful.tag.incncol( 1) end, + "columns+", LAYOUT_MANIPULATION + ), + + + -- Prompt + hk.on({ modkey }, "r", + function () awesome_context.widgets.uniq[helpers.get_current_screen()].promptbox:run() end, + "Run command...", TO_DEFINE_COLOR + ), + hk.on({ modkey }, "x", + function () + awful.prompt.run({ prompt = "Run Lua code: " }, + awesome_context.widgets.promptbox[helpers.get_current_screen()].widget, + awful.util.eval, nil, + awful.util.getdir("cache") .. "/history_eval") + end, + "eXecute lua code...", TO_DEFINE_COLOR + ), + + -- ALSA volume control + awful.key({}, "#123", function () awesome_context.widgets.volume.up() end), + awful.key({}, "#122", function () awesome_context.widgets.volume.down() end), + awful.key({}, "#121", function () awesome_context.widgets.volume.toggle() end), + awful.key({}, "#198", function () awesome_context.widgets.volume.toggle_mic() end), + + -- MPD control + awful.key({}, "#150", function () awesome_context.widgets.music.prev_song() end), + awful.key({}, "#148", function () awesome_context.widgets.music.next_song() end), + awful.key({}, "#172", function () awesome_context.widgets.music.toggle() end), + + hk.on({ modkey }, "c", + function () os.execute("xsel -p -o | xsel -i -b") end, + "copy to Clipboard", TO_DEFINE_COLOR + ), + + -- Standard program + hk.on({ modkey, }, "Return", + function () awful.util.spawn(cmd.tmux) end, + "terminal", IMPORTANT_COLOR + ), + hk.on({ modkey, }, "s", + function () awful.util.spawn(cmd.file_manager) end, + "file manager", TO_DEFINE_COLOR + ), + + hk.on({ modkey, "Control" }, "r", + capi.awesome.restart, + "Reload awesome wm", IMPORTANT_COLOR + ), + hk.on({ modkey, "Shift" }, "q", + capi.awesome.quit, + "Quit awesome wm", IMPORTANT_COLOR + ), + + -- Scrot stuff + hk.on({ "Control" }, "Print", + function () + awful.util.spawn_with_shell( + "scrot -ub '%Y-%m-%d--%s_$wx$h_scrot.png' -e " .. cmd.scrot_preview_cmd) + end, + "screenshot focused", TO_DEFINE_COLOR + ), + hk.on({ altkey }, "Print", + function () + awful.util.spawn_with_shell( + "scrot -s '%Y-%m-%d--%s_$wx$h_scrot.png' -e " .. cmd.scrot_preview_cmd) + end, + "screenshot selected", TO_DEFINE_COLOR + ), + hk.on({ }, "Print", + function () + awful.util.spawn_with_shell( + "scrot '%Y-%m-%d--%s_$wx$h_scrot.png' -e " .. cmd.scrot_preview_cmd) + end, + "screenshot all", TO_DEFINE_COLOR + ) ) -status.clientkeys = awful.util.table.join( - awful.key({ modkey, }, "f", - function (c) c.fullscreen = not c.fullscreen end), - awful.key({ modkey, }, "q", - function (c) c:kill() end), - awful.key({ modkey, "Control" }, "space", - awful.client.floating.toggle), - awful.key({ modkey, "Control" }, "Return", - function (c) c:swap(awful.client.getmaster()) end), - awful.key({ modkey, }, "o", - awful.client.movetoscreen), - awful.key({ modkey, }, "t", - function (c) c.ontop = not c.ontop end), - awful.key({ modkey, "Shift" }, "t", - function(c) - titlebar.titlebar_toggle(c) - --awful.titlebar.toggle( - -- c, beautiful.titlebar_position or 'top') - end), - awful.key({ modkey, }, "n", - function (c) c.minimized = true end), - awful.key({ modkey, }, "m", - function (c) - c.maximized_horizontal = not c.maximized_horizontal - c.maximized_vertical = not c.maximized_vertical - end) +awesome_context.clientkeys = awful.util.table.join( + + -- By direction client swap/move + hk.on({ modkey, "Shift" }, "Down", + function (c) + if floats(c) then + local g = c:geometry() + g.y = g.y + RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("down") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "Up", + function (c) + if floats(c) then + local g = c:geometry() + g.y = g.y - RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("up") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "Left", + function (c) + if floats(c) then + local g = c:geometry() + g.x = g.x - RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("left") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "Right", + function (c) + if floats(c) then + local g = c:geometry() + g.x = g.x + RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("right") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + + -- By direction client swap (VIM style) + hk.on({ modkey, "Shift" }, "j", + function (c) + if floats(c) then + local g = c:geometry() + g.y = g.y + RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("down") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "k", + function (c) + if floats(c) then + local g = c:geometry() + g.y = g.y - RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("up") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "h", + function (c) + if floats(c) then + local g = c:geometry() + g.x = g.x - RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("left") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "l", + function (c) + if floats(c) then + local g = c:geometry() + g.x = g.x + RESIZE_STEP + c:geometry(g) + else + awful.client.swap.bydirection("right") + if client.swap then client.swap:raise() end + end + end, + "client swap", CLIENT_MANIPULATION + ), + + -- Client resize + hk.on({ modkey, "Control" }, "Right", + function (c) + if floats(c) then + local g = c:geometry() + g.width = g.width + RESIZE_STEP + c:geometry(g) + else + awful.tag.incmwfact( 0.05) + end + end, + "master size+", LAYOUT_MANIPULATION + ), + hk.on({ modkey, "Control" }, "Left", + function (c) + if floats(c) then + local g = c:geometry() + g.width = g.width - RESIZE_STEP + c:geometry(g) + else + awful.tag.incmwfact(-0.05) + end + end, + "master size-", LAYOUT_MANIPULATION + ), + hk.on({ modkey, "Control" }, "Down", + function (c) + if floats(c) then + local g = c:geometry() + g.height = g.height + RESIZE_STEP + c:geometry(g) + else + awful.client.incwfact(-0.05) + end + end, + "column size-", LAYOUT_MANIPULATION + ), + hk.on({ modkey, "Control" }, "Up", + function (c) + if floats(c) then + local g = c:geometry() + g.height = g.height - RESIZE_STEP + c:geometry(g) + else + awful.client.incwfact( 0.05) + end + end, + "column size+", LAYOUT_MANIPULATION + ), + + -- Client resize (VIM style) + hk.on({ modkey, "Control" }, "l", + function (c) + if floats(c) then + local g = c:geometry() + g.width = g.width + RESIZE_STEP + c:geometry(g) + else + awful.tag.incmwfact( 0.05) + end + end, + "master size+", LAYOUT_MANIPULATION + ), + hk.on({ modkey, "Control" }, "h", + function (c) + if floats(c) then + local g = c:geometry() + g.width = g.width - RESIZE_STEP + c:geometry(g) + else + awful.tag.incmwfact(-0.05) + end + end, + "master size-", LAYOUT_MANIPULATION + ), + hk.on({ modkey, "Control" }, "j", + function (c) + if floats(c) then + local g = c:geometry() + g.height = g.height + RESIZE_STEP + c:geometry(g) + else + awful.client.incwfact(-0.05) + end + end, + "column size-", LAYOUT_MANIPULATION + ), + + hk.on({ modkey, "Control" }, "k", + function (c) + if floats(c) then + local g = c:geometry() + g.height = g.height - RESIZE_STEP + c:geometry(g) + else + awful.client.incwfact( 0.05) + end + end, + "column size+", LAYOUT_MANIPULATION + ), + + + hk.on({ modkey, }, "f", + function (c) c.fullscreen = not c.fullscreen end, + "toggle client Fullscreen", CLIENT_MANIPULATION + ), + hk.on({ modkey, }, "q", + function (c) c:kill() end, + "Quit app", IMPORTANT_COLOR + ), + hk.on({ modkey, "Control" }, "f", + awful.client.floating.toggle, + "toggle client Float", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Control" }, "Return", + function (c) c:swap(awful.client.getmaster()) end, + "put client on master", CLIENT_MANIPULATION + ), + hk.on({ modkey, }, "o", + awful.client.movetoscreen, + "move client to Other screen", CLIENT_MANIPULATION + ), + hk.on({ modkey, }, "t", + function (c) c.ontop = not c.ontop end, + "toggle client on Top", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Shift" }, "t", + function(c) + titlebar.titlebar_toggle(c) + --awful.titlebar.toggle( + -- c, beautiful.titlebar_position or 'top') + end, + "toggle Titlebar", CLIENT_MANIPULATION + ), + hk.on({ modkey, }, "n", + function (c) c.minimized = true end, + "icoNify client", CLIENT_MANIPULATION + ), + hk.on({ modkey, }, "m", + function (c) + c.maximized_horizontal = not c.maximized_horizontal + c.maximized_vertical = not c.maximized_vertical + end, + "Maximize client", CLIENT_MANIPULATION + ) ) local diff = nil -for screen = 1, 2 do +for scr = 1, 2 do for i = 1, 12 do - if screen == 1 then - -- num keys: - diff = 9 - elseif screen == 2 then - -- f-keys: - if i>10 then - diff = 84 - else - diff = 66 - end - end - - globalkeys = awful.util.table.join(globalkeys, - -- View tag only. - awful.key({ modkey }, "#" .. i + diff, - function () - local tag = awful.tag.gettags(screen)[i] - if tag then awful.tag.viewonly(tag) end - end), - -- Toggle tag. - awful.key({ modkey, "Control" }, "#" .. i + diff, - function () - local tag = awful.tag.gettags(screen)[i] - if tag then awful.tag.viewtoggle(tag) end - end), - -- Move client to tag. - awful.key({ modkey, "Shift" }, "#" .. i + diff, - function () - if client.focus then - local tag = awful.tag.gettags(screen)[i] - if tag then awful.client.movetotag(tag) end - end - end), - -- Toggle tag. - awful.key({ modkey, "Control", "Shift" }, "#" .. i + diff, - function () - if client.focus then - local tag = awful.tag.gettags(screen)[i] - if tag then awful.client.toggletag(tag) end - end - end)) + if scr == 1 then + -- num keys: + diff = 9 + elseif scr == 2 then + -- f-keys: + if i>10 then + diff = 84 + else + diff = 66 + end + end + + globalkeys = awful.util.table.join(globalkeys, + hk.on({ modkey }, "#" .. i + diff, + function () + local tag = awful.tag.gettags(scr)[i] + if tag then awful.tag.viewonly(tag) end + end, + "go to tag " .. i .. " (screen #" .. scr .. ")", TAG_COLOR + ), + hk.on({ modkey, "Control" }, "#" .. i + diff, + function () + local tag = awful.tag.gettags(scr)[i] + if tag then awful.tag.viewtoggle(tag) end + end, + "toggle tag " .. i .. " (screen #" .. scr .. ")", TAG_COLOR + ), + hk.on({ modkey, "Shift" }, "#" .. i + diff, + function () + if client.focus then + local tag = awful.tag.gettags(scr)[i] + if tag then awful.client.movetotag(tag) end + end + end, + "move client to tag " .. i .. " (screen #" .. scr .. ")", CLIENT_MANIPULATION + ), + hk.on({ modkey, "Control", "Shift" }, "#" .. i + diff, + function () + if client.focus then + local tag = awful.tag.gettags(scr)[i] + if tag then awful.client.toggletag(tag) end + end + + end, + "toggle client on tag " .. i .. " (screen #" .. scr .. ")", CLIENT_MANIPULATION + ) + ) end end -status.clientbuttons = awful.util.table.join( +awesome_context.clientbuttons = awful.util.table.join( awful.button({ }, 1, function (c) client.focus = c; @@ -386,7 +655,7 @@ status.clientbuttons = awful.util.table.join( awful.button({ modkey }, 3, awful.mouse.client.resize)) -- Set keys -root.keys(globalkeys) +capi.root.keys(globalkeys) -- }}} diff --git a/config/layouts.lua b/config/layouts.lua index 8ab1ca85..0fd0b73a 100644 --- a/config/layouts.lua +++ b/config/layouts.lua @@ -8,40 +8,40 @@ local helpers = require("actionless.helpers") local layouts = {} -function layouts.init(status) --- Table of layouts to cover with awful.layout.inc, order matters. -status.layouts = { - awful.layout.suit.tile, - awful.layout.suit.tile.bottom, - awful.layout.suit.floating, - awful.layout.suit.fair, - awful.layout.suit.fair.horizontal, - awful.layout.suit.spiral -} -awful.layout.layouts = status.layouts --- }}} - --- {{{ Wallpaper -if beautiful.wallpaper then +function layouts.init(context) + + -- Table of layouts to cover with awful.layout.inc, order matters. + context.layouts = { + awful.layout.suit.tile, + awful.layout.suit.tile.bottom, + awful.layout.suit.floating, + awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, + awful.layout.suit.spiral + } + awful.layout.layouts = context.layouts + -- }}} + + -- {{{ Wallpaper + if beautiful.wallpaper then + for s = 1, capi.screen.count() do + gears.wallpaper.tiled(beautiful.wallpaper, s) + end + elseif beautiful.wallpaper_cmd then + awful.util.spawn_with_shell(beautiful.wallpaper_cmd) + end + -- }}} + + -- {{{ Tags + -- Define a tag table which hold all screen tags. + context.tags = {} for s = 1, capi.screen.count() do - gears.wallpaper.tiled(beautiful.wallpaper, s) + -- Each screen has its own tag table. + context.tags[s] = awful.tag( + { '1:bs', '2:web', '3:ww', '4:im', '5:mm', 6, 7, 8, '9:sd', '10:nl', '11', '12' }, + s, awful.layout.layouts[1]) end -else if beautiful.wallpaper_cmd then - awful.util.spawn_with_shell(beautiful.wallpaper_cmd) -end -end --- }}} - --- {{{ Tags --- Define a tag table which hold all screen tags. -status.tags = {} -for s = 1, capi.screen.count() do - -- Each screen has its own tag table. - status.tags[s] = awful.tag( - { '1:bs', '2:web', '3:ww', '4:im', '5:mm', 6, 7, 8, '9:sd', '0:nl' }, - s, awful.layout.layouts[1]) -end --- }}} + -- }}} end return layouts diff --git a/config/menus.lua b/config/menus.lua index 42f77eeb..e5181db6 100644 --- a/config/menus.lua +++ b/config/menus.lua @@ -9,40 +9,35 @@ local get_current_screen = require("actionless.helpers").get_current_screen local menus = {} -function menus.init(status) - --- {{{ Menu --- Create a laucher widget and a main menu -local myawesomemenu = { - { "manual", status.cmds.terminal .. " -e man awesome" }, - { "edit config", status.cmds.editor_cmd .. " " .. awesome.conffile }, - { "restart", awesome.restart }, - { "quit", awesome.quit } -} - -status.menu.mainmenu = awful.menu({items = { - { "awesome", myawesomemenu, beautiful.awesome_icon }, - { "kill compositor", "killall compton" }, - { "start compositor", status.cmds.compositor }, - { "open terminal", status.cmds.terminal } -}}) - -status.widgets.launcher = awful.widget.launcher({ - image = beautiful.awesome_icon, - menu = status.menu.mainmenu -}) - --- Menubar configuration -menubar.utils.terminal = status.cmds.terminal --- }}} - - -menubar.geometry = { - height = 18, - width = capi.screen[get_current_screen()].workarea.width, - x = 0, - y = capi.screen[get_current_screen()].workarea.height - 18 -} +function menus.init(context) + + -- {{{ Menu + -- Create a laucher widget and a main menu + local myawesomemenu = { + { "manual", context.cmds.terminal .. " -e man awesome" }, + { "edit config", context.cmds.editor_cmd .. " " .. awesome.conffile }, + { "restart", awesome.restart }, + { "quit", awesome.quit } + } + + context.menu.mainmenu = awful.menu({items = { + { "awesome", myawesomemenu, beautiful.awesome_icon }, + { "kill compositor", "killall compton" }, + { "start compositor", context.cmds.compositor }, + { "open terminal", context.cmds.terminal } + }}) + -- }}} + + -- Menubar configuration + menubar.utils.terminal = context.cmds.terminal + menubar.geometry = { + height = 18, + width = capi.screen[get_current_screen()].workarea.width, + x = 0, + y = capi.screen[get_current_screen()].workarea.height - 18 + } + -- }}} end + return menus diff --git a/config/notify.lua b/config/notify.lua index 226ed241..2ccab14c 100644 --- a/config/notify.lua +++ b/config/notify.lua @@ -5,7 +5,7 @@ local awesome = awesome local notify = {} -function notify.init(status) +function notify.init(awesome_context) naughty.config.presets.normal.opacity = beautiful.notification_opacity naughty.config.presets.low.opacity = beautiful.notification_opacity naughty.config.presets.critical.opacity = beautiful.notification_opacity diff --git a/config/rules.lua b/config/rules.lua index ae139542..07dc9fd7 100644 --- a/config/rules.lua +++ b/config/rules.lua @@ -2,35 +2,37 @@ local beautiful = require("beautiful") local awful = require("awful") awful.rules = require("awful.rules") -local settings = require("actionless.settings") - local rules = {} -function rules.init(status) --- {{{ Rules --- Rules to apply to new clients (through the "manage" signal). -awful.rules.rules = { - -- All clients will match this rule. - { rule = { }, - properties = { border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - keys = status.clientkeys, - buttons = status.clientbuttons, - size_hints_honor = false}, - callback = awful.client.setslave }, +function rules.init(awesome_context) + -- Rules to apply to new clients (through the "manage" signal). + awful.rules.rules = { + + -- All clients will match this rule. + { rule = { }, + properties = { border_width = beautiful.border_width, + border_color = beautiful.border_normal, + focus = awful.client.focus.filter, + raise = true, + keys = awesome_context.clientkeys, + buttons = awesome_context.clientbuttons, + size_hints_honor = false}, + callback = awful.client.setslave }, - { rule = { class = "MPlayer" }, - properties = { floating=true } }, - { rule = { class = "Chromium" }, - properties = { tag=status.tags[1][2], raise=false } }, - { rule = { class = "Skype" }, - properties = { tag=status.tags[1][4], raise=false } }, + { rule = { class = "Skype" }, + properties = { tag=awesome_context.tags[1][4], raise=false } }, -} --- }}} + { rule = { name = "Terminator Preferences" }, + properties = { floating = true } }, + { rule = { name = "Pinterest / Pin it. - Mozilla Firefox" }, + properties = { floating = true } }, + { rule_any = { class = { "pinentry", "Guake", "feh" } }, + properties = { floating = true } }, + { rule_any = { class = { "Transmission-gtk", } }, + properties = { floating = false } }, + + } end return rules diff --git a/config/signals.lua b/config/signals.lua index 9f94af71..ba1d1d54 100644 --- a/config/signals.lua +++ b/config/signals.lua @@ -43,10 +43,10 @@ end) client.connect_signal("unfocus", function(c) if awful.client.floating.get(c) then -- floating client - c.border_color = beautiful.titlebar + c.border_color = beautiful.titlebar_border elseif awful.layout.get(c.screen) == awful.layout.suit.floating then -- floating layout - c.border_color = beautiful.titlebar + c.border_color = beautiful.titlebar_border elseif #awful.client.tiled(c.screen) == 1 then -- one tiling client titlebar.remove_border(c) diff --git a/config/toolbar.lua b/config/toolbar.lua index 7b17b6a9..41004e66 100644 --- a/config/toolbar.lua +++ b/config/toolbar.lua @@ -2,306 +2,152 @@ local wibox = require("wibox") local beautiful = require("beautiful") local awful = require("awful") -local screen = screen -local client = client +local capi = { + screen = screen, + client = client, +} -local widgets = require("actionless.widgets") -local decorated = widgets.common.decorated -local custom_tasklist = require("actionless.tasklist") -local helpers = require("actionless.helpers") ---local rpic = widgets.random_pic +local make_separator = require("actionless.widgets.common").make_separator +local current_font = require("actionless.helpers").font local toolbar = {} function toolbar.init(status) -local modkey = status.modkey - - --- CLOSE button -status.widgets.close_button = widgets.manage_client({color_n=3}) - --- NetCtl -local netctlwidget = widgets.netctl({ - update_interval = 5, - preset = status.config.net_preset, - wlan_if = status.config.wlan_if, - eth_if = status.config.eth_if, - fg = beautiful.panel_bg, - bg = beautiful.color4, -}) --- MUSIC -status.widgets.music = widgets.music.widget({ - update_interval = 5, - --backend = 'cmus', - backend = 'clementine', - --backend = 'mpd', - music_dir = '/media/terik/jessie/music/', - bg = beautiful.panel_bg, - fg = beautiful.color4, -}) --- ALSA volume -status.widgets.volume = widgets.alsa({ - update_interval = 5, - channel = 'Master', - channels_toggle = {'Master', 'Speaker', 'Headphone'}, - color_n = 4, - left = { 'separator' }, - right = { 'arrr' } -}) - --- systray_toggle -status.widgets.systray_toggle = widgets.systray_toggle({ - screen = 1 -}) - --- CPU -local cpuwidget = widgets.cpu({ - update_interval = 5, - cores_number = status.config.cpu_cores_num, - list_length = 20, - fg = beautiful.panel_bg, - bg=beautiful.color2, -}) --- MEM -local memwidget = widgets.mem({ - update_interval = 10, - list_length = 20, - fg = beautiful.panel_bg, - bg=beautiful.color2, -}) --- Sensor -local tempwidget = widgets.temp({ - update_interval = 10, - sensor = "Core 0", - warning = 75, - fg = beautiful.panel_bg, - bg=beautiful.color2, -}) --- Battery -local batwidget = widgets.bat({ - update_interval = 30, - fg = beautiful.panel_bg, - bg=beautiful.color2, -}) --- Textclock --- mytextclock = awful.widget.textclock("%a %d %b %H:%M") -local mytextclock = awful.widget.textclock("%H:%M") -widgets.calendar:attach(mytextclock) - --- Separators -local sep = wibox.widget.imagebox(beautiful.small_separator) -local separator = widgets.common.make_text_separator(' ') -local iseparator = widgets.common.make_text_separator(' ', beautiful.panel_bg) -local separator2 = widgets.common.make_text_separator(' ', beautiful.color2) -local separator4 = widgets.common.make_text_separator(' ', beautiful.color4) - -local arrl = widgets.common.make_image_separator('arrl') -local arrr = widgets.common.make_image_separator('arrr') -local arrl1 = widgets.common.make_image_separator('arrl1') -local arrr1 = widgets.common.make_image_separator('arrr1') -local arrl2 = widgets.common.make_image_separator('arrl2') -local arrr2 = widgets.common.make_image_separator('arrr2') -local arrl3 = widgets.common.make_image_separator('arrl3') -local arrr3 = widgets.common.make_image_separator('arrr3') -local arrl4 = widgets.common.make_image_separator('arrl4') -local arrr4 = widgets.common.make_image_separator('arrr4') -local arrl5 = widgets.common.make_image_separator('arrl5') -local arrr5 = widgets.common.make_image_separator('arrr5') -local arrl6 = widgets.common.make_image_separator('arrl6') -local arrr6 = widgets.common.make_image_separator('arrr6') - -local arrl9 = widgets.common.make_image_separator('arrl9') -local arrr9 = widgets.common.make_image_separator('arrr9') - -if beautiful.widget_use_text_decorations then - local l = beautiful.widget_decoration_arrl or '' - local r = beautiful.widget_decoration_arrr or '' - arrl = widgets.common.make_text_separator(l ) - arrr = widgets.common.make_text_separator(r ) - arrl1 = widgets.common.make_text_separator(l, nil, beautiful.color1) - arrr1 = widgets.common.make_text_separator(r, nil, beautiful.color1) - arrl2 = widgets.common.make_text_separator(l, nil, beautiful.color2) - arrr2 = widgets.common.make_text_separator(r, nil, beautiful.color2) - arrl3 = widgets.common.make_text_separator(l, nil, beautiful.color3) - arrr3 = widgets.common.make_text_separator(r, nil, beautiful.color3) - arrl4 = widgets.common.make_text_separator(l, nil, beautiful.color4) - arrr4 = widgets.common.make_text_separator(r, nil, beautiful.color4) - arrl5 = widgets.common.make_text_separator(l, nil, beautiful.color5) - arrr5 = widgets.common.make_text_separator(r, nil, beautiful.color5) - arrl6 = widgets.common.make_text_separator(l, nil, beautiful.color6) - arrr6 = widgets.common.make_text_separator(r, nil, beautiful.color6) - - arrl9 = widgets.common.make_text_separator('', nil, beautiful.color9) - arrr9 = widgets.common.make_text_separator('', nil, beautiful.color9) -end - - --- Create a wibox for each screen and add it -local mytaglist = {} -mytaglist.buttons = awful.util.table.join( - awful.button({ }, 1, awful.tag.viewonly), - awful.button({ modkey }, 1, awful.client.movetotag), - awful.button({ }, 3, awful.tag.viewtoggle), - awful.button({ modkey }, 3, awful.client.toggletag), - awful.button({ }, 5, function(t) - awful.tag.viewnext(awful.tag.getscreen(t)) end), - awful.button({ }, 4, function(t) - awful.tag.viewprev(awful.tag.getscreen(t)) end) -) -local mycurrenttask = {} -local mytasklist = {} -mytasklist.buttons = awful.util.table.join( - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - -- Without this, the following - -- :isvisible() makes no sense - c.minimized = false - if not c:isvisible() then - awful.tag.viewonly(c:tags()[1]) - end - -- This will also un-minimize - -- the client, if needed - client.focus = c - c:raise() + local modkey = status.modkey + local bpc = beautiful.panel_colors + local loaded_widgets = status.widgets + + -- Separators + local sep = wibox.widget.imagebox(beautiful.small_separator) + local separator = make_separator(' ') + local iseparator = make_separator('sq', {color_n='f'}) + local sep_info = make_separator('sq', {color_n=bpc.info}) + local sep_media = make_separator('sq', {color_n=bpc.media}) + + + local arr = { l={}, r={} } + for _, direction in ipairs({'l', 'r'}) do + for i=0,15 do + arr[direction][i] = make_separator( + 'arr' .. direction, { fg=beautiful.color[i] }) end - end), - awful.button({ }, 3, function () - if status.menu.instance then - status.menu.instance:hide() - status.menu.instance = nil - else - status.menu.instance = awful.menu.clients({ - theme = {width=screen[helpers.get_current_screen()].workarea.width}, - coords = {x=0, y=18}}) + for _, i in ipairs({'b', 'f'}) do + arr[direction][i] = make_separator( + 'arr' .. direction, { fg=beautiful.color[i] }) end - end), - awful.button({ }, 4, function () - awful.client.focus.byidx(-1) - if client.focus then client.focus:raise() end - end), - awful.button({ }, 5, function () - awful.client.focus.byidx(1) - if client.focus then client.focus:raise() end - end)) - -status.widgets.promptbox = {} -local mylayoutbox = {} -local mywibox = {} -for s = 1, screen.count() do - - awful.screen.padding( - screen[s], - { top = beautiful.screen_margin, - bottom = beautiful.screen_margin, - left = beautiful.screen_margin, - right = beautiful.screen_margin }) - - -- layoutbox - mylayoutbox[s] = widgets.layoutbox({ - screen = s, - bg = beautiful.fg, - fg = beautiful.bg} - ) - mylayoutbox[s]:buttons(awful.util.table.join( - awful.button({ }, 1, function () - awful.layout.inc(awful.layout.layouts, 1) end), - awful.button({ }, 3, function () - awful.layout.inc(awful.layout.layouts, -1) end), - awful.button({ }, 5, function () - awful.layout.inc(awful.layout.layouts, 1) end), - awful.button({ }, 4, function () - awful.layout.inc(awful.layout.layouts, -1) end))) - - -- taglist - mytaglist[s] = decorated({ - widget = awful.widget.taglist( - s, awful.widget.taglist.filter.all, mytaglist.buttons), - color_n = 1, - }) - - -- promptbox - status.widgets.promptbox[s] = awful.widget.prompt() - - -- tasklist - mytasklist[s] = custom_tasklist( - s, custom_tasklist.filter.focused_and_minimized_current_tags, mytasklist.buttons) - - -- LEFT side - local left_layout = wibox.layout.fixed.horizontal() - left_layout:add(sep) - left_layout:add(mytaglist[s]) - left_layout:add(separator) - left_layout:add(status.widgets.close_button) - left_layout:add(status.widgets.promptbox[s]) - left_layout:add(separator) - left_layout:add(arrl9) - - -- RIGHT side - local right_layout = wibox.layout.fixed.horizontal() - right_layout:add(arrr9) - right_layout:add(separator) - - right_layout:add(arrl4) - right_layout:add(netctlwidget) - right_layout:add(separator4) - right_layout:add(status.widgets.music) - right_layout:add(status.widgets.volume) - - if s == 1 then right_layout:add(status.widgets.systray_toggle) end - - right_layout:add(arrl2) - right_layout:add(memwidget) - right_layout:add(separator2) - right_layout:add(cpuwidget) - right_layout:add(separator2) - right_layout:add(tempwidget) - right_layout:add(separator2) - right_layout:add(batwidget) - --right_layout:add(separator2) - - right_layout:add(arrr2) - right_layout:add(separator) - right_layout:add(mytextclock) - right_layout:add(separator) - right_layout:add(mylayoutbox[s]) - - - -- TOOLBAR - local layout = wibox.layout.align.horizontal() - layout:set_left(left_layout) - layout:set_middle(mytasklist[s]) - layout:set_right(right_layout) - - - -- enabled: - if beautiful.panel_margin then - local margined_layout = wibox.layout.align.vertical() - margined_layout:set_middle(layout) - margined_layout:set_bottom( - wibox.widget.textbox( - ' ' - )) - layout = margined_layout + setmetatable( + arr[direction], + { __index = make_separator('arr' .. direction) } + ) end - mywibox[s] = awful.wibox({ - position = "top", - screen = s, - height = beautiful.panel_height, - -- disabled: - --border_width = beautiful.panel_margin, - }) - mywibox[s]:set_widget(layout) - mywibox[s].opacity = beautiful.panel_opacity - mywibox[s]:set_bg(beautiful.panel_bg) - mywibox[s]:set_fg(beautiful.panel_fg) -end + -- Create a wibox for each screen and add it + local mywibox = {} + for s = 1, capi.screen.count() do + + -- LEFT side + local left_layout = wibox.layout.fixed.horizontal() + + left_layout:add(sep) + left_layout:add(loaded_widgets.screen[s].taglist) + + left_layout:add(separator) + left_layout:add(loaded_widgets.close_button) + left_layout:add(separator) + left_layout:add(loaded_widgets.screen[s].promptbox) + left_layout:add(arr.l[bpc.tasklist]) + -- RIGHT side + local right_layout = wibox.layout.fixed.horizontal() + right_layout:add(arr.r[bpc.tasklist]) + + right_layout:add(separator) + + right_layout:add(arr.l[bpc.media]) + right_layout:add(loaded_widgets.netctl) + right_layout:add(sep_media) + right_layout:add(loaded_widgets.music) + right_layout:add(loaded_widgets.volume) + + -- a) systray_toggle + if s == 1 then right_layout:add(loaded_widgets.systray_toggle) end + -- b) static systray + --right_layout:add(separator) + + right_layout:add(arr.l[bpc.info]) + right_layout:add(loaded_widgets.mem) + right_layout:add(sep_info) + right_layout:add(loaded_widgets.cpu) + right_layout:add(sep_info) + right_layout:add(loaded_widgets.temp) + right_layout:add(sep_info) + right_layout:add(loaded_widgets.bat) + right_layout:add(arr.r[bpc.info]) + + -- b) static systray + --[[ + if s == 1 then + right_layout:add(separator) + right_layout:add(wibox.widget.systray()) + right_layout:add(sep) + end + --]] + + right_layout:add(separator) + + right_layout:add(loaded_widgets.textclock) + + right_layout:add(separator) + + right_layout:add(loaded_widgets.screen[s].layoutbox) + + + -- TOOLBAR + local layout = wibox.layout.align.horizontal() + layout:set_left(left_layout) + layout:set_middle(loaded_widgets.screen[s].tasklist) + layout:set_right(right_layout) + + -- bottom panel MARGIN: + if beautiful.panel_margin then + local margined_layout = wibox.layout.align.vertical() + margined_layout:set_middle(layout) + margined_layout:set_bottom( + wibox.widget.textbox( + string.format( + ' ', + current_font, + beautiful.panel_margin + ) + )) + layout = margined_layout + end + + mywibox[s] = awful.wibox({ + position = "top", + screen = s, + height = beautiful.panel_height, + }) + mywibox[s]:set_widget(layout) + mywibox[s].opacity = beautiful.panel_opacity + mywibox[s]:set_bg(beautiful.panel_bg) + mywibox[s]:set_fg(beautiful.panel_fg) + + -- padding for clients' area + awful.screen.padding( + capi.screen[s], { + top = beautiful.screen_margin, + bottom = beautiful.screen_margin, + left = beautiful.screen_margin, + right = beautiful.screen_margin + } + ) + + end + end return toolbar diff --git a/config/variables.lua b/config/variables.lua index 37307732..7ea4c371 100644 --- a/config/variables.lua +++ b/config/variables.lua @@ -2,17 +2,17 @@ local variables = {} -function variables.init(status) +function variables.init(awesome_context) local terminal = "st" or "urxvt -lsp 1 -geometry 120x30" or "xterm" local editor = "vim" or os.getenv("EDITOR") or "nano" or "vi" -status.vars = { +awesome_context.vars = { terminal = terminal, editor = editor, } -status.cmds = { +awesome_context.cmds = { terminal = terminal, editor_cmd = terminal .. " -e " .. editor, --browser= "dwb", diff --git a/config/widgets.lua b/config/widgets.lua new file mode 100644 index 00000000..592919ef --- /dev/null +++ b/config/widgets.lua @@ -0,0 +1,198 @@ +local beautiful = require("beautiful") +local awful = require("awful") +local wibox = require("wibox") + +local capi = { + screen = screen, + client = client, +} + +local helpers = require("actionless.helpers") +local widgets = require("actionless.widgets") +local tasklist_addon = require("actionless.tasklist_addon") + + +local widget_loader = {} + +function widget_loader.init(awesome_context) + local w = awesome_context.widgets + local conf = awesome_context.config + local bpc = beautiful.panel_colors + local modkey = awesome_context.modkey + + -- CLOSE button + w.close_button = widgets.manage_client({color_n=bpc.close}) + + -- NetCtl + w.netctl = widgets.netctl({ + update_interval = 5, + preset = conf.net_preset, + wlan_if = conf.wlan_if, + eth_if = conf.eth_if, + bg = beautiful.color[bpc.media], + fg = beautiful.panel_bg, + }) + -- MUSIC + w.music = widgets.music.widget({ + update_interval = 5, + backend = conf.music_player, + music_dir = conf.music_dir, + bg = beautiful.panel_bg, + fg = beautiful.color[bpc.media], + }) + -- ALSA volume + w.volume = widgets.alsa({ + update_interval = 5, + channel = 'Master', + channels_toggle = {'Master', 'Speaker', 'Headphone'}, + color_n = bpc.media, + widget_inverted=true, + left_separators = { 'sq' }, + right_separators = { 'arrr' } + }) + + -- systray_toggle + w.systray_toggle = widgets.systray_toggle({ + screen = 1 + }) + + -- MEM + w.mem = widgets.mem({ + update_interval = 10, + list_length = 20, + bg = beautiful.color[bpc.info], + fg = beautiful.panel_bg, + }) + -- CPU + w.cpu = widgets.cpu({ + update_interval = 5, + cores_number = conf.cpu_cores_num, + list_length = 20, + bg = beautiful.color[bpc.info], + fg = beautiful.panel_bg, + }) + -- Sensor + w.temp = widgets.temp({ + update_interval = 10, + sensor = "Core 0", + warning = 75, + bg = beautiful.color[bpc.info], + fg = beautiful.panel_bg, + }) + -- Battery + w.bat = widgets.bat({ + update_interval = 30, + bg = beautiful.color[bpc.info], + fg = beautiful.panel_bg, + }) + + -- Textclock + w.textclock = awful.widget.textclock("%H:%M") + widgets.calendar:attach(w.textclock) + + + w.screen = {} + for s = 1, capi.screen.count() do + w.screen[s] = {} + local sw = w.screen[s] + + -- taglist + sw.taglist = {} + sw.taglist.buttons = awful.util.table.join( + awful.button({ }, 1, awful.tag.viewonly), + awful.button({ modkey }, 1, awful.client.movetotag), + awful.button({ }, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, awful.client.toggletag), + awful.button({ }, 5, function(t) + awful.tag.viewnext(awful.tag.getscreen(t)) end), + awful.button({ }, 4, function(t) + awful.tag.viewprev(awful.tag.getscreen(t)) end) + ) + sw.taglist = widgets.common.decorated({ + widget = awful.widget.taglist( + s, awful.widget.taglist.filter.all, sw.taglist.buttons + ), + color_n = bpc.taglist, + }) + + -- promptbox + sw.promptbox = awful.widget.prompt() + + -- tasklist + local tasklist_buttons = awful.util.table.join( + awful.button({ }, 1, function (c) + if c == capi.client.focus then + c.minimized = true + else + c.minimized = false + if not c:isvisible() then + awful.tag.viewonly(c:tags()[1]) + end + -- This will also un-minimize + -- the client, if needed + capi.client.focus = c + c:raise() + end + end), + awful.button({ }, 3, function () + if awesome_context.menu.instance then + awesome_context.menu.instance:hide() + awesome_context.menu.instance = nil + else + awesome_context.menu.instance = awful.menu.clients({ + theme = { + width=capi.screen[helpers.get_current_screen()].workarea.width + }, + coords = { + x=0, y=18 + } + }) + end + end), + awful.button({ }, 4, function () + awful.client.focus.byidx(-1) + if capi.client.focus then capi.client.focus:raise() end + end), + awful.button({ }, 5, function () + awful.client.focus.byidx(1) + if capi.client.focus then capi.client.focus:raise() end + end) + ) + local active_client_widget = awful.widget.tasklist( + s, + awful.widget.tasklist.filter.focused, + tasklist_buttons + ) + local minimized_clients_widget = awful.widget.tasklist( + s, + awful.widget.tasklist.filter.minimizedcurrenttags, + tasklist_buttons, + nil, + tasklist_addon.list_update + ) + sw.tasklist = wibox.layout.align.horizontal() + sw.tasklist:set_second(active_client_widget) + sw.tasklist:set_third(minimized_clients_widget) + + -- layoutbox + sw.layoutbox = widgets.layoutbox({ + screen = s, + color_n = 7 + }) + sw.layoutbox:buttons(awful.util.table.join( + awful.button({ }, 1, function () + awful.layout.inc(awful.layout.layouts, 1) end), + awful.button({ }, 3, function () + awful.layout.inc(awful.layout.layouts, -1) end), + awful.button({ }, 5, function () + awful.layout.inc(awful.layout.layouts, 1) end), + awful.button({ }, 4, function () + awful.layout.inc(awful.layout.layouts, -1) end) + )) + + end + + return awesome_context +end + +return widget_loader diff --git a/eminent.lua b/eminent.lua index 804a9aee..f8eae3d2 120000 --- a/eminent.lua +++ b/eminent.lua @@ -1 +1 @@ -eminent/eminent.lua \ No newline at end of file +third_party/eminent/eminent.lua \ No newline at end of file diff --git a/icons/calendar/white/calendar b/icons/calendar/white/calendar deleted file mode 120000 index 9f6b7d23..00000000 --- a/icons/calendar/white/calendar +++ /dev/null @@ -1 +0,0 @@ -../dark/calendar \ No newline at end of file diff --git a/icons/tango_dark/arrl.png b/icons/tango_dark/arrl.png deleted file mode 100644 index 7579073c..00000000 Binary files a/icons/tango_dark/arrl.png and /dev/null differ diff --git a/icons/tango_dark/arrl.xcf b/icons/tango_dark/arrl.xcf deleted file mode 100644 index 49e75482..00000000 Binary files a/icons/tango_dark/arrl.xcf and /dev/null differ diff --git a/icons/tango_dark/arrl_sf.png b/icons/tango_dark/arrl_sf.png deleted file mode 100644 index 5d303693..00000000 Binary files a/icons/tango_dark/arrl_sf.png and /dev/null differ diff --git a/icons/tango_dark/arrr.png b/icons/tango_dark/arrr.png deleted file mode 100644 index 2a86ed8b..00000000 Binary files a/icons/tango_dark/arrr.png and /dev/null differ diff --git a/icons/tango_dark/titlebar b/icons/tango_dark/titlebar index 84516cc0..33f2b9e7 120000 --- a/icons/tango_dark/titlebar +++ b/icons/tango_dark/titlebar @@ -1 +1 @@ -../titlebar/pixel16 \ No newline at end of file +../titlebar/pixel28 \ No newline at end of file diff --git a/icons/titlebar/pixel16/titlebar b/icons/titlebar/pixel16/titlebar deleted file mode 120000 index 7d2df7f0..00000000 --- a/icons/titlebar/pixel16/titlebar +++ /dev/null @@ -1 +0,0 @@ -../dark/titlebar \ No newline at end of file diff --git a/rc.lua b/rc.lua deleted file mode 120000 index fae4084c..00000000 --- a/rc.lua +++ /dev/null @@ -1 +0,0 @@ -actionless.rc.lua \ No newline at end of file diff --git a/rc.lua b/rc.lua new file mode 100644 index 00000000..f01a501e --- /dev/null +++ b/rc.lua @@ -0,0 +1,59 @@ +--[[ +OH HI +--]] + + +-- localization +os.setlocale(os.getenv("LANG")) + +require("eminent") +local awful = require("awful") +require("awful.autofocus") +local beautiful = require("beautiful") + +local context = { + + widgets = {}, + menu = {}, + + modkey = "Mod4", + altkey = "Mod1", + theme_dir = awful.util.getdir("config") .. "/themes/noble_dark/theme.lua", + config = { + net_preset = 'netctl-auto', + wlan_if = 'wlp12s0', + eth_if = 'enp0s25', + cpu_cores_num = 2, + music_player = 'mpd', + music_dir = '~/music/', + }, + + autorun = {}, + +} + +pcall(function() + local local_config = require("config.local") + if local_config then + context = local_config.init(context) or context + end +end) +beautiful.init(context.theme_dir) + +local widget_config = require("actionless.config") +widget_config.init(context) + +local config = require("config") + +config.notify.init(context) +config.variables.init(context) +config.autorun.init(context) +config.layouts.init(context) +config.menus.init(context) +config.widgets.init(context) +config.toolbar.init(context) +config.keys.init(context) +config.rules.init(context) +config.signals.init(context) + +-- vim: set shiftwidth=2: diff --git a/themes/TODO.txt b/themes/TODO.txt index 8f6caaa4..45a25315 100644 --- a/themes/TODO.txt +++ b/themes/TODO.txt @@ -1,3 +1,3 @@ -pokemon_light -lcars_modern_monokai -ceti +lcars/ +noble_dark/ +pokemon_*/ diff --git a/themes/ceti/icons b/themes/ceti/icons deleted file mode 120000 index e2ccb48d..00000000 --- a/themes/ceti/icons +++ /dev/null @@ -1 +0,0 @@ -../../icons/standard_dark \ No newline at end of file diff --git a/themes/ceti/pattern.png b/themes/ceti/pattern.png deleted file mode 100644 index ee1a4f54..00000000 Binary files a/themes/ceti/pattern.png and /dev/null differ diff --git a/themes/lcars/theme.lua b/themes/lcars/theme.lua index a5505947..1f8c1b02 100644 --- a/themes/lcars/theme.lua +++ b/themes/lcars/theme.lua @@ -5,7 +5,6 @@ theme.dir = themes_dir --theme.wallpaper_cmd = "hsetroot" theme.wallpaper_cmd = "nitrogen --restore" theme.show_widget_icon = false -theme.show_widget_decorations = true theme.widget_use_text_decorations = false theme.bg = "#000000" diff --git a/themes/lcars_modern/icons/arrl.png b/themes/lcars_modern/icons/arrl.png deleted file mode 100644 index 7579073c..00000000 Binary files a/themes/lcars_modern/icons/arrl.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl.xcf b/themes/lcars_modern/icons/arrl.xcf deleted file mode 100644 index 49e75482..00000000 Binary files a/themes/lcars_modern/icons/arrl.xcf and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl1.png b/themes/lcars_modern/icons/arrl1.png deleted file mode 100644 index daa950b2..00000000 Binary files a/themes/lcars_modern/icons/arrl1.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl2.png b/themes/lcars_modern/icons/arrl2.png deleted file mode 100644 index 8f1aa855..00000000 Binary files a/themes/lcars_modern/icons/arrl2.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl3.png b/themes/lcars_modern/icons/arrl3.png deleted file mode 100644 index 647d223d..00000000 Binary files a/themes/lcars_modern/icons/arrl3.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl4.png b/themes/lcars_modern/icons/arrl4.png deleted file mode 100644 index fe0acca1..00000000 Binary files a/themes/lcars_modern/icons/arrl4.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl5.png b/themes/lcars_modern/icons/arrl5.png deleted file mode 100644 index 8ef6a20b..00000000 Binary files a/themes/lcars_modern/icons/arrl5.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl6.png b/themes/lcars_modern/icons/arrl6.png deleted file mode 100644 index 8bdcda7b..00000000 Binary files a/themes/lcars_modern/icons/arrl6.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl9.png b/themes/lcars_modern/icons/arrl9.png deleted file mode 100644 index b6e634b2..00000000 Binary files a/themes/lcars_modern/icons/arrl9.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl_err.png b/themes/lcars_modern/icons/arrl_err.png deleted file mode 100644 index f70dadc8..00000000 Binary files a/themes/lcars_modern/icons/arrl_err.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl_sf.png b/themes/lcars_modern/icons/arrl_sf.png deleted file mode 100644 index 5d303693..00000000 Binary files a/themes/lcars_modern/icons/arrl_sf.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrl_warn.png b/themes/lcars_modern/icons/arrl_warn.png deleted file mode 100644 index a0e48ce6..00000000 Binary files a/themes/lcars_modern/icons/arrl_warn.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr.png b/themes/lcars_modern/icons/arrr.png deleted file mode 100644 index 2a86ed8b..00000000 Binary files a/themes/lcars_modern/icons/arrr.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr1.png b/themes/lcars_modern/icons/arrr1.png deleted file mode 100644 index 8b3822a6..00000000 Binary files a/themes/lcars_modern/icons/arrr1.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr2.png b/themes/lcars_modern/icons/arrr2.png deleted file mode 100644 index 6bb9b190..00000000 Binary files a/themes/lcars_modern/icons/arrr2.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr3.png b/themes/lcars_modern/icons/arrr3.png deleted file mode 100644 index 1da53d70..00000000 Binary files a/themes/lcars_modern/icons/arrr3.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr4.png b/themes/lcars_modern/icons/arrr4.png deleted file mode 100644 index c92eaf09..00000000 Binary files a/themes/lcars_modern/icons/arrr4.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr5.png b/themes/lcars_modern/icons/arrr5.png deleted file mode 100644 index 06ba907f..00000000 Binary files a/themes/lcars_modern/icons/arrr5.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr6.png b/themes/lcars_modern/icons/arrr6.png deleted file mode 100644 index 04173777..00000000 Binary files a/themes/lcars_modern/icons/arrr6.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr9.png b/themes/lcars_modern/icons/arrr9.png deleted file mode 100644 index 34fd0ca3..00000000 Binary files a/themes/lcars_modern/icons/arrr9.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr_err.png b/themes/lcars_modern/icons/arrr_err.png deleted file mode 100644 index 1600e78d..00000000 Binary files a/themes/lcars_modern/icons/arrr_err.png and /dev/null differ diff --git a/themes/lcars_modern/icons/arrr_warn.png b/themes/lcars_modern/icons/arrr_warn.png deleted file mode 100644 index 72db834e..00000000 Binary files a/themes/lcars_modern/icons/arrr_warn.png and /dev/null differ diff --git a/themes/lcars_modern/theme.lua b/themes/lcars_modern/theme.lua index 9ce2a266..6e6b8f22 100644 --- a/themes/lcars_modern/theme.lua +++ b/themes/lcars_modern/theme.lua @@ -1,247 +1,88 @@ -theme = {} - -themes_dir = os.getenv("HOME") .. "/.config/awesome/themes/lcars_modern" -theme.dir = themes_dir +local generate_theme = require("actionless.common_theme").generate_theme + +local theme_dir = os.getenv("HOME") .. "/.config/awesome/themes/monovedek" + +-- TERMINAL COLORSCHEME: +-- +color = {} +--black +color[0] ='#000000' +color[8] ='#666699' +--red +color[1] ='#cc6666' +color[9] ='#ff3300' +--green (actually orange ;) ) +color[2] ='#ff9966' +color[10] ='#ff9900' +--yellow +color[3] ='#cc9966' +color[11] ='#ffcc66' +--blue +color[4] ='#9966ff' +color[12] ='#9999ff' +--purple +color[5] ='#cc6699' +color[13] ='#cc99cc' +--cyan +color[6] ='#9999cc' +color[14] ='#99ccff' +--white +color[7] ='#ffcc99' +color[15] ='#ccccff' + +color.b = '#000000' +color.f = '#ffffc6' +color.c = '#cc6699' + +-- PANEL COLORS: +-- +panel_colors = { + taglist=2, + close=1, + tasklist=4, + media=14, + info=13 +} + +-- GENERATE DEFAULT THEME: +-- +local theme = generate_theme( + theme_dir, + color, + panel_colors +) + +-- CUSTOMIZE default theme:----------------------------------------------- + +-- WALLPAPER: +-- +-- Use plain color: --theme.wallpaper_cmd = "hsetroot" -theme.wallpaper_cmd = "nitrogen --restore" -theme.show_widget_icon = false -theme.show_widget_decorations = true -theme.widget_use_text_decorations = false ---theme.widget_use_text_decorations = true ---theme.font = "Meslo LG S for Powerline Bold 10.5" ---theme.widget_decoration_arrl = '' ---theme.widget_decoration_arrr = '' - -theme.bg = "#000000" - -theme.fg = "#ffcc99" -theme.alt_fg = "#ffcc66" -theme.shiny = "#000000" - -theme.theme = "#cc99cc" -theme.warning = "#ff9900" -theme.error = "#ff3300" - -theme.border = "#000000" -theme.sel_border = "#ff9900" -theme.titlebar = "#000000" -theme.titlebar_focus = "#000000" -theme.titlebar_focus_border = theme.sel_border - -theme.color1 = '#ff9966' -theme.color2 = '#cc99cc' -theme.color3 = '#cc6666' -theme.color4 = '#99ccff' -theme.color5 = '#9999ff' -theme.color6 = '#6666ff' -theme.color7 = '#cc9966' -theme.color8 = '#6699cc' -theme.color9 = '#9966ff' -theme.color10 = '#666699' - -theme.colorf = theme.fg -theme.colorb = theme.bg -theme.colorerr = theme.error -theme.colorwarn = theme.warning - - -theme.alt_bg = theme.color9 -theme.theme2 = theme.color1 - ---theme.font = "Dina 9" ---theme.font = "Terminus Bold 9.8" ---theme.font = "Fixed Bold 10.5" ---theme.font = "Meslo LG S Bold 10.5" -theme.font = "Share Tech Mono Bold 10.5" ---theme.font = "Source Code Pro Bold 10.5" ---theme.font = "DejaVu Sans Mono Bold 9" ---theme.font = "LCARS 11" ---theme.font = "LCARS 17" ---theme.font = "Fira Mono 8" ---theme.sans_font = "Fira Sans Medium 10.5" ---theme.sans_font = "Kelly Slab Bold 10.5" -theme.sans_font = "Share Tech Bold 10.5" ---theme.sans_font = theme.font - -theme.fg_normal = theme.fg -theme.bg_normal = theme.bg -theme.fg_focus = theme.shiny -theme.bg_focus = theme.theme -theme.fg_urgent = theme.bg -theme.bg_urgent = theme.error - -theme.screen_margin = 0 - -theme.border_width = "10" -theme.border_normal = theme.border -theme.border_focus = theme.sel_border -theme.border_marked = theme.error - -theme.panel_bg = theme.bg -theme.panel_fg = theme.fg -theme.panel_opacity = 0.96 -theme.panel_height = 23 ---theme.panel_height = 18 -theme.panel_margin = 3 -theme.panel_enbolden_details = false - -theme.taglist_font = theme.font -theme.taglist_fg_occupied = theme.bg -theme.taglist_bg_occupied = theme.theme2 -theme.taglist_fg_empty = theme.bg -theme.taglist_bg_empty = theme.theme -theme.taglist_fg_focus = theme.theme2 -theme.taglist_bg_focus = theme.bg - -theme.tasklist_font = theme.sans_font -theme.tasklist_fg_focus = theme.alt_bg -theme.tasklist_bg_focus = theme.bg -theme.tasklist_fg_normal = theme.fg -theme.tasklist_bg_normal = theme.bg -theme.tasklist_fg_minimize = theme.bg -theme.tasklist_bg_minimize = theme.alt_bg - -theme.titlebar_font = theme.font -theme.titlebar_fg_focus = theme.tasklist_fg_focus -theme.titlebar_fg_normal = theme.tasklist_fg_normal -theme.titlebar_bg_focus = theme.titlebar_focus -theme.titlebar_bg_normal = theme.titlebar - -theme.titlebar_opacity = 0.7 -theme.titlebar_position = 'top' - -theme.notification_opacity = 0.8 -theme.notification_font = theme.sans_font -theme.notification_monofont = theme.font -theme.notify_fg = theme.fg_normal -theme.notify_bg = theme.bg_normal -theme.notify_border = theme.border_focus - -theme.textbox_widget_margin_top = 1 -theme.awful_widget_height = 14 -theme.awful_widget_margin_top = 2 -theme.mouse_finder_color = theme.error -theme.menu_border_width = "3" -theme.menu_height = "16" -theme.menu_width = "140" - -theme.player_text = theme.color2 +-- Use nitrogen: +--theme.wallpaper_cmd = "nitrogen --restore" +-- Use wallpaper tile: +--theme.wallpaper = theme_dir .. '/pattern.png' +-- PANEL DECORATIONS: +-- +theme.show_widget_icon = false +theme.widget_decoration_arrl = '' +theme.widget_decoration_arrr = '' + +-- FONTS: +-- +--theme.font = "Source Code Pro Bold 10.5" +--theme.sans_font = "Source Sans Pro Bold 10.3" +-- +--theme.font = "Meslo LG S for Lcarsline Bold 10.5" +--theme.sans_font = "PT Sans Bold 10.3" +-- +-- use ~/.fonts.conf, Luke ;) +theme.font = "Monospace Bold 10.5" +theme.sans_font = "Sans Bold 10.3" +-- +-- Don't use sans font: +--theme.sans_font = theme.font --- ICONS - -icons_dir = theme.dir .. "/icons/" -theme.icons_dir = icons_dir - -theme.menu_submenu_icon = icons_dir .. "submenu.png" - -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" - -theme.small_separator = icons_dir .. "small_separator.png" -theme.arrl = icons_dir .. "arrl.png" -theme.arrr = icons_dir .. "arrr.png" -theme.arrlerr = icons_dir .. "arrl_err.png" -theme.arrrerr = icons_dir .. "arrr_err.png" -theme.arrlwarn = icons_dir .. "arrl_warn.png" -theme.arrrwarn = icons_dir .. "arrr_warn.png" -theme.arrl1 = icons_dir .. "arrl1.png" -theme.arrr1 = icons_dir .. "arrr1.png" -theme.arrl2 = icons_dir .. "arrl2.png" -theme.arrr2 = icons_dir .. "arrr2.png" -theme.arrl3 = icons_dir .. "arrl3.png" -theme.arrr3 = icons_dir .. "arrr3.png" -theme.arrl4 = icons_dir .. "arrl4.png" -theme.arrr4 = icons_dir .. "arrr4.png" -theme.arrl5 = icons_dir .. "arrl5.png" -theme.arrr5 = icons_dir .. "arrr5.png" -theme.arrl6 = icons_dir .. "arrl6.png" -theme.arrr6 = icons_dir .. "arrr6.png" - -theme.arrl9 = icons_dir .. "arrl9.png" -theme.arrr9 = icons_dir .. "arrr9.png" - -theme.widget_ac = icons_dir .. "ac.png" -theme.widget_ac_charging = icons_dir .. "ac_charging.png" -theme.widget_ac_charging_low = icons_dir .. "ac_charging_low.png" - -theme.widget_battery = icons_dir .. "battery.png" -theme.widget_battery_low = icons_dir .. "battery_low.png" -theme.widget_battery_empty = icons_dir .. "battery_empty.png" - -theme.widget_mem = icons_dir .. "mem.png" -theme.widget_cpu = icons_dir .. "cpu.png" -theme.widget_temp = icons_dir .. "temp.png" -theme.widget_net = icons_dir .. "net.png" -theme.widget_hdd = icons_dir .. "hdd.png" - -theme.widget_net_wireless = icons_dir .. "net_wireless.png" -theme.widget_net_wired = icons_dir .. "net_wired.png" -theme.widget_net_searching = icons_dir .. "net_searching.png" - -theme.widget_music = icons_dir .. "note.png" -theme.widget_music_on = icons_dir .. "note_on.png" -theme.widget_music_off = icons_dir .. "note_off.png" -theme.widget_vol_high = icons_dir .. "vol_high.png" -theme.widget_vol = icons_dir .. "vol.png" -theme.widget_vol_low = icons_dir .. "vol_low.png" -theme.widget_vol_no = icons_dir .. "vol_no.png" -theme.widget_vol_mute = icons_dir .. "vol_mute.png" -theme.widget_mail = icons_dir .. "mail.png" -theme.widget_mail_on = icons_dir .. "mail_on.png" - -theme.dropdown_icon = icons_dir .. "dropdown.png" - -theme.tasklist_disable_icon = true ---theme.tasklist_floating = "*" ---theme.tasklist_maximized_horizontal = "_" ---theme.tasklist_maximized_vertical = "|" - -layout_icons_dir = icons_dir .. "layout/" -theme.layout_icons_dir = layout_icons_dir -theme.layout_tile = layout_icons_dir .. "tile.png" -theme.layout_tilegaps = layout_icons_dir .. "tilegaps.png" -theme.layout_tileleft = layout_icons_dir .. "tileleft.png" -theme.layout_tilebottom = layout_icons_dir .. "tilebottom.png" -theme.layout_tiletop = layout_icons_dir .. "tiletop.png" -theme.layout_fairv = layout_icons_dir .. "fairv.png" -theme.layout_fairh = layout_icons_dir .. "fairh.png" -theme.layout_spiral = layout_icons_dir .. "spiral.png" -theme.layout_dwindle = layout_icons_dir .. "dwindle.png" -theme.layout_max = layout_icons_dir .. "max.png" -theme.layout_fullscreen = layout_icons_dir .. "fullscreen.png" -theme.layout_magnifier = layout_icons_dir .. "magnifier.png" -theme.layout_floating = layout_icons_dir .. "floating.png" - -titlebar_icons_dir = icons_dir .. "titlebar/" -theme.titlebar_icons_dir = titlebar_icons_dir -theme.titlebar_close_button_focus = titlebar_icons_dir .. "/close_focus.png" -theme.titlebar_close_button_normal = titlebar_icons_dir .. "/close_normal.png" - -theme.titlebar_ontop_button_focus_active = titlebar_icons_dir .. "/ontop_focus_active.png" -theme.titlebar_ontop_button_normal_active = titlebar_icons_dir .. "/ontop_normal_active.png" -theme.titlebar_ontop_button_focus_inactive = titlebar_icons_dir .. "/ontop_focus_inactive.png" -theme.titlebar_ontop_button_normal_inactive = titlebar_icons_dir .. "/ontop_normal_inactive.png" - -theme.titlebar_sticky_button_focus_active = titlebar_icons_dir .. "/sticky_focus_active.png" -theme.titlebar_sticky_button_normal_active = titlebar_icons_dir .. "/sticky_normal_active.png" -theme.titlebar_sticky_button_focus_inactive = titlebar_icons_dir .. "/sticky_focus_inactive.png" -theme.titlebar_sticky_button_normal_inactive = titlebar_icons_dir .. "/sticky_normal_inactive.png" - -theme.titlebar_floating_button_focus_active = titlebar_icons_dir .. "/floating_focus_active.png" -theme.titlebar_floating_button_normal_active = titlebar_icons_dir .. "/floating_normal_active.png" -theme.titlebar_floating_button_focus_inactive = titlebar_icons_dir .. "/floating_focus_inactive.png" -theme.titlebar_floating_button_normal_inactive = titlebar_icons_dir .. "/floating_normal_inactive.png" - -theme.titlebar_maximized_button_focus_active = titlebar_icons_dir .. "/maximized_focus_active.png" -theme.titlebar_maximized_button_normal_active = titlebar_icons_dir .. "/maximized_normal_active.png" -theme.titlebar_maximized_button_focus_inactive = titlebar_icons_dir .. "/maximized_focus_inactive.png" -theme.titlebar_maximized_button_normal_inactive = titlebar_icons_dir .. "/maximized_normal_inactive.png" - -theme.titlebar_minimize_button_focus_active = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_active = titlebar_icons_dir .. "/minimized_normal.png" -theme.titlebar_minimize_button_focus_inactive = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_inactive = titlebar_icons_dir .. "/minimized_normal.png" - return theme diff --git a/themes/lcars_xresources/icons b/themes/lcars_xresources/icons new file mode 120000 index 00000000..b839b1fa --- /dev/null +++ b/themes/lcars_xresources/icons @@ -0,0 +1 @@ +../lcars_modern/icons \ No newline at end of file diff --git a/themes/lcars_xresources/theme.lua b/themes/lcars_xresources/theme.lua new file mode 100644 index 00000000..3a3d642b --- /dev/null +++ b/themes/lcars_xresources/theme.lua @@ -0,0 +1,68 @@ +local xresources = require("actionless.xresources") +local generate_theme = require("actionless.common_theme").generate_theme + +local theme_dir = os.getenv("HOME") .. "/.config/awesome/themes/lcars_xresources" + +-- TERMINAL COLORSCHEME: +-- +local colors = xresources.read_theme( + os.getenv('HOME') .. '/.Xcolours/monovedek' +) +--local colors = xresources.read_theme( +-- os.getenv('HOME') .. '/.Xcolours/jwr_dark' +-- ) + +-- PANEL COLORS: +-- +local panel_colors = { + taglist=7, + close=1, + tasklist='b', + media=14, + info=13 +} + +-- LOAD DEFAULT THEME: +-- +local theme = generate_theme( + theme_dir, + colors, + panel_colors +) + + +-- CUSTOMIZE default theme:----------------------------------------------- + +-- WALLPAPER: +-- +-- Use plain color: +--theme.wallpaper_cmd = "hsetroot" +-- Use nitrogen: +--theme.wallpaper_cmd = "nitrogen --restore" +-- Use wallpaper tile: +theme.wallpaper = theme_dir .. '/umbreon_pattern.png' + +-- PANEL DECORATIONS: +-- +theme.show_widget_icon = false +theme.widget_decoration_arrl = '' +theme.widget_decoration_arrr = '' + +-- FONTS: +-- +--theme.font = "Source Code Pro Bold 10.5" +--theme.sans_font = "Source Sans Pro Bold 10.3" +-- +--theme.font = "Meslo LG S for Lcarsline Bold 10.5" +--theme.sans_font = "PT Sans Bold 10.3" +-- +-- use ~/.fonts.conf, Luke ;) +theme.font = "Monospace Bold 10.5" +theme.sans_font = "Sans Bold 10.3" +theme.taglist_font = theme.font +theme.tasklist_font = theme.sans_font +-- +-- Don't use sans font: +--theme.sans_font = theme.font + +return theme diff --git a/themes/lcars_xresources/umbreon_pattern.png b/themes/lcars_xresources/umbreon_pattern.png new file mode 100644 index 00000000..af5ab9e3 Binary files /dev/null and b/themes/lcars_xresources/umbreon_pattern.png differ diff --git a/themes/monovedek/icons b/themes/monovedek/icons new file mode 120000 index 00000000..b839b1fa --- /dev/null +++ b/themes/monovedek/icons @@ -0,0 +1 @@ +../lcars_modern/icons \ No newline at end of file diff --git a/themes/monovedek/theme.lua b/themes/monovedek/theme.lua new file mode 100644 index 00000000..3642c314 --- /dev/null +++ b/themes/monovedek/theme.lua @@ -0,0 +1,88 @@ +local generate_theme = require("actionless.common_theme").generate_theme + +local theme_dir = os.getenv("HOME") .. "/.config/awesome/themes/monovedek" + +-- TERMINAL COLORSCHEME: +-- +color = {} +--black +color[0] = '#000000' +color[8] = '#465457' +--red +color[1] = '#960050' +color[9] = '#F92672' +--green +color[2] = '#008877' +color[10] = '#A6E22E' +--yellow +color[3] = '#FD971F' +color[11] = '#e6db74' +--blue +color[4] = '#7711dd' +color[12] = '#8432ff' +--purple +color[5] = '#890089' +color[13] = '#85509b' +--cyan +color[6] = '#00d6b5' +color[14] = '#51edbc' +--white +color[7] = '#888a85' +color[15] = '#ffffff' + +color.b = '#0e0021' +color.f = '#bcbcbc' +color.c = '#ae81ff' + +-- PANEL COLORS: +-- +panel_colors = { + taglist=7, + close=1, + tasklist='b', + media=14, + info=13 +} + +-- GENERATE DEFAULT THEME: +-- +local theme = generate_theme( + theme_dir, + color, + panel_colors +) + +-- CUSTOMIZE default theme:----------------------------------------------- + +-- WALLPAPER: +-- +-- Use plain color: +--theme.wallpaper_cmd = "hsetroot" +-- Use nitrogen: +--theme.wallpaper_cmd = "nitrogen --restore" +-- Use wallpaper tile: +--theme.wallpaper = theme_dir .. '/pattern.png' + +-- PANEL DECORATIONS: +-- +theme.show_widget_icon = false +theme.widget_decoration_arrl = '' +theme.widget_decoration_arrr = '' + +-- FONTS: +-- +--theme.font = "Source Code Pro Bold 10.5" +--theme.sans_font = "Source Sans Pro Bold 10.3" +-- +--theme.font = "Meslo LG S for Lcarsline Bold 10.5" +--theme.sans_font = "PT Sans Bold 10.3" +-- +-- use ~/.fonts.conf, Luke ;) +theme.font = "Monospace Bold 10.5" +theme.sans_font = "Sans Bold 10.3" +-- +-- Don't use sans font: +--theme.sans_font = theme.font + + +return theme diff --git a/themes/monovedek/umbreon_pattern.png b/themes/monovedek/umbreon_pattern.png new file mode 100644 index 00000000..af5ab9e3 Binary files /dev/null and b/themes/monovedek/umbreon_pattern.png differ diff --git a/themes/noble_dark/icons b/themes/noble_dark/icons index 64b6661a..f0ad6da2 120000 --- a/themes/noble_dark/icons +++ b/themes/noble_dark/icons @@ -1 +1 @@ -/home/lie/.config/awesome/icons/tango_dark \ No newline at end of file +../../icons/tango_dark \ No newline at end of file diff --git a/themes/noble_dark/pattern.png b/themes/noble_dark/pattern.png index ee1a4f54..808f2761 100644 Binary files a/themes/noble_dark/pattern.png and b/themes/noble_dark/pattern.png differ diff --git a/themes/noble_dark/theme.lua b/themes/noble_dark/theme.lua index f29e425d..684d568d 100644 --- a/themes/noble_dark/theme.lua +++ b/themes/noble_dark/theme.lua @@ -1,214 +1,79 @@ -theme = {} - -themes_dir = os.getenv("HOME") .. "/.config/awesome/themes/noble_dark" -theme.dir = themes_dir -theme.wallpaper_cmd = 'nitrogen --restore' -theme.wallpaper = themes_dir .. '/pattern.png' -theme.show_widget_icon = true -theme.show_widget_decorations = true -theme.widget_use_text_decorations = true +local generate_theme = require("actionless.common_theme").generate_theme + +local theme_dir = os.getenv("HOME") .. "/.config/awesome/themes/noble_dark" + +-- TERMINAL COLORSCHEME: +-- +color = {} +color.b = '#3c3c3c' +color.f = '#ffffc6' +color.c = '#cc6699' +color[0] = '#2E3436' +color[1] = '#CC0000' +color[2] = '#4E9A06' +color[3] = '#C4A000' +color[4] = '#3465A4' +color[5] = '#75507B' +color[6] = '#06989A' +color[7] = '#D3D7CF' +color[8] = '#555753' +color[9] = '#EF2929' +color[10] = '#8AE234' +color[11] = '#FCE94F' +color[12] = '#729FCF' +color[13] = '#AD7FA8' +color[14] = '#34E2E2' +color[15] = '#eeeeec' + +-- PANEL COLORS: +-- +panel_colors = { + taglist=7, + close=1, + tasklist='b', + media=14, + info=13 +} + +-- GENERATE DEFAULT THEME: +-- +local theme = generate_theme( + theme_dir, + color, + panel_colors +) + +-- CUSTOMIZE default theme:----------------------------------------------- + +-- WALLPAPER: +-- +-- Use plain color: +--theme.wallpaper_cmd = "hsetroot" +-- Use nitrogen: +--theme.wallpaper_cmd = "nitrogen --restore" +-- Use wallpaper tile: +theme.wallpaper = theme_dir .. '/pattern.png' + +-- PANEL DECORATIONS: +-- theme.widget_decoration_arrl = 'sq' theme.widget_decoration_arrr = 'sq' +theme.show_widget_icon = true -theme.fg = "#e6e6e6" -theme.alt_fg = "#a8a8a8" - -theme.bg = "#3c3c3c" -theme.alt_bg = "#a562b3" -theme.shiny = "#ffffff" - -theme.theme = "#ad7fa8" -theme.warning = theme.theme -theme.error = "#cc0000" - -theme.border = "#000000" -theme.sel_border = "#d33862" -theme.titlebar = theme.bg -theme.titlebar_focus = theme.bg -theme.titlebar_focus_border = "#66436C" - -theme.color1 = "#75507b" -theme.color2 = theme.theme -theme.color3 = '#c40000' -theme.color4 = '#8ae234' -theme.color5 = '#9999ff' -theme.color6 = '#6666ff' -theme.color7 = '#cc9966' -theme.color8 = '#6699cc' -theme.color9 = "#818181" -theme.color10 = '#666699' - -theme.colorf = theme.fg -theme.colorb = theme.bg -theme.colorerr = theme.error -theme.colorwarn = theme.warning - - -theme.font = "Meslo LG S for Powerline 10.5" -theme.sans_font = "PT Sans 10" - -theme.fg_normal = theme.fg -theme.bg_normal = theme.bg -theme.fg_focus = theme.fg -theme.bg_focus = theme.theme -theme.fg_urgent = theme.bg -theme.bg_urgent = theme.error - -theme.screen_margin = 0 - -theme.border_width = "12" -theme.border_normal = theme.border -theme.border_focus = theme.sel_border -theme.border_marked = theme.error - -theme.panel_bg = theme.bg -theme.panel_fg = theme.fg -theme.panel_opacity = 0.75 -theme.panel_height = 18 -theme.panel_margin = 0 -theme.panel_enbolden_details = true - -theme.taglist_font = theme.font -theme.taglist_fg_occupied = theme.fg -theme.taglist_bg_occupied = theme.panel_bg -theme.taglist_fg_empty = theme.bg -theme.taglist_bg_empty = theme.theme2 -theme.taglist_fg_focus = theme.colorf -theme.taglist_bg_focus = theme.color1 - -theme.tasklist_font = theme.sans_font -theme.tasklist_fg_focus = theme.panel_fg -theme.tasklist_bg_focus = theme.panel_bg -theme.tasklist_fg_normal = theme.panel_fg -theme.tasklist_bg_normal = theme.panel_bg -theme.tasklist_fg_minimize = theme.panel_bg -theme.tasklist_bg_minimize = theme.color9 - ---theme.titlebar_font = theme.sans_font -theme.titlebar_font = "PT Caption Bold 10.5" ---theme.titlebar_font = "Source Sans Pro Bold 10.5" -theme.titlebar_fg_focus = theme.shiny -theme.titlebar_fg_normal = theme.bg -theme.titlebar_bg_focus = theme.titlebar_focus -theme.titlebar_bg_normal = theme.titlebar - -theme.titlebar_opacity = 0.7 -theme.titlebar_position = 'top' - -theme.notification_opacity = 0.8 -theme.notification_font = theme.sans_font -theme.notification_monofont = theme.font -theme.notify_fg = theme.fg_normal -theme.notify_bg = theme.bg_normal -theme.notify_border = theme.border_focus - -theme.textbox_widget_margin_top = 1 -theme.awful_widget_height = 14 -theme.awful_widget_margin_top = 2 -theme.mouse_finder_color = theme.error -theme.menu_border_width = "3" -theme.menu_height = "16" -theme.menu_width = "140" - -theme.player_text = "#8d5f88" - --- ICONS - - -icons_dir = theme.dir .. "/icons/" -theme.icons_dir = icons_dir - -theme.close_button = icons_dir .. "close.png" -theme.close_button_hover = icons_dir .. "close_hover.png" - -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" - -theme.menu_submenu_icon = icons_dir .. "submenu.png" -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" - -theme.arrl = icons_dir .. "arrl.png" - -theme.widget_ac = icons_dir .. "ac.png" -theme.widget_ac_charging = icons_dir .. "ac_charging.png" -theme.widget_ac_charging_low = icons_dir .. "ac_charging_low.png" - -theme.widget_battery = icons_dir .. "battery.png" -theme.widget_battery_low = icons_dir .. "battery_low.png" -theme.widget_battery_empty = icons_dir .. "battery_empty.png" - -theme.widget_mem = icons_dir .. "mem.png" -theme.widget_cpu = icons_dir .. "cpu.png" -theme.widget_temp = icons_dir .. "temp.png" -theme.widget_net = icons_dir .. "net.png" -theme.widget_hdd = icons_dir .. "hdd.png" - -theme.widget_net_wireless = icons_dir .. "net_wireless.png" -theme.widget_net_wired = icons_dir .. "net_wired.png" -theme.widget_net_searching = icons_dir .. "net_searching.png" - -theme.widget_music = icons_dir .. "note.png" -theme.widget_music_on = icons_dir .. "note_on.png" -theme.widget_vol_high = icons_dir .. "vol_high.png" -theme.widget_vol = icons_dir .. "vol.png" -theme.widget_vol_low = icons_dir .. "vol_low.png" -theme.widget_vol_no = icons_dir .. "vol_no.png" -theme.widget_vol_mute = icons_dir .. "vol_mute.png" -theme.widget_mail = icons_dir .. "mail.png" -theme.widget_mail_on = icons_dir .. "mail_on.png" - -theme.dropdown_icon = icons_dir .. "dropdown.png" - -theme.tasklist_disable_icon = true ---theme.tasklist_floating = "*" ---theme.tasklist_maximized_horizontal = "_" ---theme.tasklist_maximized_vertical = "|" - -layout_icons_dir = icons_dir .. "layout/" -theme.layout_icons_dir = layout_icons_dir -theme.layout_tile = layout_icons_dir .. "tile.png" -theme.layout_tilegaps = layout_icons_dir .. "tilegaps.png" -theme.layout_tileleft = layout_icons_dir .. "tileleft.png" -theme.layout_tilebottom = layout_icons_dir .. "tilebottom.png" -theme.layout_tiletop = layout_icons_dir .. "tiletop.png" -theme.layout_fairv = layout_icons_dir .. "fairv.png" -theme.layout_fairh = layout_icons_dir .. "fairh.png" -theme.layout_spiral = layout_icons_dir .. "spiral.png" -theme.layout_dwindle = layout_icons_dir .. "dwindle.png" -theme.layout_max = layout_icons_dir .. "max.png" -theme.layout_fullscreen = layout_icons_dir .. "fullscreen.png" -theme.layout_magnifier = layout_icons_dir .. "magnifier.png" -theme.layout_floating = layout_icons_dir .. "floating.png" - -titlebar_icons_dir = icons_dir .. "titlebar/" -theme.titlebar_icons_dir = titlebar_icons_dir -theme.titlebar_close_button_focus = titlebar_icons_dir .. "/close_focus.png" -theme.titlebar_close_button_normal = titlebar_icons_dir .. "/close_normal.png" - -theme.titlebar_ontop_button_focus_active = titlebar_icons_dir .. "/ontop_focus_active.png" -theme.titlebar_ontop_button_normal_active = titlebar_icons_dir .. "/ontop_normal_active.png" -theme.titlebar_ontop_button_focus_inactive = titlebar_icons_dir .. "/ontop_focus_inactive.png" -theme.titlebar_ontop_button_normal_inactive = titlebar_icons_dir .. "/ontop_normal_inactive.png" - -theme.titlebar_sticky_button_focus_active = titlebar_icons_dir .. "/sticky_focus_active.png" -theme.titlebar_sticky_button_normal_active = titlebar_icons_dir .. "/sticky_normal_active.png" -theme.titlebar_sticky_button_focus_inactive = titlebar_icons_dir .. "/sticky_focus_inactive.png" -theme.titlebar_sticky_button_normal_inactive = titlebar_icons_dir .. "/sticky_normal_inactive.png" - -theme.titlebar_floating_button_focus_active = titlebar_icons_dir .. "/floating_focus_active.png" -theme.titlebar_floating_button_normal_active = titlebar_icons_dir .. "/floating_normal_active.png" -theme.titlebar_floating_button_focus_inactive = titlebar_icons_dir .. "/floating_focus_inactive.png" -theme.titlebar_floating_button_normal_inactive = titlebar_icons_dir .. "/floating_normal_inactive.png" - -theme.titlebar_maximized_button_focus_active = titlebar_icons_dir .. "/maximized_focus_active.png" -theme.titlebar_maximized_button_normal_active = titlebar_icons_dir .. "/maximized_normal_active.png" -theme.titlebar_maximized_button_focus_inactive = titlebar_icons_dir .. "/maximized_focus_inactive.png" -theme.titlebar_maximized_button_normal_inactive = titlebar_icons_dir .. "/maximized_normal_inactive.png" +-- FONTS: +-- +--theme.font = "Source Code Pro Bold 10.5" +--theme.sans_font = "Source Sans Pro Bold 10.3" +-- +--theme.font = "Meslo LG S for Lcarsline Bold 10.5" +--theme.sans_font = "PT Sans Bold 10.3" +-- +-- use ~/.fonts.conf, Luke ;) +theme.font = "Monospace Bold 10.5" +theme.sans_font = "Sans Bold 10.3" +-- +-- Don't use sans font: +--theme.sans_font = theme.font -theme.titlebar_minimize_button_focus_active = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_active = titlebar_icons_dir .. "/minimized_normal.png" -theme.titlebar_minimize_button_focus_inactive = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_inactive = titlebar_icons_dir .. "/minimized_normal.png" return theme diff --git a/themes/pokemon_dark/pattern.png b/themes/pokemon_dark/pattern.png new file mode 100644 index 00000000..af5ab9e3 Binary files /dev/null and b/themes/pokemon_dark/pattern.png differ diff --git a/themes/pokemon_dark/theme.lua b/themes/pokemon_dark/theme.lua index 57c1804c..efce35a7 100644 --- a/themes/pokemon_dark/theme.lua +++ b/themes/pokemon_dark/theme.lua @@ -1,214 +1,88 @@ -theme = {} - -themes_dir = os.getenv("HOME") .. "/.config/awesome/themes/pokemon_dark" -theme.dir = themes_dir -theme.wallpaper_cmd = 'nitrogen --restore' -theme.wallpaper = themes_dir .. '/vulcarona_pattern_blur.png' -theme.show_widget_icon = true -theme.show_widget_decorations = true -theme.widget_use_text_decorations = true +local generate_theme = require("actionless.common_theme").generate_theme + +local theme_dir = os.getenv("HOME") .. "/.config/awesome/themes/pokemon_dark" + +-- TERMINAL COLORSCHEME: +-- +color = {} +--black +color[0] = '#000000' +color[8] = '#465457' +--red +color[1] = '#960050' +color[9] = '#F92672' +--green +color[2] = '#008877' +color[10] = '#A6E22E' +--yellow +color[3] = '#FD971F' +color[11] = '#e6db74' +--blue +color[4] = '#7711dd' +color[12] = '#8432ff' +--purple +color[5] = '#890089' +color[13] = '#85509b' +--cyan +color[6] = '#00d6b5' +color[14] = '#51edbc' +--white +color[7] = '#888a85' +color[15] = '#ffffff' + +color.b = '#0e0021' +color.f = '#bcbcbc' +color.c = '#ae81ff' + +-- PANEL COLORS: +-- +panel_colors = { + taglist=7, + close=1, + tasklist='b', + media=14, + info=13 +} + +-- GENERATE DEFAULT THEME: +-- +local theme = generate_theme( + theme_dir, + color, + panel_colors +) + +-- CUSTOMIZE default theme:----------------------------------------------- + +-- WALLPAPER: +-- +-- Use plain color: +--theme.wallpaper_cmd = "hsetroot" +-- Use nitrogen: +--theme.wallpaper_cmd = "nitrogen --restore" +-- Use wallpaper tile: +theme.wallpaper = theme_dir .. '/pattern.png' + +-- PANEL DECORATIONS: +-- theme.widget_decoration_arrl = 'sq' theme.widget_decoration_arrr = 'sq' +theme.show_widget_icon = true -theme.fg = "#e6e6e6" -theme.alt_fg = "#a8a8a8" - -theme.bg = "#3c3c3c" -theme.alt_bg = "#a562b3" -theme.shiny = "#ffffff" - -theme.theme = "#ad7fa8" -theme.warning = theme.theme -theme.error = "#cc0000" - -theme.border = "#000000" -theme.sel_border = "#d33862" -theme.titlebar = theme.bg -theme.titlebar_focus = theme.bg -theme.titlebar_focus_border = "#66436C" - -theme.color1 = "#75507b" -theme.color2 = theme.theme -theme.color3 = '#c40000' -theme.color4 = '#8ae234' -theme.color5 = '#9999ff' -theme.color6 = '#6666ff' -theme.color7 = '#cc9966' -theme.color8 = '#6699cc' -theme.color9 = "#818181" -theme.color10 = '#666699' - -theme.colorf = theme.fg -theme.colorb = theme.bg -theme.colorerr = theme.error -theme.colorwarn = theme.warning - - -theme.font = "Meslo LG S for Powerline 10.5" -theme.sans_font = "PT Sans 10" - -theme.fg_normal = theme.fg -theme.bg_normal = theme.bg -theme.fg_focus = theme.fg -theme.bg_focus = theme.theme -theme.fg_urgent = theme.bg -theme.bg_urgent = theme.error - -theme.screen_margin = 0 - -theme.border_width = "12" -theme.border_normal = theme.border -theme.border_focus = theme.sel_border -theme.border_marked = theme.error - -theme.panel_bg = theme.bg -theme.panel_fg = theme.fg -theme.panel_opacity = 0.75 -theme.panel_height = 18 -theme.panel_margin = 0 -theme.panel_enbolden_details = true - -theme.taglist_font = theme.font -theme.taglist_fg_occupied = theme.fg -theme.taglist_bg_occupied = theme.panel_bg -theme.taglist_fg_empty = theme.bg -theme.taglist_bg_empty = theme.theme2 -theme.taglist_fg_focus = theme.colorf -theme.taglist_bg_focus = theme.color1 - -theme.tasklist_font = theme.sans_font -theme.tasklist_fg_focus = theme.panel_fg -theme.tasklist_bg_focus = theme.panel_bg -theme.tasklist_fg_normal = theme.panel_fg -theme.tasklist_bg_normal = theme.panel_bg -theme.tasklist_fg_minimize = theme.panel_bg -theme.tasklist_bg_minimize = theme.color9 - ---theme.titlebar_font = theme.sans_font -theme.titlebar_font = "PT Caption Bold 10.5" ---theme.titlebar_font = "Source Sans Pro Bold 10.5" -theme.titlebar_fg_focus = theme.shiny -theme.titlebar_fg_normal = theme.bg -theme.titlebar_bg_focus = theme.titlebar_focus -theme.titlebar_bg_normal = theme.titlebar - -theme.titlebar_opacity = 0.7 -theme.titlebar_position = 'top' - -theme.notification_opacity = 0.8 -theme.notification_font = theme.sans_font -theme.notification_monofont = theme.font -theme.notify_fg = theme.fg_normal -theme.notify_bg = theme.bg_normal -theme.notify_border = theme.border_focus - -theme.textbox_widget_margin_top = 1 -theme.awful_widget_height = 14 -theme.awful_widget_margin_top = 2 -theme.mouse_finder_color = theme.error -theme.menu_border_width = "3" -theme.menu_height = "16" -theme.menu_width = "140" - -theme.player_text = "#8d5f88" - --- ICONS - - -icons_dir = theme.dir .. "/icons/" -theme.icons_dir = icons_dir - -theme.close_button = icons_dir .. "close.png" -theme.close_button_hover = icons_dir .. "close_hover.png" - -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" - -theme.menu_submenu_icon = icons_dir .. "submenu.png" -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" - -theme.arrl = icons_dir .. "arrl.png" - -theme.widget_ac = icons_dir .. "ac.png" -theme.widget_ac_charging = icons_dir .. "ac_charging.png" -theme.widget_ac_charging_low = icons_dir .. "ac_charging_low.png" - -theme.widget_battery = icons_dir .. "battery.png" -theme.widget_battery_low = icons_dir .. "battery_low.png" -theme.widget_battery_empty = icons_dir .. "battery_empty.png" - -theme.widget_mem = icons_dir .. "mem.png" -theme.widget_cpu = icons_dir .. "cpu.png" -theme.widget_temp = icons_dir .. "temp.png" -theme.widget_net = icons_dir .. "net.png" -theme.widget_hdd = icons_dir .. "hdd.png" - -theme.widget_net_wireless = icons_dir .. "net_wireless.png" -theme.widget_net_wired = icons_dir .. "net_wired.png" -theme.widget_net_searching = icons_dir .. "net_searching.png" - -theme.widget_music = icons_dir .. "note.png" -theme.widget_music_on = icons_dir .. "note_on.png" -theme.widget_vol_high = icons_dir .. "vol_high.png" -theme.widget_vol = icons_dir .. "vol.png" -theme.widget_vol_low = icons_dir .. "vol_low.png" -theme.widget_vol_no = icons_dir .. "vol_no.png" -theme.widget_vol_mute = icons_dir .. "vol_mute.png" -theme.widget_mail = icons_dir .. "mail.png" -theme.widget_mail_on = icons_dir .. "mail_on.png" - -theme.dropdown_icon = icons_dir .. "dropdown.png" - -theme.tasklist_disable_icon = true ---theme.tasklist_floating = "*" ---theme.tasklist_maximized_horizontal = "_" ---theme.tasklist_maximized_vertical = "|" - -layout_icons_dir = icons_dir .. "layout/" -theme.layout_icons_dir = layout_icons_dir -theme.layout_tile = layout_icons_dir .. "tile.png" -theme.layout_tilegaps = layout_icons_dir .. "tilegaps.png" -theme.layout_tileleft = layout_icons_dir .. "tileleft.png" -theme.layout_tilebottom = layout_icons_dir .. "tilebottom.png" -theme.layout_tiletop = layout_icons_dir .. "tiletop.png" -theme.layout_fairv = layout_icons_dir .. "fairv.png" -theme.layout_fairh = layout_icons_dir .. "fairh.png" -theme.layout_spiral = layout_icons_dir .. "spiral.png" -theme.layout_dwindle = layout_icons_dir .. "dwindle.png" -theme.layout_max = layout_icons_dir .. "max.png" -theme.layout_fullscreen = layout_icons_dir .. "fullscreen.png" -theme.layout_magnifier = layout_icons_dir .. "magnifier.png" -theme.layout_floating = layout_icons_dir .. "floating.png" - -titlebar_icons_dir = icons_dir .. "titlebar/" -theme.titlebar_icons_dir = titlebar_icons_dir -theme.titlebar_close_button_focus = titlebar_icons_dir .. "/close_focus.png" -theme.titlebar_close_button_normal = titlebar_icons_dir .. "/close_normal.png" - -theme.titlebar_ontop_button_focus_active = titlebar_icons_dir .. "/ontop_focus_active.png" -theme.titlebar_ontop_button_normal_active = titlebar_icons_dir .. "/ontop_normal_active.png" -theme.titlebar_ontop_button_focus_inactive = titlebar_icons_dir .. "/ontop_focus_inactive.png" -theme.titlebar_ontop_button_normal_inactive = titlebar_icons_dir .. "/ontop_normal_inactive.png" - -theme.titlebar_sticky_button_focus_active = titlebar_icons_dir .. "/sticky_focus_active.png" -theme.titlebar_sticky_button_normal_active = titlebar_icons_dir .. "/sticky_normal_active.png" -theme.titlebar_sticky_button_focus_inactive = titlebar_icons_dir .. "/sticky_focus_inactive.png" -theme.titlebar_sticky_button_normal_inactive = titlebar_icons_dir .. "/sticky_normal_inactive.png" - -theme.titlebar_floating_button_focus_active = titlebar_icons_dir .. "/floating_focus_active.png" -theme.titlebar_floating_button_normal_active = titlebar_icons_dir .. "/floating_normal_active.png" -theme.titlebar_floating_button_focus_inactive = titlebar_icons_dir .. "/floating_focus_inactive.png" -theme.titlebar_floating_button_normal_inactive = titlebar_icons_dir .. "/floating_normal_inactive.png" - -theme.titlebar_maximized_button_focus_active = titlebar_icons_dir .. "/maximized_focus_active.png" -theme.titlebar_maximized_button_normal_active = titlebar_icons_dir .. "/maximized_normal_active.png" -theme.titlebar_maximized_button_focus_inactive = titlebar_icons_dir .. "/maximized_focus_inactive.png" -theme.titlebar_maximized_button_normal_inactive = titlebar_icons_dir .. "/maximized_normal_inactive.png" +-- FONTS: +-- +--theme.font = "Source Code Pro Bold 10.5" +--theme.sans_font = "Source Sans Pro Bold 10.3" +-- +--theme.font = "Meslo LG S for Lcarsline Bold 10.5" +--theme.sans_font = "PT Sans Bold 10.3" +-- +-- use ~/.fonts.conf, Luke ;) +theme.font = "Monospace Bold 10.5" +theme.sans_font = "Sans Bold 10.3" +-- +-- Don't use sans font: +--theme.sans_font = theme.font -theme.titlebar_minimize_button_focus_active = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_active = titlebar_icons_dir .. "/minimized_normal.png" -theme.titlebar_minimize_button_focus_inactive = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_inactive = titlebar_icons_dir .. "/minimized_normal.png" return theme diff --git a/themes/pokemon_light/vulcarona_pattern.png b/themes/pokemon_light/pattern.png similarity index 100% rename from themes/pokemon_light/vulcarona_pattern.png rename to themes/pokemon_light/pattern.png diff --git a/themes/pokemon_light/theme.lua b/themes/pokemon_light/theme.lua index ca4c8fb5..8fc38966 100644 --- a/themes/pokemon_light/theme.lua +++ b/themes/pokemon_light/theme.lua @@ -1,221 +1,88 @@ -theme = {} - -themes_dir = os.getenv("HOME") .. "/.config/awesome/themes/pokemon_light" -theme.dir = themes_dir -theme.wallpaper= themes_dir .. "/vulcarona_pattern_blur.png" +local generate_theme = require("actionless.common_theme").generate_theme + +local theme_dir = os.getenv("HOME") .. "/.config/awesome/themes/pokemon_light" + +-- TERMINAL COLORSCHEME: +-- +color = {} +--black +color[0] = '#000000' +color[8] = '#465457' +--red +color[1] = '#b60050' +color[9] = '#F92672' +--green +color[2] = '#008877' +color[10] = '#86c22e' +--yellow +color[3] = '#fc882b' +color[11] = '#ffea32' +--blue +color[4] = '#ad7fa8' +color[12] = '#ad5fc8' +--purple +color[5] = '#890089' +color[13] = '#e733b4' +--cyan +color[6] = '#00a685' +color[14] = '#51bd8c' +--white +color[7] = '#888a85' +color[15] = '#ffffff' + +color.b = '#ffffff' +color.f = '#1a1a1a' +color.c = '#ae81ff' + +-- PANEL COLORS: +-- +panel_colors = { + taglist=7, + close=1, + tasklist='b', + media=14, + info=13 +} + +-- GENERATE DEFAULT THEME: +-- +local theme = generate_theme( + theme_dir, + color, + panel_colors +) + +-- CUSTOMIZE default theme:----------------------------------------------- + +-- WALLPAPER: +-- +-- Use plain color: +--theme.wallpaper_cmd = "hsetroot" +-- Use nitrogen: +--theme.wallpaper_cmd = "nitrogen --restore" +-- Use wallpaper tile: +theme.wallpaper = theme_dir .. '/pattern.png' + +-- PANEL DECORATIONS: +-- +theme.widget_decoration_arrl = 'sq' +theme.widget_decoration_arrr = 'sq' theme.show_widget_icon = true -theme.show_widget_decorations = false - -theme.bg = "#e6e6e6" -theme.alt_fg = "#a8a8a8" - -theme.fg = "#3c3c3c" -theme.alt_bg = "#a562b3" -theme.shiny = "#ffffff" - -theme.theme = "#ad7fa8" -theme.warning = theme.theme -theme.error = "#f92672" - -theme.border = "#000000" -theme.sel_border = "#d33862" -theme.titlebar = "#3c3c3c" -theme.titlebar_focus = theme.titlebar -theme.titlebar_focus_border = "#66436C" - -theme.color1 = theme.fg -theme.color2 = theme.fg -theme.color3 = '#cc6666' -theme.color4 = '#5e468c' -theme.color4 = theme.fg -theme.color5 = '#9999ff' -theme.color6 = '#6666ff' -theme.color7 = '#cc9966' -theme.color8 = '#6699cc' -theme.color9 = '#9966ff' -theme.color10 = '#666699' - -theme.colorf = theme.fg -theme.colorerr = theme.error -theme.colorwarn = theme.warning - - -theme.font = "DejaVu Sans Mono 9" ---theme.font = "Dina 8" ---theme.font = "Fira Mono 9" ---theme.font = "Meslo LG S 10" ---theme.font = "monoOne 10" ---theme.font = "PT Mono 8" ---theme.font = "Share Tech Mono 11" ---theme.font = "Source Code Pro Medium 9.4" ---theme.font = "tewi 9" - -theme.sans_font = "PT Sans 10" ---theme.sans_font = "Share Tech 11" ---theme.sans_font = "Source Sans Pro Regular 10" - -theme.fg_normal = theme.fg -theme.bg_normal = theme.bg -theme.fg_focus = theme.fg -theme.bg_focus = theme.theme -theme.fg_urgent = theme.bg -theme.bg_urgent = theme.error - -theme.screen_margin = 0 - -theme.border_width = "12" -theme.border_normal = theme.border -theme.border_focus = theme.sel_border -theme.border_marked = theme.error - -theme.panel_bg = theme.bg -theme.panel_fg = theme.fg -theme.panel_opacity = 0.75 -theme.panel_height = 18 -theme.panel_margin = 0 - -theme.taglist_font = theme.font -theme.taglist_fg_occupied = theme.fg -theme.taglist_bg_occupied = theme.panel_bg -theme.taglist_fg_empty = theme.bg -theme.taglist_bg_empty = theme.theme2 -theme.taglist_fg_focus = theme.shiny -theme.taglist_bg_focus = theme.theme - -theme.tasklist_font = theme.sans_font -theme.tasklist_fg_focus = theme.panel_fg -theme.tasklist_bg_focus = theme.panel_bg -theme.tasklist_fg_normal = theme.panel_fg -theme.tasklist_bg_normal = theme.panel_bg -theme.tasklist_fg_minimize = theme.panel_bg -theme.tasklist_bg_minimize = "#818181" - ---theme.titlebar_font = theme.sans_font -theme.titlebar_font = "PT Caption Bold 10.5" ---theme.titlebar_font = "Source Sans Pro Bold 10.5" -theme.titlebar_fg_focus = theme.shiny -theme.titlebar_fg_normal = theme.bg -theme.titlebar_bg_focus = theme.titlebar_focus -theme.titlebar_bg_normal = theme.titlebar - -theme.titlebar_opacity = 0.7 -theme.titlebar_position = 'top' - -theme.notification_opacity = 0.8 -theme.notification_font = theme.sans_font -theme.notification_monofont = theme.font -theme.notify_fg = theme.fg_normal -theme.notify_bg = theme.bg_normal -theme.notify_border = theme.border_focus - -theme.textbox_widget_margin_top = 1 -theme.awful_widget_height = 14 -theme.awful_widget_margin_top = 2 -theme.mouse_finder_color = theme.error -theme.menu_border_width = "3" -theme.menu_height = "16" -theme.menu_width = "140" - -theme.player_text = "#8d5f88" - -theme.widget_use_text_decorations = true -theme.widget_decoration_arrl = '' -theme.widget_decoration_arrr = '' - --- ICONS - - -icons_dir = theme.dir .. "/icons/" -theme.icons_dir = icons_dir - -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" - -theme.menu_submenu_icon = icons_dir .. "submenu.png" -theme.taglist_squares_sel = icons_dir .. "square_sel.png" -theme.taglist_squares_unsel = icons_dir .. "square_unsel.png" - -theme.arrl = icons_dir .. "arrl.png" - -theme.widget_ac = icons_dir .. "ac.png" -theme.widget_ac_charging = icons_dir .. "ac_charging.png" -theme.widget_ac_charging_low = icons_dir .. "ac_charging_low.png" - -theme.widget_battery = icons_dir .. "battery.png" -theme.widget_battery_low = icons_dir .. "battery_low.png" -theme.widget_battery_empty = icons_dir .. "battery_empty.png" - -theme.widget_mem = icons_dir .. "mem.png" -theme.widget_cpu = icons_dir .. "cpu.png" -theme.widget_temp = icons_dir .. "temp.png" -theme.widget_net = icons_dir .. "net.png" -theme.widget_hdd = icons_dir .. "hdd.png" - -theme.widget_net_wireless = icons_dir .. "net_wireless.png" -theme.widget_net_wired = icons_dir .. "net_wired.png" -theme.widget_net_searching = icons_dir .. "net_searching.png" - -theme.widget_music = icons_dir .. "note.png" -theme.widget_music_on = icons_dir .. "note_on.png" -theme.widget_vol_high = icons_dir .. "vol_high.png" -theme.widget_vol = icons_dir .. "vol.png" -theme.widget_vol_low = icons_dir .. "vol_low.png" -theme.widget_vol_no = icons_dir .. "vol_no.png" -theme.widget_vol_mute = icons_dir .. "vol_mute.png" -theme.widget_mail = icons_dir .. "mail.png" -theme.widget_mail_on = icons_dir .. "mail_on.png" - -theme.dropdown_icon = icons_dir .. "dropdown.png" - -theme.tasklist_disable_icon = true ---theme.tasklist_floating = "*" ---theme.tasklist_maximized_horizontal = "_" ---theme.tasklist_maximized_vertical = "|" - -layout_icons_dir = icons_dir .. "layout/" -theme.layout_icons_dir = layout_icons_dir -theme.layout_tile = layout_icons_dir .. "tile.png" -theme.layout_tilegaps = layout_icons_dir .. "tilegaps.png" -theme.layout_tileleft = layout_icons_dir .. "tileleft.png" -theme.layout_tilebottom = layout_icons_dir .. "tilebottom.png" -theme.layout_tiletop = layout_icons_dir .. "tiletop.png" -theme.layout_fairv = layout_icons_dir .. "fairv.png" -theme.layout_fairh = layout_icons_dir .. "fairh.png" -theme.layout_spiral = layout_icons_dir .. "spiral.png" -theme.layout_dwindle = layout_icons_dir .. "dwindle.png" -theme.layout_max = layout_icons_dir .. "max.png" -theme.layout_fullscreen = layout_icons_dir .. "fullscreen.png" -theme.layout_magnifier = layout_icons_dir .. "magnifier.png" -theme.layout_floating = layout_icons_dir .. "floating.png" - -titlebar_icons_dir = icons_dir .. "titlebar/" -theme.titlebar_icons_dir = titlebar_icons_dir -theme.titlebar_close_button_focus = titlebar_icons_dir .. "/close_focus.png" -theme.titlebar_close_button_normal = titlebar_icons_dir .. "/close_normal.png" - -theme.titlebar_ontop_button_focus_active = titlebar_icons_dir .. "/ontop_focus_active.png" -theme.titlebar_ontop_button_normal_active = titlebar_icons_dir .. "/ontop_normal_active.png" -theme.titlebar_ontop_button_focus_inactive = titlebar_icons_dir .. "/ontop_focus_inactive.png" -theme.titlebar_ontop_button_normal_inactive = titlebar_icons_dir .. "/ontop_normal_inactive.png" - -theme.titlebar_sticky_button_focus_active = titlebar_icons_dir .. "/sticky_focus_active.png" -theme.titlebar_sticky_button_normal_active = titlebar_icons_dir .. "/sticky_normal_active.png" -theme.titlebar_sticky_button_focus_inactive = titlebar_icons_dir .. "/sticky_focus_inactive.png" -theme.titlebar_sticky_button_normal_inactive = titlebar_icons_dir .. "/sticky_normal_inactive.png" - -theme.titlebar_floating_button_focus_active = titlebar_icons_dir .. "/floating_focus_active.png" -theme.titlebar_floating_button_normal_active = titlebar_icons_dir .. "/floating_normal_active.png" -theme.titlebar_floating_button_focus_inactive = titlebar_icons_dir .. "/floating_focus_inactive.png" -theme.titlebar_floating_button_normal_inactive = titlebar_icons_dir .. "/floating_normal_inactive.png" -theme.titlebar_maximized_button_focus_active = titlebar_icons_dir .. "/maximized_focus_active.png" -theme.titlebar_maximized_button_normal_active = titlebar_icons_dir .. "/maximized_normal_active.png" -theme.titlebar_maximized_button_focus_inactive = titlebar_icons_dir .. "/maximized_focus_inactive.png" -theme.titlebar_maximized_button_normal_inactive = titlebar_icons_dir .. "/maximized_normal_inactive.png" +-- FONTS: +-- +--theme.font = "Source Code Pro Bold 10.5" +--theme.sans_font = "Source Sans Pro Bold 10.3" +-- +--theme.font = "Meslo LG S for Lcarsline Bold 10.5" +--theme.sans_font = "PT Sans Bold 10.3" +-- +-- use ~/.fonts.conf, Luke ;) +theme.font = "Monospace Bold 10.5" +theme.sans_font = "Sans Bold 10.3" +-- +-- Don't use sans font: +--theme.sans_font = theme.font -theme.titlebar_minimize_button_focus_active = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_active = titlebar_icons_dir .. "/minimized_normal.png" -theme.titlebar_minimize_button_focus_inactive = titlebar_icons_dir .. "/minimized_focus.png" -theme.titlebar_minimize_button_normal_inactive = titlebar_icons_dir .. "/minimized_normal.png" return theme diff --git a/eminent b/third_party/eminent similarity index 100% rename from eminent rename to third_party/eminent