This commit is contained in:
Yessiest 2023-05-06 12:56:25 +04:00
parent 02a3db7ebd
commit 6a0489d2cd
31 changed files with 583 additions and 51 deletions

View File

@ -1,3 +1,7 @@
# The experimental awesome-git branch
This branch is an attempt to move the entire config to the non-deprecated part of awesome-git api using as little editing as possible. Generally speaking simply dropping in the widget from the main branch should work, with a few exceptions. In particular, awful.wallpaper is a bit more complex (though the old gears.wallpaper method works), notifications are more complex and some things act a little weird (mpc widget for some reason displays "Loading mpc..." although it should drop once mpc is detected). Also, anything that uses the old awful.rules api should be made compatible with ruled api.
# Reno desktop - awesomewm || ( openbox && xfce ) # Reno desktop - awesomewm || ( openbox && xfce )
Reno is an evolution of my previous configuration, https://512mb.org/git/Yessiest/awesome. This time, this bad boy can fit 90% more configuration options, through the use of AWMTK2 (or RenoTK, never really decided on the name). Reno is an evolution of my previous configuration, https://512mb.org/git/Yessiest/awesome. This time, this bad boy can fit 90% more configuration options, through the use of AWMTK2 (or RenoTK, never really decided on the name).

View File

@ -1,7 +1,7 @@
# Global variables # Global variables
[global] [global]
terminal = "$HOME/.local/bin/st" terminal = "st"
browser = "prime-run librewolf" browser = "librewolf"
modkey = "Mod4" modkey = "Mod4"
theme = "unity_mate" theme = "unity_mate"
shell = "zsh" shell = "zsh"
@ -10,16 +10,19 @@ shell = "zsh"
# Format: <modifier>(+<modifier>+...)+<key> = "<command or :internal.function>" # Format: <modifier>(+<modifier>+...)+<key> = "<command or :internal.function>"
# "modkey" as modifier will be substituted for modkey variable in [global] # "modkey" as modifier will be substituted for modkey variable in [global]
[keys] [keys]
modkey+Up = ":root.client_next" modkey+Left = ":root.tag_next"
modkey+Down = ":root.client_previous" modkey+Right = ":root.tag_prev"
modkey+Control+Up = ":root.screen_next" modkey+j = ":root.client_next"
modkey+Control+Down = ":root.screen_previous" modkey+k = ":root.client_previous"
modkey+Control+j = ":root.screen_next"
modkey+Control+k = ":root.screen_previous"
modkey+Tab = ":root.client_swap" modkey+Tab = ":root.client_swap"
modkey+Return = ":root.spawn_terminal" modkey+Return = ":root.spawn_terminal"
modkey+Shift+Return = ":root.spawn_browser" modkey+Shift+Return = ":root.spawn_browser"
modkey+Shift+y = ":root.toggle_titlebars" modkey+Shift+y = ":root.toggle_titlebars"
# Client keys only work if a focused client exists # Client keys only work if a focused client exists
modkey+Control+o = ":client.move_to_screen"
modkey+Shift+c = ":client.kill" modkey+Shift+c = ":client.kill"
modkey+t = ":client.cycle_screen" modkey+t = ":client.cycle_screen"
modkey+o = ":client.ontop" modkey+o = ":client.ontop"
@ -50,6 +53,28 @@ XF86AudioNext = ":mpc.next"
Print = "flameshot gui" Print = "flameshot gui"
Shift+Print = "flameshot launcher" Shift+Print = "flameshot launcher"
# Macro recording/playback keys
KP_Home = ":macro.play_1"
KP_Up = ":macro.play_2"
KP_PageUp = ":macro.play_3"
KP_Left = ":macro.record_1"
KP_Begin = ":macro.record_2"
KP_Right = ":macro.record_3"
KP_Delete = ":macro.loop"
# Tiling
modkey+Shift+j = ":layout.swap_next_client"
modkey+Shift+k = ":layout.swap_prev_client"
modkey+Control+Return = ":client.swap_to_master"
modkey+l = ":layout.increase_master"
modkey+h = ":layout.decrease_master"
modkey+Shift+l = ":layout.increase_master_count"
modkey+Shift+h = ":layout.decrease_master_count"
modkey+Control+l = ":layout.increase_column_count"
modkey+Control+h = ":layout.decrease_column_count"
modkey+[ = ":layout.next_layout"
modkey+] = ":layout.prev_layout"
# Power manager module # Power manager module
[powerman] [powerman]
# Bad battery condition warning threshold # Bad battery condition warning threshold
@ -67,3 +92,8 @@ on_critical_condition = ""
[compositor] [compositor]
# Command to use to spawn compositor # Command to use to spawn compositor
exec = "picom" exec = "picom"
# Macro system
[macros]
step = 10

View File

@ -12,7 +12,6 @@ local asckey = {
} }
local awful = require("awful") local awful = require("awful")
local gears = require("gears") local gears = require("gears")
asckey.set_keymap = function(keymap) asckey.set_keymap = function(keymap)
for k,v in pairs(keymap) do for k,v in pairs(keymap) do
asckey.keymap[v] = k asckey.keymap[v] = k
@ -29,14 +28,49 @@ asckey.get_keycomb = function(name)
return modifiers,name return modifiers,name
end end
asckey.k = function(name,callback,description) asckey.k = function(name,callback,description,release)
if not asckey.keymap[name] then if not asckey.keymap[name] then
return {} return {}
end end
local modifiers,key = asckey.get_keycomb(asckey.keymap[name]) local modifiers,key = asckey.get_keycomb(asckey.keymap[name])
return awful.key(modifiers,key, if key:match("^Mouse(%d+)$") then
callback, -- After several experiments, the best solution to making the extra mouse buttons bindable
description) -- was this. The drawback is that all bindings for these are global, and they do not return
-- the button object itself. Crappy hack, but it will suffice for now.
local callback_wrap = function(...)
callback(...)
-- For some ungodly reason binding to mouse drops all keybindings
gears.timer.delayed_call(function()
mousegrabber.run(function() return false end,"bogosity")
mousegrabber.stop()
end)
end
local new_button = awful.button(modifiers, tonumber(key:match("^Mouse(%d+)$")),
callback_wrap,release)
awful.rules.rules[1].properties.buttons = gears.table.join(
awful.rules.rules[1].properties.buttons,
new_button
)
root.buttons(gears.table.join(
root.buttons(),
new_button
))
return {}
else
local callback_wrap = (description.release_pre and function(...)
root.fake_input("key_release",key)
callback(...)
end) or callback
if release then
return awful.key(modifiers,key,
callback_wrap,
description)
else
return awful.key(modifiers,key,
callback_wrap,
release, description)
end
end
end end
asckey.custom_binds = function() asckey.custom_binds = function()

11
libs/imagemagick_blur.lua Normal file
View File

@ -0,0 +1,11 @@
-- If possible, try to blur the image and return its path via callback. Relies on ImageMagick
local awful = require("awful")
return function(image_path,callback)
local blurred_wallpaper_path = "/tmp/.blur_"..image_path:match("[^/]$")
if select(3,os.execute("convert -version")) == 0 then
awful.spawn.easy_async("convert "..image_path.." -blur 0x10 "..blurred_wallpaper_path,function()
callback(blurred_wallpaper_path)
end)
end
return image_path
end

16
macros/macro1 Normal file
View File

@ -0,0 +1,16 @@
loop=false
delay=10
-KP_Left
-Right
+Right
-Right
+BackSpace
-BackSpace
+p
-p
+space
-space
+-
--
+r
-r

5
macros/macro2 Normal file
View File

@ -0,0 +1,5 @@
loop=true
delay=10
-KP_Begin
+v
-v

5
macros/macro3 Normal file
View File

@ -0,0 +1,5 @@
loop=true
delay=10
-KP_Right
+c
-c

View File

@ -18,7 +18,7 @@ awful.spawn.with_line_callback("find "..gfs.get_xdg_config_home().."autostart/ -
if (data.RunHook == "0") or (data.RunHook == nil) then if (data.RunHook == "0") or (data.RunHook == nil) then
if not gfs.file_readable(stdir..line:match("[^/]*$")) then if not gfs.file_readable(stdir..line:match("[^/]*$")) then
io.open(stdir..line:match("[^/]*$"),"w"):close() io.open(stdir..line:match("[^/]*$"),"w"):close()
awful.spawn(data.Exec) awful.spawn(data.Exec:gsub("%%%w",""))
end end
end end
end end

View File

@ -69,6 +69,11 @@ client.connect_signal("manage", function(c)
end end
end) end)
--available layouts
awful.layout.layouts = {
awful.layout.suit.floating
}
client.connect_signal("focus", function(c) client.connect_signal("focus", function(c)
c.border_color = beautiful.border_focus c.border_color = beautiful.border_focus
end) end)

View File

@ -14,9 +14,14 @@ global.modkey = global.modkey or "Mod4"
ask.set_keymap(config.keys) ask.set_keymap(config.keys)
local custom_keys = ask.custom_binds() local custom_keys = ask.custom_binds()
local k = ask.k local k = ask.k
local titlebar_states = {}
local keys = gears.table.join( local keys = gears.table.join(
k(':root.tag_next',
awful.tag.viewnext,
{description = "switch to next tag", group = "client"}),
k(':root.tag_prev',
awful.tag.viewprev,
{description = "switch to previous tag", group = "client"}),
k(':root.client_next', k(':root.client_next',
function() function()
awful.client.focus.byidx(1) awful.client.focus.byidx(1)
@ -60,6 +65,36 @@ local keys = gears.table.join(
awesome.emit_signal("titlebar::toggle") awesome.emit_signal("titlebar::toggle")
end , end ,
{description = "(un)hide all titlebars", group = "client"}), {description = "(un)hide all titlebars", group = "client"}),
k(":layout.increase_master",
function() awful.tag.incmwfact(0.05) end,
{description = "increase master width factor", group = "layout"}),
k(":layout.decrease_master",
function() awful.tag.incmwfact(-0.05) end,
{description = "decrease master width factor", group = "layout"}),
k(":layout.increase_master_count",
function() awful.tag.incnmaster(1, nil, true) end,
{description = "increase the number of master clients", group = "layout"}),
k(":layout.decrease_master_count",
function() awful.tag.incnmaster(-1, nil, true) end,
{description = "decrease the number of master clients", group = "layout"}),
k(":layout.increase_column_count",
function() awful.tag.incncol(1, nil, true) end,
{description = "increase the number of columns", group = "layout"}),
k(":layout.decrease_column_count",
function() awful.tag.incncol(-1, nil, true) end,
{description = "decrease the number of columns", group = "layout"}),
k(":layout.next_layout",
function() awful.layout.inc(1) end,
{description = "next layout", group = "layout"}),
k(":layout.prev_layout",
function() awful.layout.inc(-1) end,
{description = "previous layout", group = "layout"}),
k(":layout.swap_next_client",
function() awful.client.swap.byidx(1) end,
{description = "swap with next client by index", group = "client"}),
k(":layout.swap_next_client",
function() awful.client.swap.byidx(-1) end,
{description = "swap with previous client by index", group = "client"}),
table.unpack(custom_keys)) table.unpack(custom_keys))
root.keys(keys) root.keys(keys)
@ -117,7 +152,17 @@ local clientkeys = gears.table.join(
function (c) function (c)
c:emit_signal("titlebar::toggle") c:emit_signal("titlebar::toggle")
end , end ,
{description = "(un)hide titlebars", group = "client"})) {description = "(un)hide titlebars", group = "client"}),
k(":client.swap_to_master",
function (c)
c:swap(awful.client.getmaster())
end,
{description = "swap with master", group = "client"}),
k(":client.move_to_screen",
function (c)
c:move_to_screen()
end,
{description = "move to screen", group = "client"}))
awful.rules.rules[1].properties.keys = clientkeys awful.rules.rules[1].properties.keys = clientkeys
local clientbuttons = gears.table.join( local clientbuttons = gears.table.join(
@ -131,6 +176,7 @@ local clientbuttons = gears.table.join(
awful.button({ global.modkey }, 3, function (c) awful.button({ global.modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true}) c:emit_signal("request::activate", "mouse_click", {raise = true})
awful.mouse.client.resize(c) awful.mouse.client.resize(c)
end)) end)
)
awful.rules.rules[1].properties.buttons = clientbuttons awful.rules.rules[1].properties.buttons = clientbuttons

156
modules/macros.lua Normal file
View File

@ -0,0 +1,156 @@
local awful = require("awful")
local gears = require("gears")
local ask = require("asckey")
local fs = gears.filesystem
_G.MacroTimer = {}
_G.MacroActive = {}
local mconf = config.macros
local macro_loop = false
local macro_delay = mconf.step or 10
local macro_base_dir = mconf.base_dir or (root_path.."/macros/")
if not fs.dir_readable(root_path.."/macros/") then
fs.make_directories(root_path.."/macros/")
end
awesome.connect_signal("macro::record",function(filename)
if not filename then return end
local timeline = "loop="..tostring(macro_loop).."\n"..
"delay="..tostring(macro_delay).."\n"
require("naughty").notify({title =
"Recording macro "..
tostring(filename)..
" (Escape to stop)"
})
awful.keygrabber {
autostart = true,
stop_key = "Escape",
keypressed_callback = function(self, mod, key, event)
if key == " " then
key = "space"
end
timeline = timeline.."+"..key.."\n"
end,
keyreleased_callback = function(self, mod, key, event)
if key == " " then
key = "space"
end
timeline = timeline.."-"..key.."\n"
end,
stop_callback = function()
local macrofile = io.open(filename,"w")
if macrofile then
macrofile:write(timeline)
macrofile:close()
require("naughty").notify({title="Macro saved as "..tostring(filename)})
else
require("naughty").notify({title="Failed to save macro"})
end
-- For some reason after keygrabber is done input doesn't work
gears.timer.delayed_call(function()
awful.keygrabber:stop()
end)
end
}
end)
awesome.connect_signal("macro::play",function(filename)
if (not filename) or (not fs.file_readable(filename)) then
return
end
local macrofile = io.open(filename,"r")
local macrodata = macrofile:read("*a")
macrofile:close()
local macro = {}
local step = 0
macrodata:gsub("([^\n]+)",function(line)
table.insert(macro,line)
end)
local delay = tonumber(macro[2]:match("delay=(%d+)"))
_G.MacroActive[filename] = (macro[1]:match("loop=(.+)") == "true")
table.remove(macro,2)
table.remove(macro,1)
local macro_length = #macro
_G.MacroTimer[filename] = gears.timer.start_new((1/1000)*delay,function()
step = step + 1
local instruction = macro[step]
local event = (instruction:match("^%+") and "key_press") or "key_release"
root.fake_input(event,instruction:match("^[%+%-](.*)"))
if (step == macro_length) and (_G.MacroActive[filename]) then
step = 0
return true
elseif (step < macro_length) then
return true
else
_G.MacroTimer[filename] = nil
_G.MacroActive[filename] = nil
return false
end
end)
end)
root.keys(gears.table.join(
root.keys(),
ask.k(":macro.record_1", function()
awesome.emit_signal("macro::record",macro_base_dir.."macro1")
end,{group="macros",description="Record macro 1"}),
ask.k(":macro.record_2", function()
awesome.emit_signal("macro::record",macro_base_dir.."macro2")
end,{group="macros",description="Record macro 2"}),
ask.k(":macro.record_3", function()
awesome.emit_signal("macro::record",macro_base_dir.."macro3")
end,{group="macros",description="Record macro 3"}),
ask.k(":macro.record_4", function()
awesome.emit_signal("macro::record",macro_base_dir.."macro4")
end,{group="macros",description="Record macro 4"}),
ask.k(":macro.record_5", function()
awesome.emit_signal("macro::record",macro_base_dir.."macro5")
end,{group="macros",description="Record macro 5"}),
ask.k(":macro.play_1", function()
if not _G.MacroActive[macro_base_dir.."macro1"] then
awesome.emit_signal("macro::play",macro_base_dir.."macro1")
else
_G.MacroActive[macro_base_dir.."macro1"] = false
end
end,{group="macros",description="Play macro 1",release_pre=true}),
ask.k(":macro.play_2", function()
if not _G.MacroActive[macro_base_dir.."macro2"] then
awesome.emit_signal("macro::play",macro_base_dir.."macro2")
else
_G.MacroActive[macro_base_dir.."macro2"] = false
end
end,{group="macros",description="Play macro 2",release_pre=true}),
ask.k(":macro.play_3", function()
if not _G.MacroActive[macro_base_dir.."macro3"] then
awesome.emit_signal("macro::play",macro_base_dir.."macro3")
else
_G.MacroActive[macro_base_dir.."macro3"] = false
end
end,{group="macros",description="Play macro 3",release_pre=true}),
ask.k(":macro.play_4", function()
if not _G.MacroActive[macro_base_dir.."macro4"] then
awesome.emit_signal("macro::play",macro_base_dir.."macro4")
else
_G.MacroActive[macro_base_dir.."macro4"] = false
end
end,{group="macros",description="Play macro 4",release_pre=true}),
ask.k(":macro.play_5", function()
if not _G.MacroActive[macro_base_dir.."macro5"] then
awesome.emit_signal("macro::play",macro_base_dir.."macro5")
else
_G.MacroActive[macro_base_dir.."macro5"] = false
end
end,{group="macros",description="Play macro 5",release_pre=true}),
ask.k(":macro.loop",function()
macro_loop = not macro_loop
if macro_loop then
require("naughty").notify({title="Macro looping turned on"})
else
require("naughty").notify({title="Macro looping turned off"})
end
end,{group="macros",description="turn looping on/off"})
))

View File

@ -4,8 +4,18 @@ awful.rules.rules = gears.table.join(awful.rules.rules, {
{ rule_any = { class = { { rule_any = { class = {
"steam_app_548430", "steam_app_548430",
"steam_app_%d*", "steam_app_%d*",
"love" "love",
"^Minecraft.*"
}}, }},
properties = {inhibit_compositor = true}, properties = {inhibit_compositor = true},
}, },
{ rule_any = { class = {
"thunderbird"
}},
properties = {callback = function(c)
gears.timer.delayed_call(function()
c.minimized = true
end)
end}
}
}) })

View File

@ -19,14 +19,6 @@ awful.screen.connect_for_each_screen(function(s)
end) end)
-- keybindings for tags -- keybindings for tags
local keys = root.keys() local keys = root.keys()
keys = gears.table.join(keys,
awful.key({global.modkey}, "Left",
awful.tag.viewprev,
{description = "view next tag", group = "tag"}),
awful.key({global.modkey}, "Right",
awful.tag.viewnext,
{description = "view previous tag", group = "tag"}))
for i = 1,9 do for i = 1,9 do
keys = gears.table.join(keys, keys = gears.table.join(keys,
awful.key({global.modkey}, "#"..i+9, awful.key({global.modkey}, "#"..i+9,

12
modules/tiling.lua Normal file
View File

@ -0,0 +1,12 @@
local awful = require("awful")
awful.layout.layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
}

View File

@ -16,7 +16,7 @@ local json = require("dkjson")
menu_utils.wm_name = "" menu_utils.wm_name = ""
-- Directories to scan for .desktop files -- Directories to scan for .desktop files
local desktop_dirs = {} local desktop_dirs = {os.getenv("HOME").."/Desktop"}
local desktop_dirs_complete = 0 local desktop_dirs_complete = 0
local _ = ((table.concat(gears.filesystem.get_xdg_data_dirs(),":") or local _ = ((table.concat(gears.filesystem.get_xdg_data_dirs(),":") or
"/usr/share:/usr/local/share")..":"..os.getenv("HOME").."/.local/share"):gsub("[^:]*",function(path) "/usr/share:/usr/local/share")..":"..os.getenv("HOME").."/.local/share"):gsub("[^:]*",function(path)

2
rc.lua
View File

@ -24,4 +24,6 @@ require("modules.binds")
require("modules.xdg_data") require("modules.xdg_data")
require("modules.autostart") require("modules.autostart")
require("modules.static_tags") require("modules.static_tags")
require("modules.tiling")
require("modules.desktop") require("modules.desktop")
require("modules.macros")

View File

@ -20,6 +20,7 @@
{ {
"widget": "widgets.base.subpanel", "widget": "widgets.base.subpanel",
"layout": {"list":[ "layout": {"list":[
{ "widget": "widgets.base.layout" },
{ "widget": "widgets.desktop.battery" }, { "widget": "widgets.desktop.battery" },
{ "widget": "widgets.base.systray" }, { "widget": "widgets.base.systray" },
{ "widget": "widgets.base.clock" } { "widget": "widgets.base.clock" }

View File

@ -35,7 +35,7 @@ theme.fg_focus = "#000000"
theme.fg_urgent = "#000000" theme.fg_urgent = "#000000"
theme.fg_minimize = "#000000" theme.fg_minimize = "#000000"
theme.useless_gap = dpi(0) theme.useless_gap = dpi(10)
-- technically speaking these are irrelevant since they're not exactly smart -- technically speaking these are irrelevant since they're not exactly smart
-- borders -- borders
theme.border_width = dpi(0) theme.border_width = dpi(0)

View File

@ -17,6 +17,7 @@
"path": "$HOME/Pictures/Wallpapers" "path": "$HOME/Pictures/Wallpapers"
} }
}, },
{ "widget": "widgets.base.layout" },
{ "widget": "widgets.desktop.battery" }, { "widget": "widgets.desktop.battery" },
{ "widget": "widgets.base.systray" }, { "widget": "widgets.base.systray" },
{ "widget": "widgets.base.clock" } { "widget": "widgets.base.clock" }

View File

@ -35,7 +35,7 @@ theme.fg_focus = "#000000"
theme.fg_urgent = "#000000" theme.fg_urgent = "#000000"
theme.fg_minimize = "#000000" theme.fg_minimize = "#000000"
theme.useless_gap = dpi(0) theme.useless_gap = dpi(10)
-- technically speaking these are irrelevant since they're not exactly smart -- technically speaking these are irrelevant since they're not exactly smart
-- borders -- borders
theme.titlebar_bg_accent_normal_1 = "#808080" theme.titlebar_bg_accent_normal_1 = "#808080"

View File

@ -19,7 +19,8 @@
}, },
{ "widget": "widgets.desktop.battery" }, { "widget": "widgets.desktop.battery" },
{ "widget": "widgets.base.systray" }, { "widget": "widgets.base.systray" },
{ "widget": "widgets.base.clock" } { "widget": "widgets.base.clock" },
{ "widget": "widgets.base.layout" }
] ]
} }
} }

View File

@ -32,7 +32,7 @@ theme.fg_urgent = "#e1dec7"
theme.fg_minimize = "#e1dec7" theme.fg_minimize = "#e1dec7"
theme.window_rounding = 5 theme.window_rounding = 5
theme.useless_gap = dpi(0) theme.useless_gap = dpi(10)
-- technically speaking these are irrelevant since they're not exactly smart -- technically speaking these are irrelevant since they're not exactly smart
-- borders -- borders
theme.border_width = dpi(0) theme.border_width = dpi(0)

View File

@ -5,5 +5,6 @@
}, },
"widgets.rootmenu":{}, "widgets.rootmenu":{},
"widgets.lockscreen":{}, "widgets.lockscreen":{},
"widgets.base.keypopup":{} "widgets.base.keypopup":{},
"widgets.supermenu":{}
} }

View File

@ -0,0 +1,3 @@
{
"widgets.supermenu.applications-tab":{}
}

View File

@ -19,7 +19,8 @@
}, },
{ "widget": "widgets.desktop.battery" }, { "widget": "widgets.desktop.battery" },
{ "widget": "widgets.base.systray" }, { "widget": "widgets.base.systray" },
{ "widget": "widgets.base.clock" } { "widget": "widgets.base.clock" },
{ "widget": "widgets.base.layout" }
] ]
} }
} }

View File

@ -32,7 +32,7 @@ theme.fg_urgent = "#e1dec7"
theme.fg_minimize = "#e1dec7" theme.fg_minimize = "#e1dec7"
theme.window_rounding = 5 theme.window_rounding = 5
theme.useless_gap = dpi(0) theme.useless_gap = dpi(10)
-- technically speaking these are irrelevant since they're not exactly smart -- technically speaking these are irrelevant since they're not exactly smart
-- borders -- borders
theme.border_width = dpi(0) theme.border_width = dpi(0)

2
widgets/base/layout.lua Normal file
View File

@ -0,0 +1,2 @@
local awful = require("awful")
return function(args) return awful.widget.layoutbox(args.screen) end

View File

@ -49,7 +49,7 @@ return function(args)
local display_widget = t.container({ local display_widget = t.container({
{ {
t.textbox({ t.textbox({
markup = "MPC Loading..", text = "MPC Loading..",
id = "display" id = "display"
}), }),
widget = wibox.container.scroll.horizontal, widget = wibox.container.scroll.horizontal,
@ -108,7 +108,7 @@ return function(args)
if not out:match("paused") then if not out:match("paused") then
pause_state = true pause_state = true
icon.image = beautiful["mpc-play-symbolic"] icon.image = beautiful["mpc-play-symbolic"]
display:set_markup(status) display.text = status
update_ready = true update_ready = true
return return
else else
@ -118,7 +118,7 @@ return function(args)
status = status..out:match("#%d*").." ".. status = status..out:match("#%d*").." "..
out:match("[^\n]*").." ".. out:match("[^\n]*").." "..
out:match("%d*:%d*/%d*:%d*%s*%(%d*%%%)") out:match("%d*:%d*/%d*:%d*%s*%(%d*%%%)")
display:set_markup(status) display.text = status
update_ready = true update_ready = true
end) end)
end end

View File

@ -75,24 +75,25 @@ return function(args)
local container = slider_part:get_children_by_id("slidercontainer")[1] local container = slider_part:get_children_by_id("slidercontainer")[1]
-- Alsa master handle -- Alsa master handle
args.device = args.device or "default" args.device = args.device or "default"
local update_callback = function()
awful.spawn.easy_async_with_shell("amixer -D "..args.device.." sget Master",function(stdout)
local volume_percent = stdout:match("%[(%d+)%%%]")
volume_percent = tonumber(volume_percent)
if not volume_percent then
return
end
slider.value = volume_percent
if stdout:match("%[off%]") then
volume_percent = 0
end
icon.image = get_icon(volume_percent)
end)
end
local update_timer = gears.timer { local update_timer = gears.timer {
autostart = true, autostart = true,
timeout = 0.5, timeout = 0.5,
call_now = true, call_now = true,
callback = function() callback = update_callback
awful.spawn.easy_async_with_shell("amixer -D "..args.device.." sget Master",function(stdout)
local volume_percent = stdout:match("%[(%d+)%%%]")
volume_percent = tonumber(volume_percent)
if not volume_percent then
return
end
slider.value = volume_percent
if stdout:match("%[off%]") then
volume_percent = 0
end
icon.image = get_icon(volume_percent)
end)
end
} }
slider:connect_signal("widget::redraw_needed",function() slider:connect_signal("widget::redraw_needed",function()
awful.spawn("amixer -D "..args.device.." sset Master "..slider.value.."%") awful.spawn("amixer -D "..args.device.." sset Master "..slider.value.."%")
@ -113,10 +114,20 @@ return function(args)
awful.spawn.with_shell(args.mixer or try_launch) awful.spawn.with_shell(args.mixer or try_launch)
end end
if button == 4 then if button == 4 then
awful.spawn("amixer -D "..args.device.." sset Master 5%+") if (slider.value < 96) then
slider.value = slider.value + 5
else
slider.value = 100
end
slider:emit_signal("widget::redraw_needed")
end end
if button == 5 then if button == 5 then
awful.spawn("amixer -D "..args.device.." sset Master 5%-") if (slider.value > 4) then
slider.value = slider.value - 5
else
slider.value = 0
end
slider:emit_signal("widget::redraw_needed")
end end
end) end)
root.keys(gears.table.join( root.keys(gears.table.join(

114
widgets/supermenu.lua Normal file
View File

@ -0,0 +1,114 @@
-- This file is part of Reno desktop.
--
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
--
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
local awful = require("awful")
local gears = require("gears")
local awmtk2 = require("awmtk2")
local beautiful = require("beautiful")
local wibox = require("wibox")
local json = require("dkjson")
local try_blur = require("imagemagick_blur")
local bgimagegen = function(path)
return function(cont,cr,width,height)
local s = gears.surface.load_uncached_silently(
path
)
local bg_width,bg_height = gears.surface.get_size(s)
local scale = height/bg_height
if width/bg_width > scale then
scale = width/bg_width
end
cr:translate((width - (bg_width*scale))/2,(height - (bg_height*scale))/2)
cr:rectangle(0,0, (bg_width*scale), (bg_height*scale))
cr:clip()
cr:scale(scale,scale)
cr:set_source_surface(s)
cr:paint()
end
end
local function _preload(args)
local style = awmtk2.create_style("supermenu",
awmtk2.generic.composite_widget,{})
local templates = awmtk2.create_template_lib("supermenu",awmtk2.templates,{})
local t = awmtk2.build_templates(templates,style,args.vertical)
local wallpaper
if gears.filesystem.file_readable(root_path.."/wallpaper.txt") then
local wallpaper_f = io.open(root_path.."/wallpaper.txt","r")
wallpaper = wallpaper_f:read("*a")
wallpaper_f:close()
end
supermenu = awful.popup(t.popup({
{
{
widget = wibox.container.background
},
{
layout = wibox.layout.fixed.vertical,
id = "contents"
},
{
t.container({
id = "buttonlist",
layout = wibox.layout.fixed.vertical
},{
bg = style.container.bg_highlight
}),
valign = "center",
halign = "right",
fill_vertical = true,
fill_horizontal = false,
widget = wibox.container.place
},
layout = wibox.layout.align.horizontal
},
widget = wibox.container.background,
forced_width = args.screen.workarea.width-style.container.margins,
forced_height = args.screen.workarea.height-style.container.margins,
id = "supermenu_root"
},{
x = args.screen.workarea.x,
y = args.screen.workarea.y,
visible = true
}))
local supermenu_root = supermenu.widget:get_children_by_id("supermenu_root")[1]
supermenu_root.bgimage = bgimagegen(try_blur(wallpaper or beautiful.wallpaper,
function(path)
supermenu_root.bgimage = bgimagegen(path)
end))
args.screen:connect_signal("property::workarea",function()
supermenu.x = args.screen.workarea.x
supermenu.y = args.screen.workarea.y
supermenu_root.forced_width = args.screen.workarea.width-style.container.margins*2
supermenu_root.forced_height = args.screen.workarea.height-style.container.margins*2
end)
supermenu:connect_signal("button::press",function(self,x,y,button)
if button == 3 then
supermenu.visible = false
end
end)
local tabsfile = io.open(root_path.."/themes/"..global.theme..'/config/supermenu.json',"r")
local tabs = {}
if tabsfile then
for k,v in pairs(json.decode(tabsfile:read("*a"))) do
table.insert(tabs,require(k)(v))
end
end
local contents = supermenu.widget:get_children_by_id("contents")[1]
if tabs[1] then
contents:add(tabs[1])
end
return supermenu
end
return function(args)
for s in screen do
s.lock = _preload(gears.table.join(args,{
screen = s
}))
end
end

View File

@ -0,0 +1,69 @@
local awful = require("awful")
local gears = require("gears")
local awmtk2 = require("awmtk2")
local wibox = require("wibox")
local beautiful = require("beautiful")
return function(args)
local style = awmtk2.create_style("applications_tab",
awmtk2.generic.menu, args.style, args.vertical)
local templates = awmtk2.create_template_lib("applications_tab",
awmtk2.templates,args.templates)
local t = awmtk2.build_templates(templates,style,args.vertical)
local widget = wibox.widget({
{
t.center(t.container(t.container({
widget = wibox.widget.textbox,
markup = "Search area",
id = "searchtext"
},{
id = "searchbox",
bg = style.container.bg_highlight,
forced_width = 240
})
)),
{
{
layout = wibox.layout.grid,
forced_num_cols = args.columns or 4,
homogenous = true,
expand = true,
orientation = "veritcal",
spacing = style.base.spacing,
id = "appgrid"
},
margins = 20,
widget = wibox.container.margin
},
layout = wibox.layout.fixed.vertical,
spacing = style.base.spacing,
id = "root_ratio"
},
widget = wibox.container.margin,
margins = 20
})
local appgrid = widget:get_children_by_id("appgrid")[1]
local gen_icon = function(appdata)
local appicon = wibox.widget({
t.icon({
image = appdata.icon or beautiful.icon_default,
}),
{
markup = appdata.title,
widget = wibox.widget.textbox,
align = "center"
},
spacing = style.base.spacing,
layout = wibox.layout.fixed.vertical
})
appicon:connect_signal("button::press",function(_,_,_,button)
if button == 1 then
awful.spawn(appdata.exec)
end
end)
return appicon
end
awesome.connect_signal("xdg::all_finished",function()
end)
return widget
end