From e3cbb2f98776cd4d589a8aa597e14427e073c055 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Thu, 31 Dec 2020 13:29:58 +0100 Subject: [PATCH 01/14] Power menu: add sleep, hybrid sleep and hibernate buttons --- assets/icons/hibernate.svg | 1 + assets/icons/sleep.svg | 1 + simple/init.lua | 11 ++++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 assets/icons/hibernate.svg create mode 100644 assets/icons/sleep.svg diff --git a/assets/icons/hibernate.svg b/assets/icons/hibernate.svg new file mode 100644 index 0000000..7160a65 --- /dev/null +++ b/assets/icons/hibernate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/icons/sleep.svg b/assets/icons/sleep.svg new file mode 100644 index 0000000..5d570e2 --- /dev/null +++ b/assets/icons/sleep.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/simple/init.lua b/simple/init.lua index 5f0904f..f8f9260 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -168,10 +168,12 @@ local launcher = awful.widget.button({ launcher:buttons(gears.table.join(launcher:buttons(), awful.button({}, 1, nil, function() showAppLauncher(false) end))) -shutdown_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/power.svg", beautiful.power_menu_icon_color) -restart_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/refresh-cw.svg", beautiful.power_menu_icon_color) -logout_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/log-out.svg", beautiful.power_menu_icon_color) lock_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/lock.svg", beautiful.power_menu_icon_color) +logout_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/log-out.svg", beautiful.power_menu_icon_color) +sleep_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/sleep.svg", beautiful.power_menu_icon_color) +hibernate_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/hibernate.svg", beautiful.power_menu_icon_color) +restart_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/refresh-cw.svg", beautiful.power_menu_icon_color) +shutdown_icon = gears.color.recolor_image(awful.util.getdir("config") .. "/assets/icons/power.svg", beautiful.power_menu_icon_color) os_menu = awful.widget.launcher({ image = beautiful.awesome_icon, @@ -183,6 +185,9 @@ os_menu = awful.widget.launcher({ { "Open terminal", config.awesome.terminal }, { "Lock", lockScreen, lock_icon }, { "Logout", function() awesome.quit() end, logout_icon }, + { "Sleep", function() os.execute('systemctl suspend') end, sleep_icon}, + { "Hybrid sleep", function() os.execute('systemctl hybrid-sleep') end, hibernate_icon }, + { "Hibernate", function() os.execute('systemctl hibernate') end, hibernate_icon }, { "Restart", function() os.execute('shutdown -r now') end, restart_icon }, { "Shutdown", function() os.execute('shutdown now') end, shutdown_icon }, } From 37a94eb5edba3be32d391198ac340c0caa1ebd59 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 27 Dec 2020 08:24:44 +0100 Subject: [PATCH 02/14] Add trailing new line to config.lua and theme.lua --- config.lua | 2 +- theme.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.lua b/config.lua index 4116bc7..526175c 100644 --- a/config.lua +++ b/config.lua @@ -1,3 +1,3 @@ local config = require("default_config") -return config \ No newline at end of file +return config diff --git a/theme.lua b/theme.lua index 62c006c..83059c4 100644 --- a/theme.lua +++ b/theme.lua @@ -1,3 +1,3 @@ local theme = require("default_theme") -return theme \ No newline at end of file +return theme From f3b9ffcaf96fc7ddce491143462aecca65625fc6 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Fri, 2 Oct 2020 18:33:27 +0200 Subject: [PATCH 03/14] Revert "Disable titlebars on dialogs" This reverts commit e689f17a561c56ab3c9fd4bcda9cc07c071204e7. --- simple/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple/init.lua b/simple/init.lua index f8f9260..4e73678 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -658,7 +658,7 @@ awful.rules.rules = { -- Add titlebars to normal clients and dialogs { rule_any = { - type = { "normal" } + type = { "normal", "dialog" } }, properties = { titlebars_enabled = true } }, From 3908cb40587b0256a59eef832830923e4b1f5b1b Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 17 Feb 2021 11:24:54 +0100 Subject: [PATCH 04/14] Hide titlebar for clients that request so Co-authored-by: Arkhist --- simple/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simple/init.lua b/simple/init.lua index 4e73678..7908ff4 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -715,6 +715,10 @@ client.connect_signal("request::titlebars", function(c) }, layout = wibox.layout.align.horizontal } + + if c.requests_no_titlebar then + awful.titlebar.hide(c) + end end) -- Enable sloppy focus, so that focus follows mouse. From c8409703e1dd221762df6243f95a786ab30c122d Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 17 Feb 2021 11:29:06 +0100 Subject: [PATCH 05/14] Update author name and README.md todo list Co-authored-by: Arkhist --- README.md | 9 +++++---- rc.lua | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e81e914..25f52dd 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,11 @@ By default, Simple Awesome uses - Replace the os menu with a custom widget - Add backlight media keys to xbacklight command functionnality - Add icon to the battery widget -- Make mouse auto focus configurable -- Make desktop entries menu -- Alt tab tab tab to switch -## Arisu personal todo +## Interesting resources + +- https://github.com/manilarome/the-glorious-dotfiles/tree/master/config/awesome/gnawesome/module + +## ashpie personal todo - Add aliases to rofi https://github.com/davatorium/rofi/issues/97 diff --git a/rc.lua b/rc.lua index a6efe2c..130b631 100644 --- a/rc.lua +++ b/rc.lua @@ -1,5 +1,5 @@ -- --- Simple Awesome - By Arisu & Arkhist +-- Simple Awesome - By ashpie & Arkhist -- To configure Simple Awesome without losing your changes when updating, see the `config.lua` file. -- require("simple") From 4b93a05fa5e93e7d842b61a08e43d63aa83f4c62 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 17 Feb 2021 11:37:32 +0100 Subject: [PATCH 06/14] Fix hotkey collision --- simple/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple/init.lua b/simple/init.lua index 7908ff4..927bde6 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -500,7 +500,7 @@ clientkeys = gears.table.join(-- tiling { description = "toggle fullscreen", group = "client" }), awful.key({ config.keys.modkey, "Shift" }, "c", function(c) c:kill() end, { description = "close", group = "client" }), - awful.key({ config.keys.modkey, "Control" }, "space", awful.client.floating.toggle, + awful.key({ config.keys.modkey, "Shift" }, "space", awful.client.floating.toggle, { description = "toggle floating", group = "client" }), awful.key({ config.keys.modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end, { description = "move to master", group = "client" }), From 93a3caf5a4e4673ff90fdd2661b20c028a658b9c Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 17 Feb 2021 11:38:02 +0100 Subject: [PATCH 07/14] Add hotkey to manually toggle titlebar Co-authored-by: Arkhist --- simple/init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/simple/init.lua b/simple/init.lua index 927bde6..26a9aca 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -532,7 +532,16 @@ clientkeys = gears.table.join(-- tiling c.maximized_horizontal = not c.maximized_horizontal c:raise() end, - { description = "(un)maximize horizontally", group = "client" })) + { description = "(un)maximize horizontally", group = "client" }), + awful.key({ config.keys.modkey, "Shift"}, "p", + function(c) + awful.titlebar.toggle(c) + if c.maximized then + c.maximized = false + c.maximized = true + end + end, + { description = "toggle titlebar", group = "client"})) -- Bind all key numbers to tags. -- Be careful: we use keycodes to make it work on any keyboard layout. From 5961d734b58f159172dc6492f58d6ff99a32982b Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 21 Feb 2021 19:30:44 +0100 Subject: [PATCH 08/14] Don't ignore wallpaper aspect ratio --- simple/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple/init.lua b/simple/init.lua index 26a9aca..706acc8 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -242,7 +242,7 @@ local function set_wallpaper(s) if type(wallpaper) == "function" then wallpaper = wallpaper(s) end - gears.wallpaper.maximized(wallpaper, s, true) + gears.wallpaper.maximized(wallpaper, s) end end From fbc13ab63f5480797295843d624bd2a88b1fe276 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Thu, 8 Apr 2021 12:42:13 +0200 Subject: [PATCH 09/14] media_control.lua: make volume management fully async --- default_theme.lua | 1 + simple/media_control.lua | 348 ++++++++++++++++++++------------------- 2 files changed, 184 insertions(+), 165 deletions(-) diff --git a/default_theme.lua b/default_theme.lua index adcae79..5227958 100644 --- a/default_theme.lua +++ b/default_theme.lua @@ -187,6 +187,7 @@ theme.volume_osd_border_color = theme.border_normal theme.volume_osd_border_width = dpi(0) theme.volume_osd_progress_bg = theme.bg_minimize theme.volume_osd_progress_color = "#ffffff" +theme.volume_osd_progress_color_muted = "#555555" theme.volume_osd_progress_border_color = theme.volume_osd_border_color theme.volume_osd_progress_border_width = dpi(0) theme.volume_osd_image_color = "#ffffff" diff --git a/simple/media_control.lua b/simple/media_control.lua index 0bac4fc..26defef 100644 --- a/simple/media_control.lua +++ b/simple/media_control.lua @@ -23,109 +23,116 @@ local config = require("config") local hasPlayerctl = os.execute("playerctl -v") == true -- playerctl -function sendToPlayerctl(command) - os.execute("playerctl " .. command) +function sendToPlayerctl(command, callback) + callback = callback or function() + end + awful.spawn.easy_async("playerctl " .. command, callback) end -- Spotify -function sendToSpotify(command) - awful.util.spawn_with_shell("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command) +function sendToSpotify(command, callback) + callback = callback or function() + end + awful.spawn.easy_async_with_shell("dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player." .. command, callback) end -- Brightness control -function getBrightness() - local handle = io.popen("xbacklight -get") - local brightness = handle:read("*a") - handle:close() - return brightness +function getBrightness(callback) + callback = callback or function() + end + + awful.spawn.easy_async("xbacklight -get", function(stdout, stderr, reason, exit_code) + callback(stdout) + end) end -function increaseBrightness() - os.execute("xbacklight -inc 2") +function increaseBrightness(callback) + callback = callback or function() + end + awful.spawn.easy_async("xbacklight -inc 2", callback) end -function decreaseBrightness() - os.execute("xbacklight -dec 2") +function decreaseBrightness(callback) + callback = callback or function() + end + awful.spawn.easy_async("xbacklight -dec 2", callback) end -- Volume control -function getVolume() - if isMuted() then return 0 end - local handle = io.popen("amixer " .. config.audio.card .. " sget '" .. config.audio.device .. "' -M | awk -F\"[][]\" '/%/ { print $2 }' | head -n 1", "r") - local volume = string.gsub(handle:read("*a"), "[\n%%]+", "") / 100 - handle:close() - return volume +function isMuted(callback) + awful.spawn.easy_async_with_shell("amixer " .. config.audio.card .. " sget '" .. config.audio.device .. "' | egrep 'Playback.*?\\[o' | egrep -o '\\[o.+\\]'", function(stdout, stderr, reason, exit_code) + callback(string.match(string.gsub(stdout, "[\n]+", ""), "off")) + end) end -function isMuted() - local handle = io.popen("amixer " .. config.audio.card .. " sget '" .. config.audio.device .. "' | egrep 'Playback.*?\\[o' | egrep -o '\\[o.+\\]'", "r") - local muted = string.match(string.gsub(handle:read("*a"), "[\n]+", ""), "off") - handle:close() - return muted +function getVolume(callback) + awful.spawn.easy_async_with_shell("amixer " .. config.audio.card .. " sget '" .. config.audio.device .. "' -M | awk -F\"[][]\" '/%/ { print $2 }' | head -n 1", function(stdout, stderr, reason, exit_code) + callback(string.gsub(stdout, "[\n%%]+", "") / 100) + end) end function getVolumeImage(volume) - local path = beautiful.volume_osd_icon_3 - if volume < 0.667 then - path = beautiful.volume_osd_icon_2 - end - if volume < 0.334 then - path = beautiful.volume_osd_icon_1 - end - if volume <= 0 then - path = beautiful.volume_osd_icon_0 - end - return gears.color.recolor_image(path, beautiful.volume_osd_image_color) + local path = beautiful.volume_osd_icon_3 + if volume < 0.667 then + path = beautiful.volume_osd_icon_2 + end + if volume < 0.334 then + path = beautiful.volume_osd_icon_1 + end + if volume <= 0 then + path = beautiful.volume_osd_icon_0 + end + return gears.color.recolor_image(path, beautiful.volume_osd_image_color) end local volumeWibox = wibox({ - ontop = true, - bg = beautiful.volume_osd_bg, - border_width = beautiful.volume_osd_border_width, - border_color = beautiful.volume_osd_border_color, - shape = beautiful.volume_osd_shape, - width = beautiful.volume_osd_width, - height = beautiful.volume_osd_bar_height + beautiful.volume_osd_padding * 3, - widget = wibox.widget { - { - { - image = getVolumeImage(1), - widget = wibox.widget.imagebox - }, - left = beautiful.volume_osd_padding, - right = beautiful.volume_osd_padding, - top = beautiful.volume_osd_padding, - bottom = 0, - widget = wibox.container.margin, - }, - { - { - { - max_value = 1, - value = 0.33, - shape = gears.shape.rounded_bar, - bar_shape = gears.shape.rounded_bar, - margins = beautiful.volume_osd_padding + 4, - color = beautiful.volume_osd_progress_color, - background_color = beautiful.volume_osd_progress_bg, - border_color = beautiful.volume_osd_progress_border_color, - border_width = beautiful.volume_osd_progress_border_width, - widget = wibox.widget.progressbar - }, - forced_width = 80, - forced_height = 80, - direction = "east", - layout = wibox.container.rotate, - }, - left = beautiful.volume_osd_padding, - right = beautiful.volume_osd_padding, - top = 0, - bottom = beautiful.volume_osd_padding, - widget = wibox.container.margin, - }, - layout = wibox.layout.align.vertical - }, + ontop = true, + bg = beautiful.volume_osd_bg, + border_width = beautiful.volume_osd_border_width, + border_color = beautiful.volume_osd_border_color, + shape = beautiful.volume_osd_shape, + width = beautiful.volume_osd_width, + height = beautiful.volume_osd_bar_height + beautiful.volume_osd_padding * 3, + widget = wibox.widget { + { + { + image = getVolumeImage(1), + widget = wibox.widget.imagebox + }, + left = beautiful.volume_osd_padding, + right = beautiful.volume_osd_padding, + top = beautiful.volume_osd_padding, + bottom = 0, + widget = wibox.container.margin, + }, + { + { + { + max_value = 1, + value = 0.33, + shape = gears.shape.rounded_bar, + bar_shape = gears.shape.rounded_bar, + margins = beautiful.volume_osd_padding + 4, + color = beautiful.volume_osd_progress_color, + background_color = beautiful.volume_osd_progress_bg, + border_color = beautiful.volume_osd_progress_border_color, + border_width = beautiful.volume_osd_progress_border_width, + widget = wibox.widget.progressbar + }, + forced_width = 80, + forced_height = 80, + direction = "east", + layout = wibox.container.rotate, + }, + left = beautiful.volume_osd_padding, + right = beautiful.volume_osd_padding, + top = 0, + bottom = beautiful.volume_osd_padding, + widget = wibox.container.margin, + }, + layout = wibox.layout.align.vertical + }, }) local imagebox = volumeWibox.widget:get_children()[1]:get_children()[1] @@ -135,116 +142,127 @@ local timer = nil -- {{{ Control local playPause = function() - if hasPlayerctl then - sendToPlayerctl("play-pause") - else - sendToSpotify("PlayPause") - end + if hasPlayerctl then + sendToPlayerctl("play-pause") + else + sendToSpotify("PlayPause") + end end local nextTrack = function() - if hasPlayerctl then - sendToPlayerctl("next") - else - sendToSpotify("Next") - end + if hasPlayerctl then + sendToPlayerctl("next") + else + sendToSpotify("Next") + end end local previousTrack = function() - if hasPlayerctl then - sendToPlayerctl("previous") - else - sendToSpotify("Previous") - end + if hasPlayerctl then + sendToPlayerctl("previous") + else + sendToSpotify("Previous") + end end local displayVolume = function() - -- Update screen - local screen = awful.screen:focused() - volumeWibox.screen = screen + isMuted(function(muted) + getVolume(function(volume) + -- Update values + imagebox.image = getVolumeImage(muted and 0 or volume) + progressbar.value = volume + progressbar.color = muted and beautiful.volume_osd_progress_color_muted or beautiful.volume_osd_progress_color - -- Position - local position = beautiful.volume_osd_position(screen.geometry.width, screen.geometry.height, beautiful.volume_osd_width, beautiful.volume_osd_height) - volumeWibox:geometry({ - x = (screen.geometry.x + position[1]), - y = (screen.geometry.y + position[2]) - }) + if timer ~= nil and timer.started then + timer:again() + return + end - -- Get volume - local volume = getVolume() + -- Update screen + local screen = awful.screen:focused() + volumeWibox.screen = screen - -- Update values - imagebox.image = getVolumeImage(volume) - progressbar.value = volume + -- Position + local position = beautiful.volume_osd_position(screen.geometry.width, screen.geometry.height, beautiful.volume_osd_width, beautiful.volume_osd_height) + volumeWibox:geometry({ + x = (screen.geometry.x + position[1]), + y = (screen.geometry.y + position[2]) + }) - -- Show - volumeWibox.visible = true + -- Show + volumeWibox.visible = true - -- Schedule hide - if timer ~= nil then - timer:stop() - end - timer = gears.timer { - timeout = config.volume_osd_timeout, - callback = function() - volumeWibox.visible = false - timer:stop() - timer = nil - end - } - timer:start() + -- Schedule hide + if timer ~= nil then + timer:stop() + end + timer = gears.timer { + timeout = config.volume_osd_timeout, + callback = function() + volumeWibox.visible = false + timer:stop() + timer = nil + end + } + timer:start() + end) + end) end local raiseVolume = function() - os.execute("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' 5%+ -M") - displayVolume() + awful.spawn.easy_async("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' 5%+ -M", function(stdout, stderr, reason, exit_code) + displayVolume() + end) end local lowerVolume = function() - os.execute("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' 5%- -M") - displayVolume() + awful.spawn.easy_async("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' 5%- -M", function(stdout, stderr, reason, exit_code) + displayVolume() + end) end local toggleMute = function() - local muted = isMuted() - os.execute("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' " .. (muted and 'on' or 'off')) - displayVolume() + isMuted(function(muted) + awful.spawn.easy_async("amixer " .. config.audio.card .. " set '" .. config.audio.device .. "' " .. (muted and 'on' or 'off'), function(stdout, stderr, reason, exit_code) + displayVolume() + end) + end) end -- }}} function getKeys(keys) - if config.audio.card == 'disabled' then - return - -- Media control - hotkey.make(keys.playPause, playPause, - { description = "Toggle Play / Pause", group = "media control" }), - hotkey.make(keys.nextTrack, nextTrack, - { description = "Next track", group = "media control" }), - hotkey.make(keys.previousTrack, previousTrack, - { description = "Previous track", group = "media control" }) - end + if config.audio.card == 'disabled' then + return + -- Media control + hotkey.make(keys.playPause, playPause, + { description = "Toggle Play / Pause", group = "media control" }), + hotkey.make(keys.nextTrack, nextTrack, + { description = "Next track", group = "media control" }), + hotkey.make(keys.previousTrack, previousTrack, + { description = "Previous track", group = "media control" }) + end - return - -- Volume control - hotkey.make(keys.raiseVolume, raiseVolume, - { description = "Raise volume", group = "media control" }), - hotkey.make(keys.lowerVolume, lowerVolume, - { description = "Lower volume", group = "media control" }), - hotkey.make(keys.toggleMute, toggleMute, - { description = "Toggle mute audio", group = "media control" }), + return + -- Volume control + hotkey.make(keys.raiseVolume, raiseVolume, + { description = "Raise volume", group = "media control" }), + hotkey.make(keys.lowerVolume, lowerVolume, + { description = "Lower volume", group = "media control" }), + hotkey.make(keys.toggleMute, toggleMute, + { description = "Toggle mute audio", group = "media control" }), - -- Media control - hotkey.make(keys.playPause, playPause, - { description = "Toggle Play / Pause", group = "media control" }), - hotkey.make(keys.nextTrack, nextTrack, - { description = "Next track", group = "media control" }), - hotkey.make(keys.previousTrack, previousTrack, - { description = "Previous track", group = "media control" }), - - -- Backlight control - hotkey.make(keys.brightnessUp, increaseBrightness, - { description = "Increase screen backlight brightness", group = "media control"}), - hotkey.make(keys.brightnessDown, decreaseBrightness, - { description = "Decrease screen backlight brightness", group = "media control"}) + -- Media control + hotkey.make(keys.playPause, playPause, + { description = "Toggle Play / Pause", group = "media control" }), + hotkey.make(keys.nextTrack, nextTrack, + { description = "Next track", group = "media control" }), + hotkey.make(keys.previousTrack, previousTrack, + { description = "Previous track", group = "media control" }), + + -- Backlight control + hotkey.make(keys.brightnessUp, increaseBrightness, + { description = "Increase screen backlight brightness", group = "media control" }), + hotkey.make(keys.brightnessDown, decreaseBrightness, + { description = "Decrease screen backlight brightness", group = "media control" }) end return { - getKeys = getKeys, -} \ No newline at end of file + getKeys = getKeys, +} From 6e94e368ed12db181d36059ff82e8f5400a5dcb3 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Thu, 8 Apr 2021 12:43:56 +0200 Subject: [PATCH 10/14] keyboard_layout.lua: quote command argument --- simple/widgets/keyboard_layout.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simple/widgets/keyboard_layout.lua b/simple/widgets/keyboard_layout.lua index 3a07c4f..3ed710c 100644 --- a/simple/widgets/keyboard_layout.lua +++ b/simple/widgets/keyboard_layout.lua @@ -11,7 +11,7 @@ local layouts = config.widgets.keyboard_layout.layouts local current_layout_index = 1 function switchLayout() current_layout_index = (current_layout_index % #(layouts)) + 1 - os.execute(config.widgets.keyboard_layout.layout_switch_command .. " " .. layouts[current_layout_index]) + os.execute(config.widgets.keyboard_layout.layout_switch_command .. " \"" .. layouts[current_layout_index] .. "\"") end return { @@ -23,4 +23,4 @@ return { hotkey.make(config.switch_alt, switchLayout, { description = "switch keyboard layout (alternative)" }) end -} \ No newline at end of file +} From 957452c55b66460a06b80b13a598f915946f75a9 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sat, 15 May 2021 20:04:34 +0200 Subject: [PATCH 11/14] Make sure fullscreen clients get a correct fullscreen geometry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mițca Dumitru --- simple/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/simple/init.lua b/simple/init.lua index 706acc8..bf0fffa 100644 --- a/simple/init.lua +++ b/simple/init.lua @@ -740,3 +740,17 @@ 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) -- }}} + + +-- Make sure clients requesting fullscreen get a correct fullscreen geometry +-- See https://github.com/awesomeWM/awesome/issues/3156 +-- OP: https://github.com/awesomeWM/awesome/issues/1607#issuecomment-298194491 +client.connect_signal("property::fullscreen", function(c) + if c.fullscreen then + gears.timer.delayed_call(function() + if c.valid then + c:geometry(c.screen.geometry) + end + end) + end +end) From 662a816dd0e66892bb2df1893d38715a60dac84a Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Mon, 31 May 2021 10:50:27 +0200 Subject: [PATCH 12/14] default config: update lock command for i3lock-color update --- default_config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default_config.lua b/default_config.lua index c31bdfe..aac34f4 100644 --- a/default_config.lua +++ b/default_config.lua @@ -25,7 +25,7 @@ config.awesome = { application_launcher_cmd = "rofi -show run -config " .. awful.util.getdir("config") .. "/assets/rofi/themes/paper-float.rasi", -- Screen locker - lock_command = "i3lock --blur=5 -f -k --timecolor=ffffffff --datecolor=ffffffff --indicator --ringcolor=aaaaaaaa", + lock_command = "i3lock --blur=5 -f -k --time-color=ffffffff --date-color=ffffffff --indicator --ring-color=aaaaaaaa", -- lock_command = "xscreensaver-command -lock", -- Terminal From 7ed0fc752211522db6070df0ceef4c5b8dfb6c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Hern=C3=A1n=20Tarche?= Date: Sat, 3 Jul 2021 16:41:03 -0300 Subject: [PATCH 13/14] Fixed battery widget opening missing file --- simple/widgets/system_resources.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/simple/widgets/system_resources.lua b/simple/widgets/system_resources.lua index b20592c..f338bcc 100644 --- a/simple/widgets/system_resources.lua +++ b/simple/widgets/system_resources.lua @@ -151,8 +151,13 @@ function getBatteryCapacity() local capacity = 0 for b in getBatteries() do if b:sub(1,3) ~= 'hid' and readCommand("cat /sys/class/power_supply/" .. b .. "/type"):match("Battery") then - charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now") - capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_full") + if type(readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now")) == "string" then + charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_now") + capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_full") + else + charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now") + capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_full") + end end end return charge / capacity From 16772da504836b33cb50491e46b19e078b35f08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Hern=C3=A1n=20Tarche?= Date: Sun, 4 Jul 2021 10:10:25 -0300 Subject: [PATCH 14/14] Added `fileExists()` --- simple/widgets/system_resources.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/simple/widgets/system_resources.lua b/simple/widgets/system_resources.lua index f338bcc..03c2eeb 100644 --- a/simple/widgets/system_resources.lua +++ b/simple/widgets/system_resources.lua @@ -34,6 +34,15 @@ local bars = wibox.widget { layout = wibox.layout.flex.horizontal } +function fileExists(name) + local f = io.open(name, "r") + if f ~= nil then + io.close(f) + return true + end + return false +end + function readCommand(command) local handle = io.popen(command, "r") local r = handle:read("*a") @@ -151,12 +160,12 @@ function getBatteryCapacity() local capacity = 0 for b in getBatteries() do if b:sub(1,3) ~= 'hid' and readCommand("cat /sys/class/power_supply/" .. b .. "/type"):match("Battery") then - if type(readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now")) == "string" then - charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_now") - capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_full") - else + if fileExists("/sys/class/power_supply/" .. b .. "/energy_now") then charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_now") capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/energy_full") + else + charge = charge + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_now") + capacity = capacity + readCommand("cat /sys/class/power_supply/" .. b .. "/charge_full") end end end