Skip to content
Alexis edited this page Sep 21, 2023 · 29 revisions

⚠️ Before you begin

This config is for my personal use. I've done my best to make it usable for others but there's bound to be bugs here and there. If you find any, please open an issue and I'll take a look as soon as I can.

If you have any suggestions or feature requests, you can also open an issue.

I hope you enjoy the config as I've really enjoyed making it!

🛠️ Installation

These instructions are written for Arch.

# (Optional) Back up your old config
mv ~/.config/awesome ~/.config/awesome.backup

# Install dependencies
# Luajit optional. you should be able to use awesome-git 
# instead - but I think it runs noticeably faster with luajit
# yay -S awesome-luajit-git luajit 

yay -S awesome-git picom-ftlabs-git gcalcli nerd-fonts-inter
sudo pacman -S task timew curl upower ledger playerctl

# Clone
git clone --recurse-submodules https://github.com/garado/cozy.git ~/.config/awesome
cd ~/.config/awesome
cp extras/default_cozyconf.lua cozyconf/init.lua

🧰 Setup

Cozy is integrated with a lot of different external tools. Here's how to set them up.

Google Calendar (gcalcli)

  1. Follow the instructions to set up gcalcli.
  2. Refresh the calendar by going to the calendar tab and either pressing r or the Refresh button.

The authorization for gcalcli expires every ~2 weeks and you will need to re-login to your Google account when that happens. gcalcli will conveniently open a browser with the reauth stuff automatically when that time comes. (If it doesn't open, try refreshing the calendar tab again.)

Habit tracking (Pixela)

Pixela is a habit tracker that works entirely through API calls.

  1. Follow the official setup instructions to create your account and set up your habits.

  2. Cozy needs your username and user token to perform the API calls. They go in cozyconf/pixela.lua.

echo -e "return {\n  name  = "YOUR-USER-NAME",\n  token = "YOUR-USER-TOKEN",\n}" > ~/.config/awesome/cozyconf/pixela.lua
  1. Update cozyconf/init.lua with your habits (graph IDs).

  2. Restart Awesome.

Note: API calls will fail 25% of the time if you're not a Pixela patron. Cozy should give an error message when this happens - you can just try the action again.

OpenWeather

  1. Obtain an OpenWeather API key.
  2. Put your API key in cozyconf/init.lua along with your latitude, longitude, and preferred units.
  3. Restart Awesome.

Taskwarrior

Disclaimer: Cozy is built specifically for the way I use Taskwarrior:

  • tags are treated as categories and projects are treated as subcategories
  • a task can be assigned to only one tag and only one project

If that doesn't work for you, you might not find much use for the dashboard task tab (you can disable the tab in cozyconf). The hooks below and the schedule widget showing upcoming due dates should still be useful though.

  1. Install the necessary hooks by placing them in the hooks/ directory of your Taskwarrior data directory. With these hooks, every time a task is added/modified outside of Cozy, the dashboard will detect it and update accordingly.
cp ~/.config/awesome/extras/taskhooks/*cozy YOUR_TASK_DATA_PATH/hooks
chmod +x YOUR_TASK_DATA_PATH/hooks/*cozy

Timewarrior

I use Timewarrior to track time spent on Taskwarrior tasks.

  1. If you haven't used Timewarrior before, create a Timewarrior data directory by running timew.

  2. Install this hook by placing it in the hooks/ directory of your Taskwarrior data directory. With this, every time a task is started/stopped, the dashboard will detect it and update accordingly. The hook also conveniently updates the Timewarrior session with task data.

cp ~/.config/awesome/extras/taskhooks/*timewarrior YOUR_TASK_DATA_PATH/hooks
chmod +x YOUR_TASK_DATA_PATH/hooks/*timewarrior

🔧 Personalization

Most configuration options are self-explanatory and located within `cozyconf/init.lua`.

Control center quick actions

Configurable within cozyconf/actions.lua.

There are two types of quick action buttons you can add - stateless and stateful.

Stateless

create_stateless_qa({
  name = "Quick action name",
  icon = "", -- Nerd Font icon
  on_press = function()
    -- your stuff goes here
  end,
})

Stateful

Here's an example from my config.

create_stateful_qa({
  name = "Redshift",
  icon = "", -- Nerd Font icon

  -- Sets the initial state for the quick action.
  init = function(qa)
    -- Search for an active Redshift instance.
    local cmd = "ps -e | grep redshift"
    awful.spawn.easy_async_with_shell(cmd, function(stdout)
      -- True if QA should be active, false otherwise.
      qa:setstate(stdout ~= "")
    end)
  end,

  -- This function runs when you turn on the quick action.
  activate = function()
    local cmd = "redshift"
    awful.spawn.easy_async_with_shell(cmd, function() end)
  end,

  -- This function runs when you turn off the quick action.
  deactivate = function()
    local cmd = "pkill redshift"
    awful.spawn.easy_async_with_shell(cmd, function() end)
  end,
})

Theme switch integrations

You'll need to write functions that run the commands to switch themes for other applications. These functions go in cozyconf/integrations.lua. This is an example that works for Kitty.

-- cozyconf/integrations.lua
return {
  kitty = function(args)
    local cmd = "kitty +kitten themes --reload-in=all " .. args
    awful.spawn.easy_async_with_shell(cmd, function() end)
  end,
}

Then you'll need to edit the colorscheme files (theme/colorschemes/COLORSCHEME_NAME/COLORSCHEME_STYLE.lua) and provide the arguments for that function.

-- somewhere in theme/colorschemes/nord/dark.lua
integrations = {
  kitty = "Nord",
}

So the command that runs for the Nord Dark theme would be kitty +kitten themes --reload-in=all nord.

Creating your own theme

Custom themes go in their own folder in themes/colorschemes. Look at the existing themes for implementation examples. After adding your theme, restart Awesome and it should show up in the theme switcher.