Commit ff9f8786 authored by epsi sayidina's avatar epsi sayidina

coding style

parent 6bada51f
......@@ -3,7 +3,8 @@
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# helpers
function hc($arguments) {
function hc($arguments)
{
system("herbstclient $arguments");
}
......@@ -22,7 +23,8 @@ function do_config($command, $hash) {
# Must pass the array as parameters,
# since PHP can't read local array variable outside function.
function set_tags_with_name($tag_names, $tag_keys) {
function set_tags_with_name($tag_names, $tag_keys)
{
hc("rename default '$tag_names[0]' 2>/dev/null || true");
foreach($tag_names as $index=>$value) {
......@@ -42,7 +44,8 @@ function set_tags_with_name($tag_names, $tag_keys) {
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# miscellanous
function bind_cycle_layout() {
function bind_cycle_layout()
{
# The following cycles through the available layouts
# within a frame, but skips layouts, if the layout change
# wouldn't affect the actual window positions.
......@@ -63,7 +66,8 @@ function bind_cycle_layout() {
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# find the panel
function do_panel() {
function do_panel()
{
$panel = __dir__."/../bash/dzen2/panel.sh";
if (!is_executable($panel))
$panel = "/etc/xdg/herbstluftwm/panel.sh";
......
......@@ -2,7 +2,8 @@
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# load on startup
function startup_run() {
function startup_run()
{
$command = 'silent new_attr bool my_not_first_autostart';
system("herbstclient $command", $exitcode);
......
module GMC
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
# google material colors
# https://material.io/guidelines/style/color.html
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
# google material colors
# https://material.io/guidelines/style/color.html
# Associative Array (Hash)
# http://ruby-doc.org/core-2.4.1/Hash.html
# Associative Array (Hash)
# http://ruby-doc.org/core-2.4.1/Hash.html
Color = {
'white' => '#ffffff',
'black' => '#000000',
Color = {
'white' => '#ffffff',
'black' => '#000000',
'grey50' => '#fafafa',
'grey100' => '#f5f5f5',
'grey200' => '#eeeeee',
'grey300' => '#e0e0e0',
'grey400' => '#bdbdbd',
'grey500' => '#9e9e9e',
'grey600' => '#757575',
'grey700' => '#616161',
'grey800' => '#424242',
'grey900' => '#212121',
'grey50' => '#fafafa',
'grey100' => '#f5f5f5',
'grey200' => '#eeeeee',
'grey300' => '#e0e0e0',
'grey400' => '#bdbdbd',
'grey500' => '#9e9e9e',
'grey600' => '#757575',
'grey700' => '#616161',
'grey800' => '#424242',
'grey900' => '#212121',
'red50' => '#ffebee',
'red100' => '#ffcdd2',
'red200' => '#ef9a9a',
'red300' => '#e57373',
'red400' => '#ef5350',
'red500' => '#f44336',
'red600' => '#e53935',
'red700' => '#d32f2f',
'red800' => '#c62828',
'red900' => '#b71c1c',
'redA100' => '#ff8a80',
'redA200' => '#ff5252',
'redA400' => '#ff1744',
'redA700' => '#d50000',
'red50' => '#ffebee',
'red100' => '#ffcdd2',
'red200' => '#ef9a9a',
'red300' => '#e57373',
'red400' => '#ef5350',
'red500' => '#f44336',
'red600' => '#e53935',
'red700' => '#d32f2f',
'red800' => '#c62828',
'red900' => '#b71c1c',
'redA100' => '#ff8a80',
'redA200' => '#ff5252',
'redA400' => '#ff1744',
'redA700' => '#d50000',
'pink50' => '#fce4ec',
'pink100' => '#f8bbd0',
'pink200' => '#f48fb1',
'pink300' => '#f06292',
'pink400' => '#ec407a',
'pink500' => '#e91e63',
'pink600' => '#d81b60',
'pink700' => '#c2185b',
'pink800' => '#ad1457',
'pink900' => '#880e4f',
'pinkA100' => '#ff80ab',
'pinkA200' => '#ff4081',
'pinkA400' => '#f50057',
'pinkA700' => '#c51162',
'pink50' => '#fce4ec',
'pink100' => '#f8bbd0',
'pink200' => '#f48fb1',
'pink300' => '#f06292',
'pink400' => '#ec407a',
'pink500' => '#e91e63',
'pink600' => '#d81b60',
'pink700' => '#c2185b',
'pink800' => '#ad1457',
'pink900' => '#880e4f',
'pinkA100' => '#ff80ab',
'pinkA200' => '#ff4081',
'pinkA400' => '#f50057',
'pinkA700' => '#c51162',
'blue50' => '#e3f2fd',
'blue100' => '#bbdefb',
'blue200' => '#90caf9',
'blue300' => '#64b5f6',
'blue400' => '#42a5f5',
'blue500' => '#2196f3',
'blue600' => '#1e88e5',
'blue700' => '#1976d2',
'blue800' => '#1565c0',
'blue900' => '#0d47a1',
'blueA100' => '#82b1ff',
'blueA200' => '#448aff',
'blueA400' => '#2979ff',
'blueA700' => '#2962ff',
'blue50' => '#e3f2fd',
'blue100' => '#bbdefb',
'blue200' => '#90caf9',
'blue300' => '#64b5f6',
'blue400' => '#42a5f5',
'blue500' => '#2196f3',
'blue600' => '#1e88e5',
'blue700' => '#1976d2',
'blue800' => '#1565c0',
'blue900' => '#0d47a1',
'blueA100' => '#82b1ff',
'blueA200' => '#448aff',
'blueA400' => '#2979ff',
'blueA700' => '#2962ff',
'yellow50' => '#fffde7',
'yellow100' => '#fff9c4',
'yellow200' => '#fff59d',
'yellow300' => '#fff176',
'yellow400' => '#ffee58',
'yellow500' => '#ffeb3b',
'yellow600' => '#fdd835',
'yellow700' => '#fbc02d',
'yellow800' => '#f9a825',
'yellow900' => '#f57f17',
'yellowA100' => '#ffff8d',
'yellowA200' => '#ffff00',
'yellowA400' => '#ffea00',
'yellowA700' => '#ffd600',
'yellow50' => '#fffde7',
'yellow100' => '#fff9c4',
'yellow200' => '#fff59d',
'yellow300' => '#fff176',
'yellow400' => '#ffee58',
'yellow500' => '#ffeb3b',
'yellow600' => '#fdd835',
'yellow700' => '#fbc02d',
'yellow800' => '#f9a825',
'yellow900' => '#f57f17',
'yellowA100' => '#ffff8d',
'yellowA200' => '#ffff00',
'yellowA400' => '#ffea00',
'yellowA700' => '#ffd600',
'teal50' => '#e0f2f1',
'teal100' => '#b2dfdb',
'teal200' => '#80cbc4',
'teal300' => '#4db6ac',
'teal400' => '#26a69a',
'teal500' => '#009688',
'teal600' => '#00897b',
'teal700' => '#00796b',
'teal800' => '#00695c',
'teal900' => '#004d40',
'tealA100' => '#a7ffeb',
'tealA200' => '#64ffda',
'tealA400' => '#1de9b6',
'tealA700' => '#00bfa5',
'teal50' => '#e0f2f1',
'teal100' => '#b2dfdb',
'teal200' => '#80cbc4',
'teal300' => '#4db6ac',
'teal400' => '#26a69a',
'teal500' => '#009688',
'teal600' => '#00897b',
'teal700' => '#00796b',
'teal800' => '#00695c',
'teal900' => '#004d40',
'tealA100' => '#a7ffeb',
'tealA200' => '#64ffda',
'tealA400' => '#1de9b6',
'tealA700' => '#00bfa5',
'green50' => '#e8f5e9',
'green100' => '#c8e6c9',
'green200' => '#a5d6a7',
'green300' => '#81c784',
'green400' => '#66bb6a',
'green500' => '#4caf50',
'green600' => '#43a047',
'green700' => '#388e3c',
'green800' => '#2e7d32',
'green900' => '#1b5e20',
'greenA100' => '#b9f6ca',
'greenA200' => '#69f0ae',
'greenA400' => '#00e676',
'greenA700' => '#00c853',
'green50' => '#e8f5e9',
'green100' => '#c8e6c9',
'green200' => '#a5d6a7',
'green300' => '#81c784',
'green400' => '#66bb6a',
'green500' => '#4caf50',
'green600' => '#43a047',
'green700' => '#388e3c',
'green800' => '#2e7d32',
'green900' => '#1b5e20',
'greenA100' => '#b9f6ca',
'greenA200' => '#69f0ae',
'greenA400' => '#00e676',
'greenA700' => '#00c853',
'orange50' => '#fff3e0',
'orange100' => '#ffe0b2',
'orange200' => '#ffcc80',
'orange300' => '#ffb74d',
'orange400' => '#ffa726',
'orange500' => '#ff9800',
'orange600' => '#fb8c00',
'orange700' => '#f57c00',
'orange800' => '#ef6c00',
'orange900' => '#e65100',
'orangeA100' => '#ffd180',
'orangeA200' => '#ffab40',
'orangeA400' => '#ff9100',
'orangeA700' => '#ff6d00',
'orange50' => '#fff3e0',
'orange100' => '#ffe0b2',
'orange200' => '#ffcc80',
'orange300' => '#ffb74d',
'orange400' => '#ffa726',
'orange500' => '#ff9800',
'orange600' => '#fb8c00',
'orange700' => '#f57c00',
'orange800' => '#ef6c00',
'orange900' => '#e65100',
'orangeA100' => '#ffd180',
'orangeA200' => '#ffab40',
'orangeA400' => '#ff9100',
'orangeA700' => '#ff6d00',
'deepOrange50' => '#fbe9e7',
'deepOrange100' => '#ffccbc',
'deepOrange200' => '#ffab91',
'deepOrange300' => '#ff8a65',
'deepOrange400' => '#ff7043',
'deepOrange500' => '#ff5722',
'deepOrange600' => '#f4511e',
'deepOrange700' => '#e64a19',
'deepOrange800' => '#d84315',
'deepOrange900' => '#bf360c',
'deepOrangeA100' => '#ff9e80',
'deepOrangeA200' => '#ff6e40',
'deepOrangeA400' => '#ff3d00',
'deepOrangeA700' => '#dd2c00'
}
'deepOrange50' => '#fbe9e7',
'deepOrange100' => '#ffccbc',
'deepOrange200' => '#ffab91',
'deepOrange300' => '#ff8a65',
'deepOrange400' => '#ff7043',
'deepOrange500' => '#ff5722',
'deepOrange600' => '#f4511e',
'deepOrange700' => '#e64a19',
'deepOrange800' => '#d84315',
'deepOrange900' => '#bf360c',
'deepOrangeA100' => '#ff9e80',
'deepOrangeA200' => '#ff6e40',
'deepOrangeA400' => '#ff3d00',
'deepOrangeA700' => '#dd2c00'
}
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# end of ruby module
......
......@@ -16,7 +16,7 @@ system("xsetroot -solid '#{GMC::Color['blue500']}'")
hc('emit_hook reload')
# gap counter
system("echo 35 > /tmp/herbstluftwm-gap");
system("echo 35 > /tmp/herbstluftwm-gap")
# do not repaint until unlock
hc("lock");
......
This diff is collapsed.
......@@ -4,40 +4,40 @@ require_relative 'config'
# helpers
def hc(arguments)
system("herbstclient #{arguments}");
system("herbstclient #{arguments}")
end
def do_config(command, hash)
# loop over hash
hash.each do |key, value|
hc(command+' '+key+' '+value)
# loop over hash
hash.each do |key, value|
hc(command+' '+key+' '+value)
# uncomment to debug in terminal
# puts(command+' '+key+' '+value)
end
# uncomment to debug in terminal
# puts(command+' '+key+' '+value)
end
end
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# tags related
def set_tags_with_name()
tag_names = Config::Tag_names
tag_keys = Config::Tag_keys
tag_names = Config::Tag_names
tag_keys = Config::Tag_keys
hc("rename default '#{tag_names[0]}' 2>/dev/null || true")
hc("rename default '#{tag_names[0]}' 2>/dev/null || true")
tag_names.each_with_index do |tag_name, index|
hc("add '#{tag_names[index]}'")
tag_names.each_with_index do |tag_name, index|
hc("add '#{tag_names[index]}'")
# uncomment to debug in terminal
# puts i
key = tag_keys[index]
unless key.to_s.empty?
hc("keybind Mod4-#{key} use_index '#{index}'");
hc("keybind Mod4-Shift-#{key} move_index '#{index}'");
end
# uncomment to debug in terminal
# puts i
key = tag_keys[index]
unless key.to_s.empty?
hc("keybind Mod4-#{key} use_index '#{index}'");
hc("keybind Mod4-Shift-#{key} move_index '#{index}'");
end
end
end
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
......@@ -45,16 +45,16 @@ end
# I don't understand what this is
def bind_cycle_layout()
# The following cycles through the available layouts
# within a frame, but skips layouts, if the layout change
# wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame,
# the grid layout is skipped.
hc( "keybind Mod4-space " \
"or , and . compare tags.focus.curframe_wcount = 2 " \
". cycle_layout +1 vertical horizontal max vertical grid " \
", cycle_layout +1 ")
# The following cycles through the available layouts
# within a frame, but skips layouts, if the layout change
# wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame,
# the grid layout is skipped.
hc( "keybind Mod4-space " \
"or , and . compare tags.focus.curframe_wcount = 2 " \
". cycle_layout +1 vertical horizontal max vertical grid " \
", cycle_layout +1 ")
end
# do multi monitor setup here, e.g.:
......@@ -66,16 +66,16 @@ end
# find the panel
def do_panel()
panel = __dir__ + "/../bash/dzen2/panel.sh"
panel = __dir__ + "/../bash/dzen2/panel.sh"
if not File.exist?(panel) and File.executable?(panel)
panel = "/etc/xdg/herbstluftwm/panel.sh"
end
if not File.exist?(panel) and File.executable?(panel)
panel = "/etc/xdg/herbstluftwm/panel.sh"
end
raw = IO.popen('herbstclient list_monitors | cut -d: -f1').read()
monitors = raw.split("\n")
raw = IO.popen('herbstclient list_monitors | cut -d: -f1').read()
monitors = raw.split("\n")
for monitor in (monitors)
system("#{panel} #{monitor} &");
end
for monitor in (monitors)
system("#{panel} #{monitor} &")
end
end
......@@ -2,23 +2,23 @@
# load on startup
def startup_run()
command = 'silent new_attr bool my_not_first_autostart'
system("herbstclient #{command}")
exitcode = $?.exitstatus
command = 'silent new_attr bool my_not_first_autostart'
system("herbstclient #{command}")
exitcode = $?.exitstatus
if (exitcode == 0)
# non windowed app
system("compton &")
system("dunst &")
system("parcellite &")
system("nitrogen --restore &")
system("mpd &")
if (exitcode == 0)
# non windowed app
system("compton &")
system("dunst &")
system("parcellite &")
system("nitrogen --restore &")
system("mpd &")
# windowed app
system("xfce4-terminal &")
system("sleep 1 && firefox &")
system("sleep 2 && geany &")
system("sleep 2 && thunar &")
end
# windowed app
system("xfce4-terminal &")
system("sleep 1 && firefox &")
system("sleep 2 && geany &")
system("sleep 2 && thunar &")
end
end
......@@ -11,16 +11,16 @@ myTimeFormat = "%a %b %d %H:%M:%S"
wFormatTime :: FormatTime t => t -> String
wFormatTime myUtcTime = formatTime
Data.Time.Format.defaultTimeLocale myTimeFormat myUtcTime
Data.Time.Format.defaultTimeLocale myTimeFormat myUtcTime
wSleep :: Int -> IO ()
wSleep mySecond = threadDelay (1000000 * mySecond)
printDate = do
now <- getZonedTime
let nowFmt = wFormatTime now
putStrLn nowFmt
wSleep 1
now <- getZonedTime
let nowFmt = wFormatTime now
putStrLn nowFmt
wSleep 1
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- main
......
......@@ -12,8 +12,8 @@ import Control.Monad
wFormatTime :: FormatTime t => t -> String
wFormatTime myUtcTime = formatTime
Data.Time.Format.defaultTimeLocale myTimeFormat myUtcTime
where myTimeFormat = "%a %b %d %H:%M:%S"
Data.Time.Format.defaultTimeLocale myTimeFormat myUtcTime
where myTimeFormat = "%a %b %d %H:%M:%S"
wSleep :: Int -> IO ()
wSleep mySecond = threadDelay (1000000 * mySecond)
......
......@@ -14,28 +14,28 @@ import Control.Monad
cmdout = "dzen2"
getDzen2Parameters = [
"-x", xpos, "-y", ypos,
"-w", width, "-h", height,
"-fn", font,
"-ta", "c",
"-bg", bgcolor,
"-fg", fgcolor,
"-title-name", "dzentop"
]
where
xpos = "0"
ypos = "0"
width = "640"
height = "24"
fgcolor = "#000000"
bgcolor = "#ffffff"
font = "-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
"-x", xpos, "-y", ypos,
"-w", width, "-h", height,
"-fn", font,
"-ta", "c",
"-bg", bgcolor,
"-fg", fgcolor,
"-title-name", "dzentop"
]
where
xpos = "0"
ypos = "0"
width = "640"
height = "24"
fgcolor = "#000000"
bgcolor = "#ffffff"
font = "-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
wFormatTime :: FormatTime t => t -> String
wFormatTime myUtcTime = formatTime
Data.Time.Format.defaultTimeLocale myTimeFormat myUtcTime
where myTimeFormat = "%a %b %d %H:%M:%S"
Data.Time.Format.defaultTimeLocale myTimeFormat myUtcTime
where myTimeFormat = "%a %b %d %H:%M:%S"
wSleep :: Int -> IO ()
......@@ -44,7 +44,7 @@ wSleep mySecond = threadDelay (1000000 * mySecond)
generatedOutput pipein = do
now <- getZonedTime
let nowFmt = wFormatTime now
hPutStrLn pipein nowFmt
hFlush pipein
......
......@@ -18,22 +18,22 @@ wConkyFileName :: String -> String
wConkyFileName dirName = dirName ++ "/../assets" ++ "/conky.lua"
getDzen2Parameters = [
"-x", xpos, "-y", ypos,
"-w", width, "-h", height,
"-fn", font,
"-ta", "c",
"-bg", bgcolor,
"-fg", fgcolor,
"-title-name", "dzentop"
]
where
xpos = "0"
ypos = "0"
width = "640"
height = "24"
fgcolor = "#000000"
bgcolor = "#ffffff"
font = "-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
"-x", xpos, "-y", ypos,
"-w", width, "-h", height,
"-fn", font,
"-ta", "c",
"-bg", bgcolor,
"-fg", fgcolor,
"-title-name", "dzentop"
]
where
xpos = "0"
ypos = "0"
width = "640"
height = "24"
fgcolor = "#000000"
bgcolor = "#ffffff"
font = "-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
wSleep :: Int -> IO ()
wSleep mySecond = threadDelay (1000000 * mySecond)
......
......@@ -6,7 +6,7 @@ import datetime
import time
import subprocess
import os
import signal
def get_dzen2_parameters():
xpos = '0'
......
......@@ -4,7 +4,7 @@ import datetime
import time
import subprocess
import os
import signal
def get_dzen2_parameters():
xpos = '0'
......
......@@ -3,9 +3,9 @@
timeformat = '%a %b %d %H:%M:%S'
while true do
localtime = Time.now
datestr = localtime.strftime(timeformat)
puts datestr
localtime = Time.now
datestr = localtime.strftime(timeformat)
puts datestr
sleep(1)
sleep(1)
end
......@@ -3,21 +3,21 @@
# http://ruby-doc.org/core-1.8.7/IO.html#method-c-popen
def generated_output(stdin)
path = __dir__+ "/../assets"
cmdin = 'conky -c ' + path + '/conky.lua'
path = __dir__+ "/../assets"