mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-25 17:47:14 +08:00
Clean up code and comments plus some refactoring
This commit is contained in:
parent
3ce53e84d6
commit
98a23d9fea
5 changed files with 34 additions and 18 deletions
|
|
@ -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 = [[
|
||||
|
|
|
|||
|
|
@ -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@
|
||||
']]
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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 = "<b>"..song.."</b> by <b>"..artist.."</b>", icon = icons.music, timeout = timeout, app_name = "mpd" }, notif)
|
||||
notif = notifications.notify_dwim(
|
||||
{
|
||||
title = "Now playing:",
|
||||
message = "<b>"..song.."</b> by <b>"..artist.."</b>",
|
||||
icon = icons.music,
|
||||
timeout = timeout,
|
||||
app_name = "mpd"
|
||||
},
|
||||
notif)
|
||||
old_artist = artist
|
||||
old_song = song
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue