From 98a23d9fea8b4884c17cacca3830a14d79fa3c38 Mon Sep 17 00:00:00 2001 From: elenapan Date: Sun, 24 May 2020 06:04:18 +0300 Subject: [PATCH] Clean up code and comments plus some refactoring --- config/awesome/evil/brightness.lua | 2 +- config/awesome/evil/coronavirus.lua | 4 ++-- config/awesome/evil/init.lua | 6 ++---- config/awesome/notifications/mpd.lua | 14 ++++++++++++-- config/awesome/rc.lua | 26 +++++++++++++++++--------- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/config/awesome/evil/brightness.lua b/config/awesome/evil/brightness.lua index d44a071..5b99daf 100644 --- a/config/awesome/evil/brightness.lua +++ b/config/awesome/evil/brightness.lua @@ -7,7 +7,7 @@ local awful = require("awful") -- Requires inotify-tools local brightness_subscribe_script = [[ bash -c " - while (inotifywait -e modify /sys/class/backlight/?**/brightness -qq) do echo; done + while (inotifywait -e modify /sys/class/backlight/?*/brightness -qq) do echo; done "]] local brightness_script = [[ diff --git a/config/awesome/evil/coronavirus.lua b/config/awesome/evil/coronavirus.lua index a0ff412..f6f20fb 100644 --- a/config/awesome/evil/coronavirus.lua +++ b/config/awesome/evil/coronavirus.lua @@ -17,12 +17,12 @@ local coronavirus_script = [[ country="]]..country..[[" stats=$(curl "https://corona-stats.online/$country?format=json" 2>/dev/null) - + cases_total="$(echo $stats | jq ".data[0].cases")" cases_today="$(echo $stats | jq ".data[0].todayCases")" deaths_total="$(echo $stats | jq ".data[0].deaths")" deaths_today="$(echo $stats | jq ".data[0].todayDeaths")" - + echo CTOTAL@$cases_total@CTODAY@$cases_today@DTOTAL@$deaths_total@DTODAY@$deaths_today@ ']] diff --git a/config/awesome/evil/init.lua b/config/awesome/evil/init.lua index d745268..1a3518c 100644 --- a/config/awesome/evil/init.lua +++ b/config/awesome/evil/init.lua @@ -14,9 +14,7 @@ require("evil.brightness") -- Internet access required -- Note: These daemons use a temp file to store the retrieved -- values in order to check its modification time and decide if it is time to update or not. --- If you want to change their parameters (e.g. --- coronavirus_country), make sure to delete files --- `/tmp/awesomewm-evil-weather` and --- `/tmp/awesomewm-evil-coronavirus` before restarting AwesomeWM. +-- No need to worry that you will be updating too often when restarting AwesomeWM :) +-- This is useful because some APIs have a limit on the number of calls per hour. require("evil.coronavirus") require("evil.weather") diff --git a/config/awesome/notifications/mpd.lua b/config/awesome/notifications/mpd.lua index 77ef02b..9882ef2 100644 --- a/config/awesome/notifications/mpd.lua +++ b/config/awesome/notifications/mpd.lua @@ -22,9 +22,19 @@ local send_mpd_notif = function (artist, song, paused) notif:destroy() end else - -- Since the evil::mpd signal is also emitted when seeking, only send a notification when the song and artist are different than before. + -- Since the evil::mpd signal is also emitted when seeking, only + -- send a notification when the song and artist are different than + -- before. if artist ~= old_artist and song ~=old_song then - notif = notifications.notify_dwim({ title = "Now playing:", message = ""..song.." by "..artist.."", icon = icons.music, timeout = timeout, app_name = "mpd" }, notif) + notif = notifications.notify_dwim( + { + title = "Now playing:", + message = ""..song.." by "..artist.."", + icon = icons.music, + timeout = timeout, + app_name = "mpd" + }, + notif) old_artist = artist old_song = song end diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 86e1527..f7b643c 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -36,7 +36,7 @@ local bar_themes = { "lovelace", -- 2 -- Start button, taglist, layout "skyfall", -- 3 -- Weather, taglist, window buttons, pop-up tray "ephemeral", -- 4 -- Taglist, start button, tasklist, and more buttons - "amarena", -- 5 -- Autohiding taglist + "amarena", -- 5 -- Hardcore "bar-less" setup with autohiding taglist } local bar_theme = bar_themes[5] @@ -49,9 +49,9 @@ local icon_themes = { local icon_theme = icon_themes[2] -- =================================================================== local notification_themes = { - "lovelace", -- 1 -- Standard image icons - "ephemeral", -- 2 -- Text icons - "amarena", -- 3 -- Speech bubble shape with text icons + "lovelace", -- 1 -- Plain with standard image icons + "ephemeral", -- 2 -- Outlined text icons and a rainbow stripe + "amarena", -- 3 -- Speech bubble shape with filled text icons } local notification_theme = notification_themes[3] -- =================================================================== @@ -743,7 +743,7 @@ awful.rules.rules = { properties = {}, callback = function (c) -- Make it floating, ontop and move it out of the way if the current tag is maximized - if awful.layout.get(mouse.screen) == awful.layout.suit.max then + if awful.layout.get(awful.screen.focused()) == awful.layout.suit.max then c.floating = true c.ontop = true c.width = screen_width * 0.30 @@ -807,8 +807,7 @@ awful.rules.rules = { { rule_any = { class = { - "Firefox", - "firefox", + "[fF]irefox", -- "qutebrowser", }, }, @@ -824,6 +823,7 @@ awful.rules.rules = { { rule_any = { class = { + "lt-love", "portal2_linux", "deadcells", "csgo_linux64", @@ -833,10 +833,13 @@ awful.rules.rules = { "Terraria.bin.x86", "dontstarve_steam", "Wine", + "trove.exe" }, instance = { "synthetik.exe", - "leagueclient.exe" + "pathofexile_x64steam.exe", + "leagueclient.exe", + "glyphclientapp.exe" }, }, properties = { screen = 1, tag = awful.screen.focused().tags[2] } @@ -853,6 +856,7 @@ awful.rules.rules = { "Signal", "Slack", "TeamSpeak 3", + "zoom", }, }, properties = { screen = 1, tag = awful.screen.focused().tags[3] } @@ -931,12 +935,16 @@ awful.rules.rules = { "Transmission", "Deluge", "VirtualBox Manager", + "KeePassXC" }, instance = { "torrent", "qemu", } }, + except_any = { + type = { "dialog" } + }, properties = { screen = 1, tag = awful.screen.focused().tags[10] } }, @@ -1035,7 +1043,7 @@ end) -- Raise focused clients automatically client.connect_signal("focus", function(c) c:raise() end) --- Focus urgent clients automatically +-- Focus all urgent clients automatically -- client.connect_signal("property::urgent", function(c) -- if c.urgent then -- c.minimized = false