diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2017-10-17 18:12:57 -0600 |
---|---|---|
committer | mediocregopher <mediocregopher@gmail.com> | 2021-10-03 17:22:56 -0600 |
commit | 07ab3a77b44944a1ac234fbd717391f36370416e (patch) | |
tree | edd959740bf9256bf38e9c2e3cacda8c555f8c56 /awesome |
initial public commit
Diffstat (limited to 'awesome')
61 files changed, 841 insertions, 0 deletions
diff --git a/awesome/awesome.desktop b/awesome/awesome.desktop new file mode 100644 index 0000000..1945e7a --- /dev/null +++ b/awesome/awesome.desktop @@ -0,0 +1,9 @@ +# For use in ubuntu, just copy into /usr/share/xsessions + +[Desktop Entry] +Name=awesome +Comment=Highly configurable framework window manager +Exec=/home/mediocregopher/.nix-profile/bin/awesome +Type=Application +Icon=/usr/share/pixmaps/awesome.xpm +Keywords=Window manager diff --git a/awesome/bat.lua b/awesome/bat.lua new file mode 100644 index 0000000..a5348d6 --- /dev/null +++ b/awesome/bat.lua @@ -0,0 +1,43 @@ +local io = io +local math = math +local tonumber = tonumber +local string = string +local naughty = require("naughty") + +function batteryInfo() + for i=0,1 do + local dir = "/sys/class/power_supply/BAT" .. tostring(i) .. "/" + local f_status = io.popen("cat " .. dir .. "status 2>/dev/null") + local c_status = f_status:read() + f_status:close() + + if c_status and c_status ~= "" then + local prefix = "energy" + local f_now = io.popen("cat " .. dir .. prefix .. "_now 2>/dev/null") + local c_now_str = f_now:read() + f_now:close() + + if not c_now_str or c_now_str == "" then + prefix = "charge" + local f_now = io.popen("cat " .. dir .. prefix .. "_now") + c_now_str = f_now:read() + f_now:close() + end + + local f_full = io.popen("cat " .. dir .. prefix .. "_full") + local c_full_str = f_full:read() + f_full:close() + + local c_now = tonumber(c_now_str) + local c_full = tonumber(c_full_str) + + local charging = (c_status == "Charging" or c_status == "Full") + + if c_now ~= nil and c_full ~= nil then + local percent = math.floor((c_now/c_full) * 100) + return percent, charging + end + end + end + return nil, charging +end diff --git a/awesome/bin/cricket b/awesome/bin/cricket Binary files differnew file mode 100755 index 0000000..b8d5699 --- /dev/null +++ b/awesome/bin/cricket diff --git a/awesome/bin/imgavg b/awesome/bin/imgavg Binary files differnew file mode 100755 index 0000000..f839d31 --- /dev/null +++ b/awesome/bin/imgavg diff --git a/awesome/bin/random_i3lock.sh b/awesome/bin/random_i3lock.sh new file mode 100755 index 0000000..e5f4e16 --- /dev/null +++ b/awesome/bin/random_i3lock.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +R=`find "$1" | grep -P 'png$' | sort -R | head -n1` +exec i3lock -i $R -t diff --git a/awesome/bin/scrot-gobin.sh b/awesome/bin/scrot-gobin.sh new file mode 100755 index 0000000..33bfc9f --- /dev/null +++ b/awesome/bin/scrot-gobin.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +scrot -o -s "/tmp/shot.png" +eog /tmp/shot.png diff --git a/awesome/bin/sysstats.sh b/awesome/bin/sysstats.sh new file mode 100755 index 0000000..f42588e --- /dev/null +++ b/awesome/bin/sysstats.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +cd $(dirname "$0") + +sep=" | " + +out=$(/home/mediocregopher/.config/awesome/bin/cricket \ + --limit 1 \ + --ping-hosts 8.8.8.8 \ + --net-interval "" \ + --disk-interval "" \ + --disk-io-interval "") + +function outNum { + echo "$out" | grep "$1" | grep -oP "$2=\"[0-9]+\"" | grep -oP '[0-9]+' +} + +echo -n "ping:$(outNum "ping result" "tookMSAvg")ms" + +echo -n "$sep" + +memBarSize=10 +memPer=$(outNum "mem stats" "memUsedPer") +memUsed=$(expr $memPer / $memBarSize) +memUnused=$(expr $memBarSize - $memUsed) +echo -n "mem:" +for i in $(seq $memUsed); do echo -n "█"; done +for i in $(seq $memUnused); do echo -n "░"; done +for i in $(seq $(expr $memBarSize - $memUsed - $memUnused)); do echo -n "░"; done + +echo -n "$sep" + +cpuBarSize=20 +cpuIdle=$(outNum "cpu stats" "cpuIdle") +cpuSys=$(outNum "cpu stats" "cpuSystem") +cpuUser=$(outNum "cpu stats" "cpuUser") +cpuTot=$(expr $cpuIdle + $cpuSys + $cpuUser) +function cpuL { + python -c "print(int($1 / $cpuTot * $cpuBarSize))" +} +cpuLIdle=$(cpuL $cpuIdle) +cpuLSys=$(cpuL $cpuSys) +cpuLUser=$(cpuL $cpuUser) +echo -n "cpu:" +for i in $(seq $cpuLUser); do echo -n "█"; done +for i in $(seq $cpuLSys); do echo -n "▓"; done +for i in $(seq $cpuLIdle); do echo -n "░"; done +for i in $(seq $(expr $cpuBarSize - $cpuLIdle - $cpuLSys - $cpuLUser)); do echo -n "░"; done + +echo "" diff --git a/awesome/default.nix b/awesome/default.nix new file mode 100644 index 0000000..8b52d9c --- /dev/null +++ b/awesome/default.nix @@ -0,0 +1,26 @@ +{ + + pkgs ? (import ../pkgs.nix) {}, + +}: rec { + + cfg = ./.; + wp = ../wallpapers; + + dirsLua = pkgs.writeTextDir "dirs.lua" '' + home_dir = os.getenv("HOME").."/" + conf_dir = "${cfg}/" + wp_dir = "${wp}/" + ''; + + awesome = pkgs.writeScriptBin "awesome" '' + #!${pkgs.bash}/bin/bash + echo "[$(date)] New awesome session starting" > ~/.awesome.log + exec ${pkgs.awesome}/bin/awesome \ + -c ${cfg}/rc.lua \ + --search ${dirsLua} \ + --search ${cfg} \ + 2>&1 2>>~/.awesome.log + ''; + +} diff --git a/awesome/helper.png b/awesome/helper.png Binary files differnew file mode 100644 index 0000000..4b43bf7 --- /dev/null +++ b/awesome/helper.png diff --git a/awesome/mediocregopher-sysstats.service b/awesome/mediocregopher-sysstats.service new file mode 100644 index 0000000..bac39ba --- /dev/null +++ b/awesome/mediocregopher-sysstats.service @@ -0,0 +1,13 @@ +[Unit] +Description=mediocregopher's sysstats +Requires=network.target +After=network.target + +[Service] +Restart=always +RestartSec=1s +User=mediocregopher +ExecStart=/bin/bash -c 'while [ 1 ]; do out=$(~/.config/awesome/bin/sysstats.sh); echo "$out" > /tmp/sysstats; sleep 1; done' + +[Install] +WantedBy=multi-user.target diff --git a/awesome/pulseaudio.lua b/awesome/pulseaudio.lua new file mode 100644 index 0000000..765fd12 --- /dev/null +++ b/awesome/pulseaudio.lua @@ -0,0 +1,40 @@ +local io = io +local math = math +local tonumber = tonumber +local tostring = tostring +local string = string +local naughty = require("naughty") + +function volumeInfo() + volmin = 0 + volmax = 65536 + local f = io.popen("pacmd dump |grep set-sink-volume|grep analog-stereo") + local g = io.popen("pacmd dump |grep set-sink-mute|grep analog-stereo") + local v = f:read() + local mute = g:read() + if mute ~= nil and string.find(mute, "no") then + volume = math.floor(tonumber(string.sub(v, string.find(v, 'x')-1)) * 100 / volmax) + else + volume = "off" + end + f:close() + g:close() + return "vol:"..volume.." " +end + +function muteAll() + local outh = io.popen("pactl list short sources | awk '{print $1}'") + while true do + local i = outh:read() + if i == nil then break end + io.popen("pactl set-source-mute " .. i .. " 1"):close() + end + outh:close() +end + +function unmuted() + local outh = io.popen("pactl list sources | grep 'Mute: no'") + local any = outh:read() + outh:close() + return any ~= nil +end diff --git a/awesome/rc.lua b/awesome/rc.lua new file mode 100644 index 0000000..5ec053e --- /dev/null +++ b/awesome/rc.lua @@ -0,0 +1,544 @@ +-- Standard awesome library +local gears = require("gears") +local awful = require("awful") +awful.rules = require("awful.rules") +require("awful.autofocus") +-- Widget and layout library +local wibox = require("wibox") +-- Notification library +local naughty = require("naughty") +local menubar = require("menubar") + +local function debug(msg) + if not msg then msg = "" end + naughty.notify({ text = "debug: " .. msg }) +end + +local function info(msg) + naughty.notify({ text = msg }) +end + +require("dirs") +require("bat") +require("pulseaudio") +muteAll() -- pre-emptively mute all mics, just in-case + +-- for sanity +local home_dir = os.getenv("HOME").."/" + +-- {{{ Naughty config (the notification library) +naughty.config.defaults.position = "bottom_right" +naughty.config.defaults.width = 250 +naughty.config.defaults.icon=conf_dir .. "helper.png" +naughty.config.defaults.icon_size = 75 +-- }}} + +-- {{{ Error handling +-- Check if awesome encountered an error during startup and fell back to +-- another config (This code will only ever execute for the fallback config) +if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) +end + +-- Handle runtime errors after startup +do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true + + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = err }) + in_error = false + end) +end +-- }}} + + +local beautiful = require("beautiful") + +-- {{{ Wallpaper +-- we do this here, before the theme is loaded, because our theme depends on +-- knowing what our wallpaper is, cause this shit is cray +function rand_wp() + local ls = io.popen("ls " .. wp_dir .. " | shuf -n1") + local wp = ls:read("*l") + return wp_dir .. '/' .. wp +end + +function rand_wp_lock() + awful.spawn(conf_dir.."bin/random_i3lock.sh "..wp_dir, false) +end + +local wp = rand_wp() +local imgavg = io.popen("cat " .. wp .. " | " .. conf_dir .. "/bin/imgavg") +local avgcolor = imgavg:read() +local comcolor = imgavg:read() +imgavg:close() + +for s = 1, screen.count() do + gears.wallpaper.maximized(wp, s, true) +end +-- }}} + +require("theme/theme") +local theme = load_theme(avgcolor, comcolor) +beautiful.init(theme) + +-- This is used later as the default terminal and editor to run. +terminal = "alacritty" + +editor = os.getenv("EDITOR") or "nano" +editor_cmd = terminal .. " -e " .. editor + +-- Default modkey. +-- Usually, Mod4 is the key with a logo between Control and Alt. +-- If you do not like this or do not have such a key, +-- I suggest you to remap Mod4 to another key using xmodmap or other tools. +-- However, you can use another modifier like Mod1, but it may interact with others. +modkey = "Mod4" + +-- Table of layouts to cover with awful.layout.inc, order matters. +local layouts = +{ + awful.layout.suit.fair, + awful.layout.suit.fair.horizontal, + awful.layout.suit.tile, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + -- awful.layout.suit.spiral, + -- awful.layout.suit.spiral.dwindle, + -- awful.layout.suit.max, + -- awful.layout.suit.max.fullscreen, + -- awful.layout.suit.magnifier, + awful.layout.suit.floating +} +-- }}} + + +-- {{{ Tags +-- Define a tag table which hold all screen tags. +tags = {} +for s = 1, screen.count() do + -- Each screen has its own tag table. + tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[1]) +end +-- }}} + +-- Menubar configuration +menubar.utils.terminal = terminal -- Set the terminal for applications that require it + +-- {{{ Wibox + +-- {{{ Battery widget +local battimerintvl = 4 +batwidget = wibox.widget.textbox("") +battimer = gears.timer({ timeout = battimerintvl }) +battimer:connect_signal("timeout", + function() + local batlevel, charging = batteryInfo() + if batlevel == nil then batlevel = "unk" + elseif (tonumber(batlevel) < 10) then + naughty.notify({ + preset = naughty.config.presets.critical, + title="ALERT", + text="BATTERY LEVEL LOW", + timeout=battimerintvl-1, + }) + end + if charging then + batwidget:set_markup('bat:'..batlevel) + else + batwidget:set_markup('<b>bat:'..batlevel..'</b>') + end + end) +battimer:start() +-- }}} + +-- {{{ sysstats widget +sysstatswidget = wibox.widget.textbox("") +sysstatstimer = gears.timer({ timeout = 1 }) +sysstatstimer:connect_signal("timeout", + function() + local sysstats = "??? STATS ???" + local f_sysstats = io.open("/tmp/sysstats") + if f_sysstats then + c_sysstats = f_sysstats:read() + f_sysstats:close() + if c_sysstats then sysstats = c_sysstats end + end + sysstatswidget:set_markup(sysstats) + end) +sysstatstimer:start() +-- }}} + +-- {{{ notifier for when my mic isn't muted +local unmuteNot +mutechecktimer = gears.timer({ timeout = 0.5 }) +mutechecktimer:connect_signal("timeout", + function() + local anyUnmuted = unmuted() + if unmuteNot and not anyUnmuted then + naughty.destroy(unmuteNot, naughty.notificationClosedReason.dismissedByUser) + unmuteNot = nil + elseif not unmuteNot and anyUnmuted then + unmuteNot = naughty.notify({ + preset = naughty.config.presets.critical, + text = "Mic is hot!", + timeout = 0, + }) + end + end) +mutechecktimer:start() +-- }}} + + +-- Create a textclock widget +mytextclock = wibox.widget.textclock("%a <b>%d</b>/%m <b>%H:%M</b> %z") +myutctextclock = wibox.widget.textclock("%a %d/%m %H:%M %z", 60, "Z") + +-- Create a wibox for each screen and add it +mywibox = {} +mypromptbox = {} +mylayoutbox = {} +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({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end), + awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end) + ) +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() + end + end), + awful.button({ }, 3, function () + if instance then + instance:hide() + instance = nil + else + instance = awful.menu.clients({ + theme = { width = 250 } + }) + 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)) + +for s = 1, screen.count() do + -- Create a promptbox for each screen + mypromptbox[s] = awful.widget.prompt() + -- Create an imagebox widget which will contains an icon indicating which layout we're using. + -- We need one layoutbox per screen. + mylayoutbox[s] = awful.widget.layoutbox(s) + mylayoutbox[s]:buttons(awful.util.table.join( + awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), + awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), + awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), + awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) + -- Create a taglist widget + mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) + + -- Create a tasklist widget + mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) + + -- Create the wibox + mywibox[s] = awful.wibar({ position = "top", screen = s }) + + -- Widgets that are aligned to the left + local left_layout = wibox.layout.fixed.horizontal() + left_layout:add(mylayoutbox[s]) + left_layout:add(mypromptbox[s]) + + -- Widgets that are aligned to the right + local right_sep = " | " + local right_layout = wibox.layout.fixed.horizontal() + --right_layout:add(wibox.widget.textbox(right_sep)) + right_layout:add(sysstatswidget) + right_layout:add(wibox.widget.textbox(right_sep)) + right_layout:add(batwidget) + right_layout:add(wibox.widget.textbox(right_sep)) + right_layout:add(wibox.widget.systray()) + right_layout:add(wibox.widget.textbox(right_sep)) + right_layout:add(mytaglist[s]) + right_layout:add(wibox.widget.textbox(right_sep)) + right_layout:add(myutctextclock) + right_layout:add(wibox.widget.textbox(right_sep)) + right_layout:add(mytextclock) + + -- Now bring it all together (with the tasklist in the middle) + local layout = wibox.layout.align.horizontal() + layout:set_left(left_layout) + layout:set_middle(mytasklist[s]) + layout:set_right(right_layout) + + mywibox[s]:set_widget(layout) +end +-- }}} + +local function focused() + return awful.screen.focused().index +end + +-- {{{ Mouse bindings +root.buttons(awful.util.table.join( + -- awful.button({ }, 3, function () mymainmenu:toggle() end), + awful.button({ }, 4, awful.tag.viewnext), + awful.button({ }, 5, awful.tag.viewprev) +)) +-- }}} + +-- {{{ Key bindings +globalkeys = awful.util.table.join( + awful.key({ modkey, }, "Left", awful.tag.viewprev ), + awful.key({ modkey, }, "Right", awful.tag.viewnext ), + + -- j and k are used for moving around windows and moving windows around + awful.key({ modkey, }, "j", + function () + awful.client.focus.byidx( 1) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, }, "k", + function () + awful.client.focus.byidx(-1) + if client.focus then client.focus:raise() end + end), + awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), + awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), + awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), + awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), + + -- h and l are for resizing + awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), + awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), + awful.key({ modkey, "Control" }, "h", function () awful.tag.incnmaster( 1) end), + awful.key({ modkey, "Control" }, "l", function () awful.tag.incnmaster(-1) end), + + -- Space is for changing the layout + awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), + awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), + + + -- r is for restart, awesome or the whole computer + awful.key({ modkey }, "r", awesome.restart), + awful.key({ modkey, "Control" }, "r", + function () + info("rebooting") + awful.spawn("systemctl reboot") + end), + + -- Escape is for quitting, either the current program, all of awesome, or + -- or all of everything (suspend) (current program is under clientkeys) + awful.key({ modkey, "Control" }, "Escape", awesome.quit), + awful.key({ modkey, "Control", "Shift" }, "Escape", + function () + info("hibernating") + awful.spawn("systemctl hibernate") + end), + + -- n is for minimizing and unminimizing (minimmize is implemented under + -- clientkeys) + awful.key({ modkey, "Control" }, "n", awful.client.restore), + + -- Prompt + awful.key({ modkey }, "p", function () + local screen = awful.screen.focused().index + mywibox[screen].visible = true + mypromptbox[screen]:run() + end), + + --Terminal + awful.key({ modkey }, "Return", function () + awful.spawn(terminal) + end), + + --PrintScreen + awful.key({}, "Print", false, function () awful.spawn(conf_dir.."bin/scrot-gobin.sh",false) end), + awful.key({ "Control" }, "Print", function () + local scr_dir = home_dir..'Screenshots' + awful.spawn("mkdir -p "..scr_dir, false) + awful.spawn("scrot -e 'mv $f "..scr_dir.."/ 2>/dev/null'",false) + naughty.notify({ text = "Screenshot taken" }) + end), + + --Lock screen + awful.key({ modkey, "Control" }, "Delete", rand_wp_lock), + + awful.key( { }, "XF86AudioRaiseVolume", function() + awful.spawn("/usr/bin/pactl set-sink-volume @DEFAULT_SINK@ +5%", false) + awful.spawn("/usr/bin/pactl set-sink-mute @DEFAULT_SINK@ 0", false) + end), + + awful.key( { }, "XF86AudioLowerVolume", function() + awful.spawn("/usr/bin/pactl set-sink-volume @DEFAULT_SINK@ -5%", false) + awful.spawn("/usr/bin/pactl set-sink-mute @DEFAULT_SINK@ 0", false) + end), + + awful.key( { }, "XF86AudioMute", function() + awful.spawn("/usr/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle", false) + end), + + awful.key( { }, "XF86MonBrightnessUp", function() + awful.spawn("/usr/bin/xbacklight -inc 5", false) + end), + + awful.key( { }, "XF86MonBrightnessDown", function() + awful.spawn("/usr/bin/xbacklight -dec 5", false) + end), + + -- Push to talk + awful.key( { modkey }, "q", function() + awful.spawn("/usr/bin/pactl set-source-mute @DEFAULT_SOURCE@ 0") + end, + muteAll, + { }) +) + +globalkeys = awful.util.table.join(globalkeys, + awful.key( { modkey }, "a", function() + info(tostring(os.time())) + end) +) + +clientkeys = awful.util.table.join( + awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end), + awful.key({ modkey, }, "Escape", function (c) c:kill() end), + awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), + awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), + awful.key({ modkey, }, "n", + function (c) + -- The client currently has the input focus, so it cannot be + -- minimized, since minimized clients can't have the focus. + c.minimized = true + end), + awful.key({ modkey, }, "m", + function (c) + c.maximized_horizontal = not c.maximized_horizontal + c.maximized_vertical = not c.maximized_vertical + end) +) + +-- Bind all key numbers to tags. +-- Be careful: we use keycodes to make it works on any keyboard layout. +-- This should map on the top row of your keyboard, usually 1 to 9. +for i = 1, 9 do + globalkeys = awful.util.table.join(globalkeys, + -- View tag only. + awful.key({ modkey }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end), + -- Toggle tag. + awful.key({ modkey, "Control" }, "#" .. i + 9, + function () + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end), + -- Move client to tag. + awful.key({ modkey, "Shift" }, "#" .. i + 9, + function () + if client.focus then + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end)) +end + +clientbuttons = awful.util.table.join( + awful.button({ }, 1, function (c) client.focus = c; c:raise() end), + awful.button({ modkey }, 1, awful.mouse.client.move), + awful.button({ modkey }, 3, awful.mouse.client.resize)) + +-- Set keys +root.keys(globalkeys) +-- }}} + +-- {{{ 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 = clientkeys, + buttons = clientbuttons } }, + { rule = { class = "MPlayer" }, + properties = { floating = true } }, + { rule = { class = "pinentry" }, + properties = { floating = true } }, + { rule = { class = "gimp" }, + properties = { floating = true } } + -- Set Firefox to always map on tags number 2 of screen 1. + -- { rule = { class = "Firefox" }, + -- properties = { tag = tags[1][2] } }, +} +-- }}} + +-- {{{ Signals +-- Signal function to execute when a new client appears. +client.connect_signal("manage", function (c, startup) + -- Enable sloppy focus + c:connect_signal("mouse::enter", function(c) + if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier + and awful.client.focus.filter(c) then + client.focus = c + end + end) + + if not startup then + -- Set the windows at the slave, + -- i.e. put it at the end of others instead of setting it master. + -- awful.client.setslave(c) + + -- Put windows in a smart way, only if they does not set an initial position. + if not c.size_hints.user_position and not c.size_hints.program_position then + c:move_to_screen(awful.screen.focused()) + awful.placement.no_overlap(c) + awful.placement.no_offscreen(c) + end + end +end) + +client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) +client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +-- }}} diff --git a/awesome/theme/README b/awesome/theme/README new file mode 100644 index 0000000..1ddb349 --- /dev/null +++ b/awesome/theme/README @@ -0,0 +1,3 @@ +Background images: + Mikael Eriksson <mikael_eriksson@miffe.org> + Licensed under CC-BY-SA-3.0 diff --git a/awesome/theme/background.png b/awesome/theme/background.png Binary files differnew file mode 100644 index 0000000..d72a39e --- /dev/null +++ b/awesome/theme/background.png diff --git a/awesome/theme/background_white.png b/awesome/theme/background_white.png Binary files differnew file mode 100644 index 0000000..363ddd6 --- /dev/null +++ b/awesome/theme/background_white.png diff --git a/awesome/theme/layouts/dwindle.png b/awesome/theme/layouts/dwindle.png Binary files differnew file mode 100644 index 0000000..943ece5 --- /dev/null +++ b/awesome/theme/layouts/dwindle.png diff --git a/awesome/theme/layouts/dwindlew.png b/awesome/theme/layouts/dwindlew.png Binary files differnew file mode 100644 index 0000000..36de1ba --- /dev/null +++ b/awesome/theme/layouts/dwindlew.png diff --git a/awesome/theme/layouts/fairh.png b/awesome/theme/layouts/fairh.png Binary files differnew file mode 100644 index 0000000..b4e289d --- /dev/null +++ b/awesome/theme/layouts/fairh.png diff --git a/awesome/theme/layouts/fairhw.png b/awesome/theme/layouts/fairhw.png Binary files differnew file mode 100644 index 0000000..514d66d --- /dev/null +++ b/awesome/theme/layouts/fairhw.png diff --git a/awesome/theme/layouts/fairv.png b/awesome/theme/layouts/fairv.png Binary files differnew file mode 100644 index 0000000..e5aad70 --- /dev/null +++ b/awesome/theme/layouts/fairv.png diff --git a/awesome/theme/layouts/fairvw.png b/awesome/theme/layouts/fairvw.png Binary files differnew file mode 100644 index 0000000..f97ce56 --- /dev/null +++ b/awesome/theme/layouts/fairvw.png diff --git a/awesome/theme/layouts/floating.png b/awesome/theme/layouts/floating.png Binary files differnew file mode 100644 index 0000000..cbc7804 --- /dev/null +++ b/awesome/theme/layouts/floating.png diff --git a/awesome/theme/layouts/floatingw.png b/awesome/theme/layouts/floatingw.png Binary files differnew file mode 100644 index 0000000..7ddf7ae --- /dev/null +++ b/awesome/theme/layouts/floatingw.png diff --git a/awesome/theme/layouts/fullscreen.png b/awesome/theme/layouts/fullscreen.png Binary files differnew file mode 100644 index 0000000..46716f5 --- /dev/null +++ b/awesome/theme/layouts/fullscreen.png diff --git a/awesome/theme/layouts/fullscreenw.png b/awesome/theme/layouts/fullscreenw.png Binary files differnew file mode 100644 index 0000000..2c3cfad --- /dev/null +++ b/awesome/theme/layouts/fullscreenw.png diff --git a/awesome/theme/layouts/magnifier.png b/awesome/theme/layouts/magnifier.png Binary files differnew file mode 100644 index 0000000..1476555 --- /dev/null +++ b/awesome/theme/layouts/magnifier.png diff --git a/awesome/theme/layouts/magnifierw.png b/awesome/theme/layouts/magnifierw.png Binary files differnew file mode 100644 index 0000000..97c1d11 --- /dev/null +++ b/awesome/theme/layouts/magnifierw.png diff --git a/awesome/theme/layouts/max.png b/awesome/theme/layouts/max.png Binary files differnew file mode 100644 index 0000000..fe70bef --- /dev/null +++ b/awesome/theme/layouts/max.png diff --git a/awesome/theme/layouts/maxw.png b/awesome/theme/layouts/maxw.png Binary files differnew file mode 100644 index 0000000..d8debb8 --- /dev/null +++ b/awesome/theme/layouts/maxw.png diff --git a/awesome/theme/layouts/spiral.png b/awesome/theme/layouts/spiral.png Binary files differnew file mode 100644 index 0000000..a24faf5 --- /dev/null +++ b/awesome/theme/layouts/spiral.png diff --git a/awesome/theme/layouts/spiralw.png b/awesome/theme/layouts/spiralw.png Binary files differnew file mode 100644 index 0000000..f34ceb0 --- /dev/null +++ b/awesome/theme/layouts/spiralw.png diff --git a/awesome/theme/layouts/tile.png b/awesome/theme/layouts/tile.png Binary files differnew file mode 100644 index 0000000..071a385 --- /dev/null +++ b/awesome/theme/layouts/tile.png diff --git a/awesome/theme/layouts/tilebottom.png b/awesome/theme/layouts/tilebottom.png Binary files differnew file mode 100644 index 0000000..aeedbe2 --- /dev/null +++ b/awesome/theme/layouts/tilebottom.png diff --git a/awesome/theme/layouts/tilebottomw.png b/awesome/theme/layouts/tilebottomw.png Binary files differnew file mode 100644 index 0000000..f42da9d --- /dev/null +++ b/awesome/theme/layouts/tilebottomw.png diff --git a/awesome/theme/layouts/tileleft.png b/awesome/theme/layouts/tileleft.png Binary files differnew file mode 100644 index 0000000..ab55e08 --- /dev/null +++ b/awesome/theme/layouts/tileleft.png diff --git a/awesome/theme/layouts/tileleftw.png b/awesome/theme/layouts/tileleftw.png Binary files differnew file mode 100644 index 0000000..c18e7b4 --- /dev/null +++ b/awesome/theme/layouts/tileleftw.png diff --git a/awesome/theme/layouts/tiletop.png b/awesome/theme/layouts/tiletop.png Binary files differnew file mode 100644 index 0000000..3febc35 --- /dev/null +++ b/awesome/theme/layouts/tiletop.png diff --git a/awesome/theme/layouts/tiletopw.png b/awesome/theme/layouts/tiletopw.png Binary files differnew file mode 100644 index 0000000..daf965f --- /dev/null +++ b/awesome/theme/layouts/tiletopw.png diff --git a/awesome/theme/layouts/tilew.png b/awesome/theme/layouts/tilew.png Binary files differnew file mode 100644 index 0000000..c722a35 --- /dev/null +++ b/awesome/theme/layouts/tilew.png diff --git a/awesome/theme/submenu.png b/awesome/theme/submenu.png Binary files differnew file mode 100644 index 0000000..b2778e2 --- /dev/null +++ b/awesome/theme/submenu.png diff --git a/awesome/theme/taglist/squarefw.png b/awesome/theme/taglist/squarefw.png Binary files differnew file mode 100644 index 0000000..2a86430 --- /dev/null +++ b/awesome/theme/taglist/squarefw.png diff --git a/awesome/theme/taglist/squarew.png b/awesome/theme/taglist/squarew.png Binary files differnew file mode 100644 index 0000000..913f2ca --- /dev/null +++ b/awesome/theme/taglist/squarew.png diff --git a/awesome/theme/theme.lua b/awesome/theme/theme.lua new file mode 100644 index 0000000..904c2bd --- /dev/null +++ b/awesome/theme/theme.lua @@ -0,0 +1,105 @@ +--------------------------- +-- Default awesome theme -- +--------------------------- + +function load_theme(avgcolor, comcolor) + if not avgcolor then avgcolor = "#000000" end + if not comcolor then comcolor = "#FFFFFF" end + + local theme = {} + + theme.font = "sans 8" + + --theme.bg_normal = "#222222" + theme.bg_normal = avgcolor + theme.bg_focus = theme.bg_normal + theme.bg_urgent = "#ff0000" -- TODO should be opposite of bg_normal + theme.bg_minimize = theme.bg_normal + theme.bg_systray = theme.bg_normal + + + --theme.fg_normal = "#aaaaaa" + theme.fg_normal = comcolor + theme.fg_focus = comcolor + theme.fg_urgent = "#ffffff" + theme.fg_minimize = comcolor + + theme.border_width = 1 + theme.border_normal = "#000000" + theme.border_focus = "#535d6c" + theme.border_marked = "#91231c" + + -- There are other variable sets + -- overriding the default one when + -- defined, the sets are: + -- [taglist|tasklist]_[bg|fg]_[focus|urgent] + -- titlebar_[bg|fg]_[normal|focus] + -- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] + -- mouse_finder_[color|timeout|animate_timeout|radius|factor] + -- Example: + --theme.taglist_bg_focus = "#ff0000" + + -- Display the taglist squares + theme.taglist_squares_sel = "/usr/share/awesome/themes/default/taglist/squarefw.png" + theme.taglist_squares_unsel = "/usr/share/awesome/themes/default/taglist/squarew.png" + + -- Variables set for theming the menu: + -- menu_[bg|fg]_[normal|focus] + -- menu_[border_color|border_width] + theme.menu_submenu_icon = "/usr/share/awesome/themes/default/submenu.png" + theme.menu_height = 15 + theme.menu_width = 100 + + -- You can add as many variables as + -- you wish and access them by using + -- beautiful.variable in your rc.lua + --theme.bg_widget = "#cc0000" + + -- Define the image to load + theme.titlebar_close_button_normal = "/usr/share/awesome/themes/default/titlebar/close_normal.png" + theme.titlebar_close_button_focus = "/usr/share/awesome/themes/default/titlebar/close_focus.png" + + theme.titlebar_ontop_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_normal_inactive.png" + theme.titlebar_ontop_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_focus_inactive.png" + theme.titlebar_ontop_button_normal_active = "/usr/share/awesome/themes/default/titlebar/ontop_normal_active.png" + theme.titlebar_ontop_button_focus_active = "/usr/share/awesome/themes/default/titlebar/ontop_focus_active.png" + + theme.titlebar_sticky_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_normal_inactive.png" + theme.titlebar_sticky_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_focus_inactive.png" + theme.titlebar_sticky_button_normal_active = "/usr/share/awesome/themes/default/titlebar/sticky_normal_active.png" + theme.titlebar_sticky_button_focus_active = "/usr/share/awesome/themes/default/titlebar/sticky_focus_active.png" + + theme.titlebar_floating_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/floating_normal_inactive.png" + theme.titlebar_floating_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/floating_focus_inactive.png" + theme.titlebar_floating_button_normal_active = "/usr/share/awesome/themes/default/titlebar/floating_normal_active.png" + theme.titlebar_floating_button_focus_active = "/usr/share/awesome/themes/default/titlebar/floating_focus_active.png" + + theme.titlebar_maximized_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_normal_inactive.png" + theme.titlebar_maximized_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_focus_inactive.png" + theme.titlebar_maximized_button_normal_active = "/usr/share/awesome/themes/default/titlebar/maximized_normal_active.png" + theme.titlebar_maximized_button_focus_active = "/usr/share/awesome/themes/default/titlebar/maximized_focus_active.png" + + theme.wallpaper = "/usr/share/awesome/themes/default/background.png" + + -- You can use your own layout icons like this: + theme.layout_fairh = "/usr/share/awesome/themes/default/layouts/fairhw.png" + theme.layout_fairv = "/usr/share/awesome/themes/default/layouts/fairvw.png" + theme.layout_floating = "/usr/share/awesome/themes/default/layouts/floatingw.png" + theme.layout_magnifier = "/usr/share/awesome/themes/default/layouts/magnifierw.png" + theme.layout_max = "/usr/share/awesome/themes/default/layouts/maxw.png" + theme.layout_fullscreen = "/usr/share/awesome/themes/default/layouts/fullscreenw.png" + theme.layout_tilebottom = "/usr/share/awesome/themes/default/layouts/tilebottomw.png" + theme.layout_tileleft = "/usr/share/awesome/themes/default/layouts/tileleftw.png" + theme.layout_tile = "/usr/share/awesome/themes/default/layouts/tilew.png" + theme.layout_tiletop = "/usr/share/awesome/themes/default/layouts/tiletopw.png" + theme.layout_spiral = "/usr/share/awesome/themes/default/layouts/spiralw.png" + theme.layout_dwindle = "/usr/share/awesome/themes/default/layouts/dwindlew.png" + + theme.awesome_icon = "/usr/share/awesome/icons/awesome16.png" + + -- Define the icon theme for application icons. If not set then the icons + -- from /usr/share/icons and /usr/share/icons/hicolor will be used. + theme.icon_theme = nil + + return theme +end diff --git a/awesome/theme/titlebar/close_focus.png b/awesome/theme/titlebar/close_focus.png Binary files differnew file mode 100644 index 0000000..a5b7958 --- /dev/null +++ b/awesome/theme/titlebar/close_focus.png diff --git a/awesome/theme/titlebar/close_normal.png b/awesome/theme/titlebar/close_normal.png Binary files differnew file mode 100644 index 0000000..d0fdb7e --- /dev/null +++ b/awesome/theme/titlebar/close_normal.png diff --git a/awesome/theme/titlebar/floating_focus_active.png b/awesome/theme/titlebar/floating_focus_active.png Binary files differnew file mode 100644 index 0000000..3447bb2 --- /dev/null +++ b/awesome/theme/titlebar/floating_focus_active.png diff --git a/awesome/theme/titlebar/floating_focus_inactive.png b/awesome/theme/titlebar/floating_focus_inactive.png Binary files differnew file mode 100644 index 0000000..fe5bb3c --- /dev/null +++ b/awesome/theme/titlebar/floating_focus_inactive.png diff --git a/awesome/theme/titlebar/floating_normal_active.png b/awesome/theme/titlebar/floating_normal_active.png Binary files differnew file mode 100644 index 0000000..3108e9e --- /dev/null +++ b/awesome/theme/titlebar/floating_normal_active.png diff --git a/awesome/theme/titlebar/floating_normal_inactive.png b/awesome/theme/titlebar/floating_normal_inactive.png Binary files differnew file mode 100644 index 0000000..d6f19db --- /dev/null +++ b/awesome/theme/titlebar/floating_normal_inactive.png diff --git a/awesome/theme/titlebar/maximized_focus_active.png b/awesome/theme/titlebar/maximized_focus_active.png Binary files differnew file mode 100644 index 0000000..78a2914 --- /dev/null +++ b/awesome/theme/titlebar/maximized_focus_active.png diff --git a/awesome/theme/titlebar/maximized_focus_inactive.png b/awesome/theme/titlebar/maximized_focus_inactive.png Binary files differnew file mode 100644 index 0000000..2c3a5b7 --- /dev/null +++ b/awesome/theme/titlebar/maximized_focus_inactive.png diff --git a/awesome/theme/titlebar/maximized_normal_active.png b/awesome/theme/titlebar/maximized_normal_active.png Binary files differnew file mode 100644 index 0000000..7eb34a9 --- /dev/null +++ b/awesome/theme/titlebar/maximized_normal_active.png diff --git a/awesome/theme/titlebar/maximized_normal_inactive.png b/awesome/theme/titlebar/maximized_normal_inactive.png Binary files differnew file mode 100644 index 0000000..63cc537 --- /dev/null +++ b/awesome/theme/titlebar/maximized_normal_inactive.png diff --git a/awesome/theme/titlebar/ontop_focus_active.png b/awesome/theme/titlebar/ontop_focus_active.png Binary files differnew file mode 100644 index 0000000..f954bed --- /dev/null +++ b/awesome/theme/titlebar/ontop_focus_active.png diff --git a/awesome/theme/titlebar/ontop_focus_inactive.png b/awesome/theme/titlebar/ontop_focus_inactive.png Binary files differnew file mode 100644 index 0000000..7b7cf11 --- /dev/null +++ b/awesome/theme/titlebar/ontop_focus_inactive.png diff --git a/awesome/theme/titlebar/ontop_normal_active.png b/awesome/theme/titlebar/ontop_normal_active.png Binary files differnew file mode 100644 index 0000000..48defb3 --- /dev/null +++ b/awesome/theme/titlebar/ontop_normal_active.png diff --git a/awesome/theme/titlebar/ontop_normal_inactive.png b/awesome/theme/titlebar/ontop_normal_inactive.png Binary files differnew file mode 100644 index 0000000..fd1dc01 --- /dev/null +++ b/awesome/theme/titlebar/ontop_normal_inactive.png diff --git a/awesome/theme/titlebar/sticky_focus_active.png b/awesome/theme/titlebar/sticky_focus_active.png Binary files differnew file mode 100644 index 0000000..1106399 --- /dev/null +++ b/awesome/theme/titlebar/sticky_focus_active.png diff --git a/awesome/theme/titlebar/sticky_focus_inactive.png b/awesome/theme/titlebar/sticky_focus_inactive.png Binary files differnew file mode 100644 index 0000000..d75fa0e --- /dev/null +++ b/awesome/theme/titlebar/sticky_focus_inactive.png diff --git a/awesome/theme/titlebar/sticky_normal_active.png b/awesome/theme/titlebar/sticky_normal_active.png Binary files differnew file mode 100644 index 0000000..b33956a --- /dev/null +++ b/awesome/theme/titlebar/sticky_normal_active.png diff --git a/awesome/theme/titlebar/sticky_normal_inactive.png b/awesome/theme/titlebar/sticky_normal_inactive.png Binary files differnew file mode 100644 index 0000000..7aeac90 --- /dev/null +++ b/awesome/theme/titlebar/sticky_normal_inactive.png |