mirror of
https://github.com/harish2704/dotFiles.git
synced 2026-09-10 07:11:09 +00:00
New utils
* Tile pdf eg: Tile A5 in A4 page * Start / stop pulseaudio tcp * systemd service generator
This commit is contained in:
@@ -2,7 +2,7 @@ font:
|
|||||||
size: 13.0
|
size: 13.0
|
||||||
normal:
|
normal:
|
||||||
# family: Source Code Pro Medium
|
# family: Source Code Pro Medium
|
||||||
family: CodeNewRoman Nerd Font Mono
|
family: DejaVuSansMono Nerd Font Mono
|
||||||
|
|
||||||
key_bindings:
|
key_bindings:
|
||||||
- { key: Return, mods: Shift, chars: "\e[13;2u" }
|
- { key: Return, mods: Shift, chars: "\e[13;2u" }
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ set $down j
|
|||||||
set $up k
|
set $up k
|
||||||
set $right l
|
set $right l
|
||||||
# Your preferred terminal emulator
|
# Your preferred terminal emulator
|
||||||
set $term gnome-terminal
|
# set $term gnome-terminal
|
||||||
|
set $term konsole
|
||||||
# Your preferred application launcher
|
# Your preferred application launcher
|
||||||
set $menu dmenu_run
|
set $menu dmenu_run
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
|
|||||||
# Resize them with right mouse button + $mod.
|
# Resize them with right mouse button + $mod.
|
||||||
# Despite the name, also works for non-floating windows.
|
# Despite the name, also works for non-floating windows.
|
||||||
# Change normal to inverse to use left mouse button for resizing and right
|
# Change normal to inverse to use left mouse button for resizing and right
|
||||||
# mouse button for dragging.
|
|
||||||
floating_modifier $mod normal
|
floating_modifier $mod normal
|
||||||
|
|
||||||
# reload the configuration file
|
# reload the configuration file
|
||||||
@@ -189,7 +190,9 @@ bindsym $mod+r mode "resize"
|
|||||||
#
|
#
|
||||||
# Read `man 5 sway-bar` for more information about this section.
|
# Read `man 5 sway-bar` for more information about this section.
|
||||||
bar {
|
bar {
|
||||||
status_command i3status
|
#status_command i3status
|
||||||
|
swaybar_command waybar
|
||||||
|
status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
|
||||||
position top
|
position top
|
||||||
colors {
|
colors {
|
||||||
statusline #ffffff
|
statusline #ffffff
|
||||||
@@ -201,7 +204,7 @@ bar {
|
|||||||
include /etc/sway/config.d/*
|
include /etc/sway/config.d/*
|
||||||
|
|
||||||
|
|
||||||
set $wp_switch ~/.local/bin/sway-wp-switch
|
set $wp_switch sway-wp-switch
|
||||||
|
|
||||||
bindsym Control+Shift+Alt+Up exec $wp_switch -m up
|
bindsym Control+Shift+Alt+Up exec $wp_switch -m up
|
||||||
bindsym Control+Shift+Alt+Down exec $wp_switch -m down
|
bindsym Control+Shift+Alt+Down exec $wp_switch -m down
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ chromewayland(){
|
|||||||
|
|
||||||
# pidEnv <PID> . Print environment variables of a PID.
|
# pidEnv <PID> . Print environment variables of a PID.
|
||||||
pidEnv(){
|
pidEnv(){
|
||||||
cat /proc/$(pgrep kwin)/environ | tr '\0' '\n' | awk '{ print "export "$0}'
|
cat /proc/$(pgrep $1)/environ | tr '\0' '\n' | awk '{ print "export "$0}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy files from local to remote
|
# Copy files from local to remote
|
||||||
@@ -220,12 +220,49 @@ json2csv(){
|
|||||||
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv'
|
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv'
|
||||||
}
|
}
|
||||||
|
|
||||||
# pdfTile <input file> <nup 2x1>
|
# pdfTile <input file> <nup 2x1> [options]
|
||||||
# Tile input pdf in A4 sheet
|
# Tile input pdf in A4 sheet
|
||||||
pdfTile(){
|
pdfTile(){
|
||||||
pdfjam $1 --no-landscape --nup $2 --paper a4paper --suffix A4
|
local infile=$1
|
||||||
|
shift
|
||||||
|
local nup=$1
|
||||||
|
shift
|
||||||
|
pdfjam $infile --nup $nup --paper a4paper --suffix A4 $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# servicegen <name> <exec> [logsdir]
|
||||||
|
# Generate systemd service file
|
||||||
|
servicegen(){
|
||||||
|
local name=$1
|
||||||
|
local cmd=$2
|
||||||
|
local logsdir=$3
|
||||||
|
cat<<EOF
|
||||||
|
[Unit]
|
||||||
|
Description = $name
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type = simple
|
||||||
|
LimitNOFILE = 4096
|
||||||
|
Restart = always
|
||||||
|
RestartSec = 2s
|
||||||
|
StandardOutput = append:$logsdir/stdout.log
|
||||||
|
StandardError = append:$logsdir/stderr.log
|
||||||
|
ExecStart = $cmd
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy = multi-user.target
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start pulseaudio in tcp port 24667 to use with docker containers
|
||||||
|
pulseTcpStart(){
|
||||||
|
pactl load-module module-native-protocol-tcp port=24667 auth-ip-acl=172.16.0.0/12
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stop pulseaudio in tcp port 24667
|
||||||
|
pulseTcpStop(){
|
||||||
|
pactl unload-module module-native-protocol-tcp
|
||||||
|
}
|
||||||
|
|
||||||
# Setup autocomplete. run eval "$(THIS_FILE setup-autocomplete)"
|
# Setup autocomplete. run eval "$(THIS_FILE setup-autocomplete)"
|
||||||
setup-autocomplete(){
|
setup-autocomplete(){
|
||||||
|
|||||||
Reference in New Issue
Block a user