display, i3

This commit is contained in:
2020-02-15 15:04:47 +01:00
parent 560841459c
commit 93edf69d60
16 changed files with 298 additions and 41 deletions

View File

@ -4,7 +4,7 @@ xterm*cursorColor:green
!xterm*pointerShape:arrow
!xterm*pointerColor:blue
xterm*VT100.geometry:80x32
xterm*faceName:Terminus:style=Regular:size=9
xterm*faceName:Terminus Nerd Font:style=Regular:size=9
!xterm*font:-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*
!xterm*faceName:Inconsolata:style=Regular:size=11
!xterm*font:-*-dina-medium-r-*-*-16-*-*-*-*-*-*-*
@ -25,6 +25,10 @@ xterm*termName:xterm-256color
xterm*metaSendsEscape:true
urxvt*font:-xos4-terminus-*-*-*-*-12-*-*-*-*-*-*-*
!urxvt*font: TerminessTTF Nerd Font:style=Medium:size=12
!URxvt*font: xft:xos4 Terminus:style=Regular :size=12 xft:TerminessTTF Nerd Font Mono:style=Medium :size=12
!URxvt*letterSpace: -1
!urxvt*depth: 32
!urxvt*background: rgba:0000/0000/0200/c800
!urxvt*transparent: false

View File

@ -10,7 +10,7 @@
padding = 8
horizontal_padding = 8
frame_width = 1
frame_color = "#6C901C"
frame_color = "#8C552E"
# Define a color for the separator.
# possible values are:
@ -75,21 +75,21 @@
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#0c0d05"
foreground = "#6C901C"
background = "#0f0e09"
foreground = "#8C552E"
timeout = 5
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#0c0d05"
foreground = "#6C901C"
background = "#0f0e09"
foreground = "#8C552E"
timeout = 5
[urgency_critical]
background = "#0c0d05"
foreground = "#6C901C"
frame_color = "#6C901C"
background = "#0f0e09"
foreground = "#8C552E"
frame_color = "#8C552E"
timeout = 0
# Every section that isn't one of the above is interpreted as a rules to

View File

@ -26,9 +26,47 @@ bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id rofi -show drun -theme themes/app-launcher
bindsym $mod+i exec --no-startup-id rofi -show window
bindsym $mod+i exec --no-startup-id rofi -show window -theme themes/app-launcher
set $workspacer ~/.config/i3/i3-workspacer.py
# go to new workspace blocks
#bindsym $mod+Tab exec --no-startup-id $workspacer go -d up
#bindsym $mod+m exec --no-startup-id $workspacer go -d down
# move to new workspace blocks
#bindsym $mod+Shift+Tab exec --no-startup-id $workspacer move -d up
#bindsym $mod+Shift+m exec --no-startup-id $workspacer move -d down
# switch to workspace
bindsym $mod+grave exec --no-startup-id ~/.config/i3/i3-goto-workspace
bindsym $mod+1 exec --no-startup-id $workspacer go -n 1
bindsym $mod+2 exec --no-startup-id $workspacer go -n 2
bindsym $mod+3 exec --no-startup-id $workspacer go -n 3
bindsym $mod+4 exec --no-startup-id $workspacer go -n 4
bindsym $mod+5 exec --no-startup-id $workspacer go -n 5
bindsym $mod+6 exec --no-startup-id $workspacer go -n 6
bindsym $mod+7 exec --no-startup-id $workspacer go -n 7
bindsym $mod+8 exec --no-startup-id $workspacer go -n 8
bindsym $mod+9 exec --no-startup-id $workspacer go -n 9
bindsym $mod+0 exec --no-startup-id $workspacer go -n 10
# move focused container to workspace
bindsym $mod+Shift+grave exec --no-startup-id ~/.config/i3/i3-moveto-workspace
bindsym $mod+Shift+1 exec --no-startup-id $workspacer move -n 1
bindsym $mod+Shift+2 exec --no-startup-id $workspacer move -n 2
bindsym $mod+Shift+3 exec --no-startup-id $workspacer move -n 3
bindsym $mod+Shift+4 exec --no-startup-id $workspacer move -n 4
bindsym $mod+Shift+5 exec --no-startup-id $workspacer move -n 5
bindsym $mod+Shift+6 exec --no-startup-id $workspacer move -n 6
bindsym $mod+Shift+7 exec --no-startup-id $workspacer move -n 7
bindsym $mod+Shift+8 exec --no-startup-id $workspacer move -n 8
bindsym $mod+Shift+9 exec --no-startup-id $workspacer move -n 9
bindsym $mod+Shift+0 exec --no-startup-id $workspacer move -n 10
# renaming workspace
bindsym $mod+n exec --no-startup-id ~/.config/i3/i3-rename-workspace
bindsym $mod+Shift+n exec --no-startup-id ~/.config/i3/i3-renumber-workspace
# move focused window
bindsym $mod+j move left
bindsym $mod+k move down
@ -74,30 +112,6 @@ set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
@ -152,9 +166,10 @@ exec_always --no-startup-id $HOME/.config/polybar/launch.sh
exec --no-startup-id i3-msg 'exec $TERMINAL; workspace 2; exec firefox;'
exec --no-startup-id feh --bg-scale ~/Wallpapers/seneca.jpg
exec --no-startup-id xrandr --output HDMI1 --right-of eDP1
exec --no-startup-id xset dpms 500
exec --no-startup-id ~/bin/autoconfgure_display.sh
#exec --no-startup-id xset dpms 500
exec --no-startup-id nm-applet
exec --no-startup-id pasystray
exec --no-startup-id clipit
exec --no-startup-id xautolock -time 10 -locker "betterlockscreen -l dim"
exec --no-startup-id ~/bin/dunstwal
@ -163,7 +178,8 @@ exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec telegram-desktop
exec mattermost-desktop
exec --no-startup-id sleep 4; i3-msg '[class="Mattermost"] move scratchpad; [class="Telegram"] move scratchpad'
exec --no-startup-id sleep 4; i3-msg '[class="Telegram"] move scratchpad'
exec --no-startup-id sleep 4; i3-msg '[class="Mattermost"] move scratchpad'
exec_always --no-startup-id wal -R -n
@ -187,10 +203,11 @@ bindsym Mod1+Tab workspace back_and_forth
bindsym $mod+Tab focus right
bindsym $mod+Ctrl+Tab focus left
bindsym Print exec "~/bin/screenshot.sh"
bindsym $mod+Print exec "owo -s --fullscreen --no-cursor"
#bindsym $mod+Print exec "owo -sq --fullscreen --no-cursor"
bindsym $mod+minus [class="Telegram"] scratchpad show
bindsym $mod+p [class="Mattermost"] scratchpad show
bindsym $mod+m [class="Cantata"] scratchpad show
bindsym $mod+Delete exec rofi -modi system:$HOME/.config/rofi/scripts/powermenu.sh -show system -theme themes/system-menu
bindsym $mod+shift+Delete exec betterlockscreen -l

2
.config/i3/i3-goto-workspace Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
i3-input -f "-xos4-terminus-*-*-*-*-16-*-*-*-*-*-*-*" -F "exec --no-startup-id ~/.config/i3/i3-workspacer.py go --exact --number \"%s\"" -P 'Go To Workspace Number: '

2
.config/i3/i3-moveto-workspace Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
i3-input -f "-xos4-terminus-*-*-*-*-16-*-*-*-*-*-*-*" -F "exec --no-startup-id ~/.config/i3/i3-workspacer.py move --exact --number \"%s\"" -P 'Move To Workspace Number: '

2
.config/i3/i3-rename-workspace Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
i3-input -f "-xos4-terminus-*-*-*-*-16-*-*-*-*-*-*-*" -F "exec --no-startup-id ~/.config/i3/i3-workspacer.py rename --name \"%s\"" -P 'Workspace Name: '

View File

@ -0,0 +1,2 @@
#!/bin/bash
i3-input -f "-xos4-terminus-*-*-*-*-16-*-*-*-*-*-*-*" -F "exec --no-startup-id ~/.config/i3/i3-workspacer.py rename --number \"%s\"" -P 'Workspace Number: '

148
.config/i3/i3-workspacer.py Executable file
View File

@ -0,0 +1,148 @@
#!/usr/bin/python
import i3ipc # Required for interactions with i3 and its IPC interface
import sys # Required for exiting
import math # Required for rounding
import argparse # Required for easy arguments to command
VERSION = (1, 0)
i3 = i3ipc.Connection()
def go_to_workspace(workspace_number):
if workspace_number <= 0:
workspace_number = 1
i3_command = 'workspace number %s' % (workspace_number)
print('i3 Command: %s' % i3_command)
i3.command(i3_command)
def move_to_workspace(workspace_number):
if workspace_number <= 0:
print('Not doing anything to a negative workspace')
return 1
i3_command = 'move container to workspace number %s' % (workspace_number)
print('i3 Command: %s' % i3_command)
i3.command(i3_command)
def rename_workspace(workspace_name):
i3_command = 'rename workspace to "%s"' % (workspace_name)
print('i3 Command: %s' % i3_command)
i3.command(i3_command)
def get_workspace_number_and_name(workspace_name):
try:
if ': ' in workspace_name:
workspace_number, workspace_name = workspace_name.split(': ')
else:
workspace_number = workspace_name
workspace_number = int(workspace_number)
except ValueError:
print("Unable to parse Workspace's number and name")
return (1, workspace_name)
return (workspace_number, workspace_name)
def make_workspace_name(workspace_number, workspace_name):
return ': '.join([str(workspace_number), workspace_name])
def get_workspace_block(workspace_number):
return int(math.floor((workspace_number-1)/10))*10
def shift_workspace_number(workspace_number, direction, number, exact):
if direction is not None:
if direction == 'up':
workspace_number += 10
elif direction == 'down':
workspace_number -= 10
elif direction == 'next':
workspace_number += 1
elif direction == 'prev':
workspace_number -= 1
elif number is not None:
if exact is True:
workspace_number = number
else:
workspace_block = get_workspace_block(workspace_number)
workspace_number_in_block = number
workspace_number = workspace_block + workspace_number_in_block
return workspace_number
def action_go(workspace_number, workspace_name, args):
workspace_number = shift_workspace_number(workspace_number, args.direction, args.number, args.exact)
go_to_workspace(workspace_number)
def action_move(workspace_number, workspace_name, args):
workspace_number = shift_workspace_number(workspace_number, args.direction, args.number, args.exact)
return move_to_workspace(workspace_number)
def action_rename(workspace_number, workspace_name, args):
if args.number is not None:
workspace_number = args.number
if args.name is not None:
workspace_name = args.name
rename_workspace(make_workspace_name(workspace_number, workspace_name))
def parse_args():
parser = argparse.ArgumentParser(description='simplifying large amounts of i3 workspaces')
parser.set_defaults(action=None)
parser.add_argument('--version', action='version', version="%(prog)s {}.{}".format(*VERSION))
subparsers = parser.add_subparsers(help='check help for each command for required arguments')
parser_go = subparsers.add_parser('go', help="like the 'workspace number' command")
parser_go.set_defaults(action=action_go)
parser_go.add_argument('--exact', action='store_true',
help="number arguments will be the actual workspace number instead of the index in the current block")
group_go = parser_go.add_mutually_exclusive_group(required=True)
group_go.add_argument('-d', '--direction', choices=['up', 'down', 'next', 'prev'],
help='operate relative to the current workspace; up/down = +/- 10')
group_go.add_argument('-n', '--number', type=int,
help='specify workspace number')
parser_move = subparsers.add_parser('move', help="like the 'move container to workspace number' command")
parser_move.set_defaults(action=action_move)
parser_move.add_argument('--exact', action='store_true',
help="number arguments will be the actual workspace number instead of the index in the current block")
group_move = parser_move.add_mutually_exclusive_group(required=True)
group_move.add_argument('-d', '--direction', choices=['up', 'down', 'next', 'prev'],
help='operate relative to the current workspace; up/down = +/- 10')
group_move.add_argument('-n', '--number', type=int,
help='specify workspace number')
parser_rename = subparsers.add_parser('rename', help="like the 'rename workspace to' command")
parser_rename.set_defaults(action=action_rename)
parser_rename.add_argument('-na', '--name',
help='change the name of the current workspace')
parser_rename.add_argument('-nu', '--number', type=int,
help='change the number of the current workspace')
args = parser.parse_args()
if args.action is None:
parser.print_help()
return
return args
def main():
args = parse_args()
workspace_name = i3.get_tree().find_focused().workspace().name
workspace_number, workspace_name = get_workspace_number_and_name(workspace_name)
sys.exit(args.action(workspace_number, workspace_name, args))
if __name__ == '__main__':
main()

View File

@ -330,7 +330,7 @@ icon-prev = 玲
icon-next = 怜
label-song-maxlen = 25
label-song-maxlen = 60
label-song-ellipsis = true
[module/xbacklight]
@ -577,7 +577,7 @@ label-warn-padding = 1
format-warn = <ramp> <label-warn>
;format-warn-underline = ${self.format-underline}
format-warn-background= ${colors.primary}
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon6/temp1_input
hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon5/temp1_input
label = %temperature-c%
label-warn = %temperature-c%
label-warn-foreground = ${colors.background}

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ nbproject
.idea
docker/etc/php/
.jira
bin/__pycache__/

3
.zshrc
View File

@ -23,6 +23,7 @@ export PATH="/usr/bin/core_perl:$PATH"
export PATH="/home/paramah/.gem/ruby/2.4.0/bin:$PATH"
export PATH="/home/paramah/.gem/ruby/2.3.0/bin:$PATH"
export PATH="/home/paramah/.gem/ruby/2.5.0/bin:$PATH"
export PATH="/home/paramah/.gem/ruby/2.7.0/bin:$PATH"
export PATH="/home/paramah/.local/bin:$PATH"
export PATH=$PATH:$HOME/.SpaceVim/bin
export PATH=$PATH:$HOME/.captain/bin
@ -177,7 +178,7 @@ alias sourcec="docker run --publish 7080:7080 --rm --volume ~/.sourcegraph/confi
alias hadolint="docker run --rm -i hadolint/hadolint"
s-telegram-desktop () { # launch telegram and send it to scratchpad
dd_telegram-desktop () { # launch telegram and send it to scratchpad
(/usr/bin/telegram-desktop &)
sleep 2
i3-msg '[class="Telegram"] move scratchpad'

48
bin/autoconfgure_display.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
set -o pipefail
export DISPLAY=:0
XRANDR="/usr/bin/xrandr"
AWK="/usr/bin/awk"
GREP="/usr/bin/grep"
PRIMARY_DISPLAY="eDP1"
function displayChange {
STATUS=${2}
DIS=${1}
POS=${3}
notify-send "Display $DIS $STATUS"
echo "Display $DIS $STATUS" >> /home/paramah/.display.log
if [ $STATUS = "connected" ]; then
$XRANDR --output $DIS --auto
$XRANDR --output $DIS $POS $PRIMARY_DISPLAY
fi
if [ $STATUS = "disconnected" ]; then
$XRANDR --output $DIS --off
fi
}
function myDisplays {
for D in = $($XRANDR |$GREP -w "${1}" |$GREP -v $PRIMARY_DISPLAY |$AWK '{print $1}')
do
if [ $D = "DP2" ]; then
displayChange "DP2" "${1}" "--left-of"
fi
if [ $D = "HDMI1" ]; then
displayChange "HDMI1" "${1}" "--right-of"
fi
done
}
myDisplays "disconnected"
myDisplays "connected"

22
bin/services Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
import re
import consul
import docker
running = {}
c = consul.Consul()
client = docker.from_env()
for services in c.catalog.services():
for service in services:
idx, details = c.catalog.service(service)
if len(details) == 0:
continue
for item in details:
link = item['ServiceName']+".service."+item['Datacenter']+".consul:"+str(item['ServicePort'])
print("http://"+link)

3
docs/udev.md Normal file
View File

@ -0,0 +1,3 @@
# udev
Nie będę tłumaczyć czym jest `udev`.

View File

@ -134,6 +134,8 @@ Plug 'fatih/vim-go'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plug 'chr4/nginx.vim'
Plug 'robertbasic/vim-hugo-helper'
Plug 'ekalinin/Dockerfile.vim'
call plug#end()
@ -371,3 +373,5 @@ let g:vdebug_options = {
" let $NVIM_PYTHON_LOG_FILE="/tmp/nvim_log"
" let $NVIM_PYTHON_LOG_LEVEL="DEBUG"
"
let g:hugohelper_spell_check_lang = 'pl_pl'

View File

@ -0,0 +1 @@
ACTION=="change", SUBSYSTEM=="drm", RUN+="/home/paramah/bin/autoconfgure_display.sh"