Rename scripts

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2019-03-06 16:53:16 +01:00
parent df6b44e541
commit 410d0b33c6
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
46 changed files with 566 additions and 249 deletions

7
.gitignore vendored
View file

@ -11,4 +11,9 @@ system/.config/mpv/restore-old-bindings.conf
.zcompdump
system/.config/pulse/*
!system/.config/pulse/default.pa
!system/.config/pulse/default.pa
system/.config/cmus/*
!system/.config/cmus/rc
system/.config/polybar/scripts/gmail/credentials.json

View file

@ -16,5 +16,5 @@ Lint:
- shellcheck ./system/.config/zsh/.zprofile
- shellcheck ./system/.config/zsh/.zshrc
- shellcheck ./system/.config/X11/xsetup
- shellcheck ./install.sh
- shellcheck ./post-install.sh
- shellcheck ./install
- shellcheck ./post-install

View file

@ -9,14 +9,16 @@ While the configurations are based on my preferences and made my dotfiles public
The installation is pretty straightforward using a couple of installation scripts.
1. Clone the repository
2. Run `./install.sh`
2. Run `./install`
3. Reboot the system
4. Run `./post-install.sh`
4. Run `./post-install`
## Keybindings
| Keybinding | Use |
| ------------------------------- | ------------------- |
| <kbd>Super</kbd>+<kbd>1-9</kbd> | Switching workspace |
| Keybinding | Description |
| ------------------------------------------------ | -------------------------------- |
| <kbd>Super</kbd>+<kbd>1-9</kbd> | Switching workspace |
| <kbd>Super</kbd>+<kbd>Shift</kbd>+<kbd>1-9</kbd> | Move focused window to workspace |
| <kbd>Super</kbd>+<kbd>G</kbd> | Open game menu |
## Contents
The list of my used arch packages are found inside `packages/packages.list`.
@ -25,6 +27,14 @@ The main content of this repository can be found in the `system` folder. It
contains all configurations files, directories and scripts that mostly get symlinked
by my install script.
### `etc/udev`
This folder contains my custom udev rules. They are moved to
`/etc/udev/rules.d/` by the installation script.
### `etc/sudoers.d`
This folder contains my custom sudoers configuration. They are moved to
`/etc/sudoers.d` by the installation script.
### `.config/autokey`
This folder contains my phrases and scripts for
[AutoKey](https://github.com/autokey/autokey).
@ -32,6 +42,10 @@ This folder contains my phrases and scripts for
### `.config/bat`
This folder contains my configuration for [bat](https://github.com/sharkdp/bat) a replacement for cat.
### `.config/cmus`
This folder contains my [cmus](https://cmus.github.io/)
configuration.
### `.config/compton`
This folder contains my [compton](https://github.com/yshui/compton/releases) configuration.
@ -108,9 +122,5 @@ This file contains my QT4 configuration.
### `.local/bin`
This folder contains a bunch of scripts that I use. Some of them are used by
Polybar or i3 and others are used directly and some like `utils.sh` contain
functions that I use in other scripts.
### `udev`
This folder contains my custom udev rules. They are moved to
`/etc/udev/rules.d/` by the installation script.
Polybar or i3 and others are used directly and some like `utils` contain
functions that I use in other scripts.

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# install.sh
# install
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -12,8 +12,8 @@
# installs pacman packages and gives out the correct permissions to files.
#
# USAGE:
# ./install.sh
. ./system/.local/bin/utils.sh
# ./install
. ./system/.local/bin/utils
#######################################
# Configuration variables
@ -26,12 +26,15 @@ DIRECTORIES=(
"Build"
"Downloads"
"Projects"
"Videos"
"Images"
)
# Array of files which should be symlinked in the home folder
LINKED_FILES_HOME=(
".config/autokey"
".config/bat"
".config/cmus"
".config/compton"
".config/cron"
".config/custom"
@ -115,8 +118,14 @@ do
done
print_header "Copy custom udev rules"
for file in ${SYSTEM_DIR}/udev/rules.d/*.rules
for file in ${SYSTEM_DIR}/etc/udev/rules.d/*.rules
do
copy_udev_rule "${file}"
done
sudo udevadm control --reload-rules
print_header "Copy sudoers content"
for file in ${SYSTEM_DIR}/etc/sudoers.d/*
do
copy_sudoers_content "${file}"
done

View file

@ -1,19 +1,19 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# post-install.sh
# post-install
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This is the post-install script for my dotfiles. It should be only run
# after install.sh has been run and the system has been rebooted. This script
# after install has been run and the system has been rebooted. This script
# installs global npm packages.
#
# USAGE:
# ./post-install.sh
. ./system/.local/bin/utils.sh
# ./post-install
. ./system/.local/bin/utils
#######################################
# Configuration variables

View file

@ -22,4 +22,6 @@ rofi.seperator-style: solid
rofi.opacity: 100
rofi.location: 2
rofi.yoffset: 35
rofi.fixed-num-lines: false
rofi.fixed-num-lines: false
Sxiv.background: #000000

View file

@ -31,4 +31,4 @@ xrdb -merge "${XDG_CONFIG_HOME}/X11/xresources"
# Start ibus
#ibus-daemon -drx
. "${XDG_BIN_HOME}/resolution.sh"
. "${XDG_BIN_HOME}/resolution"

View file

@ -12,10 +12,10 @@
"interfaceType": "XRecord",
"undoUsingBackspace": true,
"windowDefaultSize": [
924,
469
1872,
962
],
"hPanePosition": 232,
"hPanePosition": 472,
"columnWidths": [
150,
50,

View file

@ -13,9 +13,9 @@
"undoUsingBackspace": true,
"windowDefaultSize": [
1872,
301
962
],
"hPanePosition": 470,
"hPanePosition": 472,
"columnWidths": [
150,
50,

View file

@ -15,7 +15,7 @@
],
"backspace": true,
"ignoreCase": false,
"immediate": true,
"immediate": false,
"triggerInside": false,
"wordChars": "[\\w]"
},

View file

@ -5,7 +5,7 @@
"modes": [
1
],
"usageCount": 12,
"usageCount": 19,
"prompt": false,
"omitTrigger": false,
"showInTrayMenu": false,
@ -15,7 +15,7 @@
],
"backspace": true,
"ignoreCase": false,
"immediate": true,
"immediate": false,
"triggerInside": false,
"wordChars": "[\\w]"
},

1
system/.config/cmus/rc Normal file
View file

@ -0,0 +1 @@
set display_artist_sort_name=/home/severin/.local/bin/cmus-cover

View file

@ -15,7 +15,7 @@ opacity-rule = [
"85:class_g = 'Nemo'"
];
inactive-dim = 0.25;
#inactive-dim = 0.25;
# Performance improvements
unredir-if-possible = true;

View file

@ -11,5 +11,10 @@
# This file is loaded on boot by crontab.
# Synchronize Google Drive every 30 minutes
*/30 * * * * grive -d -p /home/severin/GoogleDrive/ >> /home/severin/.local/log/cron.log 2>&1
*/5 * * * * /home/severin/.local/bin/sync_notes.sh >> /home/severin/.local/log/notes.log 2>&1
*/30 * * * * grive -d -p $HOME/Documents/ >> $HOME/.local/log/cron.log
# Sync pacman databases every 30 minutes
*/30 * * * * sudo $HOME/.local/bin/sync_package_databases >> $HOME/.local/log/cron.log
# Synchronize notes every 5 minutes
*/5 * * * * $HOME/.local/bin/sync_notes >> $HOME/.local/log/cron.log

View file

@ -32,6 +32,9 @@ alias pj="cd ~/Projects"
# Alias to get to my Downloads folder
alias dl="cd ~/Downloads"
# Alias to get to my Documents folder
alias doc="cd ~/Documents"
# Alias for opening my code editor
alias e="code"

View file

@ -11,7 +11,7 @@
#
# USAGE:
# This script is sourced by .bashrc
. "${XDG_BIN_HOME}/utils.sh"
. "${XDG_BIN_HOME}/utils"
# XDG Overrides for unsupported programs
export HTTPIE_CONFIG_DIR="${XDG_CONFIG_HOME}/httpie"

View file

@ -1,5 +1,5 @@
file:///home/severin/Downloads Downloads
file:///home/severin/GoogleDrive GoogleDrive
file:///home/severin/Documents Documents
file:///home/severin/Projects Projects
file:///home/severin/dotfiles dotfiles
file:///home/severin/Notes Notes

View file

@ -10,18 +10,36 @@
# USAGE:
# This file is automatically used by i3.
# Disable window titlebars and borders
for_window [class="^.*"] border pixel 0
# Gaps
gaps inner 25
#gaps outer -10
new_window none
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Noto Sans, Font Awesome 5 Free 15px
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
###############################################################################
# Modifiers #
###############################################################################
set $mod Mod4
set $alt Mod1
###############################################################################
# Outputs #
###############################################################################
set $output1 HDMI-1
set $output2 eDP-1
###############################################################################
# Workspaces #
###############################################################################
@ -49,29 +67,36 @@ workspace $workspace8 output $output1
workspace $workspace9 output $output2
workspace $workspace10 output $output2
new_window none
# Assign applications to workspaces
assign [class="Google-chrome-beta"] $workspace1
assign [instance="cmus"] $workspace10
assign [class="Code"] $workspace3
assign [class="Nemo"] $workspace4
assign [class="discord"] $workspace5
assign [class="Steam"] $workspace6
assign [class="keepassxc"] $workspace8
assign [class="vlc"] $workspace9
assign [class="mpv"] $workspace9
assign [class="Notable"] $workspace7
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:Noto Sans, Font Awesome 5 Free 15px
###############################################################################
# Keybindings #
###############################################################################
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# Start a terminal
bindsym $mod+Return exec termite -c ~/.config/termite/config
# Kill focused window
bindsym $mod+Shift+q kill
# Rofi menus
# Open run menu
bindsym $mod+R exec rofi -show run -lines 5
bindsym $mod+G exec games.sh
bindsym $mod+F4 exec power.sh
# Open game menu
bindsym $mod+G exec games
# Open power menu
bindsym $mod+F4 exec power
# Change focus
bindsym $mod+Left focus left
@ -99,67 +124,57 @@ bindsym $mod+$alt+H move workspace to output left
bindsym $mod+$alt+Right move workspace to output right
bindsym $mod+$alt+L move workspace to output right
# split in horizontal orientation
#bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# Toggle split orientation
bindsym $mod+T split toggle
# Fullscreen toggle
bindsym $mod+F11 fullscreen toggle
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
bindsym $mod+Shift+Space floating toggle
# Workspace switching
bindsym $mod+1 workspace $workspace1
bindsym $mod+2 workspace $workspace2
bindsym $mod+3 workspace $workspace3
bindsym $mod+4 workspace $workspace4
bindsym $mod+5 workspace $workspace5
bindsym $mod+6 workspace $workspace6
bindsym $mod+7 workspace $workspace7
bindsym $mod+8 workspace $workspace8
bindsym $mod+9 workspace $workspace9
bindsym $mod+0 workspace $workspace10
bindsym $mod+KP_1 workspace $workspace1
bindsym $mod+2 workspace $workspace2
bindsym $mod+KP_2 workspace $workspace2
bindsym $mod+3 workspace $workspace3
bindsym $mod+KP_3 workspace $workspace3
bindsym $mod+4 workspace $workspace4
bindsym $mod+KP_4 workspace $workspace4
bindsym $mod+5 workspace $workspace5
bindsym $mod+KP_5 workspace $workspace5
bindsym $mod+6 workspace $workspace6
bindsym $mod+KP_6 workspace $workspace6
bindsym $mod+7 workspace $workspace7
bindsym $mod+KP_7 workspace $workspace7
bindsym $mod+8 workspace $workspace8
bindsym $mod+KP_8 workspace $workspace8
bindsym $mod+9 workspace $workspace9
bindsym $mod+KP_9 workspace $workspace9
bindsym $mod+0 workspace $workspace10
bindsym $mod+KP_0 workspace $workspace10
# Moving container to workspace
bindsym $mod+Shift+1 move container to workspace $workspace1
bindsym $mod+Shift+2 move container to workspace $workspace2
bindsym $mod+Shift+3 move container to workspace $workspace3
bindsym $mod+Shift+4 move container to workspace $workspace4
bindsym $mod+Shift+5 move container to workspace $workspace5
bindsym $mod+Shift+6 move container to workspace $workspace6
bindsym $mod+Shift+7 move container to workspace $workspace7
bindsym $mod+Shift+8 move container to workspace $workspace8
bindsym $mod+Shift+9 move container to workspace $workspace9
bindsym $mod+Shift+0 move container to workspace $workspace10
bindsym $mod+Shift+KP_1 move container to workspace $workspace1
bindsym $mod+Shift+2 move container to workspace $workspace2
bindsym $mod+Shift+KP_2 move container to workspace $workspace2
bindsym $mod+Shift+3 move container to workspace $workspace3
bindsym $mod+Shift+KP_3 move container to workspace $workspace3
bindsym $mod+Shift+4 move container to workspace $workspace4
bindsym $mod+Shift+KP_4 move container to workspace $workspace4
bindsym $mod+Shift+5 move container to workspace $workspace5
bindsym $mod+Shift+KP_5 move container to workspace $workspace5
bindsym $mod+Shift+6 move container to workspace $workspace6
bindsym $mod+Shift+KP_6 move container to workspace $workspace6
bindsym $mod+Shift+7 move container to workspace $workspace7
bindsym $mod+Shift+KP_7 move container to workspace $workspace7
bindsym $mod+Shift+8 move container to workspace $workspace8
bindsym $mod+Shift+KP_8 move container to workspace $workspace8
bindsym $mod+Shift+9 move container to workspace $workspace9
bindsym $mod+Shift+KP_9 move container to workspace $workspace9
bindsym $mod+Shift+0 move container to workspace $workspace10
bindsym $mod+Shift+KP_0 move container to workspace $workspace10
# Restart i3
@ -181,20 +196,14 @@ bindsym Escape mode "default"
bindsym $mod+x mode "resize"
exec_always --no-startup-id $HOME/.config/polybar/launch.sh
#######################################
# Custom keybinding
#######################################
# Screen lock controls
#bindsym $mod+l exec --no-startup-id $XDG_BIN_HOME/screenlock.sh
bindsym XF86Sleep exec --no-startup-id $XDG_BIN_HOME/screenlock.sh
bindsym XF86Sleep exec --no-startup-id screenlock
# Volume controls
bindsym XF86AudioMute exec --no-startup-id pamixer -t
bindsym $mod+m exec --no-startup-id pamixer -t
bindsym XF86AudioRaiseVolume exec --no-startup-id $XDG_BIN_HOME/increase_volume.sh
bindsym $mod+KP_Add exec --no-startup-id $XDG_BIN_HOME/increase_volume.sh
bindsym XF86AudioRaiseVolume exec --no-startup-id increase_volume
bindsym $mod+KP_Add exec --no-startup-id increase_volume
bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 5 --allow-boost
bindsym $mod+KP_Subtract exec --no-startup-id pamixer -d 5 --allow-boost
@ -212,21 +221,25 @@ bindsym XF86AudioPrev exec --no-startup-id cmus-remote -r
bindsym $mod+Control+Left exec --no-startup-id cmus-remote -r
exec --no-startup-id "i3-msg 'workspace 10: ; append_layout /home/severin/.config/i3/workspace-10.json'"
#######################################
# Startup applications
#######################################
# Dunst
exec --no-startup-id dunst
# Compton
###############################################################################
# Startup applications #
###############################################################################
# Start compton
exec --no-startup-id compton -b
# Background-Image
exec_always --no-startup-id feh --randomize --bg-fill $HOME/GoogleDrive/02_Media/Images/01_Wallpaper/Desktop/*
# Start polybar
exec_always --no-startup-id $XDG_CONFIG_HOME/polybar/launch
# Monitor settings
exec_always --no-startup-id $XDG_BIN_HOME/resolution.sh
# Start dunst
exec --no-startup-id dunst
# Set resolution
exec_always --no-startup-id resolution
# Set wallpaper
exec_always --no-startup-id wallpaper
# Other applications
exec autokey-gtk
@ -238,23 +251,5 @@ exec nemo
exec keepassxc
exec notable
exec termite -e cmus --name cmus
# Assign programs to specific workspaces
###
assign [class="Google-chrome-beta"] $workspace1
assign [instance="cmus"] $workspace10
assign [class="Code"] $workspace3
assign [class="Nemo"] $workspace4
assign [class="discord"] $workspace5
assign [class="Steam"] $workspace6
assign [class="keepassxc"] $workspace8
assign [class="vlc"] $workspace9
assign [class="mpv"] $workspace9
assign [class="Notable"] $workspace7
# Disable window titlebars and borders
for_window [class="^.*"] border pixel 0
# Gaps
gaps inner 25
#gaps outer -10
exec termite -e cava --name cava
exec sxiv -b -s f $HOME/.local/share/cmus/.cover

View file

@ -0,0 +1,96 @@
[
{
"border": "none",
"floating": "auto_off",
"fullscreen_mode": 0,
"layout": "splith",
"percent": 1,
"type": "con",
"nodes": [
{
"border": "none",
"floating": "auto_off",
"layout": "splith",
"percent": 1,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 0,
"floating": "auto_off",
"geometry": {
"height": 434,
"width": 736,
"x": 0,
"y": 0
},
"name": "cmus v2.7.1",
"percent": 0.7,
"swallows": [
{
"instance": "^cmus$"
}
],
"type": "con"
},
{
"border": "none",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.3,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 0,
"floating": "auto_off",
"geometry": {
"height": 1080,
"width": 1920,
"x": 0,
"y": 0
},
"name": "sxiv",
"percent": 0.5,
"swallows": [
{
"instance": "^sxiv$"
}
],
"type": "con"
},
{
"border": "none",
"floating": "auto_off",
"layout": "splith",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 0,
"floating": "auto_off",
"geometry": {
"height": 434,
"width": 736,
"x": 0,
"y": 0
},
"name": "cava",
"percent": 1,
"swallows": [
{
"instance": "^cava$"
}
],
"type": "con"
}
]
}
]
}
]
}
]
}
]

View file

@ -28,7 +28,7 @@ monitor = HDMI-1
width = 100%
height = ${settings.bar-height}
offset-x = 0
offset-y = 0
offset-y = 0
font-0 = Noto Sans:pixelsize=12;3
font-1 = Noto Sans CJK JP:pixelsize=12;3
@ -42,8 +42,8 @@ padding-right = 2
module-margin = 2
modules-left = i3
modules-center = xwindow
modules-right = battery volume backlight wlan date power
modules-center =
modules-right = update gmail todo battery volume backlight wlan date power
tray-position = none
separator = |
@ -106,20 +106,53 @@ label-urgent-background = ${settings.background-color}
label-urgent-padding = ${settings.padding}
#######################################
# Active window title
#######################################
[module/xwindow]
type = internal/xwindow
###############################################################################
# Update count #
###############################################################################
[module/update]
type = custom/script
exec = ${XDG_CONFIG_HOME}/polybar/scripts/update-count
format = <label>
label = %title%
label-maxlen = 50
label =  %output%
interval = 60
click-left = xdg-open "https://www.archlinux.org/"
###############################################################################
# G-Mail #
###############################################################################
[module/gmail]
type = custom/script
exec = ${XDG_CONFIG_HOME}/polybar/scripts/gmail/count.py
format = <label>
label =  %output%
interval = 60
click-left = xdg-open https://mail.google.com
#######################################
# Battery indicator
#######################################
###############################################################################
# Todo #
###############################################################################
[module/todo]
type = custom/script
exec = echo "$(${XDG_BIN_HOME}/todo | wc -l) / 3" | bc
format = <label>
label =  %output%
interval = 60
click-left = xdg-open "https://todoist.com/"
###############################################################################
# Battery indicator #
###############################################################################
[module/battery]
type = internal/battery
full-at = 99
@ -153,9 +186,9 @@ interval = 5
poll-interval = 5
#######################################
# Volume indicator
#######################################
##############################################################################
# Volume indicator #
##############################################################################
[module/volume]
type = internal/pulseaudio
use-ui-max = true
@ -173,9 +206,9 @@ ramp-volume-2 = 
interval = 5
#######################################
# Brightness indicator
#######################################
##############################################################################
# Brightness indicator #
##############################################################################
[module/backlight]
type = custom/script
exec = light -G | cut -d. -f1
@ -189,9 +222,9 @@ scroll-up = light -A 5
scroll-down = light -U 5
#######################################
# WiFi indicator
#######################################
##############################################################################
# WiFi indicator #
##############################################################################
[module/wlan]
type = internal/network
interface = wlp3s0
@ -212,9 +245,9 @@ ramp-signal-foreground = ${settings.foreground-color}
interval = 1
#######################################
# Time and date
#######################################
##############################################################################
# Time and date #
##############################################################################
[module/date]
type = custom/script
exec = date +"%F %H:%M:%S"
@ -227,19 +260,14 @@ interval = 1
click-left = xdg-open "https://calendar.google.com"
#######################################
# Power menu
#######################################
##############################################################################
# Power menu #
##############################################################################
[module/power]
type = custom/script
exec = echo -e "\uf011"
type = custom/text
content = 
format = <label>
label = %output%
interval = 5
click-left = $XDG_BIN_HOME/power.sh
click-left = $XDG_BIN_HOME/power
#######################################
@ -247,7 +275,7 @@ click-left = $XDG_BIN_HOME/power.sh
#######################################
[module/music]
type = custom/script
exec = ${XDG_BIN_HOME}/music.sh
exec = ${XDG_BIN_HOME}/music
format = <label>
label = %output%

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# .config/polybar/launch.sh
# .config/polybar/launch
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -10,7 +10,7 @@
# This script kills existing polybar processes and then launches the bars.
#
# USAGE:
# ./launch.sh
# ./launch
# Terminate already running bar instances
killall -q polybar

View file

@ -0,0 +1,28 @@
#!/usr/bin/env python
import os
import pathlib
import httplib2
import webbrowser
from oauth2client import client, file
SCOPE = 'https://www.googleapis.com/auth/gmail.readonly'
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
DIR = os.path.dirname(os.path.realpath(__file__))
CLIENT_SECRETS_PATH = os.path.join(DIR, 'client_secrets.json')
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
storage = file.Storage(CREDENTIALS_PATH)
if pathlib.Path(CREDENTIALS_PATH).is_file():
credentials = storage.get()
credentials.refresh(httplib2.Http())
print('Credentials successfully refreshed')
else:
flow = client.flow_from_clientsecrets(CLIENT_SECRETS_PATH, scope=SCOPE,
redirect_uri=REDIRECT_URI)
auth_uri = flow.step1_get_authorize_url()
webbrowser.open(auth_uri)
auth_code = input('Enter the auth code: ')
credentials = flow.step2_exchange(auth_code)
storage.put(credentials)
print('Credentials successfully created')

View file

@ -0,0 +1,11 @@
{
"installed": {
"client_id": "1041679298587-8solnkr9tr8iktrut958if6tsgqt42m2.apps.googleusercontent.com",
"project_id": "polybar-gmail",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "-aZZAslLp6ydldCAFvH9AEwi",
"redirect_uris": ["urn:ietf:wg:oauth:2.0:oob"]
}
}

View file

@ -0,0 +1,19 @@
#!/usr/bin/env python
import os
import pathlib
import subprocess
import time
import argparse
from apiclient import discovery, errors
from oauth2client import client, file
from httplib2 import ServerNotFoundError
DIR = os.path.dirname(os.path.realpath(__file__))
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
gmail = discovery.build(
'gmail', 'v1', credentials=file.Storage(CREDENTIALS_PATH).get())
labels = gmail.users().labels().get(userId='me', id='INBOX').execute()
print(labels['messagesUnread'])

View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# update-count
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Returns the outstanding system updates.
#
# USAGE:
# ./update-count
UPDATES=$(pacman -Qu | wc -l)
AUR_UPDATES=$(yay -Qua --devel | wc -l)
echo "${UPDATES} / ${AUR_UPDATES}"

15
system/.local/bin/cmus-cover Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# cmus-cover
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Saves the current cmus cover to a file.
#
# USAGE:
# ./cmus-cover
FILE="$(cmus-remote -Q | grep -e "file " | cut -d " " -f 2-)"
ffmpeg -y -i "${FILE}" -f image2 /home/severin/.local/share/cmus/.cover

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# games.sh
# games
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -10,7 +10,7 @@
# Displays a game menu using rofi.
#
# USAGE:
# ./games.sh
# ./games
# The rofi prompt
PROMPT="Games"
@ -19,7 +19,8 @@ PROMPT="Games"
ACTIONS=(
"1: Steam"
"2: Guild Wars 2"
"3: Pegasus"
"3: Minecraft"
"4: Pegasus"
)
SELECTION=$(printf '%s\n' "${ACTIONS[@]}" | rofi -dmenu -p "${PROMPT}" | cut -d ":" -f1)
@ -28,9 +29,12 @@ case "${SELECTION}" in
steam
;;
"2")
g2.sh
gw2
;;
"3")
pegasus-fe
optirun -b primus minecraft-launcher
;;
"4")
optirun -b primus pegasus-fe
;;
esac

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# gw2.sh
# gw2
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -10,7 +10,7 @@
# Starts Guild Wars 2 inside Wine.
#
# USAGE:
# ./gw2.sh
# ./gw2
# Set custom wineprefix
export WINEPREFIX="${HOME}/Games/Guild_Wars_2/"

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# increase_volume.sh
# increase_volume
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -12,7 +12,7 @@
# using custom i3 keybindings.
#
# USAGE:
# ./increase_volume.sh
# ./increase_volume
if [[ $(pamixer --get-volume) -lt 150 ]]; then
pamixer -i 5 --allow-boost
fi

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# music.sh
# music
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -10,7 +10,7 @@
# Prints out the title of the current playing song using cmus-remote.
#
# USAGE:
# ./music.sh
# ./music
QUERY="$(cmus-remote -Q)"

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# power.sh
# power
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -10,7 +10,7 @@
# Displays a power menu using rofi.
#
# USAGE:
# ./power.sh
# ./power
# The rofi prompt
PROMPT="Power Options"
@ -33,13 +33,13 @@ case "${SELECTION}" in
systemctl poweroff
;;
"3")
screenlock.sh
screenlock
;;
"5")
"4")
gksudo "cpupower frequency-set -g performance"
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=2' -c :8 > /dev/null
;;
"6")
"5")
gksudo "cpupower frequency-set -g powersave"
optirun -b primus nvidia-settings -a '[gpu:0]/GPUPowerMizerMode=0' -c :8 > /dev/null
;;

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# resolution.sh
# resolution
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -11,6 +11,6 @@
# is used by i3 and lightdm.
#
# USAGE:
# ./resolution.sh
# ./resolution
#xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --output HDMI3 --off --output HDMI2 --off --output HDMI-1 --mode 1280x1024 --pos 80x56 --rotate normal --output eDP-1 --primary --mode 1920x1080 --pos 1360x0 --rotate normal --output DP3 --off --output DP2 --off --output DP1 --off

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# screenlock.sh
# screenlock
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -11,5 +11,5 @@
# using a custom i3 keybinding.
#
# USAGE:
# ./screenlock.sh
# ./screenlock
i3lock-fancy -f "Noto Sans"

View file

@ -1,23 +0,0 @@
#!/bin/bash
#
# SCRIPT NAME:
# server.sh
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# This script starts / stops the Apache and MariaDB servers.
#
# USAGE:
# ./server.sh start|stop
if [ "${1}" == "start" ]; then
sudo systemctl start httpd.service
sudo systemctl start mariadb.service
elif [ "${1}" == "stop" ]; then
sudo systemctl stop httpd.service
sudo systemctl stop mariadb.service
else
echo "${1} is an unknown option"
exit 0
fi

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# submodule_update.sh
# submodule_update
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -11,14 +11,13 @@
# new commit and pushes it. Only when there are no staged changes pending.
#
# USAGE:
# ./submodule_update.sh
. utils.sh
# ./submodule_update
. utils
START_DIR=$(pwd)
print_header "Updating submodules"
while IFS= read -r -d '' dir
do
cd "$dir" || exit 1

22
system/.local/bin/sync_notes Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# sync_notes
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Sync notes in ~/Notes using git
#
# USAGE:
# ./sync_notes
. /home/severin/.local/bin/utils
print_time_log "sync_notes" "Synchronizing notes"
cd "/home/severin/Notes" || exit
git pull > /dev/null 2>&1
git add --all > /dev/null 2>&1
git commit -s -m "Update notes" > /dev/null 2>&1
git push origin master > /dev/null 2>&1

View file

@ -1,19 +0,0 @@
#!/bin/bash
#
# SCRIPT NAME:
# sync_notes.sh
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Sync notes in ~/Notes using git
#
# USAGE:
# ./sync_notes.sh
# Set custom wineprefix
cd "/home/severin/Notes" || exit
git pull
git add --all
git commit -s -m "Update notes"
git push origin master

View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# sync_package_databases
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Syncs the package database of pacman
#
# USAGE:
# ./sync_package_databases
. /home/severin/.local/bin/utils
print_time_log "sync_package_databases" "Syncing databases"
yay -Syy > /dev/null 2>&1

33
system/.local/bin/todo Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# todo
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Lists the TODOs.
#
# USAGE:
# ./todo
clear
while read -r line
do
task=$(echo "${line}" | cut -d "," -f 6)
project=$(echo "${line}" | cut -d "," -f 4 | sed -e "s/^#//")
datetime=$(echo "${line}" | cut -d "," -f 3)
echo -e "[${datetime}][${project}]\n☐ ${task}\n"
done <<< "$(todoist s && todoist --csv list --filter "(overdue | today)")"
TODOS=$(rg -g "!todo" --hidden --no-heading -n "TODO:" "${HOME}/dotfiles" "${HOME}/Projects")
if [ -n "${TODOS}" ]; then
while read -r line; do
file=$(echo "${line}" | cut -d ":" -f 1 | sed -e "s/^[[:space:]]*//")
lineNumber=$(echo "${line}" | cut -d ":" -f 2 | sed -e "s/^[[:space:]]*//")
task=$(echo "${line}" | cut -d ":" -f 4 | sed -e "s/^[[:space:]]*//")
echo -e "[Line ${lineNumber}][${file}]\n☐ ${task}\n"
done <<< "${TODOS}"
fi

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# twitch.sh
# twitch
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -11,7 +11,7 @@
# using streamlink.
#
# USAGE:
# ./twitch.sh USERNAME [RESOLUTION]
# ./twitch USERNAME [RESOLUTION]
if [[ -z $1 ]]; then
echo "Please enter a username!"
exit 1

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# upgrade.sh
# upgrade
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -11,8 +11,8 @@
# npm packages.
#
# USAGE:
# ./upgrade.sh
. utils.sh
# ./upgrade
. utils
print_header "Upgrading system"
print_section "Update arch packages"

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# utils.sh
# utils
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -39,12 +39,18 @@ function print_header() {
echo -e "╚══════════════════════════════════════════════════════════════════════════════╝${RESET}"
}
# Function to print out a log entry together with the current date and time.
# USAGE: print_time_log SCRIPT MESSAGE
function print_time_log() {
echo -e "[$(date "+%F %T")][${1}] ${2}"
}
# Function to print a info message with the current time and to send
# a notification using notify-send.
# USAGE: print_notify TITLE MESSAGE
function print_notify() {
notify-send "${1}" "${2}"
echo -e "${YELLOW}[$(date "+%H:%M:%S")] ${1} ${2}${RESET}"
echo -e "${YELLOW}[$(date "+%T")] ${1} ${2}${RESET}"
}
# Prints a section title.
@ -103,3 +109,15 @@ function copy_udev_rule() {
print_log "Copying ${YELLOW}$(basename "${1}")${RESET} to ${YELLOW}/etc/udev/rules.d/${RESET}"
sudo cp "${1}" "/etc/udev/rules.d/"
}
# Function to copy sudoers files to /etc/sudoers.d/
# USAGE: copy_sudoers_content FILE
function copy_sudoers_content() {
print_log "Copying ${YELLOW}$(basename "${1}")${RESET} to ${YELLOW}/etc/sudoers.d/${RESET}"
sudo mkdir -p "/tmp/sudoers"
sudo cp "${1}" "/tmp/sudoers/$(basename "${1}")"
sudo chmod 0440 "/tmp/sudoers/$(basename "${1}")"
sudo cp -a "/tmp/sudoers/$(basename "${1}")" "/etc/sudoers.d/"
}

20
system/.local/bin/wallpaper Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# wallpaper
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Sets the wallpaper using feh
#
# USAGE:
# ./wallpaper
. /home/severin/.local/bin/utils
print_time_log "wallpaper" "Changing wallpaper"
# When run from a cronjob the DISPLAY environment variable is not set
DISPLAY=:0 feh --randomize --bg-fill --no-fehbg "/home/severin/Documents/02_Media/Images/01_Wallpaper/Desktop/"

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# watch.sh
# watch-file
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -11,8 +11,8 @@
# executes the given command.
#
# USAGE:
# ./watch.sh FILE COMMAND...
. utils.sh
# ./watch-file FILE COMMAND...
. utils
# The file to watch
FILE="${1}"

View file

@ -0,0 +1,2 @@
# Privilege specification for user severin
severin ALL=(ALL:ALL) NOPASSWD:/home/severin/.local/bin/sync_package_databases